From c9410447019068af88971143b979d4ec02b8ac17 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Wed, 8 Dec 2021 17:07:49 +0000 Subject: [PATCH 01/18] [swift5][client] allow request cancellation and authentication flow to work together (#11019) * [swift5][client] allow request cancellation and authentication flow to work together * [swift5][client] allow request cancellation and authentication flow to work together * [swift5][client] rename OpenAPIRequestCancellable to RequestTask * [swift5][client] rename OpenAPIRequestCancellable to RequestTask --- .../src/main/resources/swift5/APIs.mustache | 5 +- .../src/main/resources/swift5/Models.mustache | 30 +++++- .../src/main/resources/swift5/api.mustache | 22 ++--- .../AlamofireImplementations.mustache | 8 +- .../URLSessionImplementations.mustache | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../OpenAPIs/AlamofireImplementations.swift | 8 +- .../Classes/OpenAPIs/Models.swift | 14 +++ .../SwaggerClientTests/PetAPITests.swift | 2 +- .../SwaggerClientTests/run_xcodebuild.sh | 4 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 96 +++++++++---------- .../APIs/FakeClassnameTags123API.swift | 8 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 72 +++++++------- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 32 +++---- .../Classes/OpenAPIs/APIs/UserAPI.swift | 64 ++++++------- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 6 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 72 +++++++------- .../APIs/FakeClassnameTags123API.swift | 6 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 54 +++++------ .../Classes/OpenAPIs/APIs/StoreAPI.swift | 24 ++--- .../Classes/OpenAPIs/APIs/UserAPI.swift | 48 +++++----- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../SwaggerClientTests/PetAPITests.swift | 2 +- .../SwaggerClientTests/run_xcodebuild.sh | 4 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 28 +++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../SwaggerClientTests/PetAPITests.swift | 2 +- .../SwaggerClientTests/run_xcodebuild.sh | 4 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 16 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../Classes/OpenAPIs/APIs/DefaultAPI.swift | 2 +- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../xcshareddata/swiftpm/Package.resolved | 6 +- .../SwaggerClientTests/PetAPITests.swift | 2 +- .../SwaggerClientTests/run_xcodebuild.sh | 4 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 4 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 48 +++++----- .../APIs/FakeClassnameTags123API.swift | 4 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 36 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 16 ++-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 32 +++---- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- .../xcshareddata/swiftpm/Package.resolved | 6 +- .../SwaggerClientTests/PetAPITests.swift | 2 +- .../SwaggerClientTests/run_xcodebuild.sh | 4 +- .../client/petstore/swift5/swift5_test_all.sh | 13 ++- .../Sources/PetstoreClient/APIs.swift | 5 +- .../PetstoreClient/APIs/AnotherFakeAPI.swift | 2 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../PetstoreClient/APIs/StoreAPI.swift | 8 +- .../Sources/PetstoreClient/APIs/UserAPI.swift | 16 ++-- .../Sources/PetstoreClient/Models.swift | 13 +++ .../URLSessionImplementations.swift | 8 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../BearerDecodableRequestBuilder.swift | 12 ++- .../SwaggerClientTests/PetAPITests.swift | 14 +-- .../SwaggerClientTests/StoreAPITests.swift | 12 +-- .../SwaggerClientTests/UserAPITests.swift | 6 +- .../SwaggerClientTests/run_xcodebuild.sh | 4 +- .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++--- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++-- .../Classes/OpenAPIs/Models.swift | 13 +++ .../OpenAPIs/URLSessionImplementations.swift | 8 +- 138 files changed, 1005 insertions(+), 784 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/APIs.mustache b/modules/openapi-generator/src/main/resources/swift5/APIs.mustache index dcca24f56d3..847e9be5595 100644 --- a/modules/openapi-generator/src/main/resources/swift5/APIs.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/APIs.mustache @@ -36,6 +36,7 @@ import Vapor {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: Any]? {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let method: String {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available.{{#useURLSession}} /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -58,8 +59,8 @@ import Vapor } @discardableResult - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func addHeader(name: String, value: String) -> Self { diff --git a/modules/openapi-generator/src/main/resources/swift5/Models.mustache b/modules/openapi-generator/src/main/resources/swift5/Models.mustache index 1195d5ea9c4..28d9935dd53 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Models.mustache @@ -4,7 +4,8 @@ // https://openapi-generator.tech // -import Foundation +import Foundation{{#useAlamofire}} +import Alamofire{{/useAlamofire}} protocol JSONEncodable { func encodeToJSON() -> Any @@ -78,3 +79,30 @@ extension CaseIterableDefaultsLast { self.init(statusCode: response.statusCode, header: header, body: body) } } + +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} final class RequestTask { +{{#useAlamofire}} + private var request: Request? + + internal func set(request: Request) { + self.request = request + } + + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func cancel() { + request?.cancel() + request = nil + } +{{/useAlamofire}} +{{^useAlamofire}} + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func cancel() { + task?.cancel() + task = nil + } +{{/useAlamofire}} +} diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 42b44955aad..5ae1f5513d2 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -57,7 +57,7 @@ extension {{projectName}}API { @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} @discardableResult - {{#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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ data: {{{returnType}}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void)) -> URLSessionTask? { + {{#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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ data: {{{returnType}}}{{^returnType}}Void{{/returnType}}?, _ error: Error?) -> Void)) -> RequestTask { return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in switch result { {{#returnType}} @@ -124,7 +124,7 @@ extension {{projectName}}API { {{/isDeprecated}} {{#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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> Observable<{{{returnType}}}{{^returnType}}Void{{/returnType}}> { return Observable.create { observer -> Disposable in - let task = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in + let requestTask = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in switch result { {{#returnType}} case let .success(response): @@ -141,7 +141,7 @@ extension {{projectName}}API { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -161,9 +161,9 @@ extension {{projectName}}API { {{/isDeprecated}} @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{{returnType}}}{{^returnType}}Void{{/returnType}}, Error> { - var task: URLSessionTask? + var requestTask: RequestTask? return Future<{{{returnType}}}{{^returnType}}Void{{/returnType}}, Error> { promise in - task = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in + requestTask = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in switch result { {{#returnType}} case let .success(response): @@ -179,7 +179,7 @@ extension {{projectName}}API { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -199,7 +199,7 @@ extension {{projectName}}API { {{/isDeprecated}} @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) {{#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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) async throws{{#returnType}} -> {{{returnType}}}{{/returnType}} { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -208,7 +208,7 @@ extension {{projectName}}API { return } - task = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in + requestTask = {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in switch result { {{#returnType}} case let .success(response): @@ -223,8 +223,8 @@ extension {{projectName}}API { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } {{/useAsyncAwait}} @@ -241,7 +241,7 @@ extension {{projectName}}API { @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} @discardableResult - open 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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{{returnType}}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void)) -> URLSessionTask? { + open 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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<{{{returnType}}}{{^returnType}}Void{{/returnType}}, ErrorResponse>) -> Void)) -> RequestTask { return {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).execute(apiResponseQueue) { result in switch result { {{#returnType}} diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache index 48105ef58d9..5ec281b054e 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache @@ -79,7 +79,7 @@ private var managerStore = SynchronizedDictionary() } @discardableResult - override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let managerId = UUID().uuidString // Create a new manager for each request to customize its request header let manager = createAlamofireSession() @@ -125,6 +125,8 @@ private var managerStore = SynchronizedDictionary() } } + requestTask.set(request: upload) + self.processRequest(request: upload, managerId, apiResponseQueue, completion) } else if contentType == "application/x-www-form-urlencoded" { encoding = URLEncoding(destination: .httpBody) @@ -142,10 +144,10 @@ private var managerStore = SynchronizedDictionary() onProgressReady(request.uploadProgress) } processRequest(request: request, managerId, apiResponseQueue, completion) - return request.task + requestTask.set(request: request) } - return nil + return requestTask } fileprivate func processRequest(request: DataRequest, _ managerId: String, _ apiResponseQueue: DispatchQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index 707577e0da3..eeae3c98aef 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -100,7 +100,7 @@ private var credentialStore = SynchronizedDictionary() } @discardableResult - override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(_ apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ private var credentialStore = SynchronizedDictionary() dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index 9ffe15ebc9a..4222b4cbaee 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. public var onProgressReady: ((Progress) -> Void)? @@ -47,8 +48,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index ac45c1f454b..5e179af64e2 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index a5165719f10..d980142c6ab 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index ac274a7c550..34e8c9c7f23 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index bd5c091925b..254930e7779 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f2539226866..c111e830130 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 3fc59f9ef4f..5e01a4a7c34 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index c8f1b663434..577abc9a6ad 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -79,7 +79,7 @@ open class AlamofireRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let managerId = UUID().uuidString // Create a new manager for each request to customize its request header let manager = createAlamofireSession() @@ -125,6 +125,8 @@ open class AlamofireRequestBuilder: RequestBuilder { } } + requestTask.set(request: upload) + self.processRequest(request: upload, managerId, apiResponseQueue, completion) } else if contentType == "application/x-www-form-urlencoded" { encoding = URLEncoding(destination: .httpBody) @@ -142,10 +144,10 @@ open class AlamofireRequestBuilder: RequestBuilder { onProgressReady(request.uploadProgress) } processRequest(request: request, managerId, apiResponseQueue, completion) - return request.task + requestTask.set(request: request) } - return nil + return requestTask } fileprivate func processRequest(request: DataRequest, _ managerId: String, _ apiResponseQueue: DispatchQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..fc69bffcc11 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -5,6 +5,7 @@ // import Foundation +import Alamofire protocol JSONEncodable { func encodeToJSON() -> Any @@ -78,3 +79,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var request: Request? + + internal func set(request: Request) { + self.request = request + } + + public func cancel() { + request?.cancel() + request = nil + } +} diff --git a/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index 31f90f6acfa..9dfbc9aa465 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -26,7 +26,7 @@ class PetAPITests: XCTestCase { func test1CreatePet() { let expectation = self.expectation(description: "testCreatePet") - let category = PetstoreClient.Category(id: 1234, name: "eyeColor") + let category = Category(id: 1234, name: "eyeColor") let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")] let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) diff --git a/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/run_xcodebuild.sh index 19e1e06dad6..719b9c84181 100755 --- a/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift5/alamofireLibrary/SwaggerClientTests/run_xcodebuild.sh @@ -1,5 +1,3 @@ #!/bin/sh -pod install - -xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild clean build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 4877906db16..bd8044516fe 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -21,7 +21,7 @@ open class AnotherFakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Client { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -30,7 +30,7 @@ open class AnotherFakeAPI { return } - task = call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -39,8 +39,8 @@ open class AnotherFakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 8e449d22dc7..1b105b037f6 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -20,7 +20,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Bool { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -29,7 +29,7 @@ open class FakeAPI { return } - task = fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -38,8 +38,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -75,7 +75,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> OuterComposite { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -84,7 +84,7 @@ open class FakeAPI { return } - task = fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -93,8 +93,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -130,7 +130,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Double { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -139,7 +139,7 @@ open class FakeAPI { return } - task = fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -148,8 +148,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -185,7 +185,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> String { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -194,7 +194,7 @@ open class FakeAPI { return } - task = fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -203,8 +203,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -240,7 +240,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -249,7 +249,7 @@ open class FakeAPI { return } - task = testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -258,8 +258,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -296,7 +296,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -305,7 +305,7 @@ open class FakeAPI { return } - task = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in + requestTask = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -314,8 +314,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -355,7 +355,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Client { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -364,7 +364,7 @@ open class FakeAPI { return } - task = testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -373,8 +373,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -425,7 +425,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -434,7 +434,7 @@ open class FakeAPI { return } - task = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result in + requestTask = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -443,8 +443,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -590,7 +590,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -599,7 +599,7 @@ open class FakeAPI { return } - task = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in + requestTask = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -608,8 +608,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -673,7 +673,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -682,7 +682,7 @@ open class FakeAPI { return } - task = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in + requestTask = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -691,8 +691,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -742,7 +742,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -751,7 +751,7 @@ open class FakeAPI { return } - task = testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in + requestTask = testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -760,8 +760,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -799,7 +799,7 @@ open class FakeAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -808,7 +808,7 @@ open class FakeAPI { return } - task = testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in + requestTask = testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -817,8 +817,8 @@ open class FakeAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 66d801132d2..6313692d6d4 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -21,7 +21,7 @@ open class FakeClassnameTags123API { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Client { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -30,7 +30,7 @@ open class FakeClassnameTags123API { return } - task = testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -39,8 +39,8 @@ open class FakeClassnameTags123API { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f169ed382da..d541b28938d 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -21,7 +21,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -30,7 +30,7 @@ open class PetAPI { return } - task = addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -39,8 +39,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -81,7 +81,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -90,7 +90,7 @@ open class PetAPI { return } - task = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in + requestTask = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -99,8 +99,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -153,7 +153,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> [Pet] { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -162,7 +162,7 @@ open class PetAPI { return } - task = findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in + requestTask = findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -171,8 +171,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -217,7 +217,7 @@ open class PetAPI { @available(*, deprecated, message: "This operation is deprecated.") @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> [Pet] { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -226,7 +226,7 @@ open class PetAPI { return } - task = findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in + requestTask = findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -235,8 +235,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -281,7 +281,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Pet { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -290,7 +290,7 @@ open class PetAPI { return } - task = getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in + requestTask = getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -299,8 +299,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -344,7 +344,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -353,7 +353,7 @@ open class PetAPI { return } - task = updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -362,8 +362,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -405,7 +405,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -414,7 +414,7 @@ open class PetAPI { return } - task = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in + requestTask = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -423,8 +423,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -477,7 +477,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> ApiResponse { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -486,7 +486,7 @@ open class PetAPI { return } - task = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in + requestTask = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -495,8 +495,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -549,7 +549,7 @@ open class PetAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> ApiResponse { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -558,7 +558,7 @@ open class PetAPI { return } - task = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in + requestTask = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -567,8 +567,8 @@ open class PetAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 41d3a6047dc..510311783b9 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -21,7 +21,7 @@ open class StoreAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -30,7 +30,7 @@ open class StoreAPI { return } - task = deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in + requestTask = deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -39,8 +39,8 @@ open class StoreAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -80,7 +80,7 @@ open class StoreAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> [String: Int] { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -89,7 +89,7 @@ open class StoreAPI { return } - task = getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in + requestTask = getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -98,8 +98,8 @@ open class StoreAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -139,7 +139,7 @@ open class StoreAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Order { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -148,7 +148,7 @@ open class StoreAPI { return } - task = getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in + requestTask = getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -157,8 +157,8 @@ open class StoreAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -199,7 +199,7 @@ open class StoreAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Order { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -208,7 +208,7 @@ open class StoreAPI { return } - task = placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -217,8 +217,8 @@ open class StoreAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index f0e57f333cd..7cc9a77f01b 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -21,7 +21,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -30,7 +30,7 @@ open class UserAPI { return } - task = createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -39,8 +39,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -78,7 +78,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -87,7 +87,7 @@ open class UserAPI { return } - task = createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -96,8 +96,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -134,7 +134,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -143,7 +143,7 @@ open class UserAPI { return } - task = createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -152,8 +152,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -190,7 +190,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -199,7 +199,7 @@ open class UserAPI { return } - task = deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in + requestTask = deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -208,8 +208,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -250,7 +250,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> User { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -259,7 +259,7 @@ open class UserAPI { return } - task = getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in + requestTask = getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -268,8 +268,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -310,7 +310,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> String { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -319,7 +319,7 @@ open class UserAPI { return } - task = loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in + requestTask = loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): continuation.resume(returning: response.body) @@ -328,8 +328,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -371,7 +371,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -380,7 +380,7 @@ open class UserAPI { return } - task = logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in + requestTask = logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -389,8 +389,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } @@ -427,7 +427,7 @@ open class UserAPI { */ @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { - var task: URLSessionTask? + var requestTask: RequestTask? return try await withTaskCancellationHandler { try Task.checkCancellation() return try await withCheckedThrowingContinuation { continuation in @@ -436,7 +436,7 @@ open class UserAPI { return } - task = updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in + requestTask = updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: continuation.resume(returning: ()) @@ -445,8 +445,8 @@ open class UserAPI { } } } - } onCancel: { [task] in - task?.cancel() + } onCancel: { [requestTask] in + requestTask?.cancel() } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 724845424e6..e0457cb53cf 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -25,9 +25,9 @@ open class AnotherFakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -37,7 +37,7 @@ open class AnotherFakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 27b455e59ff..565fb17c666 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -24,9 +24,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -36,7 +36,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -75,9 +75,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -87,7 +87,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -126,9 +126,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -138,7 +138,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -177,9 +177,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -189,7 +189,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -228,9 +228,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -240,7 +240,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -280,9 +280,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in + requestTask = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -292,7 +292,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -335,9 +335,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -347,7 +347,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -401,9 +401,9 @@ open class FakeAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result in + requestTask = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -413,7 +413,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -562,9 +562,9 @@ open class FakeAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in + requestTask = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -574,7 +574,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -641,9 +641,9 @@ open class FakeAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in + requestTask = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -653,7 +653,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -706,9 +706,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in + requestTask = testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -718,7 +718,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -759,9 +759,9 @@ open class FakeAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in + requestTask = testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -771,7 +771,7 @@ open class FakeAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index f9538610472..a8ad34b07b6 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -25,9 +25,9 @@ open class FakeClassnameTags123API { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -37,7 +37,7 @@ open class FakeClassnameTags123API { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 71225a5b53d..3f9674b43fd 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -25,9 +25,9 @@ open class PetAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -37,7 +37,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -81,9 +81,9 @@ open class PetAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in + requestTask = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -93,7 +93,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -149,9 +149,9 @@ open class PetAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { - var task: URLSessionTask? + var requestTask: RequestTask? return Future<[Pet], Error> { promise in - task = findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in + requestTask = findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -161,7 +161,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -209,9 +209,9 @@ open class PetAPI { @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], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { - var task: URLSessionTask? + var requestTask: RequestTask? return Future<[Pet], Error> { promise in - task = findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in + requestTask = findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -221,7 +221,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -269,9 +269,9 @@ open class PetAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in + requestTask = getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -281,7 +281,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -328,9 +328,9 @@ open class PetAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -340,7 +340,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -385,9 +385,9 @@ open class PetAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in + requestTask = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -397,7 +397,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -453,9 +453,9 @@ open class PetAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in + requestTask = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -465,7 +465,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -521,9 +521,9 @@ open class PetAPI { #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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in + requestTask = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -533,7 +533,7 @@ open class PetAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index ec3368c105a..623d072590e 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -25,9 +25,9 @@ open class StoreAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in + requestTask = deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -37,7 +37,7 @@ open class StoreAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -80,9 +80,9 @@ open class StoreAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[String: Int], Error> { - var task: URLSessionTask? + var requestTask: RequestTask? return Future<[String: Int], Error> { promise in - task = getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in + requestTask = getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -92,7 +92,7 @@ open class StoreAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -135,9 +135,9 @@ open class StoreAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in + requestTask = getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -147,7 +147,7 @@ open class StoreAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -191,9 +191,9 @@ open class StoreAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -203,7 +203,7 @@ open class StoreAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 5ec63243c52..28231e9be5b 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -25,9 +25,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -37,7 +37,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -78,9 +78,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -90,7 +90,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -130,9 +130,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + requestTask = createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -142,7 +142,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -182,9 +182,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in + requestTask = deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -194,7 +194,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -238,9 +238,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in + requestTask = getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -250,7 +250,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -294,9 +294,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in + requestTask = loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): promise(.success(response.body)) @@ -306,7 +306,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -351,9 +351,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in + requestTask = logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -363,7 +363,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } @@ -403,9 +403,9 @@ open class UserAPI { #if canImport(Combine) @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { - var task: URLSessionTask? + var requestTask: RequestTask? return Future { promise in - task = updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in + requestTask = updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: promise(.success(())) @@ -415,7 +415,7 @@ open class UserAPI { } } .handleEvents(receiveCancel: { - task?.cancel() + requestTask?.cancel() }) .eraseToAnyPublisher() } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index d384b276b4b..730957420e1 100644 --- a/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Flight-School/AnyCodable", "state": { "branch": null, - "revision": "876d162385e9862ae8b3c8d65dc301312b040005", - "version": "0.6.0" + "revision": "b1a7a8a6186f2fcb28f7bda67cfc545de48b3c80", + "version": "0.6.2" } } ] diff --git a/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index 6136098ee57..29c50819e27 100644 --- a/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -30,7 +30,7 @@ class PetAPITests: XCTestCase { func test1CreatePet() { let expectation = self.expectation(description: "testCreatePet") - let category = PetstoreClient.Category(id: 1234, name: "eyeColor") + let category = Category(id: 1234, name: "eyeColor") let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")] let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) diff --git a/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/run_xcodebuild.sh index 79520c7fc38..719b9c84181 100755 --- a/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift5/combineLibrary/SwaggerClientTests/run_xcodebuild.sh @@ -1,5 +1,3 @@ #!/bin/sh -pod install - -xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild clean build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index ac45c1f454b..5e179af64e2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index bf154f2e1db..78c64f76f11 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -20,7 +20,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createXmlItem(xmlItem: XmlItem, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createXmlItem(xmlItem: XmlItem, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createXmlItemWithRequestBuilder(xmlItem: xmlItem).execute(apiResponseQueue) { result in switch result { case .success: @@ -63,7 +63,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -105,7 +105,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -147,7 +147,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -189,7 +189,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -231,7 +231,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -274,7 +274,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -320,7 +320,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -377,7 +377,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -529,7 +529,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -599,7 +599,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -699,7 +699,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: @@ -752,7 +752,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testQueryParameterCollectionFormat(pipe: [String], ioutil: [String], http: [String], url: [String], context: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testQueryParameterCollectionFormatWithRequestBuilder(pipe: pipe, ioutil: ioutil, http: http, url: url, context: context).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index ac274a7c550..34e8c9c7f23 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 655b2358c52..6d37af7299f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: Set, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Set?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: Set, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Set?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f2539226866..c111e830130 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 3fc59f9ef4f..5e01a4a7c34 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index d384b276b4b..730957420e1 100644 --- a/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Flight-School/AnyCodable", "state": { "branch": null, - "revision": "876d162385e9862ae8b3c8d65dc301312b040005", - "version": "0.6.0" + "revision": "b1a7a8a6186f2fcb28f7bda67cfc545de48b3c80", + "version": "0.6.2" } } ] diff --git a/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index 31f90f6acfa..9dfbc9aa465 100644 --- a/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift5/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -26,7 +26,7 @@ class PetAPITests: XCTestCase { func test1CreatePet() { let expectation = self.expectation(description: "testCreatePet") - let category = PetstoreClient.Category(id: 1234, name: "eyeColor") + let category = Category(id: 1234, name: "eyeColor") let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")] let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) diff --git a/samples/client/petstore/swift5/default/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift5/default/SwaggerClientTests/run_xcodebuild.sh index 19e1e06dad6..719b9c84181 100755 --- a/samples/client/petstore/swift5/default/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift5/default/SwaggerClientTests/run_xcodebuild.sh @@ -1,5 +1,3 @@ #!/bin/sh -pod install - -xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild clean build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift index b40334cece0..79ef8ff207b 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 59a82575aa1..ed7c4d5c1f8 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(pet: pet).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(pet: pet).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 0f5624f3e1f..b09bede0787 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(order: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(order: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(order: order).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 26c12a61e64..c68667274c1 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(user: user).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(user: user).execute(apiResponseQueue) { result in switch result { case .success: @@ -113,7 +113,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(user: user).execute(apiResponseQueue) { result in switch result { case .success: @@ -159,7 +159,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -209,7 +209,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -256,7 +256,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -304,7 +304,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -350,7 +350,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, user: user).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift index 571d0564cef..2dc59ba173f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ internal class RequestBuilder { internal let parameters: [String: Any]? internal let method: String internal let URLString: String + internal let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ internal class RequestBuilder { } @discardableResult - internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } internal func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index f5d2ab74a2f..fee5f2b8cc2 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ internal class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 31c875915ac..344309b20bc 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> 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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ internal class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index e6f46831cf9..ff9d932c5a0 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ internal class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 74aa56a14e6..84428b2b76b 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func deletePet(apiKey: String? = nil, petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func deletePet(apiKey: String? = nil, petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(apiKey: apiKey, petId: petId).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ internal class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - internal class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 111ce53225f..226802df83a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ internal class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ internal class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ internal class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ internal class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index f8a4404579b..352cb794c30 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ internal class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - internal class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + internal class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift index 60869f63ef6..7fcbd1ee511 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ internal class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +internal final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + internal func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 0d4c11bc1ac..929cbc5f04f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ internal class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ internal class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index d84e62c007e..c8199c16356 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 5396fe8dd32..3211e37fe6d 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ import AnyCodable - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ import AnyCodable - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ import AnyCodable - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 153aaa15d8f..897771399d5 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 58fbeae4d63..851cba50715 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ import AnyCodable */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ import AnyCodable - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ import AnyCodable - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index c4c37878af9..333059bb100 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index fc6c823089a..6a9da2b760e 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ import AnyCodable - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs.swift index 312ef272770..96e432a19d0 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift index 0fabebe6410..f17b96cd1f9 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/APIs/DefaultAPI.swift @@ -18,7 +18,7 @@ open class DefaultAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func rootGet(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Fruit?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func rootGet(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Fruit?, _ error: Error?) -> Void)) -> RequestTask { return rootGetWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index 63ce26f05eb..b1a805eecf8 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,13 +6,13 @@ "repositoryURL": "https://github.com/Flight-School/AnyCodable", "state": { "branch": null, - "revision": "876d162385e9862ae8b3c8d65dc301312b040005", - "version": "0.6.0" + "revision": "b1a7a8a6186f2fcb28f7bda67cfc545de48b3c80", + "version": "0.6.2" } }, { "package": "PromiseKit", - "repositoryURL": "https://github.com/mxcl/PromiseKit.git", + "repositoryURL": "https://github.com/mxcl/PromiseKit", "state": { "branch": null, "revision": "d2f7ba14bcdc45e18f4f60ad9df883fb9055f081", diff --git a/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index b29dfa48ec6..ff6de167c8e 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -27,7 +27,7 @@ class PetAPITests: XCTestCase { func test1CreatePet() { let expectation = self.expectation(description: "testCreatePet") - let category = PetstoreClient.Category(id: 1234, name: "eyeColor") + let category = Category(id: 1234, name: "eyeColor") let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")] let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) diff --git a/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/run_xcodebuild.sh index 79520c7fc38..719b9c84181 100755 --- a/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift5/promisekitLibrary/SwaggerClientTests/run_xcodebuild.sh @@ -1,5 +1,3 @@ #!/bin/sh -pod install - -xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild clean build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index ac45c1f454b..5e179af64e2 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index a5165719f10..d980142c6ab 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index ac274a7c550..34e8c9c7f23 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index bd5c091925b..254930e7779 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f2539226866..c111e830130 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 3fc59f9ef4f..5e01a4a7c34 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index c097bc87b6e..c684ae4fad1 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -19,6 +19,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -41,8 +42,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 03e84c9a2e3..2c964608700 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index db0c4cb351c..e3474406388 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> 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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 0749c5c9dc7..bc8e16a86dd 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the result */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 33bc3ed33a9..d88ad67da75 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[Pet], ErrorResponse>) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[Pet], ErrorResponse>) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[Pet], ErrorResponse>) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[Pet], ErrorResponse>) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ open class PetAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 6ce5440ab90..766f89065fe 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[String: Int], ErrorResponse>) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[String: Int], ErrorResponse>) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index bca3f08fe83..0a40144f75a 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ open class UserAPI { - parameter completion: completion handler to receive the result */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 34db22eeb11..336e8a19e36 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -22,7 +22,7 @@ open class AnotherFakeAPI { */ open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -33,7 +33,7 @@ open class AnotherFakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 4d998a53217..e27e0b6c2db 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -21,7 +21,7 @@ open class FakeAPI { */ open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -32,7 +32,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -69,7 +69,7 @@ open class FakeAPI { */ open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -80,7 +80,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -117,7 +117,7 @@ open class FakeAPI { */ open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -128,7 +128,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -165,7 +165,7 @@ open class FakeAPI { */ open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -176,7 +176,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -213,7 +213,7 @@ open class FakeAPI { */ open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -224,7 +224,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -262,7 +262,7 @@ open class FakeAPI { */ open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in + let requestTask = testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -273,7 +273,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -314,7 +314,7 @@ open class FakeAPI { */ open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -325,7 +325,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -377,7 +377,7 @@ open class FakeAPI { */ 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result in + let requestTask = testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -388,7 +388,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -535,7 +535,7 @@ open class FakeAPI { */ 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in + let requestTask = testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -546,7 +546,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -611,7 +611,7 @@ open class FakeAPI { */ open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in + let requestTask = testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -622,7 +622,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -673,7 +673,7 @@ open class FakeAPI { */ open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in + let requestTask = testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -684,7 +684,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -723,7 +723,7 @@ open class FakeAPI { */ open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in + let requestTask = testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -734,7 +734,7 @@ open class FakeAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index a19dd70dd44..bd7da53d607 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -22,7 +22,7 @@ open class FakeClassnameTags123API { */ open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -33,7 +33,7 @@ open class FakeClassnameTags123API { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 73e4a43c655..a1fa17f78be 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -22,7 +22,7 @@ open class PetAPI { */ open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -33,7 +33,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -75,7 +75,7 @@ open class PetAPI { */ open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in + let requestTask = deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -86,7 +86,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -140,7 +140,7 @@ open class PetAPI { */ open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[Pet]> { return Observable.create { observer -> Disposable in - let task = findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in + let requestTask = findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -151,7 +151,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -197,7 +197,7 @@ open class PetAPI { @available(*, deprecated, message: "This operation is deprecated.") open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[Pet]> { return Observable.create { observer -> Disposable in - let task = findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in + let requestTask = findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -208,7 +208,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -254,7 +254,7 @@ open class PetAPI { */ open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in + let requestTask = getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -265,7 +265,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -310,7 +310,7 @@ open class PetAPI { */ open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -321,7 +321,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -364,7 +364,7 @@ open class PetAPI { */ open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in + let requestTask = updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -375,7 +375,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -429,7 +429,7 @@ open class PetAPI { */ open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in + let requestTask = uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -440,7 +440,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -494,7 +494,7 @@ open class PetAPI { */ open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in + let requestTask = uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -505,7 +505,7 @@ open class PetAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 09ef3615620..283b7332c55 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -22,7 +22,7 @@ open class StoreAPI { */ open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in + let requestTask = deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -33,7 +33,7 @@ open class StoreAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -74,7 +74,7 @@ open class StoreAPI { */ open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[String: Int]> { return Observable.create { observer -> Disposable in - let task = getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in + let requestTask = getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -85,7 +85,7 @@ open class StoreAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -126,7 +126,7 @@ open class StoreAPI { */ open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in + let requestTask = getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -137,7 +137,7 @@ open class StoreAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -179,7 +179,7 @@ open class StoreAPI { */ open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -190,7 +190,7 @@ open class StoreAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index be932ce5e32..c0be612ac9e 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -22,7 +22,7 @@ open class UserAPI { */ open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -33,7 +33,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -72,7 +72,7 @@ open class UserAPI { */ open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -83,7 +83,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -121,7 +121,7 @@ open class UserAPI { */ open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in + let requestTask = createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -132,7 +132,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -170,7 +170,7 @@ open class UserAPI { */ open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in + let requestTask = deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -181,7 +181,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -223,7 +223,7 @@ open class UserAPI { */ open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in + let requestTask = getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -234,7 +234,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -276,7 +276,7 @@ open class UserAPI { */ open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in + let requestTask = loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): observer.onNext(response.body) @@ -287,7 +287,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -330,7 +330,7 @@ open class UserAPI { */ open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in + let requestTask = logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -341,7 +341,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } @@ -379,7 +379,7 @@ open class UserAPI { */ open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { return Observable.create { observer -> Disposable in - let task = updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in + let requestTask = updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: observer.onNext(()) @@ -390,7 +390,7 @@ open class UserAPI { } return Disposables.create { - task?.cancel() + requestTask.cancel() } } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index 231d8536967..dde8565ecf6 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,13 +6,13 @@ "repositoryURL": "https://github.com/Flight-School/AnyCodable", "state": { "branch": null, - "revision": "876d162385e9862ae8b3c8d65dc301312b040005", - "version": "0.6.0" + "revision": "b1a7a8a6186f2fcb28f7bda67cfc545de48b3c80", + "version": "0.6.2" } }, { "package": "RxSwift", - "repositoryURL": "https://github.com/ReactiveX/RxSwift.git", + "repositoryURL": "https://github.com/ReactiveX/RxSwift", "state": { "branch": null, "revision": "7c17a6ccca06b5c107cfa4284e634562ddaf5951", diff --git a/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index db7609caf07..d5da81a1203 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -28,7 +28,7 @@ class PetAPITests: XCTestCase { func test1CreatePet() { let expectation = self.expectation(description: "testCreatePet") - let category = PetstoreClient.Category(id: 1234, name: "eyeColor") + let category = Category(id: 1234, name: "eyeColor") let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")] let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) diff --git a/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/run_xcodebuild.sh index 79520c7fc38..719b9c84181 100755 --- a/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift5/rxswiftLibrary/SwaggerClientTests/run_xcodebuild.sh @@ -1,5 +1,3 @@ #!/bin/sh -pod install - -xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild clean build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift5/swift5_test_all.sh b/samples/client/petstore/swift5/swift5_test_all.sh index faeb4ca6aa1..5fdedca3282 100755 --- a/samples/client/petstore/swift5/swift5_test_all.sh +++ b/samples/client/petstore/swift5/swift5_test_all.sh @@ -5,13 +5,12 @@ set -e DIRECTORY=`dirname $0` # example project with unit tests -# temporarily commment them because they are flaky -# mvn -f $DIRECTORY/alamofireLibrary/SwaggerClientTests/pom.xml integration-test -# mvn -f $DIRECTORY/combineLibrary/SwaggerClientTests/pom.xml integration-test -# mvn -f $DIRECTORY/default/SwaggerClientTests/pom.xml integration-test -# mvn -f $DIRECTORY/promisekitLibrary/SwaggerClientTests/pom.xml integration-test -# mvn -f $DIRECTORY/rxswiftLibrary/SwaggerClientTests/pom.xml integration-test -# mvn -f $DIRECTORY/urlsessionLibrary/SwaggerClientTests/pom.xml integration-test +mvn -f $DIRECTORY/alamofireLibrary/SwaggerClientTests/pom.xml integration-test +mvn -f $DIRECTORY/combineLibrary/SwaggerClientTests/pom.xml integration-test +mvn -f $DIRECTORY/default/SwaggerClientTests/pom.xml integration-test +mvn -f $DIRECTORY/promisekitLibrary/SwaggerClientTests/pom.xml integration-test +mvn -f $DIRECTORY/rxswiftLibrary/SwaggerClientTests/pom.xml integration-test +mvn -f $DIRECTORY/urlsessionLibrary/SwaggerClientTests/pom.xml integration-test # spm build mvn -f $DIRECTORY/alamofireLibrary/pom.xml integration-test diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 7759248e537..20dfa6d14c4 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -23,7 +23,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 80d050c6d3e..f336d4b552c 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -22,7 +22,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -64,7 +64,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -106,7 +106,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -148,7 +148,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -190,7 +190,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -233,7 +233,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -279,7 +279,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -336,7 +336,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -488,7 +488,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -558,7 +558,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -614,7 +614,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -658,7 +658,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift index f7968588367..e1608abb409 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift @@ -23,7 +23,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index ffcf8725e94..551edaf0db4 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -23,7 +23,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -70,7 +70,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -129,7 +129,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -180,7 +180,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -231,7 +231,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -281,7 +281,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -329,7 +329,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -388,7 +388,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -447,7 +447,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift index 8c57ab94977..052761d676e 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/StoreAPI.swift @@ -23,7 +23,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -69,7 +69,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -115,7 +115,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -162,7 +162,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index 90bc5143fa7..242239a1a9e 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -23,7 +23,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -110,7 +110,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -153,7 +153,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -200,7 +200,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -247,7 +247,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -295,7 +295,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -338,7 +338,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved index d384b276b4b..730957420e1 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Flight-School/AnyCodable", "state": { "branch": null, - "revision": "876d162385e9862ae8b3c8d65dc301312b040005", - "version": "0.6.0" + "revision": "b1a7a8a6186f2fcb28f7bda67cfc545de48b3c80", + "version": "0.6.2" } } ] diff --git a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerDecodableRequestBuilder.swift b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerDecodableRequestBuilder.swift index a28a4c90c0e..b1f37b4ea80 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerDecodableRequestBuilder.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClient/BearerDecodableRequestBuilder.swift @@ -20,8 +20,8 @@ class BearerRequestBuilderFactory: RequestBuilderFactory { } class BearerRequestBuilder: URLSessionRequestBuilder { - override func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (Result, Error>) -> Void) { - + @discardableResult + override func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (Result, ErrorResponse>) -> Void) -> RequestTask { // Before making the request, we can validate if we have a bearer token to be able to make a request BearerTokenHandler.refreshTokenIfDoesntExist { @@ -61,12 +61,14 @@ class BearerRequestBuilder: URLSessionRequestBuilder { } } } + + return requestTask } } class BearerDecodableRequestBuilder: URLSessionDecodableRequestBuilder { - override func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (Result, Error>) -> Void) { - + @discardableResult + override func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (Result, ErrorResponse>) -> Void) -> RequestTask { // Before making the request, we can validate if we have a bearer token to be able to make a request BearerTokenHandler.refreshTokenIfDoesntExist { @@ -106,6 +108,8 @@ class BearerDecodableRequestBuilder: URLSessionDecodableRequestBui } } } + + return requestTask } } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index 31f90f6acfa..f1a26cdd41b 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -26,11 +26,11 @@ class PetAPITests: XCTestCase { func test1CreatePet() { let expectation = self.expectation(description: "testCreatePet") - let category = PetstoreClient.Category(id: 1234, name: "eyeColor") - let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")] - let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) + let category = PetstoreClientAPI.Category(id: 1234, name: "eyeColor") + let tags = [PetstoreClientAPI.Tag(id: 1234, name: "New York"), PetstoreClientAPI.Tag(id: 124321, name: "Jose")] + let newPet = PetstoreClientAPI.Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available) - PetAPI.addPet(body: newPet) { (_, error) in + PetstoreClientAPI.PetAPI.addPet(body: newPet) { (_, error) in guard error == nil else { XCTFail("error creating pet") return @@ -45,7 +45,7 @@ class PetAPITests: XCTestCase { func test2GetPet() { let expectation = self.expectation(description: "testGetPet") - PetAPI.getPetById(petId: 1000) { (pet, error) in + PetstoreClientAPI.PetAPI.getPetById(petId: 1000) { (pet, error) in guard error == nil else { XCTFail("error retrieving pet") return @@ -74,7 +74,7 @@ class PetAPITests: XCTestCase { fatalError() } - PetAPI.uploadFile(petId: 1000, additionalMetadata: "additionalMetadata", file: imageURL) { (_, error) in + PetstoreClientAPI.PetAPI.uploadFile(petId: 1000, additionalMetadata: "additionalMetadata", file: imageURL) { (_, error) in guard error == nil else { FileUtils.deleteFile(fileURL: imageURL) XCTFail("error uploading file") @@ -91,7 +91,7 @@ class PetAPITests: XCTestCase { func test4DeletePet() { let expectation = self.expectation(description: "testDeletePet") - PetAPI.deletePet(petId: 1000) { (_, error) in + PetstoreClientAPI.PetAPI.deletePet(petId: 1000) { (_, error) in guard error == nil else { XCTFail("error deleting pet") return diff --git a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift index 94cb489e5f2..69752642387 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift @@ -19,10 +19,10 @@ class StoreAPITests: XCTestCase { func test1PlaceOrder() { // use explicit naming to reference the enum so that we test we don't regress on enum naming let shipDate = Date() - let order = Order(id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true) + let order = PetstoreClientAPI.Order(id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true) let expectation = self.expectation(description: "testPlaceOrder") - StoreAPI.placeOrder(body: order) { (order, error) in + PetstoreClientAPI.StoreAPI.placeOrder(body: order) { (order, error) in guard error == nil else { XCTFail("error placing order: \(error.debugDescription)") return @@ -45,7 +45,7 @@ class StoreAPITests: XCTestCase { func test2GetOrder() { let expectation = self.expectation(description: "testGetOrder") - StoreAPI.getOrderById(orderId: 1000) { (order, error) in + PetstoreClientAPI.StoreAPI.getOrderById(orderId: 1000) { (order, error) in guard error == nil else { XCTFail("error retrieving order: \(error.debugDescription)") return @@ -59,14 +59,14 @@ class StoreAPITests: XCTestCase { expectation.fulfill() } } - + self.waitForExpectations(timeout: testTimeout, handler: nil) } func test3DeleteOrder() { let expectation = self.expectation(description: "testDeleteOrder") - StoreAPI.deleteOrder(orderId: "1000") { (response, error) in + PetstoreClientAPI.StoreAPI.deleteOrder(orderId: "1000") { (response, error) in guard error == nil else { XCTFail("error deleting order") return @@ -86,7 +86,7 @@ class StoreAPITests: XCTestCase { func testDownloadProgress() { let responseExpectation = self.expectation(description: "obtain response") let progressExpectation = self.expectation(description: "obtain progress") - let requestBuilder = StoreAPI.getOrderByIdWithRequestBuilder(orderId: 1000) + let requestBuilder = PetstoreClientAPI.StoreAPI.getOrderByIdWithRequestBuilder(orderId: 1000) requestBuilder.onProgressReady = { (_) in progressExpectation.fulfill() diff --git a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift index 0a1ca3902eb..2041d1208e7 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift @@ -27,7 +27,7 @@ class UserAPITests: XCTestCase { func testLogin() { let expectation = self.expectation(description: "testLogin") - UserAPI.loginUser(username: "swiftTester", password: "swift") { (_, error) in + PetstoreClientAPI.UserAPI.loginUser(username: "swiftTester", password: "swift") { (_, error) in guard error == nil else { XCTFail("error logging in") return @@ -42,7 +42,7 @@ class UserAPITests: XCTestCase { func testLogout() { let expectation = self.expectation(description: "testLogout") - UserAPI.logoutUser { (_, error) in + PetstoreClientAPI.UserAPI.logoutUser { (_, error) in guard error == nil else { XCTFail("error logging out") return @@ -58,7 +58,7 @@ class UserAPITests: XCTestCase { // The path for this operation is /user/{userId}. In order to make a usable path, // then we must make sure that {userId} is percent-escaped when it is substituted // into the path. So we intentionally introduce a path with spaces. - let userRequestBuilder = UserAPI.getUserByNameWithRequestBuilder(username: "User Name With Spaces") + let userRequestBuilder = PetstoreClientAPI.UserAPI.getUserByNameWithRequestBuilder(username: "User Name With Spaces") let urlContainsSpace = userRequestBuilder.URLString.contains(" ") XCTAssert(!urlContainsSpace, "Expected URL to be escaped, but it was not.") diff --git a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/run_xcodebuild.sh index 19e1e06dad6..719b9c84181 100755 --- a/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift5/urlsessionLibrary/SwaggerClientTests/run_xcodebuild.sh @@ -1,5 +1,3 @@ #!/bin/sh -pod install - -xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild clean build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" | xcpretty && exit ${PIPESTATUS[0]} diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index ac45c1f454b..5e179af64e2 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index a5165719f10..d980142c6ab 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index ac274a7c550..34e8c9c7f23 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index bd5c091925b..254930e7779 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f2539226866..c111e830130 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 3fc59f9ef4f..5e01a4a7c34 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { From 347b75a024452d8fbdfc3864084d2f613004d7ca Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 8 Dec 2021 13:03:08 -0800 Subject: [PATCH 02/18] Fixes paramName and dataType for request body anyType parameters (#11075) * Adds request body of any type * Fixes param dataType, paramName, and baseName * Uses updateRequestBodyForPrimitiveType as the else case for anyType request bodies like the code used to do * Samples updated * Samples regenerated --- .../openapitools/codegen/DefaultCodegen.java | 2 + .../resources/3_0/oneOfArrayMapImport.yaml | 10 ++++ .../Classes/OpenAPIs/APIs.swift | 5 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 ++++----- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 +++--- .../Classes/OpenAPIs/Models.swift | 13 +++++ .../OpenAPIs/URLSessionImplementations.swift | 8 +-- .../builds/default/api/default.service.ts | 51 +++++++++++++++++++ 12 files changed, 118 insertions(+), 41 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index e97a6caf557..e76b78d6e5a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -6721,6 +6721,8 @@ public class DefaultCodegen implements CodegenConfig { } else if (ModelUtils.isObjectSchema(schema)) { // object type schema OR (AnyType schema with properties defined) this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false); + } else { + updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports); } addVarsRequiredVarsAdditionalProps(schema, codegenParameter); } else { diff --git a/modules/openapi-generator/src/test/resources/3_0/oneOfArrayMapImport.yaml b/modules/openapi-generator/src/test/resources/3_0/oneOfArrayMapImport.yaml index 9fb06fc38f0..ed2a9f02e3f 100644 --- a/modules/openapi-generator/src/test/resources/3_0/oneOfArrayMapImport.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/oneOfArrayMapImport.yaml @@ -12,6 +12,16 @@ paths: application/json: schema: $ref: '#/components/schemas/fruit' + put: + operationId: test + parameters: [] + requestBody: + content: + application/json: + schema: {} + responses: + '204': + description: Success components: schemas: fruit: diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs.swift index a7933c418ad..485585212d4 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -27,6 +27,7 @@ open class RequestBuilder { public let parameters: [String: Any]? public let method: String public let URLString: String + public let requestTask: RequestTask = RequestTask() /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. @@ -49,8 +50,8 @@ open class RequestBuilder { } @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { - return nil + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { + return requestTask } public func addHeader(name: String, value: String) -> Self { diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index ac45c1f454b..5e179af64e2 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -20,7 +20,7 @@ open class AnotherFakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 9f5c7a495e1..eac6aeb1a3c 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -19,7 +19,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -61,7 +61,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -103,7 +103,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -145,7 +145,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -187,7 +187,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -230,7 +230,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -276,7 +276,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -333,7 +333,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> 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).execute(apiResponseQueue) { result in switch result { case .success: @@ -485,7 +485,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @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).execute(apiResponseQueue) { result in switch result { case .success: @@ -555,7 +555,7 @@ open class FakeAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result in switch result { case .success: @@ -611,7 +611,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result in switch result { case .success: @@ -655,7 +655,7 @@ open class FakeAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index ac274a7c550..34e8c9c7f23 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -20,7 +20,7 @@ open class FakeClassnameTags123API { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) -> RequestTask { return testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 2baca7e644a..1fc238359a0 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -20,7 +20,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -67,7 +67,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deletePet(apiKey: String? = nil, petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deletePet(apiKey: String? = nil, petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deletePetWithRequestBuilder(apiKey: apiKey, petId: petId).execute(apiResponseQueue) { result in switch result { case .success: @@ -126,7 +126,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -177,7 +177,7 @@ open class PetAPI { */ @available(*, deprecated, message: "This operation is deprecated.") @discardableResult - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) -> RequestTask { return findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -228,7 +228,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) -> RequestTask { return getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -278,7 +278,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -326,7 +326,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result in switch result { case .success: @@ -385,7 +385,7 @@ open class PetAPI { - 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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -444,7 +444,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { return uploadFileWithRequiredFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f2539226866..c111e830130 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -20,7 +20,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case .success: @@ -66,7 +66,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) -> RequestTask { return getInventoryWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -112,7 +112,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -159,7 +159,7 @@ open class StoreAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) -> RequestTask { return placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 3fc59f9ef4f..5e01a4a7c34 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -20,7 +20,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -64,7 +64,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -107,7 +107,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result in switch result { case .success: @@ -150,7 +150,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case .success: @@ -197,7 +197,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) -> RequestTask { return getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -244,7 +244,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) -> RequestTask { return loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result in switch result { case let .success(response): @@ -292,7 +292,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return logoutUserWithRequestBuilder().execute(apiResponseQueue) { result in switch result { case .success: @@ -335,7 +335,7 @@ open class UserAPI { - parameter completion: completion handler to receive the data and the error objects */ @discardableResult - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> URLSessionTask? { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) -> RequestTask { return updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result in switch result { case .success: diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/Models.swift index 7787127c40d..7cb4e06d16c 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -78,3 +78,16 @@ open class Response { self.init(statusCode: response.statusCode, header: header, body: body) } } + +public final class RequestTask { + private var task: URLSessionTask? + + internal func set(task: URLSessionTask) { + self.task = task + } + + public func cancel() { + task?.cancel() + task = nil + } +} diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index fe7fb6683bc..23df908ca32 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -100,7 +100,7 @@ open class URLSessionRequestBuilder: RequestBuilder { } @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> URLSessionTask? { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { let urlSession = createURLSession() guard let xMethod = HTTPMethod(rawValue: method) else { @@ -172,14 +172,14 @@ open class URLSessionRequestBuilder: RequestBuilder { dataTask.resume() - return dataTask + requestTask.set(task: dataTask) } catch { apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, nil, error))) } - - return nil } + + return requestTask } fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { diff --git a/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts index 6a74ef3266b..7363f44f946 100644 --- a/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts +++ b/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts @@ -128,4 +128,55 @@ export class DefaultService { ); } + /** + * @param body + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public test(body?: any, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined,}): Observable; + public test(body?: any, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined,}): Observable>; + public test(body?: any, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined,}): Observable>; + public test(body?: any, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined,}): Observable { + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' = 'json'; + if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } + + return this.httpClient.put(`${this.configuration.basePath}/`, + body, + { + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + } From b755ae288afe9b4d23de14e72ff6dc7735686690 Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Wed, 8 Dec 2021 22:15:26 +0100 Subject: [PATCH 03/18] [Python] Add option to select/detect content-type. (#10978) * [Python] Add option to select/detect content-type. * Regenerate samples after rebase. * Update samples. * test: fix assertion --- .../src/main/resources/python/api.mustache | 5 + .../main/resources/python/api_client.mustache | 34 +++-- .../petstore_api/api/another_fake_api.py | 5 + .../python/petstore_api/api/fake_api.py | 80 ++++++++++ .../api/fake_classname_tags_123_api.py | 5 + .../python/petstore_api/api/pet_api.py | 45 ++++++ .../python/petstore_api/api/store_api.py | 20 +++ .../python/petstore_api/api/user_api.py | 40 +++++ .../python/petstore_api/api_client.py | 34 +++-- .../petstore/python/test/test_fake_api.py | 1 + .../petstore/python/tests/test_api_client.py | 10 ++ .../petstore/python/tests/test_pet_api.py | 25 +++- .../petstore_api/api/another_fake_api.py | 5 + .../petstore_api/api/fake_api.py | 80 ++++++++++ .../api/fake_classname_tags_123_api.py | 5 + .../petstore_api/api/pet_api.py | 45 ++++++ .../petstore_api/api/store_api.py | 20 +++ .../petstore_api/api/user_api.py | 40 +++++ .../petstore_api/api_client.py | 34 +++-- .../test/test_fake_api.py | 1 + .../python/x_auth_id_alias/api/usage_api.py | 20 +++ .../python/x_auth_id_alias/api_client.py | 34 +++-- .../python/dynamic_servers/api/usage_api.py | 10 ++ .../python/dynamic_servers/api_client.py | 34 +++-- .../petstore_api/api/another_fake_api.py | 5 + .../python/petstore_api/api/default_api.py | 5 + .../python/petstore_api/api/fake_api.py | 140 ++++++++++++++++++ .../api/fake_classname_tags_123_api.py | 5 + .../python/petstore_api/api/pet_api.py | 35 +++++ .../python/petstore_api/api/store_api.py | 20 +++ .../python/petstore_api/api/user_api.py | 40 +++++ .../python/petstore_api/api_client.py | 34 +++-- 32 files changed, 855 insertions(+), 61 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 841ac8bb855..bba20b6210b 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -270,6 +270,9 @@ class {{classname}}(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -298,6 +301,8 @@ class {{classname}}(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') {{#requiredParams}} kwargs['{{paramName}}'] = \ diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 91591e10cc5..b083d401dd4 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -129,7 +129,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _content_type: typing.Optional[str] = None ): config = self.configuration @@ -584,10 +585,12 @@ class ApiClient(object): else: return ', '.join(accepts) - def select_header_content_type(self, content_types): + def select_header_content_type(self, content_types, method=None, body=None): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. + :param method: http method (e.g. POST, PATCH). + :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: @@ -595,6 +598,11 @@ class ApiClient(object): content_types = [x.lower() for x in content_types] + if (method == 'PATCH' and + 'application/json-patch+json' in content_types and + isinstance(body, list)): + return 'application/json-patch+json' + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: @@ -685,7 +693,8 @@ class Endpoint(object): '_request_timeout', '_return_http_data_only', '_check_input_type', - '_check_return_type' + '_check_return_type', + '_content_type' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -698,7 +707,8 @@ class Endpoint(object): '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), '_return_http_data_only': (bool,), '_check_input_type': (bool,), - '_check_return_type': (bool,) + '_check_return_type': (bool,), + '_content_type': (none_type, str) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -845,12 +855,16 @@ class Endpoint(object): params['header']['Accept'] = self.api_client.select_header_accept( accept_headers_list) - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list) - params['header']['Content-Type'] = header_list + if kwargs.get('_content_type'): + params['header']['Content-Type'] = kwargs['_content_type'] + else: + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + if params['body'] != "": + header_list = self.api_client.select_header_content_type( + content_type_headers_list, self.settings['http_method'], + params['body']) + params['header']['Content-Type'] = header_list return self.api_client.call_api( self.settings['endpoint_path'], self.settings['http_method'], diff --git a/samples/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/client/petstore/python/petstore_api/api/another_fake_api.py index 2ae65760a36..1411f08cbc1 100644 --- a/samples/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/another_fake_api.py @@ -119,6 +119,9 @@ class AnotherFakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -147,6 +150,8 @@ class AnotherFakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body diff --git a/samples/client/petstore/python/petstore_api/api/fake_api.py b/samples/client/petstore/python/petstore_api/api/fake_api.py index 4afa17e3cb2..a21d5838f41 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -1132,6 +1132,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1160,6 +1163,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.array_model_endpoint.call_with_http_info(**kwargs) @@ -1194,6 +1199,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1222,6 +1230,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.boolean_endpoint.call_with_http_info(**kwargs) @@ -1258,6 +1268,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1286,6 +1299,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['xml_item'] = \ xml_item @@ -1322,6 +1337,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1350,6 +1368,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.number_with_validations_endpoint.call_with_http_info(**kwargs) @@ -1384,6 +1404,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1412,6 +1435,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs) @@ -1446,6 +1471,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1474,6 +1502,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.string_endpoint.call_with_http_info(**kwargs) @@ -1508,6 +1538,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1536,6 +1569,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.string_enum_endpoint.call_with_http_info(**kwargs) @@ -1572,6 +1607,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1600,6 +1638,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -1639,6 +1679,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1667,6 +1710,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['query'] = \ query @@ -1707,6 +1752,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1735,6 +1783,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -1781,6 +1831,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1809,6 +1862,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['query_integer'] = \ query_integer @@ -1871,6 +1926,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1899,6 +1957,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['number'] = \ number @@ -1948,6 +2008,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1976,6 +2039,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs) @@ -2019,6 +2084,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2047,6 +2115,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['required_string_group'] = \ required_string_group @@ -2088,6 +2158,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2116,6 +2189,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['param'] = \ param @@ -2155,6 +2230,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2183,6 +2261,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['param'] = \ param diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 54fdf7f892a..76e35824fbe 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -121,6 +121,9 @@ class FakeClassnameTags123Api(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -149,6 +152,8 @@ class FakeClassnameTags123Api(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body diff --git a/samples/client/petstore/python/petstore_api/api/pet_api.py b/samples/client/petstore/python/petstore_api/api/pet_api.py index 1a8a4c51fde..13fb1d981f4 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -584,6 +584,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -612,6 +615,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -650,6 +655,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -678,6 +686,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -716,6 +726,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -744,6 +757,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['status'] = \ status @@ -782,6 +797,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -810,6 +828,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['tags'] = \ tags @@ -848,6 +868,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -876,6 +899,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -913,6 +938,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -941,6 +969,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -980,6 +1010,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1008,6 +1041,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -1048,6 +1083,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1076,6 +1114,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -1116,6 +1156,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1144,6 +1187,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id diff --git a/samples/client/petstore/python/petstore_api/api/store_api.py b/samples/client/petstore/python/petstore_api/api/store_api.py index cd573a91121..934c5525999 100644 --- a/samples/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/client/petstore/python/petstore_api/api/store_api.py @@ -265,6 +265,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -293,6 +296,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order_id'] = \ order_id @@ -328,6 +333,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -356,6 +364,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.get_inventory_endpoint.call_with_http_info(**kwargs) @@ -392,6 +402,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -420,6 +433,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order_id'] = \ order_id @@ -457,6 +472,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -485,6 +503,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body diff --git a/samples/client/petstore/python/petstore_api/api/user_api.py b/samples/client/petstore/python/petstore_api/api/user_api.py index 3088eb159f1..78cc2f4a8b6 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -452,6 +452,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -480,6 +483,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -517,6 +522,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -545,6 +553,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -582,6 +592,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -610,6 +623,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -648,6 +663,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -676,6 +694,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -713,6 +733,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -741,6 +764,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -780,6 +805,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -808,6 +836,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -844,6 +874,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -872,6 +905,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.logout_user_endpoint.call_with_http_info(**kwargs) @@ -910,6 +945,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -938,6 +976,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index 9e6f1523497..7b4eea830ea 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -131,7 +131,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _content_type: typing.Optional[str] = None ): config = self.configuration @@ -572,10 +573,12 @@ class ApiClient(object): else: return ', '.join(accepts) - def select_header_content_type(self, content_types): + def select_header_content_type(self, content_types, method=None, body=None): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. + :param method: http method (e.g. POST, PATCH). + :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: @@ -583,6 +586,11 @@ class ApiClient(object): content_types = [x.lower() for x in content_types] + if (method == 'PATCH' and + 'application/json-patch+json' in content_types and + isinstance(body, list)): + return 'application/json-patch+json' + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: @@ -664,7 +672,8 @@ class Endpoint(object): '_request_timeout', '_return_http_data_only', '_check_input_type', - '_check_return_type' + '_check_return_type', + '_content_type' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -677,7 +686,8 @@ class Endpoint(object): '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), '_return_http_data_only': (bool,), '_check_input_type': (bool,), - '_check_return_type': (bool,) + '_check_return_type': (bool,), + '_content_type': (none_type, str) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -824,12 +834,16 @@ class Endpoint(object): params['header']['Accept'] = self.api_client.select_header_accept( accept_headers_list) - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list) - params['header']['Content-Type'] = header_list + if kwargs.get('_content_type'): + params['header']['Content-Type'] = kwargs['_content_type'] + else: + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + if params['body'] != "": + header_list = self.api_client.select_header_content_type( + content_type_headers_list, self.settings['http_method'], + params['body']) + params['header']['Content-Type'] = header_list return self.api_client.call_api( self.settings['endpoint_path'], self.settings['http_method'], diff --git a/samples/client/petstore/python/test/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py index 9275f2047c4..c8345a8760a 100644 --- a/samples/client/petstore/python/test/test_fake_api.py +++ b/samples/client/petstore/python/test/test_fake_api.py @@ -121,6 +121,7 @@ class TestFakeApi(unittest.TestCase): call_with_http_info.assert_called_with( _check_input_type=True, _check_return_type=True, + _content_type=None, _host_index=None, _preload_content=True, _request_timeout=None, diff --git a/samples/client/petstore/python/tests/test_api_client.py b/samples/client/petstore/python/tests/test_api_client.py index c249bf1fc5e..35747c84217 100644 --- a/samples/client/petstore/python/tests/test_api_client.py +++ b/samples/client/petstore/python/tests/test_api_client.py @@ -122,6 +122,16 @@ class ApiClientTests(unittest.TestCase): content_type = self.api_client.select_header_content_type(content_types) self.assertEqual(content_type, 'application/json') + content_types = ['application/json-patch+json', 'application/json'] + content_type = self.api_client.select_header_content_type(content_types, + 'PATCH', [{ "op": "add", "path": "/myPath", "value": ["myValue"]}]) + self.assertEqual(content_type, 'application/json-patch+json') + + content_types = ['application/json-patch+json', 'application/json'] + content_type = self.api_client.select_header_content_type(content_types, + 'PATCH', {"value": ["myValue"]}) + self.assertEqual(content_type, 'application/json') + def test_sanitize_for_serialization(self): # None data = None diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 38d7a1cc0b8..0753f64b238 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -391,7 +391,6 @@ class PetApiTests(unittest.TestCase): file.close() self.pet_api.upload_file(pet_id=self.pet.id, file=file) - def test_delete_pet(self): self.pet_api.add_pet(self.pet) self.pet_api.delete_pet(pet_id=self.pet.id, api_key="special-key") @@ -402,5 +401,29 @@ class PetApiTests(unittest.TestCase): except ApiException as e: self.assertEqual(404, e.status) + @patch.object(petstore_api.ApiClient, 'call_api') + @patch.object(petstore_api.ApiClient, 'select_header_content_type') + def test_call_select_header_content_type(self, mock_select_ct, mock_call_api): + mock_select_ct.return_value = 'application/json' + self.pet_api.add_pet(self.pet) + # check if all arguments are passed to select_header_content_type + mock_select_ct.assert_called_once_with( + ['application/json', 'application/xml'], + 'POST', + self.pet) + mock_call_api.assert_called_once() + self.assertEqual(mock_call_api.mock_calls[0][1][4], + {'Content-Type': 'application/json'}) + + @patch.object(petstore_api.ApiClient, 'call_api') + def test_call_with_forced_content_type(self, mock_call_api): + # force content-type + self.pet_api.add_pet(self.pet, _content_type='application/xml') + mock_call_api.assert_called_once() + # check if content-type is used + self.assertEqual(mock_call_api.mock_calls[0][1][4], + {'Content-Type': 'application/xml'}) + + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py index 2ae65760a36..1411f08cbc1 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py @@ -119,6 +119,9 @@ class AnotherFakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -147,6 +150,8 @@ class AnotherFakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py index 4afa17e3cb2..a21d5838f41 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py @@ -1132,6 +1132,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1160,6 +1163,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.array_model_endpoint.call_with_http_info(**kwargs) @@ -1194,6 +1199,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1222,6 +1230,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.boolean_endpoint.call_with_http_info(**kwargs) @@ -1258,6 +1268,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1286,6 +1299,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['xml_item'] = \ xml_item @@ -1322,6 +1337,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1350,6 +1368,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.number_with_validations_endpoint.call_with_http_info(**kwargs) @@ -1384,6 +1404,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1412,6 +1435,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs) @@ -1446,6 +1471,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1474,6 +1502,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.string_endpoint.call_with_http_info(**kwargs) @@ -1508,6 +1538,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1536,6 +1569,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.string_enum_endpoint.call_with_http_info(**kwargs) @@ -1572,6 +1607,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1600,6 +1638,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -1639,6 +1679,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1667,6 +1710,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['query'] = \ query @@ -1707,6 +1752,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1735,6 +1783,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -1781,6 +1831,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1809,6 +1862,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['query_integer'] = \ query_integer @@ -1871,6 +1926,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1899,6 +1957,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['number'] = \ number @@ -1948,6 +2008,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1976,6 +2039,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs) @@ -2019,6 +2084,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2047,6 +2115,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['required_string_group'] = \ required_string_group @@ -2088,6 +2158,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2116,6 +2189,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['param'] = \ param @@ -2155,6 +2230,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2183,6 +2261,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['param'] = \ param diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py index 54fdf7f892a..76e35824fbe 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py @@ -121,6 +121,9 @@ class FakeClassnameTags123Api(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -149,6 +152,8 @@ class FakeClassnameTags123Api(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py index 1a8a4c51fde..13fb1d981f4 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py @@ -584,6 +584,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -612,6 +615,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -650,6 +655,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -678,6 +686,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -716,6 +726,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -744,6 +757,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['status'] = \ status @@ -782,6 +797,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -810,6 +828,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['tags'] = \ tags @@ -848,6 +868,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -876,6 +899,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -913,6 +938,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -941,6 +969,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -980,6 +1010,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1008,6 +1041,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -1048,6 +1083,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1076,6 +1114,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -1116,6 +1156,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1144,6 +1187,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py index cd573a91121..934c5525999 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py @@ -265,6 +265,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -293,6 +296,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order_id'] = \ order_id @@ -328,6 +333,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -356,6 +364,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.get_inventory_endpoint.call_with_http_info(**kwargs) @@ -392,6 +402,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -420,6 +433,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order_id'] = \ order_id @@ -457,6 +472,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -485,6 +503,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py index 3088eb159f1..78cc2f4a8b6 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py @@ -452,6 +452,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -480,6 +483,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -517,6 +522,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -545,6 +553,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -582,6 +592,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -610,6 +623,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -648,6 +663,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -676,6 +694,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -713,6 +733,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -741,6 +764,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -780,6 +805,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -808,6 +836,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -844,6 +874,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -872,6 +905,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.logout_user_endpoint.call_with_http_info(**kwargs) @@ -910,6 +945,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -938,6 +976,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py index 9e6f1523497..7b4eea830ea 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py @@ -131,7 +131,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _content_type: typing.Optional[str] = None ): config = self.configuration @@ -572,10 +573,12 @@ class ApiClient(object): else: return ', '.join(accepts) - def select_header_content_type(self, content_types): + def select_header_content_type(self, content_types, method=None, body=None): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. + :param method: http method (e.g. POST, PATCH). + :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: @@ -583,6 +586,11 @@ class ApiClient(object): content_types = [x.lower() for x in content_types] + if (method == 'PATCH' and + 'application/json-patch+json' in content_types and + isinstance(body, list)): + return 'application/json-patch+json' + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: @@ -664,7 +672,8 @@ class Endpoint(object): '_request_timeout', '_return_http_data_only', '_check_input_type', - '_check_return_type' + '_check_return_type', + '_content_type' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -677,7 +686,8 @@ class Endpoint(object): '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), '_return_http_data_only': (bool,), '_check_input_type': (bool,), - '_check_return_type': (bool,) + '_check_return_type': (bool,), + '_content_type': (none_type, str) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -824,12 +834,16 @@ class Endpoint(object): params['header']['Accept'] = self.api_client.select_header_accept( accept_headers_list) - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list) - params['header']['Content-Type'] = header_list + if kwargs.get('_content_type'): + params['header']['Content-Type'] = kwargs['_content_type'] + else: + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + if params['body'] != "": + header_list = self.api_client.select_header_content_type( + content_type_headers_list, self.settings['http_method'], + params['body']) + params['header']['Content-Type'] = header_list return self.api_client.call_api( self.settings['endpoint_path'], self.settings['http_method'], diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py index 9275f2047c4..c8345a8760a 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py @@ -121,6 +121,7 @@ class TestFakeApi(unittest.TestCase): call_with_http_info.assert_called_with( _check_input_type=True, _check_return_type=True, + _content_type=None, _host_index=None, _preload_content=True, _request_timeout=None, diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py index b9bc47de2b3..b636697b0c4 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py @@ -243,6 +243,9 @@ class UsageApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -271,6 +274,8 @@ class UsageApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.any_key_endpoint.call_with_http_info(**kwargs) @@ -304,6 +309,9 @@ class UsageApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -332,6 +340,8 @@ class UsageApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.both_keys_endpoint.call_with_http_info(**kwargs) @@ -365,6 +375,9 @@ class UsageApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -393,6 +406,8 @@ class UsageApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.key_in_header_endpoint.call_with_http_info(**kwargs) @@ -426,6 +441,9 @@ class UsageApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -454,6 +472,8 @@ class UsageApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.key_in_query_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py index a3407d97a84..0da46122279 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py @@ -131,7 +131,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _content_type: typing.Optional[str] = None ): config = self.configuration @@ -572,10 +573,12 @@ class ApiClient(object): else: return ', '.join(accepts) - def select_header_content_type(self, content_types): + def select_header_content_type(self, content_types, method=None, body=None): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. + :param method: http method (e.g. POST, PATCH). + :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: @@ -583,6 +586,11 @@ class ApiClient(object): content_types = [x.lower() for x in content_types] + if (method == 'PATCH' and + 'application/json-patch+json' in content_types and + isinstance(body, list)): + return 'application/json-patch+json' + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: @@ -664,7 +672,8 @@ class Endpoint(object): '_request_timeout', '_return_http_data_only', '_check_input_type', - '_check_return_type' + '_check_return_type', + '_content_type' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -677,7 +686,8 @@ class Endpoint(object): '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), '_return_http_data_only': (bool,), '_check_input_type': (bool,), - '_check_return_type': (bool,) + '_check_return_type': (bool,), + '_content_type': (none_type, str) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -824,12 +834,16 @@ class Endpoint(object): params['header']['Accept'] = self.api_client.select_header_accept( accept_headers_list) - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list) - params['header']['Content-Type'] = header_list + if kwargs.get('_content_type'): + params['header']['Content-Type'] = kwargs['_content_type'] + else: + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + if params['body'] != "": + header_list = self.api_client.select_header_content_type( + content_type_headers_list, self.settings['http_method'], + params['body']) + params['header']['Content-Type'] = header_list return self.api_client.call_api( self.settings['endpoint_path'], self.settings['http_method'], diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py index d9e5929e14c..ec975f752c6 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py @@ -198,6 +198,9 @@ class UsageApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -226,6 +229,8 @@ class UsageApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.custom_server_endpoint.call_with_http_info(**kwargs) @@ -259,6 +264,9 @@ class UsageApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -287,6 +295,8 @@ class UsageApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.default_server_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py index a2dce8f7105..a7d12d3e3c1 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py @@ -131,7 +131,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _content_type: typing.Optional[str] = None ): config = self.configuration @@ -572,10 +573,12 @@ class ApiClient(object): else: return ', '.join(accepts) - def select_header_content_type(self, content_types): + def select_header_content_type(self, content_types, method=None, body=None): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. + :param method: http method (e.g. POST, PATCH). + :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: @@ -583,6 +586,11 @@ class ApiClient(object): content_types = [x.lower() for x in content_types] + if (method == 'PATCH' and + 'application/json-patch+json' in content_types and + isinstance(body, list)): + return 'application/json-patch+json' + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: @@ -664,7 +672,8 @@ class Endpoint(object): '_request_timeout', '_return_http_data_only', '_check_input_type', - '_check_return_type' + '_check_return_type', + '_content_type' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -677,7 +686,8 @@ class Endpoint(object): '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), '_return_http_data_only': (bool,), '_check_input_type': (bool,), - '_check_return_type': (bool,) + '_check_return_type': (bool,), + '_content_type': (none_type, str) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -824,12 +834,16 @@ class Endpoint(object): params['header']['Accept'] = self.api_client.select_header_accept( accept_headers_list) - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list) - params['header']['Content-Type'] = header_list + if kwargs.get('_content_type'): + params['header']['Content-Type'] = kwargs['_content_type'] + else: + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + if params['body'] != "": + header_list = self.api_client.select_header_content_type( + content_type_headers_list, self.settings['http_method'], + params['body']) + params['header']['Content-Type'] = header_list return self.api_client.call_api( self.settings['endpoint_path'], self.settings['http_method'], diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py index c99ba19bce0..52d1fc410d3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py @@ -119,6 +119,9 @@ class AnotherFakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -147,6 +150,8 @@ class AnotherFakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['client'] = \ client diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index 4d23104e6b0..26a35b8e65f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py @@ -107,6 +107,9 @@ class DefaultApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -135,6 +138,8 @@ class DefaultApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.foo_get_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 0f93d1cfde1..dd2db14c8ad 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -1720,6 +1720,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1748,6 +1751,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.additional_properties_with_array_of_enums_endpoint.call_with_http_info(**kwargs) @@ -1782,6 +1787,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1810,6 +1818,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.array_model_endpoint.call_with_http_info(**kwargs) @@ -1843,6 +1853,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1871,6 +1884,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.array_of_enums_endpoint.call_with_http_info(**kwargs) @@ -1905,6 +1920,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1933,6 +1951,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.boolean_endpoint.call_with_http_info(**kwargs) @@ -1967,6 +1987,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -1995,6 +2018,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.composed_one_of_number_with_validations_endpoint.call_with_http_info(**kwargs) @@ -2030,6 +2055,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2058,6 +2086,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['file_name'] = \ file_name @@ -2093,6 +2123,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2121,6 +2154,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.enum_test_endpoint.call_with_http_info(**kwargs) @@ -2153,6 +2188,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2181,6 +2219,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.fake_health_get_endpoint.call_with_http_info(**kwargs) @@ -2217,6 +2257,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2245,6 +2288,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['mammal'] = \ mammal @@ -2281,6 +2326,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2309,6 +2357,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.number_with_validations_endpoint.call_with_http_info(**kwargs) @@ -2343,6 +2393,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2371,6 +2424,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs) @@ -2404,6 +2459,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2432,6 +2490,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.post_inline_additional_properties_payload_endpoint.call_with_http_info(**kwargs) @@ -2465,6 +2525,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2493,6 +2556,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.post_inline_additional_properties_ref_payload_endpoint.call_with_http_info(**kwargs) @@ -2527,6 +2592,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2555,6 +2623,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.string_endpoint.call_with_http_info(**kwargs) @@ -2589,6 +2659,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2617,6 +2690,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.string_enum_endpoint.call_with_http_info(**kwargs) @@ -2653,6 +2728,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2681,6 +2759,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['file_schema_test_class'] = \ file_schema_test_class @@ -2720,6 +2800,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2748,6 +2831,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['query'] = \ query @@ -2788,6 +2873,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2816,6 +2904,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['client'] = \ client @@ -2870,6 +2960,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2898,6 +2991,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['number'] = \ number @@ -2947,6 +3042,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -2975,6 +3073,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs) @@ -3018,6 +3118,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3046,6 +3149,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['required_string_group'] = \ required_string_group @@ -3087,6 +3192,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3115,6 +3223,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['request_body'] = \ request_body @@ -3154,6 +3264,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3182,6 +3295,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['param'] = \ param @@ -3230,6 +3345,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3258,6 +3376,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pipe'] = \ pipe @@ -3301,6 +3421,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3329,6 +3452,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.tx_rx_any_of_model_endpoint.call_with_http_info(**kwargs) @@ -3364,6 +3489,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3392,6 +3520,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['body'] = \ body @@ -3430,6 +3560,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3458,6 +3591,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['file'] = \ file @@ -3493,6 +3628,9 @@ class FakeApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -3521,6 +3659,8 @@ class FakeApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.upload_files_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index efcf30af12d..0284c348b36 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -121,6 +121,9 @@ class FakeClassnameTags123Api(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -149,6 +152,8 @@ class FakeClassnameTags123Api(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['client'] = \ client diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py index 1ae658e16d4..d555b6995ad 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py @@ -472,6 +472,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -500,6 +503,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet'] = \ pet @@ -538,6 +543,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -566,6 +574,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -604,6 +614,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -632,6 +645,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['status'] = \ status @@ -670,6 +685,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -698,6 +716,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['tags'] = \ tags @@ -736,6 +756,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -764,6 +787,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id @@ -801,6 +826,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -829,6 +857,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet'] = \ pet @@ -868,6 +898,9 @@ class PetApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -896,6 +929,8 @@ class PetApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['pet_id'] = \ pet_id diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py index 26a6bfe2220..c1cb69094fe 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py @@ -267,6 +267,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -295,6 +298,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order_id'] = \ order_id @@ -330,6 +335,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -358,6 +366,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.get_inventory_endpoint.call_with_http_info(**kwargs) @@ -394,6 +404,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -422,6 +435,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order_id'] = \ order_id @@ -459,6 +474,9 @@ class StoreApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -487,6 +505,8 @@ class StoreApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['order'] = \ order diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py index 67b33352dda..da2217633ff 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py @@ -460,6 +460,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -488,6 +491,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['user'] = \ user @@ -525,6 +530,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -553,6 +561,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['user'] = \ user @@ -590,6 +600,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -618,6 +631,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['user'] = \ user @@ -656,6 +671,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -684,6 +702,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -721,6 +741,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -749,6 +772,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -788,6 +813,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -816,6 +844,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username @@ -852,6 +882,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -880,6 +913,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') return self.logout_user_endpoint.call_with_http_info(**kwargs) @@ -918,6 +953,9 @@ class UserApi(object): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. @@ -946,6 +984,8 @@ class UserApi(object): kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) + kwargs['_content_type'] = kwargs.get( + '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') kwargs['username'] = \ username diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 29ae24dd01d..86cddf1a7b2 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -131,7 +131,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _content_type: typing.Optional[str] = None ): config = self.configuration @@ -572,10 +573,12 @@ class ApiClient(object): else: return ', '.join(accepts) - def select_header_content_type(self, content_types): + def select_header_content_type(self, content_types, method=None, body=None): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. + :param method: http method (e.g. POST, PATCH). + :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: @@ -583,6 +586,11 @@ class ApiClient(object): content_types = [x.lower() for x in content_types] + if (method == 'PATCH' and + 'application/json-patch+json' in content_types and + isinstance(body, list)): + return 'application/json-patch+json' + if 'application/json' in content_types or '*/*' in content_types: return 'application/json' else: @@ -671,7 +679,8 @@ class Endpoint(object): '_request_timeout', '_return_http_data_only', '_check_input_type', - '_check_return_type' + '_check_return_type', + '_content_type' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -684,7 +693,8 @@ class Endpoint(object): '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), '_return_http_data_only': (bool,), '_check_input_type': (bool,), - '_check_return_type': (bool,) + '_check_return_type': (bool,), + '_content_type': (none_type, str) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -831,12 +841,16 @@ class Endpoint(object): params['header']['Accept'] = self.api_client.select_header_accept( accept_headers_list) - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list) - params['header']['Content-Type'] = header_list + if kwargs.get('_content_type'): + params['header']['Content-Type'] = kwargs['_content_type'] + else: + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + if params['body'] != "": + header_list = self.api_client.select_header_content_type( + content_type_headers_list, self.settings['http_method'], + params['body']) + params['header']['Content-Type'] = header_list return self.api_client.call_api( self.settings['endpoint_path'], self.settings['http_method'], From 550c0781dca1505762e8348f7b692d751b28c766 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 10 Dec 2021 02:08:17 +0800 Subject: [PATCH 04/18] [okhttp-gson-next-gen] new option for error object (#10995) * add error body and type to api exception class * add option to specify error object * add option, update api doc with better error handling * update samples * update doc --- docs/generators/java.md | 1 + .../codegen/languages/JavaClientCodegen.java | 23 +++++ .../okhttp-gson-nextgen/api.mustache | 28 +++++- .../okhttp-gson-nextgen/apiException.mustache | 40 +++++++++ .../okhttp-gson-nextgen/api_doc.mustache | 22 +++-- .../docs/AnotherFakeApi.md | 6 +- .../okhttp-gson-nextgen/docs/DefaultApi.md | 6 +- .../java/okhttp-gson-nextgen/docs/FakeApi.md | 90 ++++--------------- .../docs/FakeClassnameTags123Api.md | 6 +- .../java/okhttp-gson-nextgen/docs/PetApi.md | 54 ++--------- .../java/okhttp-gson-nextgen/docs/StoreApi.md | 24 +---- .../java/okhttp-gson-nextgen/docs/UserApi.md | 48 ++-------- .../org/openapitools/client/ApiException.java | 40 +++++++++ .../client/api/AnotherFakeApi.java | 11 ++- .../openapitools/client/api/DefaultApi.java | 11 ++- .../org/openapitools/client/api/FakeApi.java | 71 ++++++++++++--- .../client/api/FakeClassnameTags123Api.java | 11 ++- .../org/openapitools/client/api/PetApi.java | 51 ++++++++--- .../org/openapitools/client/api/StoreApi.java | 31 +++++-- .../org/openapitools/client/api/UserApi.java | 21 ++++- 20 files changed, 351 insertions(+), 244 deletions(-) diff --git a/docs/generators/java.md b/docs/generators/java.md index 1160c36f8b9..4d086325a06 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |discriminatorCaseSensitive|Whether the discriminator value lookup should be case-sensitive or not. This option only works for Java API client| |true| |dynamicOperations|Generate operations dynamically at runtime from an OAS| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|errorObjectType|Error Object type. (This option is for okhttp-gson-next-gen only)| |null| |fullJavaUtil|whether to use fully qualified name for classes under java.util. This option only works for Java API client| |false| |gradleProperties|Append additional Gradle proeprties to the gradle.properties file| |null| |groupId|groupId in generated pom.xml| |org.openapitools| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 965da6dbd77..f675c9a9c3f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -66,6 +66,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String DYNAMIC_OPERATIONS = "dynamicOperations"; public static final String SUPPORT_STREAMING = "supportStreaming"; public static final String GRADLE_PROPERTIES= "gradleProperties"; + public static final String ERROR_OBJECT_TYPE= "errorObjectType"; + public static final String ERROR_OBJECT_SUBTYPE= "errorObjectSubtype"; public static final String PLAY_24 = "play24"; public static final String PLAY_25 = "play25"; @@ -118,6 +120,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean dynamicOperations = false; protected boolean supportStreaming = false; protected String gradleProperties; + protected String errorObjectType; + protected List errorObjectSubtype; protected String authFolder; protected String serializationLibrary = null; @@ -163,6 +167,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations)); cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming)); cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle proeprties to the gradle.properties file")); + cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson-next-gen only)")); cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.")); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries instead."); @@ -343,6 +348,16 @@ public class JavaClientCodegen extends AbstractJavaCodegen } additionalProperties.put(GRADLE_PROPERTIES, gradleProperties); + if (additionalProperties.containsKey(ERROR_OBJECT_TYPE)) { + this.setErrorObjectType(additionalProperties.get(ERROR_OBJECT_TYPE).toString()); + } + additionalProperties.put(ERROR_OBJECT_TYPE, errorObjectType); + + if (additionalProperties.containsKey(ERROR_OBJECT_SUBTYPE)) { + this.setErrorObjectSubtype((List)additionalProperties.get(ERROR_OBJECT_SUBTYPE)); + } + additionalProperties.put(ERROR_OBJECT_SUBTYPE, errorObjectSubtype); + final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/"); final String modelsFolder = (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); @@ -1030,6 +1045,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen this.gradleProperties= gradleProperties; } + public void setErrorObjectType(final String errorObjectType) { + this.errorObjectType= errorObjectType; + } + + public void setErrorObjectSubtype(final List errorObjectSubtype) { + this.errorObjectSubtype= errorObjectSubtype; + } + /** * Serialization library. * diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api.mustache index 525d56fa5d5..2b623d2cf84 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api.mustache @@ -51,6 +51,7 @@ import java.util.Map; import java.io.InputStream; {{/supportStreaming}} {{/fullJavaUtil}} +import javax.ws.rs.core.GenericType; {{#operations}} public class {{classname}} { @@ -294,13 +295,32 @@ public class {{classname}} { {{/isDeprecated}} public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.executeStream(localVarCall, localVarReturnType);{{/returnType}} + {{#returnType}} + try { + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}.getType())); + e.setErrorObjectType(new GenericType<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}); + throw e; + } + {{/returnType}} } {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} + {{^returnType}} + return localVarApiClient.execute(localVarCall); + {{/returnType}} + {{#returnType}} + try { + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}.getType())); + e.setErrorObjectType(new GenericType<{{{errorObjectType}}}{{^errorObjectType}}{{{returnType}}}{{/errorObjectType}}>(){}); + throw e; + } + {{/returnType}} } {{/vendorExtensions.x-streaming}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/apiException.mustache index 4bec51da938..59da3c51c26 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/apiException.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/apiException.mustache @@ -9,6 +9,8 @@ import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} +import javax.ws.rs.core.GenericType; + /** *

ApiException class.

*/ @@ -18,6 +20,8 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us private int code = 0; private Map> responseHeaders = null; private String responseBody = null; + private {{{errorObjectType}}}{{^errorObjectType}}Object{{/errorObjectType}} errorObject = null; + private GenericType errorObjectType = null; /** *

Constructor for ApiException.

@@ -156,4 +160,40 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us public String getResponseBody() { return responseBody; } + + /** + * Get the error object type. + * + * @return Error object type + */ + public GenericType getErrorObjectType() { + return errorObjectType; + } + + /** + * Set the error object type. + * + * @param errorObjectType object type + */ + public void setErrorObjectType(GenericType errorObjectType) { + this.errorObjectType = errorObjectType; + } + + /** + * Get the error object. + * + * @return Error object + */ + public {{{errorObjectType}}}{{^errorObjectType}}Object{{/errorObjectType}} getErrorObject() { + return errorObject; + } + + /** + * Get the error object. + * + * @param errorObject Error object + */ + public void setErrorObject({{{errorObjectType}}}{{^errorObjectType}}Object{{/errorObjectType}} errorObject) { + this.errorObject = errorObject; + } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api_doc.mustache index 5a4e3969c93..616ad65a5ac 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/api_doc.mustache @@ -63,11 +63,23 @@ public class Example { .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} System.out.println(result);{{/returnType}} } catch (ApiException e) { - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + {{=< >=}} + <#errorObjectSubtype> + <^-first>} else if (e.getErrorObject() instanceof <&.>) { + // do something here + <#-last> + } else { + // something else happened + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + + <={{ }}=> + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/AnotherFakeApi.md index 149488eff9a..af82f73feb6 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/AnotherFakeApi.md @@ -35,11 +35,7 @@ public class Example { Client result = apiInstance.call123testSpecialTags(client); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/DefaultApi.md index 311c4fa6bbc..c77f189afd0 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/DefaultApi.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/DefaultApi.md @@ -32,11 +32,7 @@ public class Example { InlineResponseDefault result = apiInstance.fooGet(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooGet"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeApi.md index 3401bb6eeb0..bee53680247 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeApi.md @@ -46,11 +46,7 @@ public class Example { HealthCheckResult result = apiInstance.fakeHealthGet(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeHealthGet"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -105,11 +101,7 @@ public class Example { Boolean result = apiInstance.fakeOuterBooleanSerialize(body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -167,11 +159,7 @@ public class Example { OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -229,11 +217,7 @@ public class Example { BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -291,11 +275,7 @@ public class Example { String result = apiInstance.fakeOuterStringSerialize(body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -350,11 +330,7 @@ public class Example { List result = apiInstance.getArrayOfEnums(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#getArrayOfEnums"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -408,11 +384,7 @@ public class Example { try { apiInstance.testBodyWithFileSchema(fileSchemaTestClass); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -468,11 +440,7 @@ public class Example { try { apiInstance.testBodyWithQueryParams(query, user); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -531,11 +499,7 @@ public class Example { Client result = apiInstance.testClientModel(client); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -611,11 +575,7 @@ public class Example { try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -693,11 +653,7 @@ public class Example { try { apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -776,11 +732,7 @@ public class Example { .int64Group(int64Group) .execute(); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -840,11 +792,7 @@ public class Example { try { apiInstance.testInlineAdditionalProperties(requestBody); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -900,11 +848,7 @@ public class Example { try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -966,11 +910,7 @@ public class Example { try { apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeClassnameTags123Api.md index dbd12c37f05..5212d7c7781 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/FakeClassnameTags123Api.md @@ -42,11 +42,7 @@ public class Example { Client result = apiInstance.testClassname(client); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/PetApi.md index cca26664dea..8cdb1506fb5 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/PetApi.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/PetApi.md @@ -46,11 +46,7 @@ public class Example { try { apiInstance.addPet(pet); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -111,11 +107,7 @@ public class Example { try { apiInstance.deletePet(petId, apiKey); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -180,11 +172,7 @@ public class Example { List result = apiInstance.findPetsByStatus(status); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -249,11 +237,7 @@ public class Example { List result = apiInstance.findPetsByTags(tags); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -319,11 +303,7 @@ public class Example { Pet result = apiInstance.getPetById(petId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -386,11 +366,7 @@ public class Example { try { apiInstance.updatePet(pet); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -454,11 +430,7 @@ public class Example { try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -523,11 +495,7 @@ public class Example { ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -592,11 +560,7 @@ public class Example { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/StoreApi.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/StoreApi.md index 270388f5e44..8d9dee8e68f 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/StoreApi.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/StoreApi.md @@ -37,11 +37,7 @@ public class Example { try { apiInstance.deleteOrder(orderId); } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -106,11 +102,7 @@ public class Example { Map result = apiInstance.getInventory(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -165,11 +157,7 @@ public class Example { Order result = apiInstance.getOrderById(orderId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -227,11 +215,7 @@ public class Example { Order result = apiInstance.placeOrder(order); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson-nextgen/docs/UserApi.md index 26a0642e323..5c8ee4c6f5e 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson-nextgen/docs/UserApi.md @@ -41,11 +41,7 @@ public class Example { try { apiInstance.createUser(user); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -100,11 +96,7 @@ public class Example { try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -159,11 +151,7 @@ public class Example { try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -220,11 +208,7 @@ public class Example { try { apiInstance.deleteUser(username); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -281,11 +265,7 @@ public class Example { User result = apiInstance.getUserByName(username); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -344,11 +324,7 @@ public class Example { String result = apiInstance.loginUser(username, password); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -404,11 +380,7 @@ public class Example { try { apiInstance.logoutUser(); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } @@ -463,11 +435,7 @@ public class Example { try { apiInstance.updateUser(username, user); } catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + } } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/ApiException.java index 5851f0405ad..60e4f9a5e7e 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/ApiException.java @@ -16,6 +16,8 @@ package org.openapitools.client; import java.util.Map; import java.util.List; +import javax.ws.rs.core.GenericType; + /** *

ApiException class.

*/ @@ -25,6 +27,8 @@ public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; + private Object errorObject = null; + private GenericType errorObjectType = null; /** *

Constructor for ApiException.

@@ -151,4 +155,40 @@ public class ApiException extends Exception { public String getResponseBody() { return responseBody; } + + /** + * Get the error object type. + * + * @return Error object type + */ + public GenericType getErrorObjectType() { + return errorObjectType; + } + + /** + * Set the error object type. + * + * @param errorObjectType object type + */ + public void setErrorObjectType(GenericType errorObjectType) { + this.errorObjectType = errorObjectType; + } + + /** + * Get the error object. + * + * @return Error object + */ + public Object getErrorObject() { + return errorObject; + } + + /** + * Get the error object. + * + * @param errorObject Error object + */ + public void setErrorObject(Object errorObject) { + this.errorObject = errorObject; + } } diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index e258256633e..b0269aea9fc 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class AnotherFakeApi { private ApiClient localVarApiClient; @@ -143,8 +144,14 @@ public class AnotherFakeApi { */ public ApiResponse call123testSpecialTagsWithHttpInfo(Client client) throws ApiException { okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/DefaultApi.java index c4e26ea2b1c..1c8e2d24856 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class DefaultApi { private ApiClient localVarApiClient; @@ -135,8 +136,14 @@ public class DefaultApi { */ public ApiResponse fooGetWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = fooGetValidateBeforeCall(null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeApi.java index 3c5114fef1b..271df76973e 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeApi.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class FakeApi { private ApiClient localVarApiClient; @@ -144,8 +145,14 @@ public class FakeApi { */ public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = fakeHealthGetValidateBeforeCall(null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -251,8 +258,14 @@ public class FakeApi { */ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -359,8 +372,14 @@ public class FakeApi { */ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite) throws ApiException { okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -467,8 +486,14 @@ public class FakeApi { */ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -575,8 +600,14 @@ public class FakeApi { */ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -680,8 +711,14 @@ public class FakeApi { */ public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getArrayOfEnumsValidateBeforeCall(null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken>(){}.getType())); + e.setErrorObjectType(new GenericType>(){}); + throw e; + } } /** @@ -1023,8 +1060,14 @@ public class FakeApi { */ public ApiResponse testClientModelWithHttpInfo(Client client) throws ApiException { okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index f9449ed4420..db7a5f435f4 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class FakeClassnameTags123Api { private ApiClient localVarApiClient; @@ -143,8 +144,14 @@ public class FakeClassnameTags123Api { */ public ApiResponse testClassnameWithHttpInfo(Client client) throws ApiException { okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/PetApi.java index d88ee6f9c31..98d73aa76f0 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/PetApi.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class PetApi { private ApiClient localVarApiClient; @@ -379,8 +380,14 @@ public class PetApi { */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken>(){}.getType())); + e.setErrorObjectType(new GenericType>(){}); + throw e; + } } /** @@ -507,8 +514,14 @@ public class PetApi { @Deprecated public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken>(){}.getType())); + e.setErrorObjectType(new GenericType>(){}); + throw e; + } } /** @@ -630,8 +643,14 @@ public class PetApi { */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -1003,8 +1022,14 @@ public class PetApi { */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, file, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -1138,8 +1163,14 @@ public class PetApi { */ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/StoreApi.java index d9a068df9e9..ab5718fb99c 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/StoreApi.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class StoreApi { private ApiClient localVarApiClient; @@ -249,8 +250,14 @@ public class StoreApi { */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken>(){}.getType())); + e.setErrorObjectType(new GenericType>(){}); + throw e; + } } /** @@ -368,8 +375,14 @@ public class StoreApi { */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -486,8 +499,14 @@ public class StoreApi { */ public ApiResponse placeOrderWithHttpInfo(Order order) throws ApiException { okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java index 0f4f2d294a4..4bf2dc2b82f 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java @@ -34,6 +34,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.ws.rs.core.GenericType; public class UserApi { private ApiClient localVarApiClient; @@ -591,8 +592,14 @@ public class UserApi { */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** @@ -725,8 +732,14 @@ public class UserApi { */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + try { + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); + e.setErrorObjectType(new GenericType(){}); + throw e; + } } /** From c94d2b2331fe851c79d86e2cfae6a036de5f1ce5 Mon Sep 17 00:00:00 2001 From: Deniz Dogan Date: Fri, 10 Dec 2021 07:08:32 +0100 Subject: [PATCH 05/18] [swift5] Fix missing case for FormDataEncoding#encode (#11064) Fixes #11062 --- .../alamofire/AlamofireImplementations.mustache | 2 ++ .../urlsession/URLSessionImplementations.mustache | 9 +++++++++ .../Classes/OpenAPIs/AlamofireImplementations.swift | 2 ++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ .../PetstoreClient/URLSessionImplementations.swift | 9 +++++++++ .../Classes/OpenAPIs/URLSessionImplementations.swift | 9 +++++++++ 17 files changed, 139 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache index 5ec281b054e..b716d254fa2 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/alamofire/AlamofireImplementations.mustache @@ -114,6 +114,8 @@ private var managerStore = SynchronizedDictionary() mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) case let number as NSNumber: mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) + case let data as Data: + mpForm.append(data, withName: k) default: fatalError("Unprocessable value \(v) with key \(k)") } diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index eeae3c98aef..e235cd37200 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 577abc9a6ad..69945cad3fe 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -114,6 +114,8 @@ open class AlamofireRequestBuilder: RequestBuilder { mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) case let number as NSNumber: mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) + case let data as Data: + mpForm.append(data, withName: k) default: fatalError("Unprocessable value \(v) with key \(k)") } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 929cbc5f04f..86beadcc71c 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 23df908ca32..ca22cb7e6e5 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -477,6 +477,15 @@ private class FormDataEncoding: ParameterEncoding { ) } + case let data as Data: + + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + default: fatalError("Unprocessable value \(value) with key \(key)") } From cee5f7591241956b946263855caf8c4eb18e6470 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 10 Dec 2021 13:49:29 -0800 Subject: [PATCH 06/18] Feat adds content and header properties to CodegenResponse (#11046) * Adds responseHeaders to codegenResponse * Sets response headers in codegenResponse * Samples updated * Adds test of response headers * Adds content to CodegenResponse * Sets codegenResponse content * Tests added, test content-data.yaml spec update * Adds mediaTypeSchemaSuffix input to getContent * Tests updated * Updates how response content schema names are set * Adds missing Locale to String.format invocations --- .../openapitools/codegen/CodegenResponse.java | 24 ++- .../openapitools/codegen/DefaultCodegen.java | 66 ++++-- .../codegen/DefaultCodegenTest.java | 188 ++++++++++++------ .../src/test/resources/3_0/content-data.yaml | 34 +++- .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../openapitools/client/api/UserApiImpl.java | 1 + .../client/api/rxjava/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../openapitools/client/api/UserApiImpl.java | 1 + .../client/api/rxjava/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.scala | 1 + .../openapitools/example/api/UserApi.scala | 1 + .../org/openapitools/client/api/UserApi.scala | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/client/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../puppies/store/apis/UserApiController.java | 1 + .../store/apis/UserApiControllerImp.java | 1 + .../apis/UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../app/controllers/UserApiController.java | 1 + .../app/controllers/UserApiControllerImp.java | 1 + .../UserApiControllerImpInterface.java | 1 + .../vertxweb/server/api/UserApi.java | 1 + .../vertxweb/server/api/UserApiHandler.java | 1 + .../vertxweb/server/api/UserApiImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiService.java | 1 + .../api/impl/UserApiServiceImpl.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../openapitools/api/UserApiController.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiDelegate.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiDelegate.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiDelegate.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../openapitools/api/UserApiController.java | 1 + .../org/openapitools/api/UserApiDelegate.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../org/openapitools/api/UserApiDelegate.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../openapitools/api/UserApiController.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + .../openapitools/virtualan/api/UserApi.java | 1 + .../java/org/openapitools/api/UserApi.java | 1 + 143 files changed, 365 insertions(+), 86 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index b81bda5f583..7a23b3ab726 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -21,6 +21,7 @@ import java.util.*; public class CodegenResponse implements IJsonSchemaValidationProperties { public final List headers = new ArrayList(); + private List responseHeaders = new ArrayList(); public String code; public boolean is1xx; public boolean is2xx; @@ -87,6 +88,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { private boolean hasDiscriminatorWithNonEmptyMapping; private CodegenComposedSchemas composedSchemas; private boolean hasMultipleTypes = false; + private LinkedHashMap content; @Override public int hashCode() { @@ -98,7 +100,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(), getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(), is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired, - hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes); + hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, responseHeaders, content); } @Override @@ -147,6 +149,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() && getHasVars() == that.getHasVars() && getHasRequired() == that.getHasRequired() && + Objects.equals(content, that.getContent()) && + Objects.equals(responseHeaders, that.getResponseHeaders()) && Objects.equals(composedSchemas, that.getComposedSchemas()) && Objects.equals(vars, that.vars) && Objects.equals(requiredVars, that.requiredVars) && @@ -176,6 +180,22 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { } + public LinkedHashMap getContent() { + return content; + } + + public void setContent(LinkedHashMap content) { + this.content = content; + } + + public List getResponseHeaders() { + return responseHeaders; + } + + public void setResponseHeaders(List responseHeaders) { + this.responseHeaders = responseHeaders; + } + @Override public String getPattern() { return pattern; @@ -488,6 +508,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping); sb.append(", composedSchemas=").append(composedSchemas); sb.append(", hasMultipleTypes=").append(hasMultipleTypes); + sb.append(", responseHeaders=").append(responseHeaders); + sb.append(", content=").append(content); sb.append('}'); return sb.toString(); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index e76b78d6e5a..32947d78706 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3959,6 +3959,20 @@ public class DefaultCodegen implements CodegenConfig { ApiResponse response = operationGetResponsesEntry.getValue(); addProducesInfo(response, op); CodegenResponse r = fromResponse(key, response); + Map headers = response.getHeaders(); + if (headers != null) { + List responseHeaders = new ArrayList<>(); + for (Entry entry: headers.entrySet()) { + String headerName = entry.getKey(); + Header header = entry.getValue(); + CodegenParameter responseHeader = heeaderToCodegenParameter(header, headerName, imports, String.format(Locale.ROOT, "%sResponseParameter", r.code)); + responseHeaders.add(responseHeader); + } + r.setResponseHeaders(responseHeaders); + } + String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code); + r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix)); + if (r.baseType != null && !defaultIncludes.contains(r.baseType) && !languageSpecificPrimitives.contains(r.baseType)) { @@ -4065,6 +4079,7 @@ public class DefaultCodegen implements CodegenConfig { param = ModelUtils.getReferencedParameter(this.openAPI, param); CodegenParameter p = fromParameter(param, imports); + p.setContent(getContent(param.getContent(), imports, "RequestParameter" + toModelName(param.getName()))); // ensure unique params if (ensureUniqueParams) { @@ -4502,7 +4517,6 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.isDeprecated = parameter.getDeprecated(); } codegenParameter.jsonSchema = Json.pretty(parameter); - codegenParameter.setContent(getContent(parameter.getContent(), imports)); if (GlobalSettings.getProperty("debugParser") != null) { LOGGER.info("working on Parameter {}", parameter.getName()); @@ -6586,11 +6600,36 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.pattern = toRegularExpression(schema.getPattern()); } - protected String toMediaTypeSchemaName(String contentType) { - return toModelName(contentType + "Schema"); + protected String toMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) { + return "SchemaFor" + mediaTypeSchemaSuffix + toModelName(contentType); } - protected LinkedHashMap getContent(Content content, Set imports) { + private CodegenParameter heeaderToCodegenParameter(Header header, String headerName, Set imports, String mediaTypeSchemaSuffix) { + if (header == null) { + return null; + } + Parameter headerParam = new Parameter(); + headerParam.setName(headerName); + headerParam.setIn("header"); + headerParam.setDescription(header.getDescription()); + headerParam.setRequired(header.getRequired()); + headerParam.setDeprecated(header.getDeprecated()); + Header.StyleEnum style = header.getStyle(); + if (style != null) { + headerParam.setStyle(Parameter.StyleEnum.valueOf(style.name())); + } + headerParam.setExplode(header.getExplode()); + headerParam.setSchema(header.getSchema()); + headerParam.setExamples(header.getExamples()); + headerParam.setExample(header.getExample()); + headerParam.setContent(header.getContent()); + headerParam.setExtensions(header.getExtensions()); + CodegenParameter param = fromParameter(headerParam, imports); + param.setContent(getContent(headerParam.getContent(), imports, mediaTypeSchemaSuffix)); + return param; + } + + protected LinkedHashMap getContent(Content content, Set imports, String mediaTypeSchemaSuffix) { if (content == null) { return null; } @@ -6609,20 +6648,7 @@ public class DefaultCodegen implements CodegenConfig { for (Entry headerEntry: encHeaders.entrySet()) { String headerName = headerEntry.getKey(); Header header = ModelUtils.getReferencedHeader(this.openAPI, headerEntry.getValue()); - Parameter headerParam = new Parameter(); - headerParam.setName(headerName); - headerParam.setIn("header"); - headerParam.setDescription(header.getDescription()); - headerParam.setRequired(header.getRequired()); - headerParam.setDeprecated(header.getDeprecated()); - headerParam.setStyle(Parameter.StyleEnum.valueOf(header.getStyle().name())); - headerParam.setExplode(header.getExplode()); - headerParam.setSchema(header.getSchema()); - headerParam.setExamples(header.getExamples()); - headerParam.setExample(header.getExample()); - headerParam.setContent(header.getContent()); - headerParam.setExtensions(header.getExtensions()); - CodegenParameter param = fromParameter(headerParam, imports); + CodegenParameter param = heeaderToCodegenParameter(header, headerName, imports, mediaTypeSchemaSuffix); headers.add(param); } } @@ -6638,7 +6664,7 @@ public class DefaultCodegen implements CodegenConfig { } } String contentType = contentEntry.getKey(); - CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType), mt.getSchema()); + CodegenProperty schemaProp = fromProperty(toMediaTypeSchemaName(contentType, mediaTypeSchemaSuffix), mt.getSchema()); CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap); cmtContent.put(contentType, codegenMt); } @@ -6666,7 +6692,7 @@ public class DefaultCodegen implements CodegenConfig { if (schema == null) { throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body); } - codegenParameter.setContent(getContent(body.getContent(), imports)); + codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody")); if (StringUtils.isNotBlank(schema.get$ref())) { name = ModelUtils.getSimpleRef(schema.get$ref()); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 949bc1a9243..54a2b0d2053 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -1673,12 +1673,12 @@ public class DefaultCodegenTest { public void testDefaultResponseShouldBeLast() { OpenAPI openAPI = TestUtils.createOpenAPI(); Operation myOperation = new Operation().operationId("myOperation").responses( - new ApiResponses() - .addApiResponse( - "default", new ApiResponse().description("Default")) - .addApiResponse( - "422", new ApiResponse().description("Error")) - ); + new ApiResponses() + .addApiResponse( + "default", new ApiResponse().description("Default")) + .addApiResponse( + "422", new ApiResponse().description("Error")) + ); openAPI.path("/here", new PathItem().get(myOperation)); final DefaultCodegen codegen = new DefaultCodegen(); codegen.setOpenAPI(openAPI); @@ -2353,49 +2353,49 @@ public class DefaultCodegenTest { @Test public void testFormComposedSchema() { OpenAPI openAPI = TestUtils.parseContent("openapi: 3.0.1\n" + - "info:\n" + - " version: '1.0.0'\n" + - " title: the title\n" + - "\n" + - "paths:\n" + - " '/users/me':\n" + - " post:\n" + - " description: Change user password.\n" + - " operationId: changeCurrentUserPassword\n" + - " requestBody:\n" + - " required: true\n" + - " content:\n" + - " multipart/form-data:\n" + - " schema:\n" + - " $ref: '#/components/schemas/ChangePasswordRequest'\n" + - " responses:\n" + - " '200':\n" + - " description: Successful operation\n" + - " content: {}\n" + - "\n" + - "components:\n" + - " schemas:\n" + - " CommonPasswordRequest:\n" + - " type: object\n" + - " required: [ password, passwordConfirmation ]\n" + - " properties:\n" + - " password:\n" + - " type: string\n" + - " format: password\n" + - " passwordConfirmation:\n" + - " type: string\n" + - " format: password\n" + - "\n" + - " ChangePasswordRequest:\n" + - " type: object\n" + - " allOf:\n" + - " - $ref: '#/components/schemas/CommonPasswordRequest'\n" + - " - type: object\n" + - " required: [ oldPassword ]\n" + - " properties:\n" + - " oldPassword:\n" + - " type: string\n" + - " format: password\n"); + "info:\n" + + " version: '1.0.0'\n" + + " title: the title\n" + + "\n" + + "paths:\n" + + " '/users/me':\n" + + " post:\n" + + " description: Change user password.\n" + + " operationId: changeCurrentUserPassword\n" + + " requestBody:\n" + + " required: true\n" + + " content:\n" + + " multipart/form-data:\n" + + " schema:\n" + + " $ref: '#/components/schemas/ChangePasswordRequest'\n" + + " responses:\n" + + " '200':\n" + + " description: Successful operation\n" + + " content: {}\n" + + "\n" + + "components:\n" + + " schemas:\n" + + " CommonPasswordRequest:\n" + + " type: object\n" + + " required: [ password, passwordConfirmation ]\n" + + " properties:\n" + + " password:\n" + + " type: string\n" + + " format: password\n" + + " passwordConfirmation:\n" + + " type: string\n" + + " format: password\n" + + "\n" + + " ChangePasswordRequest:\n" + + " type: object\n" + + " allOf:\n" + + " - $ref: '#/components/schemas/CommonPasswordRequest'\n" + + " - type: object\n" + + " required: [ oldPassword ]\n" + + " properties:\n" + + " oldPassword:\n" + + " type: string\n" + + " format: password\n"); final DefaultCodegen cg = new DefaultCodegen(); cg.setOpenAPI(openAPI); @@ -2404,16 +2404,16 @@ public class DefaultCodegenTest { final PathItem path = openAPI.getPaths().get("/users/me"); final CodegenOperation operation = cg.fromOperation( - "/users/me", - "post", - path.getPost(), - path.getServers()); + "/users/me", + "post", + path.getPost(), + path.getServers()); assertEquals(operation.formParams.size(), 3, - "The list of parameters should include inherited type"); + "The list of parameters should include inherited type"); final List names = operation.formParams.stream() - .map(param -> param.paramName) - .collect(Collectors.toList()); + .map(param -> param.paramName) + .collect(Collectors.toList()); assertTrue(names.contains("password")); assertTrue(names.contains("passwordConfirmation")); assertTrue(names.contains("oldPassword")); @@ -3347,7 +3347,7 @@ public class DefaultCodegenTest { assertTrue(hasRequired); } else { // All variables must be in the above sets - fail(); + fail(); } } } @@ -3930,7 +3930,8 @@ public class DefaultCodegenTest { assertFalse(cr.primitiveType); } - public void testParameterContent() { + @Test + public void testRequestParameterContent() { DefaultCodegen codegen = new DefaultCodegen(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/content-data.yaml"); codegen.setOpenAPI(openAPI); @@ -3948,6 +3949,7 @@ public class DefaultCodegenTest { CodegenProperty cp = mt.getSchema(); assertTrue(cp.isMap); assertEquals(cp.complexType, "object"); + assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesInlineSchemaApplicationJson"); CodegenParameter coordinatesReferencedSchema = co.queryParams.get(1); content = coordinatesReferencedSchema.getContent(); @@ -3956,6 +3958,7 @@ public class DefaultCodegenTest { cp = mt.getSchema(); assertFalse(cp.isMap); // because it is a referenced schema assertEquals(cp.complexType, "coordinates"); + assertEquals(cp.baseName, "SchemaForRequestParameterCoordinatesReferencedSchemaApplicationJson"); } @Test @@ -3975,13 +3978,13 @@ public class DefaultCodegenTest { CodegenMediaType mt = content.get("application/json"); assertNull(mt.getEncoding()); CodegenProperty cp = mt.getSchema(); - assertEquals(cp.baseName, "ApplicationJsonSchema"); + assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson"); assertNotNull(cp); mt = content.get("text/plain"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "TextPlainSchema"); + assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain"); assertNotNull(cp); // Note: the inline model resolver has a bug for this use case; it extracts an inline request body into a component // but the schema it references is not string type @@ -3995,13 +3998,72 @@ public class DefaultCodegenTest { mt = content.get("application/json"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "ApplicationJsonSchema"); + assertEquals(cp.baseName, "SchemaForRequestBodyApplicationJson"); assertEquals(cp.complexType, "coordinates"); mt = content.get("text/plain"); assertNull(mt.getEncoding()); cp = mt.getSchema(); - assertEquals(cp.baseName, "TextPlainSchema"); + assertEquals(cp.baseName, "SchemaForRequestBodyTextPlain"); assertTrue(cp.isString); } -} + + @Test + public void testResponseContentAndHeader() { + DefaultCodegen codegen = new DefaultCodegen(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/content-data.yaml"); + codegen.setOpenAPI(openAPI); + String path; + CodegenOperation co; + + path = "/jsonQueryParams"; + co = codegen.fromOperation(path, "GET", openAPI.getPaths().get(path).getGet(), null); + CodegenParameter coordinatesInlineSchema = co.queryParams.get(0); + LinkedHashMap content = coordinatesInlineSchema.getContent(); + assertNotNull(content); + assertEquals(content.keySet(), new HashSet<>(Arrays.asList("application/json"))); + + CodegenParameter schemaParam = co.queryParams.get(2); + assertEquals(schemaParam.getSchema().baseName, "stringWithMinLength"); + + + CodegenResponse cr = co.responses.get(0); + List responseHeaders = cr.getResponseHeaders(); + assertEquals(1, responseHeaders.size()); + CodegenParameter header = responseHeaders.get(0); + assertEquals("X-Rate-Limit", header.baseName); + assertTrue(header.isUnboundedInteger); + assertEquals(header.getSchema().baseName, "X-Rate-Limit"); + + content = cr.getContent(); + assertEquals(content.keySet(), new HashSet<>(Arrays.asList("application/json", "text/plain"))); + CodegenMediaType mt = content.get("application/json"); + assertNull(mt.getEncoding()); + CodegenProperty cp = mt.getSchema(); + assertFalse(cp.isMap); // because it is a referenced schema + assertEquals(cp.complexType, "coordinates"); + assertEquals(cp.baseName, "SchemaFor200ResponseBodyApplicationJson"); + + mt = content.get("text/plain"); + assertNull(mt.getEncoding()); + cp = mt.getSchema(); + assertEquals(cp.baseName, "SchemaFor200ResponseBodyTextPlain"); + assertTrue(cp.isString); + + cr = co.responses.get(1); + content = cr.getContent(); + assertEquals(content.keySet(), new HashSet<>(Arrays.asList("application/json", "text/plain"))); + mt = content.get("application/json"); + assertNull(mt.getEncoding()); + cp = mt.getSchema(); + assertFalse(cp.isMap); // because it is a referenced schema + assertEquals(cp.complexType, "coordinates"); + assertEquals(cp.baseName, "SchemaFor201ResponseBodyApplicationJson"); + + mt = content.get("text/plain"); + assertNull(mt.getEncoding()); + cp = mt.getSchema(); + assertEquals(cp.baseName, "SchemaFor201ResponseBodyTextPlain"); + assertTrue(cp.isString); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/content-data.yaml b/modules/openapi-generator/src/test/resources/3_0/content-data.yaml index 56228cd3054..6296747be8a 100644 --- a/modules/openapi-generator/src/test/resources/3_0/content-data.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/content-data.yaml @@ -26,9 +26,39 @@ paths: application/json: schema: $ref: '#/components/schemas/coordinates' + - name: stringWithMinLength + in: query + schema: + $ref: '#/components/schemas/stringWithMinLength' responses: - '201': + '200': description: 'OK' + headers: + X-Rate-Limit: + description: "The number of allowed requests in the current period" + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/coordinates' + text/plain: + schema: + $ref: '#/components/schemas/stringWithMinLength' + '201': + description: 'Created OK' + headers: + X-Rate-Limit-Limit: + description: "The number of allowed requests in the current period" + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/coordinates' + text/plain: + schema: + $ref: '#/components/schemas/stringWithMinLength' /inlineRequestBodySchemasDifferingByContentType: post: requestBody: @@ -80,4 +110,4 @@ components: lat: type: number long: - type: number + type: number \ No newline at end of file diff --git a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java index e29a340990c..6e608808a73 100644 --- a/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/java-micronaut-client/src/main/java/org/openapitools/api/UserApi.java @@ -18,6 +18,7 @@ import io.micronaut.http.client.annotation.Client; import org.openapitools.query.QueryParam; import io.micronaut.core.convert.format.Format; import reactor.core.publisher.Mono; +import java.time.LocalDateTime; import org.openapitools.model.User; import javax.annotation.Generated; import java.util.ArrayList; diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java index f2bc445ff22..948722b28de 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -20,6 +20,7 @@ import org.openapitools.client.Configuration; import org.openapitools.client.model.*; import org.openapitools.client.Pair; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java index d97f8235c4d..b71073a1acc 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java @@ -4,6 +4,7 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; import org.openapitools.client.model.ApiResponse; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java index c6a74a80c00..55adb67061e 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java @@ -4,6 +4,7 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; import org.openapitools.client.model.ApiResponse; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java index eaf587737db..b3ef67b61ca 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/UserApi.java index 1c6ce952c31..c0862cb9667 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/UserApi.java @@ -20,6 +20,7 @@ import org.openapitools.client.Configuration; import org.openapitools.client.model.*; import org.openapitools.client.Pair; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/api/UserApi.java index c016f258f89..a2b14e76422 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/api/UserApi.java @@ -8,6 +8,7 @@ import org.openapitools.client.Pair; import javax.ws.rs.core.GenericType; +import java.time.LocalDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index c016f258f89..2a59daac578 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -8,6 +8,7 @@ import org.openapitools.client.Pair; import javax.ws.rs.core.GenericType; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java index b9fd9ed12a0..400bcc6a8ef 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java @@ -12,6 +12,7 @@ package org.openapitools.client.api; +import java.util.Date; import org.openapitools.client.model.User; import java.io.InputStream; diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java index 87d2be2c3f4..209d289e08e 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -17,6 +17,7 @@ import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Pair; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index d4f06af3fd5..2ce486c6491 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -17,6 +17,7 @@ import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Pair; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java index b6ab5b1bd53..706ac5239f7 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java @@ -30,6 +30,7 @@ import io.swagger.v3.oas.models.parameters.Parameter; import java.io.IOException; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.lang.reflect.Type; diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java index 4bf2dc2b82f..df1e507d1e4 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-nextgen/src/main/java/org/openapitools/client/api/UserApi.java @@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.lang.reflect.Type; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java index 7e6577a7b11..f47c499de12 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java @@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.lang.reflect.Type; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java index 7e6577a7b11..f47c499de12 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java @@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.lang.reflect.Type; diff --git a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/api/UserApi.java index 4caf52a8d5f..cfabc572135 100644 --- a/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/rest-assured-jackson/src/main/java/org/openapitools/client/api/UserApi.java @@ -13,6 +13,7 @@ package org.openapitools.client.api; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java index 4b2ee75cb92..c50c5ecb2a2 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/api/UserApi.java @@ -14,6 +14,7 @@ package org.openapitools.client.api; import com.google.gson.reflect.TypeToken; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java index 96c7210bf24..6c9ab56a94c 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.client.Pair; import javax.ws.rs.core.GenericType; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java index 3561cd6e6db..217e995d4a9 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.Collections; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java index 3561cd6e6db..217e995d4a9 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.Collections; diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java index 3208b159ade..c568e477b92 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java @@ -11,6 +11,7 @@ import okhttp3.RequestBody; import okhttp3.ResponseBody; import okhttp3.MultipartBody; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/UserApi.java index be6071fd7d0..55b998e696c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/UserApi.java @@ -9,6 +9,7 @@ import okhttp3.RequestBody; import okhttp3.ResponseBody; import okhttp3.MultipartBody; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/UserApi.java index 134d9ea66f5..f0f9bfc01f5 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/UserApi.java @@ -10,6 +10,7 @@ import okhttp3.RequestBody; import okhttp3.ResponseBody; import okhttp3.MultipartBody; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/UserApi.java index 7be5be28df3..00839a720e4 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/api/UserApi.java @@ -10,6 +10,7 @@ import okhttp3.RequestBody; import okhttp3.ResponseBody; import okhttp3.MultipartBody; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java index e5c33d583ab..5d55c6aa266 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java @@ -1,6 +1,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApiImpl.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApiImpl.java index 7c2885ba3bc..3e39564dd28 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApiImpl.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/UserApiImpl.java @@ -1,5 +1,6 @@ package org.openapitools.client.api; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import io.vertx.core.AsyncResult; diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/rxjava/UserApi.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/rxjava/UserApi.java index 51280eef380..466c016abc0 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/rxjava/UserApi.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/api/rxjava/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.client.api.rxjava; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.User; import org.openapitools.client.ApiClient; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApi.java index e5c33d583ab..b7922264c5c 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApi.java @@ -1,6 +1,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApiImpl.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApiImpl.java index 7c2885ba3bc..592748032b6 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApiImpl.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/UserApiImpl.java @@ -1,5 +1,6 @@ package org.openapitools.client.api; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import io.vertx.core.AsyncResult; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/UserApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/UserApi.java index 51280eef380..6ed5725ec83 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/UserApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.client.api.rxjava; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import org.openapitools.client.ApiClient; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java index 6920c4cd200..70fd7a644cd 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import java.util.HashMap; diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/UserApi.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/UserApi.scala index 880c084c64c..112105938ad 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/UserApi.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/UserApi.scala @@ -11,6 +11,7 @@ */ package org.openapitools.client.api +import java.time.OffsetDateTime import org.openapitools.client.model.User import org.openapitools.client.core._ import org.openapitools.client.core.CollectionFormats._ diff --git a/samples/client/petstore/scala-httpclient-deprecated/src/main/scala/org/openapitools/example/api/UserApi.scala b/samples/client/petstore/scala-httpclient-deprecated/src/main/scala/org/openapitools/example/api/UserApi.scala index d39a90e5741..e194afed5a3 100644 --- a/samples/client/petstore/scala-httpclient-deprecated/src/main/scala/org/openapitools/example/api/UserApi.scala +++ b/samples/client/petstore/scala-httpclient-deprecated/src/main/scala/org/openapitools/example/api/UserApi.scala @@ -14,6 +14,7 @@ package org.openapitools.example.api import java.text.SimpleDateFormat +import java.util.Date import org.openapitools.client.model.User import org.openapitools.example.invoker.{ApiInvoker, ApiException} diff --git a/samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/UserApi.scala b/samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/UserApi.scala index 68e147b3d0f..5cc17ea09c1 100644 --- a/samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/UserApi.scala +++ b/samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/UserApi.scala @@ -11,6 +11,7 @@ */ package org.openapitools.client.api +import java.time.OffsetDateTime import org.openapitools.client.model.User import org.openapitools.client.core.JsonSupport._ import sttp.client._ diff --git a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java index 0f9c95ed040..f02a6902a51 100644 --- a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/UserApi.java index 483b0873d51..ec264eb0d0b 100644 --- a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java index 4fabd81f3b3..5fa9e20f90d 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java index 27ab4c67aab..006c4fd5ef4 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index ab1c5d462d7..769693bc7e4 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -8,6 +8,7 @@ import org.openapitools.client.Pair; import javax.ws.rs.core.GenericType; +import java.time.OffsetDateTime; import org.openapitools.client.model.User; import java.util.ArrayList; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApi.java index 836abbd19f7..a54f5e2a3ee 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApiService.java index 14f88b4c31f..905aab2c1b6 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/api/UserApiService.java @@ -6,6 +6,7 @@ import org.openapitools.model.*; import org.wso2.msf4j.formparam.FormDataParam; import org.wso2.msf4j.formparam.FileInfo; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 9110ccdf44d..092f5f3a581 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -3,6 +3,7 @@ package org.openapitools.api.impl; import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiController.java b/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiController.java index 40e025ed445..e6e8c6097d4 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiController.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiController.java @@ -1,6 +1,7 @@ package com.puppies.store.apis; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImp.java index a5c27c44caf..3ff0eb26e4c 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImp.java @@ -1,6 +1,7 @@ package com.puppies.store.apis; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImpInterface.java index 0837531ed7a..adae1c27239 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/com/puppies/store/apis/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package com.puppies.store.apis; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-async/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-async/app/controllers/UserApiController.java index 3a89de0cd11..2d6685b18a4 100644 --- a/samples/server/petstore/java-play-framework-async/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-async/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImp.java index 417765d035b..b4c38db7da4 100644 --- a/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImpInterface.java index 39a8a9f8960..2a1a3322b19 100644 --- a/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-async/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java index 1a1e62be27c..d3c05dfa203 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java index 7c2ee85e2e1..6169c162010 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImp.java index f866d4e9853..341f5017181 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java index bd254922d03..39d422cc1ea 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java index 879700e98c7..e0572c7f33c 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImp.java index 3be679120b6..02a82befbec 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java index 8aea513ad76..722d76055f7 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java index 29a5aaf9081..f4218359b68 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImp.java index 1fc6f076ca6..75b2af29797 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java index 9f00bfc1fc1..4a83cce6198 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java index f9a5ff9af68..e8c0a2f4123 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImp.java index 551cff753e3..5d2342bdf20 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiController.java index 7c2ee85e2e1..6169c162010 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImp.java index f866d4e9853..341f5017181 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImpInterface.java index bd254922d03..39d422cc1ea 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java index 7c2ee85e2e1..6169c162010 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImp.java index f866d4e9853..341f5017181 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java index bd254922d03..39d422cc1ea 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java index 916e3d26033..582c691a51b 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImp.java index f866d4e9853..341f5017181 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java index bd254922d03..39d422cc1ea 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java index 7c2ee85e2e1..6169c162010 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.typesafe.config.Config; diff --git a/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImp.java b/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImp.java index f866d4e9853..341f5017181 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImp.java +++ b/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImp.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import play.mvc.Http; diff --git a/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java index bd254922d03..39d422cc1ea 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java @@ -1,6 +1,7 @@ package controllers; import java.util.List; +import java.time.OffsetDateTime; import apimodels.User; import com.google.inject.Inject; diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApi.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApi.java index 51a910d032f..a68768f7179 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApi.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.vertxweb.server.api; +import java.time.OffsetDateTime; import org.openapitools.vertxweb.server.model.User; import org.openapitools.vertxweb.server.ApiResponse; diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java index 85beafc942d..f32f94a006f 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiHandler.java @@ -1,5 +1,6 @@ package org.openapitools.vertxweb.server.api; +import java.time.OffsetDateTime; import org.openapitools.vertxweb.server.model.User; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiImpl.java b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiImpl.java index 13b9457de8e..b2097db1dec 100644 --- a/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiImpl.java +++ b/samples/server/petstore/java-vertx-web/src/main/java/org/openapitools/vertxweb/server/api/UserApiImpl.java @@ -1,5 +1,6 @@ package org.openapitools.vertxweb.server.api; +import java.time.OffsetDateTime; import org.openapitools.vertxweb.server.model.User; import org.openapitools.vertxweb.server.ApiResponse; diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/UserApi.java index a621c7a6229..f615b43fc0d 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.api; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/UserApi.java index 280ad569666..6a0c280728d 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.api; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/UserApi.java index 40ad9d92703..1d2df9950e4 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.api; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java index 05b3b1e61cc..ac1d5d79c93 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.Map; diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApiService.java index 15e4486bc6c..0398450b90e 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApiService.java @@ -6,6 +6,7 @@ import org.openapitools.model.*; import org.glassfish.jersey.media.multipart.FormDataBodyPart; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.List; diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-datelib-j8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 1e5df1742f1..2777fd418e3 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.List; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java index 6d96f196c9e..a21940cf130 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java index 1464a5adacb..a97a94b9630 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 2d7b2e001a4..f52f29ff610 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -3,6 +3,7 @@ package org.openapitools.api.impl; import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java index d9780d5234b..a86e19f4e7b 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ import org.openapitools.api.UserApiService; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApiService.java index 35d72d42112..9c8711a4c33 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/UserApiService.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/default/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 40d14d0be55..3922ee89e62 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java index 22506d0ee4d..18245bceec1 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.List; diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index a63f0db78fe..5b04e2fe7c5 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.List; diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java index 22506d0ee4d..4ff199c2404 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/UserApi.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import org.joda.time.DateTime; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index a63f0db78fe..6f7c52daa96 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; +import org.joda.time.DateTime; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java index 22506d0ee4d..9085d6360ea 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/UserApi.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/eap/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index a63f0db78fe..1df5c3e26f1 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApi.java index d9780d5234b..6c9a757e198 100644 --- a/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.Map; diff --git a/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApiService.java index 35d72d42112..a5042f3ed87 100644 --- a/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/java8/src/gen/java/org/openapitools/api/UserApiService.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.List; diff --git a/samples/server/petstore/jaxrs-resteasy/java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 40d14d0be55..c71a0ed4e5e 100644 --- a/samples/server/petstore/jaxrs-resteasy/java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/java8/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import java.util.List; diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java index d9780d5234b..571e51a3345 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ import org.openapitools.api.UserApiService; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import org.joda.time.DateTime; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApiService.java index 35d72d42112..8560f101ffb 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/UserApiService.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; +import org.joda.time.DateTime; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 40d14d0be55..6c64a9bc5d3 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -4,6 +4,7 @@ import org.openapitools.api.*; import org.openapitools.model.*; +import org.joda.time.DateTime; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/UserApi.java index a1fb4ed1b0f..f07a6ceb7d0 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.api; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java index a72c9431305..2657167dce1 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/UserApi.java @@ -1,5 +1,6 @@ package org.openapitools.api; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java index 9d44284fa0f..2808b3bc090 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApiService.java index 79b52a8a5ec..da302c73c1e 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApiService.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import com.sun.jersey.multipart.FormDataParam; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 5df04a4d533..be039a8631c 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import com.sun.jersey.multipart.FormDataParam; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java index aa5b7ec2d6f..d3ac6451018 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApiService.java index 79b52a8a5ec..da302c73c1e 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApiService.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import com.sun.jersey.multipart.FormDataParam; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 5df04a4d533..be039a8631c 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import com.sun.jersey.multipart.FormDataParam; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java index 2d90f252352..ba9ff14767b 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApiService.java index 15e4486bc6c..493a47591e5 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApiService.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 1e5df1742f1..f4bd2bfef42 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -3,6 +3,7 @@ package org.openapitools.api.impl; import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java index 05b3b1e61cc..08328080834 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java @@ -7,6 +7,7 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApiService.java index 15e4486bc6c..493a47591e5 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApiService.java @@ -5,6 +5,7 @@ import org.openapitools.model.*; import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index 1e5df1742f1..f4bd2bfef42 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -3,6 +3,7 @@ package org.openapitools.api.impl; import org.openapitools.api.*; import org.openapitools.model.*; +import java.util.Date; import java.util.List; import org.openapitools.model.User; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java index 941fffd3832..ce495a26f87 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..0a155195974 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.LocalDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-no-nullable/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-spring-pageable/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApi.java index f96ae913440..517f2743d2a 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApiController.java index a749387b89f..a5441a06b65 100644 --- a/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/api/UserApiController.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java index c6a6fa86699..7fce7995a83 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java index 78da7c8510b..b63fa7a1c28 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java index c6a6fa86699..7fce7995a83 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java index 78da7c8510b..b63fa7a1c28 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java index cb97dfa0de6..2e0fbbbffc9 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java index 505c317d5f4..9487e29ee1a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java index 7241a736ea1..563d11fa041 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApi.java index f96ae913440..517f2743d2a 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiController.java index da136ce2f80..927da273215 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiController.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiDelegate.java index 81c3ecc2588..00d156773a2 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApi.java index c6a6fa86699..7fce7995a83 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApiDelegate.java index 78da7c8510b..b63fa7a1c28 100644 --- a/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApi.java index f96ae913440..517f2743d2a 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApiController.java index a749387b89f..a5441a06b65 100644 --- a/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-spring-pageable-without-j8/src/main/java/org/openapitools/api/UserApiController.java @@ -1,6 +1,7 @@ package org.openapitools.api; import java.util.List; +import org.threeten.bp.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-spring-pageable/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java index f97eeb8e407..a3766015580 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.virtualan.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.virtualan.model.User; import io.swagger.annotations.*; import io.virtualan.annotation.ApiVirtual; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java index 27f6a346d30..fabb81f5f1a 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import java.util.List; +import java.time.OffsetDateTime; import org.openapitools.model.User; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; From 0236f84c1156c4aa03027c861221cf6389c35479 Mon Sep 17 00:00:00 2001 From: Guus Bloemsma Date: Sat, 11 Dec 2021 14:48:00 +0100 Subject: [PATCH 07/18] [kotlin-client] Allowing vendor types for json (#10758) * Using the first serializable 'consumes' mediaType Using all deserializable 'produces' mediaTypes Matching json vendor types as json * updating the generated samples --- .../languages/KotlinClientCodegen.java | 63 ++++++++++++++++--- .../libraries/jvm-okhttp/api.mustache | 3 + .../infrastructure/ApiClient.kt.mustache | 14 ++--- .../openapitools/client/apis/DefaultApi.kt | 1 + .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-gson/docs/PetApi.md | 10 +-- .../petstore/kotlin-gson/docs/StoreApi.md | 4 +- .../petstore/kotlin-gson/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-jackson/docs/PetApi.md | 10 +-- .../petstore/kotlin-jackson/docs/StoreApi.md | 4 +- .../petstore/kotlin-jackson/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../kotlin-json-request-string/docs/PetApi.md | 10 +-- .../docs/StoreApi.md | 4 +- .../docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../docs/PetApi.md | 10 +-- .../docs/StoreApi.md | 4 +- .../docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../kotlin-moshi-codegen/docs/PetApi.md | 10 +-- .../kotlin-moshi-codegen/docs/StoreApi.md | 4 +- .../kotlin-moshi-codegen/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-nonpublic/docs/PetApi.md | 10 +-- .../kotlin-nonpublic/docs/StoreApi.md | 4 +- .../petstore/kotlin-nonpublic/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-nullable/docs/PetApi.md | 10 +-- .../petstore/kotlin-nullable/docs/StoreApi.md | 4 +- .../petstore/kotlin-nullable/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-okhttp3/docs/PetApi.md | 10 +-- .../petstore/kotlin-okhttp3/docs/StoreApi.md | 4 +- .../petstore/kotlin-okhttp3/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-string/docs/PetApi.md | 10 +-- .../petstore/kotlin-string/docs/StoreApi.md | 4 +- .../petstore/kotlin-string/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../petstore/kotlin-threetenbp/docs/PetApi.md | 10 +-- .../kotlin-threetenbp/docs/StoreApi.md | 4 +- .../kotlin-threetenbp/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- .../org/openapitools/client/apis/EnumApi.kt | 1 + .../client/infrastructure/ApiClient.kt | 12 ++-- samples/client/petstore/kotlin/docs/PetApi.md | 10 +-- .../client/petstore/kotlin/docs/StoreApi.md | 4 +- .../client/petstore/kotlin/docs/UserApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 14 +++-- .../org/openapitools/client/apis/StoreApi.kt | 5 +- .../org/openapitools/client/apis/UserApi.kt | 14 +++-- .../client/infrastructure/ApiClient.kt | 12 ++-- 84 files changed, 483 insertions(+), 316 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index 28a3853332d..80b54000dd8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -18,8 +18,21 @@ package org.openapitools.codegen.languages; import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.*; -import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenParameter; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.meta.features.ClientModificationFeature; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.GlobalFeature; +import org.openapitools.codegen.meta.features.ParameterFeature; +import org.openapitools.codegen.meta.features.SchemaSupportFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; +import org.openapitools.codegen.meta.features.WireFormatFeature; import org.openapitools.codegen.utils.ProcessUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,6 +41,7 @@ import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -617,14 +631,14 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { // escape the variable base name for use as a string literal List vars = Stream.of( - cm.vars, - cm.allVars, - cm.optionalVars, - cm.requiredVars, - cm.readOnlyVars, - cm.readWriteVars, - cm.parentVars - ) + cm.vars, + cm.allVars, + cm.optionalVars, + cm.requiredVars, + cm.readOnlyVars, + cm.readWriteVars, + cm.parentVars + ) .flatMap(List::stream) .collect(Collectors.toList()); @@ -653,6 +667,35 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { operation.path = operation.path.substring(1); } + if (JVM_OKHTTP.equals(getLibrary()) || JVM_OKHTTP3.equals(getLibrary()) || JVM_OKHTTP4.equals(getLibrary())) { + // Ideally we would do content negotiation to choose the best mediatype, but that would be a next step. + // For now we take the first mediatype we can parse and send that. + Predicate> isSerializable = typeMapping -> { + String mediaTypeValue = typeMapping.get("mediaType"); + if (mediaTypeValue == null) + return false; + // match on first part in mediaTypes like 'application/json; charset=utf-8' + int endIndex = mediaTypeValue.indexOf(';'); + String mediaType = (endIndex == -1 + ? mediaTypeValue + : mediaTypeValue.substring(0, endIndex) + ).trim(); + return "multipart/form-data".equals(mediaType) + || "application/x-www-form-urlencoded".equals(mediaType) + || (mediaType.startsWith("application/") && mediaType.endsWith("json")); + }; + operation.consumes = operation.consumes == null ? null : operation.consumes.stream() + .filter(isSerializable) + .limit(1) + .collect(Collectors.toList()); + operation.hasConsumes = operation.consumes != null && !operation.consumes.isEmpty(); + + operation.produces = operation.produces == null ? null : operation.produces.stream() + .filter(isSerializable) + .collect(Collectors.toList()); + operation.hasProduces = operation.produces != null && !operation.produces.isEmpty(); + } + // set multipart against all relevant operations if (operation.hasConsumes == Boolean.TRUE) { if (isMultipartType(operation.consumes)) { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache index 71d19cb2eca..8059b5ffa79 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache @@ -130,6 +130,9 @@ import {{packageName}}.infrastructure.toMultiValue {{#headerParams}} {{{paramName}}}{{^required}}?{{/required}}.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} } {{/headerParams}} + {{^hasFormParams}}{{#hasConsumes}}{{#consumes}}localVariableHeaders["Content-Type"] = "{{{mediaType}}}" + {{/consumes}}{{/hasConsumes}}{{/hasFormParams}}{{#hasProduces}}localVariableHeaders["Accept"] = "{{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}" +{{/hasProduces}} return RequestConfig( method = RequestMethod.{{httpMethod}}, diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 57bd33d35bf..8f30c1808e2 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -167,8 +167,8 @@ import com.squareup.moshi.adapter } }.build() } + mediaType.startsWith("application/") && mediaType.endsWith("json") -> {{#jvm-okhttp3}} - mediaType == JsonMediaType -> { if (content == null) { EMPTY_REQUEST } else { @@ -187,10 +187,8 @@ import com.squareup.moshi.adapter {{/kotlinx_serialization}} ) } - } {{/jvm-okhttp3}} {{#jvm-okhttp4}} - mediaType == JsonMediaType -> { if (content == null) { EMPTY_REQUEST } else { @@ -210,7 +208,6 @@ import com.squareup.moshi.adapter mediaType.toMediaTypeOrNull() ) } - } {{/jvm-okhttp4}} mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers @@ -247,8 +244,9 @@ import com.squareup.moshi.adapter out.close() return f as T } - return when(mediaType) { - JsonMediaType -> {{#moshi}}Serializer.moshi.adapter().fromJson(bodyContent){{/moshi}}{{#gson}}Serializer.gson.fromJson(bodyContent, (object: TypeToken(){}).getType()){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.readValue(bodyContent, object: TypeReference() {}){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.decodeFromString(bodyContent){{/kotlinx_serialization}} + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + {{#moshi}}Serializer.moshi.adapter().fromJson(bodyContent){{/moshi}}{{#gson}}Serializer.gson.fromJson(bodyContent, (object: TypeToken(){}).getType()){{/gson}}{{#jackson}}Serializer.jacksonObjectMapper.readValue(bodyContent, object: TypeReference() {}){{/jackson}}{{#kotlinx_serialization}}Serializer.jvmJson.decodeFromString(bodyContent){{/kotlinx_serialization}} else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -343,11 +341,11 @@ import com.squareup.moshi.adapter } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 662eff77a04..dfcdc11ef3d 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -98,6 +98,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 634abe57b90..8a9c47045ed 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -167,11 +167,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-gson/docs/PetApi.md b/samples/client/petstore/kotlin-gson/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-gson/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-gson/docs/StoreApi.md b/samples/client/petstore/kotlin-gson/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-gson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-gson/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-gson/docs/UserApi.md b/samples/client/petstore/kotlin-gson/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-gson/docs/UserApi.md +++ b/samples/client/petstore/kotlin-gson/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7ccfb70d6d5..59367631c91 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 7a1fafd594e..f46f0ed6f55 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -137,8 +136,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.gson.fromJson(bodyContent, (object: TypeToken(){}).getType()) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.gson.fromJson(bodyContent, (object: TypeToken(){}).getType()) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -185,11 +185,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jackson/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-jackson/docs/StoreApi.md b/samples/client/petstore/kotlin-jackson/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-jackson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-jackson/docs/UserApi.md b/samples/client/petstore/kotlin-jackson/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-jackson/docs/UserApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7ccfb70d6d5..59367631c91 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 05f77db3037..d01fa6041c3 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -137,8 +136,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.jacksonObjectMapper.readValue(bodyContent, object: TypeReference() {}) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.jacksonObjectMapper.readValue(bodyContent, object: TypeReference() {}) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -185,11 +185,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md index 90c97d53eb7..46b5ffc5506 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getAllPets** @@ -202,7 +202,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -252,7 +252,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -297,7 +297,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md b/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-json-request-string/docs/UserApi.md b/samples/client/petstore/kotlin-json-request-string/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/UserApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 6d866a98057..a1a524e3cc2 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -246,6 +247,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -319,6 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { } } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -387,6 +390,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -453,7 +457,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -525,7 +530,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -599,6 +604,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c4700a70115..917c3d3f3d2 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -106,7 +106,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -115,7 +115,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -144,8 +143,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -192,11 +192,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/UserApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/UserApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a10b5ee2855..e6271b33fc1 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -102,7 +102,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -172,7 +173,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -243,6 +244,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -319,6 +321,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -387,6 +390,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -453,7 +457,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -525,7 +530,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -599,6 +604,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 33f04bb5423..fe498594da1 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -101,7 +101,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -166,6 +166,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -234,6 +235,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -302,6 +304,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 7cb6348f010..797a84aa61d 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -101,7 +101,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -167,7 +167,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -233,7 +233,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -299,7 +299,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -367,6 +367,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -442,6 +443,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -505,7 +507,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -574,7 +576,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c6bd90a8cbe..141689f40f8 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -108,7 +108,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -117,7 +117,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -140,8 +139,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.gson.fromJson(bodyContent, (object: TypeToken(){}).getType()) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.gson.fromJson(bodyContent, (object: TypeToken(){}).getType()) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -188,11 +188,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/UserApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/UserApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7ccfb70d6d5..59367631c91 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c75d4889d2e..c218caafae5 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -186,11 +186,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md b/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md b/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 86649ad5082..f01ad9c676d 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index fc03f3fb216..a71c936424a 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index d68ed63e17c..478f791b874 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index cb6d8697017..313f2e16527 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ internal open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ internal open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ internal open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -186,11 +186,11 @@ internal open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-nullable/docs/PetApi.md b/samples/client/petstore/kotlin-nullable/docs/PetApi.md index 42a28f741c7..e769fecd538 100644 --- a/samples/client/petstore/kotlin-nullable/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-nullable/docs/StoreApi.md b/samples/client/petstore/kotlin-nullable/docs/StoreApi.md index 63391018afb..30a28531120 100644 --- a/samples/client/petstore/kotlin-nullable/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-nullable/docs/UserApi.md b/samples/client/petstore/kotlin-nullable/docs/UserApi.md index d91ca1e97cf..94e67903d16 100644 --- a/samples/client/petstore/kotlin-nullable/docs/UserApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 164fa99175a..641f25e2ad2 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 5493c72bd74..60120ce05d9 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index e8c09009486..3b44d8f38f4 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c75d4889d2e..c218caafae5 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -186,11 +186,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md b/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-okhttp3/docs/StoreApi.md b/samples/client/petstore/kotlin-okhttp3/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-okhttp3/docs/UserApi.md b/samples/client/petstore/kotlin-okhttp3/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/UserApi.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7ccfb70d6d5..59367631c91 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 217d6fe0199..d3ac6493d6e 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -103,7 +103,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -111,7 +111,6 @@ open class ApiClient(val baseUrl: String) { MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content) ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -135,8 +134,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -183,11 +183,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-string/docs/PetApi.md b/samples/client/petstore/kotlin-string/docs/PetApi.md index a30ce4af558..39f8f0858aa 100644 --- a/samples/client/petstore/kotlin-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-string/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-string/docs/StoreApi.md b/samples/client/petstore/kotlin-string/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-string/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-string/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-string/docs/UserApi.md b/samples/client/petstore/kotlin-string/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-string/docs/UserApi.md +++ b/samples/client/petstore/kotlin-string/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 8cb9c538aff..bc8f157e488 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c75d4889d2e..c218caafae5 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -186,11 +186,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md b/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7ccfb70d6d5..59367631c91 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index f82c6d3fa4c..42e08a49f30 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -186,11 +186,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt index aca19570547..87b7bc007a6 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt @@ -98,6 +98,7 @@ class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 634abe57b90..8a9c47045ed 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -167,11 +167,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } diff --git a/samples/client/petstore/kotlin/docs/PetApi.md b/samples/client/petstore/kotlin/docs/PetApi.md index 27289c31c24..403e57a4b33 100644 --- a/samples/client/petstore/kotlin/docs/PetApi.md +++ b/samples/client/petstore/kotlin/docs/PetApi.md @@ -57,7 +57,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined @@ -155,7 +155,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **findPetsByTags** @@ -204,7 +204,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **getPetById** @@ -254,7 +254,7 @@ Configure api_key: ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **updatePet** @@ -299,7 +299,7 @@ Configure petstore_auth: ### HTTP request headers - - **Content-Type**: application/json, application/xml + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin/docs/StoreApi.md b/samples/client/petstore/kotlin/docs/StoreApi.md index f4986041af8..de2f4dbdcb1 100644 --- a/samples/client/petstore/kotlin/docs/StoreApi.md +++ b/samples/client/petstore/kotlin/docs/StoreApi.md @@ -147,7 +147,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **placeOrder** @@ -192,5 +192,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json diff --git a/samples/client/petstore/kotlin/docs/UserApi.md b/samples/client/petstore/kotlin/docs/UserApi.md index fd98ce696ad..e54decd3ba9 100644 --- a/samples/client/petstore/kotlin/docs/UserApi.md +++ b/samples/client/petstore/kotlin/docs/UserApi.md @@ -237,7 +237,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **loginUser** @@ -284,7 +284,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json # **logoutUser** diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 7ccfb70d6d5..59367631c91 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -100,7 +100,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/pet", @@ -170,7 +171,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - + return RequestConfig( method = RequestMethod.DELETE, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -241,6 +242,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("status", toMultiValue(status.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -317,6 +319,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("tags", toMultiValue(tags.toList(), "csv")) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -385,6 +388,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -451,7 +455,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.PUT, path = "/pet", @@ -523,7 +528,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("name" to name, "status" to status) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - + return RequestConfig( method = RequestMethod.POST, path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), @@ -597,6 +602,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = mapOf("additionalMetadata" to additionalMetadata, "file" to file) val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a3a2940291f..87d76a0b30d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -99,7 +99,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), @@ -164,6 +164,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -232,6 +233,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -300,6 +302,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index a68290f0718..444826b782c 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -99,7 +99,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user", @@ -165,7 +165,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithArray", @@ -231,7 +231,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.POST, path = "/user/createWithList", @@ -297,7 +297,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.DELETE, path = "/user/{username}".replace("{"+"username"+"}", "$username"), @@ -365,6 +365,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -440,6 +441,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("password", listOf(password.toString())) } val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, @@ -503,7 +505,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/user/logout", @@ -572,7 +574,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.PUT, path = "/user/{username}".replace("{"+"username"+"}", "$username"), diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c75d4889d2e..c218caafae5 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -105,7 +105,7 @@ open class ApiClient(val baseUrl: String) { } }.build() } - mediaType == JsonMediaType -> { + mediaType.startsWith("application/") && mediaType.endsWith("json") -> if (content == null) { EMPTY_REQUEST } else { @@ -114,7 +114,6 @@ open class ApiClient(val baseUrl: String) { mediaType.toMediaTypeOrNull() ) } - } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -138,8 +137,9 @@ open class ApiClient(val baseUrl: String) { out.close() return f as T } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } @@ -186,11 +186,11 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { + if(headers[ContentType].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") } - if(headers[Accept] ?: "" == "") { + if(headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } From 3247903caacb6ad139a8ebebfdc5110e8608e831 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Sat, 11 Dec 2021 13:48:59 +0000 Subject: [PATCH 08/18] [kotlin][client] update request exceptions (#11065) --- .../libraries/jvm-okhttp/api.mustache | 13 +-- .../openapitools/client/apis/DefaultApi.kt | 13 +-- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/EnumApi.kt | 13 +-- .../org/openapitools/client/apis/PetApi.kt | 90 ++++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 46 +++++----- .../org/openapitools/client/apis/UserApi.kt | 90 ++++++++++--------- 36 files changed, 1410 insertions(+), 1115 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache index 8059b5ffa79..57dd2c62aaf 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache @@ -1,6 +1,8 @@ {{>licenseInfo}} package {{apiPackage}} +import java.io.IOException + {{#imports}}import {{import}} {{/imports}} @@ -38,12 +40,14 @@ import {{packageName}}.infrastructure.toMultiValue * {{notes}} {{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}}* @return {{#returnType}}{{{returnType}}}{{#nullableReturnType}} or null{{/nullableReturnType}}{{/returnType}}{{^returnType}}void{{/returnType}} + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */{{#returnType}} @Suppress("UNCHECKED_CAST"){{/returnType}} - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} @@ -73,12 +77,11 @@ import {{packageName}}.infrastructure.toMultiValue * {{notes}} {{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}}* @return ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */{{#returnType}} @Suppress("UNCHECKED_CAST"){{/returnType}} - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index dfcdc11ef3d..e5f3a7b2fa5 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ModelWithEnumPropertyHavingDefault import org.openapitools.client.infrastructure.ApiClient @@ -47,12 +49,14 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath * * * @return ModelWithEnumPropertyHavingDefault + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun operation() : ModelWithEnumPropertyHavingDefault { val localVarResponse = operationWithHttpInfo() @@ -75,12 +79,11 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath * * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun operationWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = operationRequestConfig() diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 59367631c91..c3426fbd0a4 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 59367631c91..c3426fbd0a4 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index a1a524e3cc2..54cc4bbc49f 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -217,12 +223,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -263,12 +268,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param lastUpdated When this endpoint was hit last to help identify if the client already has the latest copy. (optional) * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List { val localVarResponse = getAllPetsWithHttpInfo(lastUpdated = lastUpdated) @@ -292,12 +299,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param lastUpdated When this endpoint was hit last to help identify if the client already has the latest copy. (optional) * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getAllPetsWithHttpInfo(lastUpdated: java.time.OffsetDateTime?) : ApiInfrastructureResponse?> { val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated) @@ -337,12 +343,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -366,12 +374,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -406,11 +413,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -434,11 +443,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -475,11 +483,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -505,11 +515,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -547,12 +556,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -578,12 +589,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index e6271b33fc1..9c9bdde5a87 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -51,11 +53,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun addPet(body: Pet) : Unit = withContext(Dispatchers.IO) { val localVarResponse = addPetWithHttpInfo(body = body) @@ -79,11 +83,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = addPetRequestConfig(body = body) @@ -119,11 +122,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit = withContext(Dispatchers.IO) { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -148,11 +153,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -188,12 +192,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List = withContext(Dispatchers.IO) { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -217,12 +223,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> = withContext(Dispatchers.IO) { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -260,12 +265,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") suspend fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List = withContext(Dispatchers.IO) { @Suppress("DEPRECATION") @@ -291,12 +298,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") suspend fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> = withContext(Dispatchers.IO) { @Suppress("DEPRECATION") @@ -337,12 +343,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getPetById(petId: kotlin.Long) : Pet = withContext(Dispatchers.IO) { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -366,12 +374,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -406,11 +413,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun updatePet(body: Pet) : Unit = withContext(Dispatchers.IO) { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -434,11 +443,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = updatePetRequestConfig(body = body) @@ -475,11 +483,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit = withContext(Dispatchers.IO) { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -505,11 +515,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -547,12 +556,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse = withContext(Dispatchers.IO) { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -578,12 +589,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index fe498594da1..94c499c7b7f 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import kotlinx.coroutines.Dispatchers @@ -50,11 +52,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun deleteOrder(orderId: kotlin.String) : Unit = withContext(Dispatchers.IO) { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -78,11 +82,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -115,12 +118,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getInventory() : kotlin.collections.Map = withContext(Dispatchers.IO) { val localVarResponse = getInventoryWithHttpInfo() @@ -143,12 +148,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> = withContext(Dispatchers.IO) { val localVariableConfig = getInventoryRequestConfig() @@ -182,12 +186,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getOrderById(orderId: kotlin.Long) : Order = withContext(Dispatchers.IO) { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -211,12 +217,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -251,12 +256,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun placeOrder(body: Order) : Order = withContext(Dispatchers.IO) { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -280,12 +287,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 797a84aa61d..8439a7f2bdb 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import kotlinx.coroutines.Dispatchers @@ -50,11 +52,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun createUser(body: User) : Unit = withContext(Dispatchers.IO) { val localVarResponse = createUserWithHttpInfo(body = body) @@ -78,11 +82,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = createUserRequestConfig(body = body) @@ -116,11 +119,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit = withContext(Dispatchers.IO) { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -144,11 +149,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -182,11 +186,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun createUsersWithListInput(body: kotlin.collections.List) : Unit = withContext(Dispatchers.IO) { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -210,11 +216,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -248,11 +253,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun deleteUser(username: kotlin.String) : Unit = withContext(Dispatchers.IO) { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -276,11 +283,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -314,12 +320,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun getUserByName(username: kotlin.String) : User = withContext(Dispatchers.IO) { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -343,12 +351,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -384,12 +391,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String = withContext(Dispatchers.IO) { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -414,12 +423,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -458,11 +466,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun logoutUser() : Unit = withContext(Dispatchers.IO) { val localVarResponse = logoutUserWithHttpInfo() @@ -485,11 +495,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun logoutUserWithHttpInfo() : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = logoutUserRequestConfig() @@ -523,11 +532,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) suspend fun updateUser(username: kotlin.String, body: User) : Unit = withContext(Dispatchers.IO) { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -552,11 +563,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) suspend fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 59367631c91..c3426fbd0a4 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index f01ad9c676d..413c98693aa 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index a71c936424a..eb69e3afbd3 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 478f791b874..75996ae3412 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 641f25e2ad2..ffa00253a36 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List? { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List? { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet? { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 60120ce05d9..28c31e3db41 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map? { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order? { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order? { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 3b44d8f38f4..9997944fa99 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User? { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String or null + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 59367631c91..c3426fbd0a4 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index bc8f157e488..fbadb8eb910 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param apiKey (optional) * @param petId Pet id to delete * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit { val localVarResponse = deletePetWithHttpInfo(apiKey = apiKey, petId = petId) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param apiKey (optional) * @param petId Pet id to delete * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(apiKey: kotlin.String?, petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 59367631c91..c3426fbd0a4 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt index 87b7bc007a6..4a5e70c002a 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.PetEnum import org.openapitools.client.infrastructure.ApiClient @@ -47,12 +49,14 @@ class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get enums * * @return PetEnum + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getEnum() : PetEnum { val localVarResponse = getEnumWithHttpInfo() @@ -75,12 +79,11 @@ class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get enums * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getEnumWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = getEnumRequestConfig() diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 59367631c91..c3426fbd0a4 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet @@ -49,11 +51,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun addPet(body: Pet) : Unit { val localVarResponse = addPetWithHttpInfo(body = body) @@ -77,11 +81,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = addPetRequestConfig(body = body) @@ -117,11 +120,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVarResponse = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) @@ -146,11 +151,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId Pet id to delete * @param apiKey (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) @@ -186,12 +190,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { val localVarResponse = findPetsByStatusWithHttpInfo(status = status) @@ -215,12 +221,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) @@ -258,12 +263,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { @Suppress("DEPRECATION") @@ -289,12 +296,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { @Suppress("DEPRECATION") @@ -335,12 +341,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return Pet + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPetById(petId: kotlin.Long) : Pet { val localVarResponse = getPetByIdWithHttpInfo(petId = petId) @@ -364,12 +372,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Returns a single pet * @param petId ID of pet to return * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) @@ -404,11 +411,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePet(body: Pet) : Unit { val localVarResponse = updatePetWithHttpInfo(body = body) @@ -432,11 +441,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body Pet object that needs to be added to the store * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { val localVariableConfig = updatePetRequestConfig(body = body) @@ -473,11 +481,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { val localVarResponse = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) @@ -503,11 +513,10 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) @@ -545,12 +554,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) @@ -576,12 +587,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 87d76a0b30d..e905c41311d 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteOrder(orderId: kotlin.String) : Unit { val localVarResponse = deleteOrderWithHttpInfo(orderId = orderId) @@ -76,11 +80,10 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) @@ -113,12 +116,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return kotlin.collections.Map + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getInventory() : kotlin.collections.Map { val localVarResponse = getInventoryWithHttpInfo() @@ -141,12 +146,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Returns pet inventories by status * Returns a map of status codes to quantities * @return ApiInfrastructureResponse?> - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { val localVariableConfig = getInventoryRequestConfig() @@ -180,12 +184,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getOrderById(orderId: kotlin.Long) : Order { val localVarResponse = getOrderByIdWithHttpInfo(orderId = orderId) @@ -209,12 +215,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) @@ -249,12 +254,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return Order + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun placeOrder(body: Order) : Order { val localVarResponse = placeOrderWithHttpInfo(body = body) @@ -278,12 +285,11 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * * @param body order placed for purchasing the pet * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { val localVariableConfig = placeOrderRequestConfig(body = body) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 444826b782c..9381925680a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -20,6 +20,8 @@ package org.openapitools.client.apis +import java.io.IOException + import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient @@ -48,11 +50,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUser(body: User) : Unit { val localVarResponse = createUserWithHttpInfo(body = body) @@ -76,11 +80,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param body Created user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { val localVariableConfig = createUserRequestConfig(body = body) @@ -114,11 +117,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body) @@ -142,11 +147,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) @@ -180,11 +184,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun createUsersWithListInput(body: kotlin.collections.List) : Unit { val localVarResponse = createUsersWithListInputWithHttpInfo(body = body) @@ -208,11 +214,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param body List of user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) @@ -246,11 +251,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteUser(username: kotlin.String) : Unit { val localVarResponse = deleteUserWithHttpInfo(username = username) @@ -274,11 +281,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username The name that needs to be deleted * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = deleteUserRequestConfig(username = username) @@ -312,12 +318,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return User + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getUserByName(username: kotlin.String) : User { val localVarResponse = getUserByNameWithHttpInfo(username = username) @@ -341,12 +349,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The name that needs to be fetched. Use user1 for testing. * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) @@ -382,12 +389,14 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { val localVarResponse = loginUserWithHttpInfo(username = username, password = password) @@ -412,12 +421,11 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username The user name for login * @param password The password for login in clear text * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) @@ -456,11 +464,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun logoutUser() : Unit { val localVarResponse = logoutUserWithHttpInfo() @@ -483,11 +493,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Logs out current logged in user session * * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { val localVariableConfig = logoutUserRequestConfig() @@ -521,11 +530,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response * @throws ServerException If the API returns a server error response */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun updateUser(username: kotlin.String, body: User) : Unit { val localVarResponse = updateUserWithHttpInfo(username = username, body = body) @@ -550,11 +561,10 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param username name that need to be deleted * @param body Updated user object * @return ApiInfrastructureResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class) fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) From fbb61658dfbcc2c1f5087511b0f74756553791ad Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 12 Dec 2021 16:32:08 +0800 Subject: [PATCH 09/18] [kotlin][client] rename ApiInfrastructureResponse to ApiResponse (#11094) * rename ApiInfrastructureResponse to ApiResponse * mark ApiResponse as reserved word * update samples, docs * fix typo --- docs/generators/kotlin-server-deprecated.md | 1 + docs/generators/kotlin-server.md | 1 + docs/generators/kotlin-vertx.md | 1 + docs/generators/kotlin.md | 1 + .../languages/AbstractKotlinCodegen.java | 1 + .../languages/KotlinClientCodegen.java | 2 +- .../libraries/jvm-okhttp/api.mustache | 6 +-- .../infrastructure/ApiClient.kt.mustache | 2 +- ...se.kt.mustache => ApiResponse.kt.mustache} | 12 ++--- .../.openapi-generator/FILES | 2 +- .../openapitools/client/apis/DefaultApi.kt | 6 +-- .../client/infrastructure/ApiClient.kt | 2 +- .../client/infrastructure/ApiResponse.kt} | 12 ++--- .../kotlin-gson/.openapi-generator/FILES | 4 +- samples/client/petstore/kotlin-gson/README.md | 2 +- .../petstore/kotlin-gson/docs/ApiResponse.md | 2 +- .../petstore/kotlin-gson/docs/PetApi.md | 6 +-- samples/client/petstore/kotlin-gson/gradlew | 0 .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../client/infrastructure/ApiResponse.kt} | 12 ++--- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../kotlin-jackson/.openapi-generator/FILES | 4 +- .../client/petstore/kotlin-jackson/README.md | 2 +- .../kotlin-jackson/docs/ApiResponse.md | 2 +- .../petstore/kotlin-jackson/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../client/infrastructure/ApiResponse.kt} | 12 ++--- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 4 +- .../kotlin-json-request-string/README.md | 2 +- .../docs/ApiResponse.md | 2 +- .../kotlin-json-request-string/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../client/infrastructure/ApiResponse.kt} | 12 ++--- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 4 +- .../kotlin-jvm-okhttp4-coroutines/README.md | 2 +- .../docs/ApiResponse.md | 2 +- .../docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 4 +- .../petstore/kotlin-moshi-codegen/README.md | 2 +- .../kotlin-moshi-codegen/docs/ApiResponse.md | 2 +- .../kotlin-moshi-codegen/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 2 +- .../petstore/kotlin-multiplatform/README.md | 2 +- .../kotlin-multiplatform/docs/ApiResponse.md | 2 +- .../kotlin-multiplatform/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 6 +-- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../kotlin-nonpublic/.openapi-generator/FILES | 4 +- .../petstore/kotlin-nonpublic/README.md | 2 +- .../kotlin-nonpublic/docs/ApiResponse.md | 2 +- .../petstore/kotlin-nonpublic/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- ...frastructureResponse.kt => ApiResponse.kt} | 12 ++--- .../client/models/ModelApiResponse.kt | 46 +++++++++++++++++++ .../kotlin-nullable/.openapi-generator/FILES | 4 +- .../client/petstore/kotlin-nullable/README.md | 2 +- .../kotlin-nullable/docs/ApiResponse.md | 2 +- .../petstore/kotlin-nullable/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- ...frastructureResponse.kt => ApiResponse.kt} | 12 ++--- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../kotlin-okhttp3/.openapi-generator/FILES | 4 +- .../client/petstore/kotlin-okhttp3/README.md | 2 +- .../kotlin-okhttp3/docs/ApiResponse.md | 2 +- .../petstore/kotlin-okhttp3/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../client/models/ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 2 +- .../README.md | 2 +- .../docs/ApiResponse.md | 2 +- .../docs/PetApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 6 +-- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 2 +- .../petstore/kotlin-retrofit2-rx3/README.md | 2 +- .../kotlin-retrofit2-rx3/docs/ApiResponse.md | 2 +- .../kotlin-retrofit2-rx3/docs/PetApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 6 +-- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../kotlin-retrofit2/.openapi-generator/FILES | 2 +- .../petstore/kotlin-retrofit2/README.md | 2 +- .../kotlin-retrofit2/docs/ApiResponse.md | 2 +- .../petstore/kotlin-retrofit2/docs/PetApi.md | 4 +- .../org/openapitools/client/apis/PetApi.kt | 6 +-- .../client/models/ModelApiResponse.kt} | 2 +- .../kotlin-string/.openapi-generator/FILES | 4 +- .../client/petstore/kotlin-string/README.md | 2 +- .../kotlin-string/docs/ApiResponse.md | 2 +- .../petstore/kotlin-string/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 4 +- .../petstore/kotlin-threetenbp/README.md | 2 +- .../kotlin-threetenbp/docs/ApiResponse.md | 2 +- .../petstore/kotlin-threetenbp/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../client/models/ModelApiResponse.kt} | 2 +- .../.openapi-generator/FILES | 2 +- .../org/openapitools/client/apis/EnumApi.kt | 6 +-- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../petstore/kotlin/.openapi-generator/FILES | 4 +- samples/client/petstore/kotlin/README.md | 2 +- .../petstore/kotlin/docs/ApiResponse.md | 2 +- samples/client/petstore/kotlin/docs/PetApi.md | 6 +-- .../org/openapitools/client/apis/PetApi.kt | 44 +++++++++--------- .../org/openapitools/client/apis/StoreApi.kt | 18 ++++---- .../org/openapitools/client/apis/UserApi.kt | 34 +++++++------- .../client/infrastructure/ApiClient.kt | 2 +- .../ApiInfrastructureResponse.kt | 43 ----------------- .../client/infrastructure/ApiResponse.kt | 43 +++++++++++++++++ .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- .../ktor/.openapi-generator/FILES | 2 +- .../petstore/kotlin-server/ktor/README.md | 2 +- .../org/openapitools/server/apis/PetApi.kt | 2 +- .../{ApiResponse.kt => ModelApiResponse.kt} | 2 +- 163 files changed, 1076 insertions(+), 1025 deletions(-) rename modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/{ApiInfrastructureResponse.kt.mustache => ApiResponse.kt.mustache} (76%) rename samples/client/petstore/{kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt => kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt} (73%) mode change 100644 => 100755 samples/client/petstore/kotlin-gson/gradlew rename samples/client/petstore/{kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt => kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt} (73%) rename samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (96%) rename samples/client/petstore/{kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt => kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt} (73%) rename samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (96%) rename samples/client/petstore/{kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt => kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt} (73%) rename samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (96%) delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt rename samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (97%) delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt rename samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (96%) rename samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (97%) rename samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/{ApiInfrastructureResponse.kt => ApiResponse.kt} (73%) create mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt rename samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/{ApiInfrastructureResponse.kt => ApiResponse.kt} (73%) rename samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (97%) delete mode 100644 samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt rename samples/client/petstore/{kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt => kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt} (96%) rename samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (97%) rename samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (96%) rename samples/client/petstore/{kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt => kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt} (96%) delete mode 100644 samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt rename samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (97%) delete mode 100644 samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt rename samples/client/petstore/{kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt => kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt} (96%) delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt create mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt rename samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/{ApiResponse.kt => ModelApiResponse.kt} (97%) rename samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/{ApiResponse.kt => ModelApiResponse.kt} (96%) diff --git a/docs/generators/kotlin-server-deprecated.md b/docs/generators/kotlin-server-deprecated.md index 2287e954abf..7e53620aa6e 100644 --- a/docs/generators/kotlin-server-deprecated.md +++ b/docs/generators/kotlin-server-deprecated.md @@ -74,6 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## RESERVED WORDS
    +
  • ApiResponse
  • abstract
  • actual
  • annotation
  • diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md index 81f75ca5785..0c0228d8a8c 100644 --- a/docs/generators/kotlin-server.md +++ b/docs/generators/kotlin-server.md @@ -76,6 +76,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## RESERVED WORDS
      +
    • ApiResponse
    • abstract
    • actual
    • annotation
    • diff --git a/docs/generators/kotlin-vertx.md b/docs/generators/kotlin-vertx.md index 90afde4de81..02d608e5274 100644 --- a/docs/generators/kotlin-vertx.md +++ b/docs/generators/kotlin-vertx.md @@ -68,6 +68,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## RESERVED WORDS
        +
      • ApiResponse
      • abstract
      • actual
      • annotation
      • diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index 49e02994b74..cbf43a3a1e9 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -79,6 +79,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## RESERVED WORDS
          +
        • ApiResponse
        • abstract
        • actual
        • annotation
        • diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index e0fb899e2f3..0cd24435d48 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -98,6 +98,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co // this includes hard reserved words defined by https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java // as well as keywords from https://kotlinlang.org/docs/reference/keyword-reference.html reservedWords = new HashSet<>(Arrays.asList( + "ApiResponse", // Used in the auto-generated api client "abstract", "actual", "annotation", diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index 80b54000dd8..3d2135e03c3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -541,7 +541,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { // jvm specific supporting files supportingFiles.add(new SupportingFile("infrastructure/Errors.kt.mustache", infrastructureFolder, "Errors.kt")); supportingFiles.add(new SupportingFile("infrastructure/ResponseExtensions.kt.mustache", infrastructureFolder, "ResponseExtensions.kt")); - supportingFiles.add(new SupportingFile("infrastructure/ApiInfrastructureResponse.kt.mustache", infrastructureFolder, "ApiInfrastructureResponse.kt")); + supportingFiles.add(new SupportingFile("infrastructure/ApiResponse.kt.mustache", infrastructureFolder, "ApiResponse.kt")); } private void processMultiplatformLibrary(final String infrastructureFolder) { diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache index 57dd2c62aaf..f7a01d9dfbb 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache @@ -13,7 +13,7 @@ import kotlinx.coroutines.withContext {{/useCoroutines}} {{/doNotUseRxAndCoroutines}} import {{packageName}}.infrastructure.ApiClient -import {{packageName}}.infrastructure.ApiInfrastructureResponse +import {{packageName}}.infrastructure.ApiResponse import {{packageName}}.infrastructure.ClientException import {{packageName}}.infrastructure.ClientError import {{packageName}}.infrastructure.ServerException @@ -76,7 +76,7 @@ import {{packageName}}.infrastructure.toMultiValue * {{summary}} * {{notes}} {{#allParams}}* @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} - {{/allParams}}* @return ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}> + {{/allParams}}* @return ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */{{#returnType}} @@ -85,7 +85,7 @@ import {{packageName}}.infrastructure.toMultiValue {{#isDeprecated}} @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} - {{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiInfrastructureResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} { + {{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}}: {{{dataType}}}{{^required}}?{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) : ApiResponse<{{#returnType}}{{{returnType}}}?{{/returnType}}{{^returnType}}Unit?{{/returnType}}>{{^doNotUseRxAndCoroutines}}{{#useCoroutines}} = withContext(Dispatchers.IO){{/useCoroutines}}{{/doNotUseRxAndCoroutines}} { {{#isDeprecated}} @Suppress("DEPRECATION") {{/isDeprecated}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 8f30c1808e2..78c16621cf8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -309,7 +309,7 @@ import com.squareup.moshi.adapter } {{/hasAuthMethods}} - protected {{#useCoroutines}}suspend {{/useCoroutines}}inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected {{#useCoroutines}}suspend {{/useCoroutines}}inline fun request(requestConfig: RequestConfig): ApiResponse { {{#jvm-okhttp3}} val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") {{/jvm-okhttp3}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiInfrastructureResponse.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiResponse.kt.mustache similarity index 76% rename from modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiInfrastructureResponse.kt.mustache rename to modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiResponse.kt.mustache index 98be9afd5fb..d529ad5599f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiInfrastructureResponse.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiResponse.kt.mustache @@ -6,7 +6,7 @@ package {{packageName}}.infrastructure {{#nonPublicApi}}internal {{/nonPublicApi}}interface Response -{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +{{#nonPublicApi}}internal {{/nonPublicApi}}abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ package {{packageName}}.infrastructure val data: T{{#nullableReturnType}}?{{/nullableReturnType}}, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) {{#nonPublicApi}}internal {{/nonPublicApi}}class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) {{#nonPublicApi}}internal {{/nonPublicApi}}class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) {{#nonPublicApi}}internal {{/nonPublicApi}}class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) {{#nonPublicApi}}internal {{/nonPublicApi}}class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES b/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES index bb98f9a0031..66329670bf9 100644 --- a/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-enum-default-value/.openapi-generator/FILES @@ -10,7 +10,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index e5f3a7b2fa5..ef0c1833384 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.ModelWithEnumPropertyHavingDefault import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -78,13 +78,13 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath /** * * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun operationWithHttpInfo() : ApiInfrastructureResponse { + fun operationWithHttpInfo() : ApiResponse { val localVariableConfig = operationRequestConfig() return request( diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 8a9c47045ed..09194ef9271 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String) { } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt similarity index 73% rename from samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt rename to samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt index 9dc8d8dbbfa..cf2cfaa95d9 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -6,7 +6,7 @@ enum class ResponseType { interface Response -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-gson/.openapi-generator/FILES b/samples/client/petstore/kotlin-gson/.openapi-generator/FILES index 1f38d3fbe2d..d1f6eddcef2 100644 --- a/samples/client/petstore/kotlin-gson/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-gson/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -30,8 +30,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-gson/README.md b/samples/client/petstore/kotlin-gson/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-gson/README.md +++ b/samples/client/petstore/kotlin-gson/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-gson/docs/ApiResponse.md b/samples/client/petstore/kotlin-gson/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-gson/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-gson/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-gson/docs/PetApi.md b/samples/client/petstore/kotlin-gson/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-gson/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-gson/gradlew b/samples/client/petstore/kotlin-gson/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c3426fbd0a4..b774e10e7b8 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index f46f0ed6f55..5ac6cfd25b7 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -160,7 +160,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt similarity index 73% rename from samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt rename to samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt index 9dc8d8dbbfa..cf2cfaa95d9 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -6,7 +6,7 @@ enum class ResponseType { interface Response -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index b50d6f2bde4..773c82f431a 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -31,7 +31,7 @@ import com.google.gson.annotations.SerializedName * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @SerializedName("code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-jackson/.openapi-generator/FILES b/samples/client/petstore/kotlin-jackson/.openapi-generator/FILES index 816d952128d..26ee35abac5 100644 --- a/samples/client/petstore/kotlin-jackson/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-jackson/.openapi-generator/FILES @@ -19,15 +19,15 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-jackson/README.md b/samples/client/petstore/kotlin-jackson/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-jackson/README.md +++ b/samples/client/petstore/kotlin-jackson/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-jackson/docs/ApiResponse.md b/samples/client/petstore/kotlin-jackson/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-jackson/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-jackson/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-jackson/docs/PetApi.md b/samples/client/petstore/kotlin-jackson/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-jackson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jackson/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c3426fbd0a4..b774e10e7b8 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d01fa6041c3..4d9d2e534de 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -160,7 +160,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt similarity index 73% rename from samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt rename to samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt index 9dc8d8dbbfa..cf2cfaa95d9 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -6,7 +6,7 @@ enum class ResponseType { interface Response -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 94a0b0b47d4..be6fc87dff1 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -31,7 +31,7 @@ import com.fasterxml.jackson.annotation.JsonProperty * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @field:JsonProperty("code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-json-request-string/.openapi-generator/FILES b/samples/client/petstore/kotlin-json-request-string/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-json-request-string/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-json-request-string/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-json-request-string/README.md b/samples/client/petstore/kotlin-json-request-string/README.md index f865de3689d..56bfbfeeb94 100644 --- a/samples/client/petstore/kotlin-json-request-string/README.md +++ b/samples/client/petstore/kotlin-json-request-string/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-json-request-string/docs/ApiResponse.md b/samples/client/petstore/kotlin-json-request-string/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md index 46b5ffc5506..417acfb195b 100644 --- a/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-json-request-string/docs/PetApi.md @@ -352,7 +352,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -367,7 +367,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -388,7 +388,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 54cc4bbc49f..dcb8d97586b 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -222,14 +222,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -298,13 +298,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get all pets * * @param lastUpdated When this endpoint was hit last to help identify if the client already has the latest copy. (optional) - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getAllPetsWithHttpInfo(lastUpdated: java.time.OffsetDateTime?) : ApiInfrastructureResponse?> { + fun getAllPetsWithHttpInfo(lastUpdated: java.time.OffsetDateTime?) : ApiResponse?> { val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated) return request>( @@ -373,13 +373,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -442,12 +442,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -514,12 +514,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -555,7 +555,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -564,11 +564,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -588,16 +588,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 917c3d3f3d2..c344dff4af6 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -167,7 +167,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt similarity index 73% rename from samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt rename to samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt index 9dc8d8dbbfa..cf2cfaa95d9 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -6,7 +6,7 @@ enum class ResponseType { interface Response -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index c53f3e313ec..61b35faee86 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -34,7 +34,7 @@ import kotlinx.parcelize.Parcelize */ @Parcelize -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES index 1f38d3fbe2d..d1f6eddcef2 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -30,8 +30,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/ApiResponse.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 9c9bdde5a87..1cd9901c0f9 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,13 +22,13 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -82,12 +82,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun addPetWithHttpInfo(body: Pet) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = addPetRequestConfig(body = body) return@withContext request( @@ -152,12 +152,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return@withContext request( @@ -222,13 +222,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> = withContext(Dispatchers.IO) { + suspend fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> = withContext(Dispatchers.IO) { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return@withContext request>( @@ -297,14 +297,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - suspend fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> = withContext(Dispatchers.IO) { + suspend fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> = withContext(Dispatchers.IO) { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -373,13 +373,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return@withContext request( @@ -442,12 +442,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun updatePetWithHttpInfo(body: Pet) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = updatePetRequestConfig(body = body) return@withContext request( @@ -514,12 +514,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return@withContext request, Unit>( @@ -555,7 +555,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -564,11 +564,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse = withContext(Dispatchers.IO) { + suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse = withContext(Dispatchers.IO) { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return@withContext when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -588,16 +588,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return@withContext request, ApiResponse>( + return@withContext request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 94c499c7b7f..430d9449c48 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -27,7 +27,7 @@ import org.openapitools.client.models.Order import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -81,12 +81,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return@withContext request( @@ -147,13 +147,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> = withContext(Dispatchers.IO) { + suspend fun getInventoryWithHttpInfo() : ApiResponse?> = withContext(Dispatchers.IO) { val localVariableConfig = getInventoryRequestConfig() return@withContext request>( @@ -216,13 +216,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return@withContext request( @@ -286,13 +286,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun placeOrderWithHttpInfo(body: Order) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = placeOrderRequestConfig(body = body) return@withContext request( diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 8439a7f2bdb..d318fa7477d 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -27,7 +27,7 @@ import org.openapitools.client.models.User import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -81,12 +81,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun createUserWithHttpInfo(body: User) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = createUserRequestConfig(body = body) return@withContext request( @@ -148,12 +148,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return@withContext request, Unit>( @@ -215,12 +215,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return@withContext request, Unit>( @@ -282,12 +282,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = deleteUserRequestConfig(username = username) return@withContext request( @@ -350,13 +350,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = getUserByNameRequestConfig(username = username) return@withContext request( @@ -422,13 +422,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - suspend fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return@withContext request( @@ -494,12 +494,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun logoutUserWithHttpInfo() : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun logoutUserWithHttpInfo() : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = logoutUserRequestConfig() return@withContext request( @@ -562,12 +562,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - suspend fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse = withContext(Dispatchers.IO) { + suspend fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse = withContext(Dispatchers.IO) { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return@withContext request( diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 141689f40f8..43f89e88cbd 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -163,7 +163,7 @@ open class ApiClient(val baseUrl: String) { } } - protected suspend inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected suspend inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 97% rename from samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index dfb777a87f7..16e2038ba9a 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -32,7 +32,7 @@ import java.io.Serializable * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @SerializedName("code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-moshi-codegen/.openapi-generator/FILES b/samples/client/petstore/kotlin-moshi-codegen/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-moshi-codegen/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-moshi-codegen/README.md b/samples/client/petstore/kotlin-moshi-codegen/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/README.md +++ b/samples/client/petstore/kotlin-moshi-codegen/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/ApiResponse.md b/samples/client/petstore/kotlin-moshi-codegen/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md +++ b/samples/client/petstore/kotlin-moshi-codegen/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c3426fbd0a4..b774e10e7b8 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c218caafae5..7282e53200b 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -161,7 +161,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 9db3de68228..1921982e783 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -32,7 +32,7 @@ import com.squareup.moshi.JsonClass * @param message */ @JsonClass(generateAdapter = true) -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES b/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES index d95b6af6c45..c917cc86876 100644 --- a/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-multiplatform/.openapi-generator/FILES @@ -26,8 +26,8 @@ src/commonMain/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt src/commonMain/kotlin/org/openapitools/client/infrastructure/OctetByteArray.kt src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/commonMain/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt -src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt src/commonMain/kotlin/org/openapitools/client/models/Category.kt +src/commonMain/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/commonMain/kotlin/org/openapitools/client/models/Order.kt src/commonMain/kotlin/org/openapitools/client/models/Pet.kt src/commonMain/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-multiplatform/README.md b/samples/client/petstore/kotlin-multiplatform/README.md index 28a4e3f1201..0e965d57d6f 100644 --- a/samples/client/petstore/kotlin-multiplatform/README.md +++ b/samples/client/petstore/kotlin-multiplatform/README.md @@ -51,8 +51,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-multiplatform/docs/ApiResponse.md b/samples/client/petstore/kotlin-multiplatform/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md b/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md index 7b3efc23d8b..efde11091c5 100644 --- a/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md +++ b/samples/client/petstore/kotlin-multiplatform/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : io.ktor.client.request.forms.InputProvider = BINARY_DATA_HERE // io.ktor.client.request.forms.InputProvider | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt index fe81cdf5bc0..1cdbc9d1052 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/PetApi.kt @@ -20,7 +20,7 @@ package org.openapitools.client.apis -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.* @@ -303,10 +303,10 @@ class PetApi( * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse */ @Suppress("UNCHECKED_CAST") - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.ktor.client.request.forms.InputProvider?): HttpResponse { + suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: io.ktor.client.request.forms.InputProvider?): HttpResponse { val localVariableAuthNames = listOf("petstore_auth") diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 97% rename from samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 0358a25b540..614529156e7 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -33,7 +33,7 @@ import kotlinx.serialization.encoding.* * @param message */ @Serializable -data class ApiResponse ( +data class ModelApiResponse ( @SerialName(value = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-nonpublic/.openapi-generator/FILES b/samples/client/petstore/kotlin-nonpublic/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-nonpublic/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-nonpublic/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-nonpublic/README.md b/samples/client/petstore/kotlin-nonpublic/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-nonpublic/README.md +++ b/samples/client/petstore/kotlin-nonpublic/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md b/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nonpublic/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 413c98693aa..33d1e110f12 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(bas * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index eb69e3afbd3..02201f04d42 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(b * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 75996ae3412..3475e9c4695 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(ba * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 313f2e16527..6ef92322fb1 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -161,7 +161,7 @@ internal open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt similarity index 73% rename from samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt rename to samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt index c618544573e..64824828dd4 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -6,7 +6,7 @@ internal enum class ResponseType { internal interface Response -internal abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +internal abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ internal class Success( val data: T, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) internal class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) internal class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) internal class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) internal class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt new file mode 100644 index 00000000000..43947587cfe --- /dev/null +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -0,0 +1,46 @@ +/** + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json + +/** + * Describes the result of uploading an image resource + * + * @param code + * @param type + * @param message + */ + +internal data class ModelApiResponse ( + + @Json(name = "code") + val code: kotlin.Int? = null, + + @Json(name = "type") + val type: kotlin.String? = null, + + @Json(name = "message") + val message: kotlin.String? = null + +) + diff --git a/samples/client/petstore/kotlin-nullable/.openapi-generator/FILES b/samples/client/petstore/kotlin-nullable/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-nullable/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-nullable/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-nullable/README.md b/samples/client/petstore/kotlin-nullable/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-nullable/README.md +++ b/samples/client/petstore/kotlin-nullable/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-nullable/docs/ApiResponse.md b/samples/client/petstore/kotlin-nullable/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-nullable/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-nullable/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-nullable/docs/PetApi.md b/samples/client/petstore/kotlin-nullable/docs/PetApi.md index e769fecd538..be940c52ee7 100644 --- a/samples/client/petstore/kotlin-nullable/docs/PetApi.md +++ b/samples/client/petstore/kotlin-nullable/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse? = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse? = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index ffa00253a36..8f8335f8b75 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse or null + * @return ModelApiResponse or null * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse? { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse? + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse? ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 28c31e3db41..b35fda44721 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9997944fa99..87ad7db8960 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c218caafae5..7282e53200b 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -161,7 +161,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt similarity index 73% rename from samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt rename to samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt index 77066de4e55..20ac25b1250 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -6,7 +6,7 @@ enum class ResponseType { interface Response -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { +abstract class ApiResponse(val responseType: ResponseType): Response { abstract val statusCode: Int abstract val headers: Map> } @@ -15,29 +15,29 @@ class Success( val data: T?, override val statusCode: Int = -1, override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) +): ApiResponse(ResponseType.Success) class Informational( val statusText: String, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) +) : ApiResponse(ResponseType.Informational) class Redirection( override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) +) : ApiResponse(ResponseType.Redirection) class ClientError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) +) : ApiResponse(ResponseType.ClientError) class ServerError( val message: String? = null, val body: Any? = null, override val statusCode: Int = -1, override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 97% rename from samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 617982fdfe3..5f584a05ac0 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -32,7 +32,7 @@ import java.io.Serializable * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-okhttp3/.openapi-generator/FILES b/samples/client/petstore/kotlin-okhttp3/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-okhttp3/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-okhttp3/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-okhttp3/README.md b/samples/client/petstore/kotlin-okhttp3/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-okhttp3/README.md +++ b/samples/client/petstore/kotlin-okhttp3/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-okhttp3/docs/ApiResponse.md b/samples/client/petstore/kotlin-okhttp3/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md b/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md +++ b/samples/client/petstore/kotlin-okhttp3/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c3426fbd0a4..b774e10e7b8 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d3ac6493d6e..17646c1df12 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -158,7 +158,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index d430296dc4d..15c64ef38ac 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -31,7 +31,7 @@ import com.squareup.moshi.Json * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES index cc7132b2874..247ff9a7238 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES @@ -40,8 +40,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/StringBuilderAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/URLAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md index 341e51a324e..8fb632221cc 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/ApiResponse.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/PetApi.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/PetApi.md index cd0240ec989..3997c8cf390 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/PetApi.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/docs/PetApi.md @@ -294,7 +294,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload -val result : ApiResponse = webService.uploadFile(petId, additionalMetadata, file) +val result : ModelApiResponse = webService.uploadFile(petId, additionalMetadata, file) ``` ### Parameters @@ -307,7 +307,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 1af051c6c7f..d3268ae63d6 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -5,7 +5,7 @@ import retrofit2.http.* import retrofit2.Call import okhttp3.RequestBody -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import okhttp3.MultipartBody @@ -115,10 +115,10 @@ interface PetApi { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ModelApiResponse]> */ @Multipart @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Call + fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Call } diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 97% rename from samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 0773d7f17d9..c898dbd1529 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -34,7 +34,7 @@ import java.io.Serializable * @param message */ @KSerializable -data class ApiResponse ( +data class ModelApiResponse ( @SerialName(value = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/.openapi-generator/FILES b/samples/client/petstore/kotlin-retrofit2-rx3/.openapi-generator/FILES index 04b505d1f17..d84bff350d2 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-retrofit2-rx3/.openapi-generator/FILES @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/README.md b/samples/client/petstore/kotlin-retrofit2-rx3/README.md index 341e51a324e..8fb632221cc 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/README.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/ApiResponse.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/docs/PetApi.md b/samples/client/petstore/kotlin-retrofit2-rx3/docs/PetApi.md index cd0240ec989..3997c8cf390 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/docs/PetApi.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/docs/PetApi.md @@ -294,7 +294,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload -val result : ApiResponse = webService.uploadFile(petId, additionalMetadata, file) +val result : ModelApiResponse = webService.uploadFile(petId, additionalMetadata, file) ``` ### Parameters @@ -307,7 +307,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 8f04b3fd8f9..c174546cae0 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -6,7 +6,7 @@ import okhttp3.RequestBody import io.reactivex.rxjava3.core.Single; import io.reactivex.rxjava3.core.Completable; -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import okhttp3.MultipartBody @@ -116,10 +116,10 @@ interface PetApi { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ModelApiResponse]> */ @Multipart @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Single + fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Single } diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index d430296dc4d..15c64ef38ac 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -31,7 +31,7 @@ import com.squareup.moshi.Json * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-retrofit2/.openapi-generator/FILES b/samples/client/petstore/kotlin-retrofit2/.openapi-generator/FILES index 04b505d1f17..d84bff350d2 100644 --- a/samples/client/petstore/kotlin-retrofit2/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-retrofit2/.openapi-generator/FILES @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExt.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-retrofit2/README.md b/samples/client/petstore/kotlin-retrofit2/README.md index 341e51a324e..8fb632221cc 100644 --- a/samples/client/petstore/kotlin-retrofit2/README.md +++ b/samples/client/petstore/kotlin-retrofit2/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-retrofit2/docs/ApiResponse.md b/samples/client/petstore/kotlin-retrofit2/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-retrofit2/docs/PetApi.md b/samples/client/petstore/kotlin-retrofit2/docs/PetApi.md index cd0240ec989..3997c8cf390 100644 --- a/samples/client/petstore/kotlin-retrofit2/docs/PetApi.md +++ b/samples/client/petstore/kotlin-retrofit2/docs/PetApi.md @@ -294,7 +294,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload -val result : ApiResponse = webService.uploadFile(petId, additionalMetadata, file) +val result : ModelApiResponse = webService.uploadFile(petId, additionalMetadata, file) ``` ### Parameters @@ -307,7 +307,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 1af051c6c7f..d3268ae63d6 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -5,7 +5,7 @@ import retrofit2.http.* import retrofit2.Call import okhttp3.RequestBody -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import okhttp3.MultipartBody @@ -115,10 +115,10 @@ interface PetApi { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ModelApiResponse]> */ @Multipart @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Call + fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String? = null, @Part file: MultipartBody.Part? = null): Call } diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index d430296dc4d..15c64ef38ac 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -31,7 +31,7 @@ import com.squareup.moshi.Json * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-string/.openapi-generator/FILES b/samples/client/petstore/kotlin-string/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-string/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-string/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-string/README.md b/samples/client/petstore/kotlin-string/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-string/README.md +++ b/samples/client/petstore/kotlin-string/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-string/docs/ApiResponse.md b/samples/client/petstore/kotlin-string/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-string/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-string/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-string/docs/PetApi.md b/samples/client/petstore/kotlin-string/docs/PetApi.md index 39f8f0858aa..3173ade5c86 100644 --- a/samples/client/petstore/kotlin-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-string/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index fbadb8eb910..40c875dcdc7 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param apiKey (optional) * @param petId Pet id to delete - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(apiKey: kotlin.String?, petId: kotlin.Long) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(apiKey: kotlin.String?, petId: kotlin.Long) : ApiResponse { val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c218caafae5..7282e53200b 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -161,7 +161,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 97% rename from samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 617982fdfe3..5f584a05ac0 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -32,7 +32,7 @@ import java.io.Serializable * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-threetenbp/.openapi-generator/FILES b/samples/client/petstore/kotlin-threetenbp/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin-threetenbp/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-threetenbp/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin-threetenbp/README.md b/samples/client/petstore/kotlin-threetenbp/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin-threetenbp/README.md +++ b/samples/client/petstore/kotlin-threetenbp/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin-threetenbp/docs/ApiResponse.md b/samples/client/petstore/kotlin-threetenbp/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c3426fbd0a4..b774e10e7b8 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 42e08a49f30..8ae5de40f5d 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -161,7 +161,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 96% rename from samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index a38d613adbe..15c64ef38ac 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -31,7 +31,7 @@ import com.squareup.moshi.Json * @param message */ -internal data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/FILES b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/FILES index c817d802484..113f981ccd5 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/FILES @@ -10,7 +10,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/EnumApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt index 4a5e70c002a..9e39ffb9d00 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.PetEnum import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -78,13 +78,13 @@ class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Get enums * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getEnumWithHttpInfo() : ApiInfrastructureResponse { + fun getEnumWithHttpInfo() : ApiResponse { val localVariableConfig = getEnumRequestConfig() return request( diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 8a9c47045ed..09194ef9271 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -145,7 +145,7 @@ open class ApiClient(val baseUrl: String) { } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin/.openapi-generator/FILES b/samples/client/petstore/kotlin/.openapi-generator/FILES index 16c712325f8..c7a409ac169 100644 --- a/samples/client/petstore/kotlin/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin/.openapi-generator/FILES @@ -19,7 +19,7 @@ src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -33,8 +33,8 @@ src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/ApiResponse.kt src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt diff --git a/samples/client/petstore/kotlin/README.md b/samples/client/petstore/kotlin/README.md index 97f9b816648..5ecae07a7ad 100644 --- a/samples/client/petstore/kotlin/README.md +++ b/samples/client/petstore/kotlin/README.md @@ -60,8 +60,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.client.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) diff --git a/samples/client/petstore/kotlin/docs/ApiResponse.md b/samples/client/petstore/kotlin/docs/ApiResponse.md index 6b4c6bf2779..12f08d5cdef 100644 --- a/samples/client/petstore/kotlin/docs/ApiResponse.md +++ b/samples/client/petstore/kotlin/docs/ApiResponse.md @@ -1,5 +1,5 @@ -# ApiResponse +# ModelApiResponse ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/kotlin/docs/PetApi.md b/samples/client/petstore/kotlin/docs/PetApi.md index 403e57a4b33..038c57e68ec 100644 --- a/samples/client/petstore/kotlin/docs/PetApi.md +++ b/samples/client/petstore/kotlin/docs/PetApi.md @@ -354,7 +354,7 @@ Configure petstore_auth: # **uploadFile** -> ApiResponse uploadFile(petId, additionalMetadata, file) +> ModelApiResponse uploadFile(petId, additionalMetadata, file) uploads an image @@ -369,7 +369,7 @@ val petId : kotlin.Long = 789 // kotlin.Long | ID of pet to update val additionalMetadata : kotlin.String = additionalMetadata_example // kotlin.String | Additional data to pass to server val file : java.io.File = BINARY_DATA_HERE // java.io.File | file to upload try { - val result : ApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) + val result : ModelApiResponse = apiInstance.uploadFile(petId, additionalMetadata, file) println(result) } catch (e: ClientException) { println("4xx response calling PetApi#uploadFile") @@ -390,7 +390,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c3426fbd0a4..b774e10e7b8 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -22,11 +22,11 @@ package org.openapitools.client.apis import java.io.IOException -import org.openapitools.client.models.ApiResponse +import org.openapitools.client.models.ModelApiResponse import org.openapitools.client.models.Pet import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -80,12 +80,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Add a new pet to the store * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun addPetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun addPetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = addPetRequestConfig(body = body) return request( @@ -150,12 +150,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param petId Pet id to delete * @param apiKey (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiInfrastructureResponse { + fun deletePetWithHttpInfo(petId: kotlin.Long, apiKey: kotlin.String?) : ApiResponse { val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) return request( @@ -220,13 +220,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByStatusWithHttpInfo(status: kotlin.collections.List) : ApiResponse?> { val localVariableConfig = findPetsByStatusRequestConfig(status = status) return request>( @@ -295,14 +295,14 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiInfrastructureResponse?> { + fun findPetsByTagsWithHttpInfo(tags: kotlin.collections.List) : ApiResponse?> { @Suppress("DEPRECATION") val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) @@ -371,13 +371,13 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Find pet by ID * Returns a single pet * @param petId ID of pet to return - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiInfrastructureResponse { + fun getPetByIdWithHttpInfo(petId: kotlin.Long) : ApiResponse { val localVariableConfig = getPetByIdRequestConfig(petId = petId) return request( @@ -440,12 +440,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Update an existing pet * * @param body Pet object that needs to be added to the store - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithHttpInfo(body: Pet) : ApiInfrastructureResponse { + fun updatePetWithHttpInfo(body: Pet) : ApiResponse { val localVariableConfig = updatePetRequestConfig(body = body) return request( @@ -512,12 +512,12 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiInfrastructureResponse { + fun updatePetWithFormWithHttpInfo(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : ApiResponse { val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) return request, Unit>( @@ -553,7 +553,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiResponse + * @return ModelApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception * @throws UnsupportedOperationException If the API returns an informational or redirection response @@ -562,11 +562,11 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ModelApiResponse { val localVarResponse = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse + ResponseType.Success -> (localVarResponse as Success<*>).data as ModelApiResponse ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") ResponseType.ClientError -> { @@ -586,16 +586,16 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiInfrastructureResponse { + fun uploadFileWithHttpInfo(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - return request, ApiResponse>( + return request, ModelApiResponse>( localVariableConfig ) } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index e905c41311d..d9cc68f0042 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.Order import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiInfrastructureResponse { + fun deleteOrderWithHttpInfo(orderId: kotlin.String) : ApiResponse { val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) return request( @@ -145,13 +145,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return ApiInfrastructureResponse?> + * @return ApiResponse?> * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getInventoryWithHttpInfo() : ApiInfrastructureResponse?> { + fun getInventoryWithHttpInfo() : ApiResponse?> { val localVariableConfig = getInventoryRequestConfig() return request>( @@ -214,13 +214,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiInfrastructureResponse { + fun getOrderByIdWithHttpInfo(orderId: kotlin.Long) : ApiResponse { val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) return request( @@ -284,13 +284,13 @@ class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) * Place an order for a pet * * @param body order placed for purchasing the pet - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun placeOrderWithHttpInfo(body: Order) : ApiInfrastructureResponse { + fun placeOrderWithHttpInfo(body: Order) : ApiResponse { val localVariableConfig = placeOrderRequestConfig(body = body) return request( diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 9381925680a..efbff792815 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -25,7 +25,7 @@ import java.io.IOException import org.openapitools.client.models.User import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiInfrastructureResponse +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException @@ -79,12 +79,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Create user * This can only be done by the logged in user. * @param body Created user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUserWithHttpInfo(body: User) : ApiInfrastructureResponse { + fun createUserWithHttpInfo(body: User) : ApiResponse { val localVariableConfig = createUserRequestConfig(body = body) return request( @@ -146,12 +146,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) return request, Unit>( @@ -213,12 +213,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Creates list of users with given input array * * @param body List of user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiInfrastructureResponse { + fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse { val localVariableConfig = createUsersWithListInputRequestConfig(body = body) return request, Unit>( @@ -280,12 +280,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun deleteUserWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun deleteUserWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = deleteUserRequestConfig(username = username) return request( @@ -348,13 +348,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiInfrastructureResponse { + fun getUserByNameWithHttpInfo(username: kotlin.String) : ApiResponse { val localVariableConfig = getUserByNameRequestConfig(username = username) return request( @@ -420,13 +420,13 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * * @param username The user name for login * @param password The password for login in clear text - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, IOException::class) - fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiInfrastructureResponse { + fun loginUserWithHttpInfo(username: kotlin.String, password: kotlin.String) : ApiResponse { val localVariableConfig = loginUserRequestConfig(username = username, password = password) return request( @@ -492,12 +492,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { /** * Logs out current logged in user session * - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun logoutUserWithHttpInfo() : ApiInfrastructureResponse { + fun logoutUserWithHttpInfo() : ApiResponse { val localVariableConfig = logoutUserRequestConfig() return request( @@ -560,12 +560,12 @@ class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object - * @return ApiInfrastructureResponse + * @return ApiResponse * @throws IllegalStateException If the request is not correctly configured * @throws IOException Rethrows the OkHttp execute method exception */ @Throws(IllegalStateException::class, IOException::class) - fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiInfrastructureResponse { + fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse { val localVariableConfig = updateUserRequestConfig(username = username, body = body) return request( diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c218caafae5..7282e53200b 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -161,7 +161,7 @@ open class ApiClient(val baseUrl: String) { } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") // take authMethod from operation diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt similarity index 97% rename from samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt rename to samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt index 617982fdfe3..5f584a05ac0 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ApiResponse.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt @@ -32,7 +32,7 @@ import java.io.Serializable * @param message */ -data class ApiResponse ( +data class ModelApiResponse ( @Json(name = "code") val code: kotlin.Int? = null, diff --git a/samples/server/petstore/kotlin-server/ktor/.openapi-generator/FILES b/samples/server/petstore/kotlin-server/ktor/.openapi-generator/FILES index 10c026f11ff..79943171ff2 100644 --- a/samples/server/petstore/kotlin-server/ktor/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-server/ktor/.openapi-generator/FILES @@ -10,8 +10,8 @@ src/main/kotlin/org/openapitools/server/apis/PetApi.kt src/main/kotlin/org/openapitools/server/apis/StoreApi.kt src/main/kotlin/org/openapitools/server/apis/UserApi.kt src/main/kotlin/org/openapitools/server/infrastructure/ApiKeyAuth.kt -src/main/kotlin/org/openapitools/server/models/ApiResponse.kt src/main/kotlin/org/openapitools/server/models/Category.kt +src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/server/models/Order.kt src/main/kotlin/org/openapitools/server/models/Pet.kt src/main/kotlin/org/openapitools/server/models/Tag.kt diff --git a/samples/server/petstore/kotlin-server/ktor/README.md b/samples/server/petstore/kotlin-server/ktor/README.md index d78e27dd2ea..6ec361da3cd 100644 --- a/samples/server/petstore/kotlin-server/ktor/README.md +++ b/samples/server/petstore/kotlin-server/ktor/README.md @@ -74,8 +74,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [org.openapitools.server.models.ApiResponse](docs/ApiResponse.md) - [org.openapitools.server.models.Category](docs/Category.md) + - [org.openapitools.server.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.server.models.Order](docs/Order.md) - [org.openapitools.server.models.Pet](docs/Pet.md) - [org.openapitools.server.models.Tag](docs/Tag.md) diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt index 95f5d7fb880..0a4b29e2cab 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/apis/PetApi.kt @@ -20,7 +20,7 @@ import org.openapitools.server.Paths import io.ktor.locations.* import io.ktor.routing.* import org.openapitools.server.infrastructure.ApiPrincipal -import org.openapitools.server.models.ApiResponse +import org.openapitools.server.models.ModelApiResponse import org.openapitools.server.models.Pet @KtorExperimentalLocationsAPI diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt similarity index 96% rename from samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt rename to samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt index 14f50dbb9ad..5548175d904 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ApiResponse.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/ModelApiResponse.kt @@ -19,7 +19,7 @@ import java.io.Serializable * @param type * @param message */ -data class ApiResponse( +data class ModelApiResponse( val code: kotlin.Int? = null, val type: kotlin.String? = null, val message: kotlin.String? = null From d5979d3180c480965ccdc1ea5faaa9e88ebfd856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Cerm=C3=A1k?= Date: Tue, 14 Dec 2021 08:44:22 +0100 Subject: [PATCH 10/18] [Protobuf-Schema] Added nullable (#11073) --- .../codegen/languages/ProtobufSchemaCodegen.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java index 5f55e9d47f0..d842a935a0f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java @@ -254,6 +254,9 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf if (Boolean.TRUE.equals(var.isArray)) { var.vendorExtensions.put("x-protobuf-type", "repeated"); } + else if (Boolean.TRUE.equals(var.isNullable && var.isPrimitiveType)) { + var.vendorExtensions.put("x-protobuf-type", "optional"); + } // add x-protobuf-data-type // ref: https://developers.google.com/protocol-buffers/docs/proto3 @@ -500,9 +503,14 @@ public class ProtobufSchemaCodegen extends DefaultCodegen implements CodegenConf int index = 1; for (CodegenParameter p : op.allParams) { // add x-protobuf-type: repeated if it's an array + if (Boolean.TRUE.equals(p.isArray)) { p.vendorExtensions.put("x-protobuf-type", "repeated"); - } else if (Boolean.TRUE.equals(p.isMap)) { + } + else if (Boolean.TRUE.equals(p.isNullable && p.isPrimitiveType)) { + p.vendorExtensions.put("x-protobuf-type", "optional"); + } + else if (Boolean.TRUE.equals(p.isMap)) { LOGGER.warn("Map parameter (name: {}, operation ID: {}) not yet supported", p.paramName, op.operationId); } From 5416e92d19236d05e23a17e3a974ebe19072e2d3 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Tue, 14 Dec 2021 07:58:19 +0000 Subject: [PATCH 11/18] [swift5][client] add support for async/await in iOS 13 and above (#11109) --- .../src/main/resources/swift5/api.mustache | 2 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 +++++++++---------- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 +++++++------- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +++---- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 ++++++------- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 5ae1f5513d2..2351c74fd9b 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -197,7 +197,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#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}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) async throws{{#returnType}} -> {{{returnType}}}{{/returnType}} { var requestTask: RequestTask? return try await withTaskCancellationHandler { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bd8044516fe..bbf14432b19 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -19,7 +19,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Client */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Client { var requestTask: RequestTask? return try await withTaskCancellationHandler { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 1b105b037f6..acc67addbbd 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -18,7 +18,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Bool */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Bool { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -73,7 +73,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: OuterComposite */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> OuterComposite { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -128,7 +128,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Double */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Double { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -183,7 +183,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: String */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> String { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -238,7 +238,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -294,7 +294,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -353,7 +353,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Client */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Client { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -423,7 +423,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -588,7 +588,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -671,7 +671,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -740,7 +740,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -797,7 +797,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 6313692d6d4..f950419aeac 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -19,7 +19,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Client */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Client { var requestTask: RequestTask? return try await withTaskCancellationHandler { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index d541b28938d..044d96d758d 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -19,7 +19,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -79,7 +79,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -151,7 +151,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: [Pet] */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [Status_findPetsByStatus], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> [Pet] { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -215,7 +215,7 @@ open class PetAPI { - returns: [Pet] */ @available(*, deprecated, message: "This operation is deprecated.") - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> [Pet] { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -279,7 +279,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Pet */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Pet { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -342,7 +342,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -403,7 +403,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -475,7 +475,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: ApiResponse */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @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, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> ApiResponse { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -547,7 +547,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: ApiResponse */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> ApiResponse { var requestTask: RequestTask? return try await withTaskCancellationHandler { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 510311783b9..1548fa8814c 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -19,7 +19,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -78,7 +78,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: [String: Int] */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> [String: Int] { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -137,7 +137,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Order */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Order { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -197,7 +197,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Order */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> Order { var requestTask: RequestTask? return try await withTaskCancellationHandler { diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 7cc9a77f01b..b44a7cdc721 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -19,7 +19,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -76,7 +76,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -132,7 +132,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -188,7 +188,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -248,7 +248,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: User */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> User { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -308,7 +308,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: String */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws -> String { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -369,7 +369,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { @@ -425,7 +425,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Void */ - @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) async throws { var requestTask: RequestTask? return try await withTaskCancellationHandler { From eb224db540443792caba44c51c72b747d3a2d7a0 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Tue, 14 Dec 2021 08:03:12 +0000 Subject: [PATCH 12/18] [kotlin][client] remove old Date usage (#11082) * [kotlin][client] remove old Date usage * [kotlin][client] remove old Date usage --- .../kotlin-spring-boot-modelMutable.yaml | 0 .../{other => }/kotlin-vertx-vertx.yaml | 0 .../kotlin-jvm-retrofit2-coroutines.yaml | 0 .../kotlin-jvm-retrofit2-rx.yaml | 0 ...m-retrofit2-rx2-kotlinx_serialization.yaml | 0 .../kotlin-jvm-retrofit2-rx2.yaml | 0 .../{openapi3 => }/kotlin-multiplatform.yaml | 0 .../kotlin-spring-boot-reactive.yaml | 0 .../{openapi3 => }/kotlin-spring-boot.yaml | 0 bin/configs/other/{openapi3 => }/kotlin.yaml | 0 .../languages/KotlinClientCodegen.java | 3 - .../infrastructure/DateAdapter.kt.mustache | 67 --- .../infrastructure/Serializer.kt.mustache | 2 - .../infrastructure/ApiClient.kt.mustache | 3 +- .../client/infrastructure/ApiClient.kt | 3 +- .../kotlin-gson/.openapi-generator/FILES | 1 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 33 -- .../client/infrastructure/DateAdapter.kt | 37 -- .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 35 -- .../infrastructure/LocalDateTimeAdapter.kt | 35 -- .../infrastructure/OffsetDateTimeAdapter.kt | 35 -- .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 23 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/DateAdapter.kt | 37 -- .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 3 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 18 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../kotlin-petstore-jackson.kotlin_module | Bin 134 -> 0 bytes .../main/org/openapitools/ApplicationKt.class | Bin 3936 -> 0 bytes .../client/apis/PetApi$WhenMappings.class | Bin 1458 -> 0 bytes .../org/openapitools/client/apis/PetApi.class | Bin 82237 -> 0 bytes .../client/apis/StoreApi$WhenMappings.class | Bin 1040 -> 0 bytes .../openapitools/client/apis/StoreApi.class | Bin 42521 -> 0 bytes .../client/apis/UserApi$WhenMappings.class | Bin 1459 -> 0 bytes .../openapitools/client/apis/UserApi.class | Bin 79974 -> 0 bytes ...tionsKt$defaultMultiValueConverter$1.class | Bin 1439 -> 0 bytes .../infrastructure/ApiAbstractionsKt.class | Bin 5327 -> 0 bytes .../ApiClient$Companion$client$2.class | Bin 1445 -> 0 bytes .../infrastructure/ApiClient$Companion.class | Bin 4330 -> 0 bytes .../ApiClient$WhenMappings.class | Bin 768 -> 0 bytes .../client/infrastructure/ApiClient.class | Bin 31155 -> 0 bytes .../ApiInfrastructureResponse.class | Bin 1608 -> 0 bytes .../ApplicationDelegates$SetOnce.class | Bin 3186 -> 0 bytes .../infrastructure/ApplicationDelegates.class | Bin 1711 -> 0 bytes .../client/infrastructure/ClientError.class | Bin 2831 -> 0 bytes .../ClientException$Companion.class | Bin 945 -> 0 bytes .../infrastructure/ClientException.class | Bin 1622 -> 0 bytes .../client/infrastructure/Informational.class | Bin 2740 -> 0 bytes .../client/infrastructure/Redirection.class | Bin 2479 -> 0 bytes .../client/infrastructure/RequestConfig.class | Bin 5445 -> 0 bytes .../client/infrastructure/RequestMethod.class | Bin 1652 -> 0 bytes .../infrastructure/ResponseExtensionsKt.class | Bin 1499 -> 0 bytes .../client/infrastructure/ResponseType.class | Bin 1580 -> 0 bytes .../client/infrastructure/Serializer.class | Bin 2066 -> 0 bytes .../client/infrastructure/ServerError.class | Bin 2858 -> 0 bytes .../ServerException$Companion.class | Bin 945 -> 0 bytes .../infrastructure/ServerException.class | Bin 1622 -> 0 bytes .../client/infrastructure/Success.class | Bin 2686 -> 0 bytes .../client/models/ApiResponse.class | Bin 3611 -> 0 bytes .../openapitools/client/models/Category.class | Bin 3046 -> 0 bytes .../client/models/Order$Status.class | Bin 2115 -> 0 bytes .../openapitools/client/models/Order.class | Bin 5914 -> 0 bytes .../client/models/Pet$Status.class | Bin 2093 -> 0 bytes .../org/openapitools/client/models/Pet.class | Bin 6141 -> 0 bytes .../org/openapitools/client/models/Tag.class | Bin 3011 -> 0 bytes .../org/openapitools/client/models/User.class | Bin 6313 -> 0 bytes .../kotlin/compileKotlin/build-history.bin | Bin 31 -> 0 bytes .../caches-jvm/inputs/source-to-output.tab | Bin 4096 -> 0 bytes .../inputs/source-to-output.tab.keystream | Bin 4096 -> 0 bytes .../inputs/source-to-output.tab.keystream.len | Bin 8 -> 0 bytes .../inputs/source-to-output.tab.len | Bin 8 -> 0 bytes .../inputs/source-to-output.tab.values.at | Bin 11858 -> 0 bytes .../caches-jvm/inputs/source-to-output.tab_i | Bin 32768 -> 0 bytes .../inputs/source-to-output.tab_i.len | Bin 8 -> 0 bytes .../jvm/kotlin/class-fq-name-to-source.tab | Bin 4096 -> 0 bytes .../class-fq-name-to-source.tab.keystream | Bin 4096 -> 0 bytes .../class-fq-name-to-source.tab.keystream.len | Bin 8 -> 0 bytes .../kotlin/class-fq-name-to-source.tab.len | Bin 8 -> 0 bytes .../class-fq-name-to-source.tab.values.at | Bin 5659 -> 0 bytes .../jvm/kotlin/class-fq-name-to-source.tab_i | Bin 32768 -> 0 bytes .../kotlin/class-fq-name-to-source.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/constants.tab | Bin 4096 -> 0 bytes .../jvm/kotlin/constants.tab.keystream | Bin 4096 -> 0 bytes .../jvm/kotlin/constants.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/constants.tab.len | Bin 8 -> 0 bytes .../jvm/kotlin/constants.tab.values.at | Bin 529 -> 0 bytes .../caches-jvm/jvm/kotlin/constants.tab_i | Bin 32768 -> 0 bytes .../caches-jvm/jvm/kotlin/constants.tab_i.len | Bin 8 -> 0 bytes .../jvm/kotlin/inline-functions.tab | Bin 4096 -> 0 bytes .../jvm/kotlin/inline-functions.tab.keystream | Bin 4096 -> 0 bytes .../kotlin/inline-functions.tab.keystream.len | Bin 8 -> 0 bytes .../jvm/kotlin/inline-functions.tab.len | Bin 8 -> 0 bytes .../jvm/kotlin/inline-functions.tab.values.at | Bin 670 -> 0 bytes .../jvm/kotlin/inline-functions.tab_i | Bin 32768 -> 0 bytes .../jvm/kotlin/inline-functions.tab_i.len | Bin 8 -> 0 bytes .../jvm/kotlin/internal-name-to-source.tab | Bin 4096 -> 0 bytes .../internal-name-to-source.tab.keystream | Bin 4096 -> 0 bytes .../internal-name-to-source.tab.keystream.len | Bin 8 -> 0 bytes .../kotlin/internal-name-to-source.tab.len | Bin 8 -> 0 bytes .../internal-name-to-source.tab.values.at | Bin 7371 -> 0 bytes .../jvm/kotlin/internal-name-to-source.tab_i | Bin 32768 -> 0 bytes .../kotlin/internal-name-to-source.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/package-parts.tab | Bin 4096 -> 0 bytes .../jvm/kotlin/package-parts.tab.keystream | Bin 4096 -> 0 bytes .../kotlin/package-parts.tab.keystream.len | Bin 8 -> 0 bytes .../jvm/kotlin/package-parts.tab.len | Bin 8 -> 0 bytes .../jvm/kotlin/package-parts.tab.values.at | Bin 58 -> 0 bytes .../caches-jvm/jvm/kotlin/package-parts.tab_i | Bin 32768 -> 0 bytes .../jvm/kotlin/package-parts.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/proto.tab | Bin 4096 -> 0 bytes .../caches-jvm/jvm/kotlin/proto.tab.keystream | Bin 4096 -> 0 bytes .../jvm/kotlin/proto.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/proto.tab.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/proto.tab.values.at | Bin 18862 -> 0 bytes .../caches-jvm/jvm/kotlin/proto.tab_i | Bin 32768 -> 0 bytes .../caches-jvm/jvm/kotlin/proto.tab_i.len | Bin 8 -> 0 bytes .../jvm/kotlin/source-to-classes.tab | Bin 4096 -> 0 bytes .../kotlin/source-to-classes.tab.keystream | Bin 4096 -> 0 bytes .../source-to-classes.tab.keystream.len | Bin 8 -> 0 bytes .../jvm/kotlin/source-to-classes.tab.len | Bin 8 -> 0 bytes .../kotlin/source-to-classes.tab.values.at | Bin 2331 -> 0 bytes .../jvm/kotlin/source-to-classes.tab_i | Bin 32768 -> 0 bytes .../jvm/kotlin/source-to-classes.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/subtypes.tab | Bin 4096 -> 0 bytes .../jvm/kotlin/subtypes.tab.keystream | Bin 4096 -> 0 bytes .../jvm/kotlin/subtypes.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/subtypes.tab.len | Bin 8 -> 0 bytes .../jvm/kotlin/subtypes.tab.values.at | Bin 793 -> 0 bytes .../caches-jvm/jvm/kotlin/subtypes.tab_i | Bin 32768 -> 0 bytes .../caches-jvm/jvm/kotlin/subtypes.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/supertypes.tab | Bin 4096 -> 0 bytes .../jvm/kotlin/supertypes.tab.keystream | Bin 4096 -> 0 bytes .../jvm/kotlin/supertypes.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/jvm/kotlin/supertypes.tab.len | Bin 8 -> 0 bytes .../jvm/kotlin/supertypes.tab.values.at | Bin 689 -> 0 bytes .../caches-jvm/jvm/kotlin/supertypes.tab_i | Bin 32768 -> 0 bytes .../jvm/kotlin/supertypes.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/counters.tab | 2 - .../caches-jvm/lookups/file-to-id.tab | Bin 4096 -> 0 bytes .../lookups/file-to-id.tab.keystream | Bin 4096 -> 0 bytes .../lookups/file-to-id.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/file-to-id.tab.len | Bin 8 -> 0 bytes .../lookups/file-to-id.tab.values.at | Bin 163 -> 0 bytes .../caches-jvm/lookups/file-to-id.tab_i | Bin 32768 -> 0 bytes .../caches-jvm/lookups/file-to-id.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/id-to-file.tab | Bin 4096 -> 0 bytes .../lookups/id-to-file.tab.keystream | Bin 4096 -> 0 bytes .../lookups/id-to-file.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/id-to-file.tab.len | Bin 8 -> 0 bytes .../lookups/id-to-file.tab.values.at | Bin 3654 -> 0 bytes .../caches-jvm/lookups/id-to-file.tab_i | Bin 32768 -> 0 bytes .../caches-jvm/lookups/id-to-file.tab_i.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/lookups.tab | Bin 16384 -> 0 bytes .../caches-jvm/lookups/lookups.tab.keystream | Bin 12288 -> 0 bytes .../lookups/lookups.tab.keystream.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/lookups.tab.len | Bin 8 -> 0 bytes .../caches-jvm/lookups/lookups.tab.values.at | Bin 12507 -> 0 bytes .../caches-jvm/lookups/lookups.tab_i | Bin 32768 -> 0 bytes .../caches-jvm/lookups/lookups.tab_i.len | Bin 8 -> 0 bytes .../build/kotlin/compileKotlin/last-build.bin | Bin 81 -> 0 bytes .../org/openapitools/client/Application.kt | 20 - .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/PetApi.kt | 494 ------------------ .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 245 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../.openapi-generator/FILES | 1 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 33 -- .../client/infrastructure/DateAdapter.kt | 37 -- .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 35 -- .../infrastructure/LocalDateTimeAdapter.kt | 35 -- .../infrastructure/OffsetDateTimeAdapter.kt | 35 -- .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 23 - .../openapitools/client/models/ApiResponse.kt | 38 -- .../openapitools/client/models/Category.kt | 35 -- .../org/openapitools/client/models/Order.kt | 58 -- .../org/openapitools/client/models/Pet.kt | 60 --- .../org/openapitools/client/models/Tag.kt | 35 -- .../org/openapitools/client/models/User.kt | 54 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/DateAdapter.kt | 37 -- .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 19 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 33 -- .../openapitools/client/models/Category.kt | 30 -- .../org/openapitools/client/models/Order.kt | 55 -- .../org/openapitools/client/models/Pet.kt | 57 -- .../org/openapitools/client/models/Tag.kt | 30 -- .../org/openapitools/client/models/User.kt | 49 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 38 -- .../openapitools/client/models/Category.kt | 35 -- .../org/openapitools/client/models/Order.kt | 58 -- .../org/openapitools/client/models/Pet.kt | 60 --- .../org/openapitools/client/models/Tag.kt | 35 -- .../org/openapitools/client/models/User.kt | 54 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 249 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../.openapi-generator/FILES | 1 - .../client/infrastructure/DateAdapter.kt | 28 - .../client/infrastructure/Serializer.kt | 2 - .../org/openapitools/client/apis/PetApi.kt | 125 ----- .../org/openapitools/client/apis/StoreApi.kt | 63 --- .../org/openapitools/client/apis/UserApi.kt | 114 ---- .../openapitools/client/auth/ApiKeyAuth.kt | 50 -- .../org/openapitools/client/auth/OAuth.kt | 151 ------ .../org/openapitools/client/auth/OAuthFlow.kt | 5 - .../client/auth/OAuthOkHttpClient.kt | 61 --- .../client/infrastructure/ApiClient.kt | 203 ------- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../infrastructure/CollectionFormats.kt | 56 -- .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/ResponseExt.kt | 16 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../org/openapitools/client/apis/PetApi.kt | 124 ----- .../org/openapitools/client/apis/StoreApi.kt | 62 --- .../org/openapitools/client/apis/UserApi.kt | 113 ---- .../openapitools/client/auth/ApiKeyAuth.kt | 50 -- .../org/openapitools/client/auth/OAuth.kt | 151 ------ .../org/openapitools/client/auth/OAuthFlow.kt | 5 - .../client/auth/OAuthOkHttpClient.kt | 61 --- .../client/infrastructure/ApiClient.kt | 200 ------- .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../infrastructure/CollectionFormats.kt | 56 -- .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/ResponseExt.kt | 16 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 38 -- .../openapitools/client/models/Category.kt | 35 -- .../org/openapitools/client/models/Order.kt | 58 -- .../org/openapitools/client/models/Pet.kt | 60 --- .../org/openapitools/client/models/Tag.kt | 35 -- .../org/openapitools/client/models/User.kt | 54 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 32 -- .../openapitools/client/models/Category.kt | 29 - .../org/openapitools/client/models/Order.kt | 54 -- .../org/openapitools/client/models/Pet.kt | 56 -- .../org/openapitools/client/models/Tag.kt | 29 - .../org/openapitools/client/models/User.kt | 48 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/EnumApi.kt | 89 ---- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 232 -------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../org/openapitools/client/models/PetEnum.kt | 43 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../org/openapitools/client/apis/PetApi.kt | 492 ----------------- .../org/openapitools/client/apis/StoreApi.kt | 253 --------- .../org/openapitools/client/apis/UserApi.kt | 476 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 251 --------- .../ApiInfrastructureResponse.kt | 43 -- .../infrastructure/ApplicationDelegates.kt | 29 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/RequestConfig.kt | 17 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 21 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../openapitools/client/models/ApiResponse.kt | 38 -- .../openapitools/client/models/Category.kt | 35 -- .../org/openapitools/client/models/Order.kt | 58 -- .../org/openapitools/client/models/Pet.kt | 60 --- .../org/openapitools/client/models/Tag.kt | 35 -- .../org/openapitools/client/models/User.kt | 54 -- .../client/infrastructure/ApiClient.kt | 3 +- .../infrastructure/ApplicationDelegates.kt | 29 - .../ktor/.openapi-generator-ignore | 22 +- .../org/openapitools/model/InlineObject.kt | 30 -- .../org/openapitools/model/InlineObject1.kt | 31 -- .../.openapi-generator/FILES | 6 +- .../.openapi-generator/VERSION | 2 +- .../build.gradle.kts | 8 +- .../kotlin-springboot-modelMutable/pom.xml | 66 +-- .../settings.gradle | 26 +- .../api/{PetApi.kt => PetApiController.kt} | 24 +- .../org/openapitools/api/PetApiService.kt | 88 +++- .../{StoreApi.kt => StoreApiController.kt} | 12 +- .../org/openapitools/api/StoreApiService.kt | 43 +- .../api/{UserApi.kt => UserApiController.kt} | 24 +- .../org/openapitools/api/UserApiService.kt | 82 ++- .../kotlin/org/openapitools/api/PetApiTest.kt | 156 +++--- .../org/openapitools/api/StoreApiTest.kt | 70 ++- .../org/openapitools/api/UserApiTest.kt | 146 +++--- .../kotlin/org/openapitools/api/PetApiTest.kt | 156 +++--- .../org/openapitools/api/StoreApiTest.kt | 70 ++- .../org/openapitools/api/UserApiTest.kt | 146 +++--- .../kotlin/org/openapitools/api/PetApiTest.kt | 156 +++--- .../org/openapitools/api/StoreApiTest.kt | 70 ++- .../org/openapitools/api/UserApiTest.kt | 146 +++--- .../kotlin/vertx/.openapi-generator/VERSION | 2 +- samples/server/petstore/kotlin/vertx/pom.xml | 6 +- .../openapitools/server/api/model/Order.kt | 2 +- 515 files changed, 816 insertions(+), 26447 deletions(-) rename bin/configs/{other => }/kotlin-spring-boot-modelMutable.yaml (100%) rename bin/configs/{other => }/kotlin-vertx-vertx.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-jvm-retrofit2-coroutines.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-jvm-retrofit2-rx.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-jvm-retrofit2-rx2-kotlinx_serialization.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-jvm-retrofit2-rx2.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-multiplatform.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-spring-boot-reactive.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin-spring-boot.yaml (100%) rename bin/configs/other/{openapi3 => }/kotlin.yaml (100%) delete mode 100644 modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/DateAdapter.kt.mustache delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/META-INF/kotlin-petstore-jackson.kotlin_module delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/ApplicationKt.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/PetApi$WhenMappings.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/PetApi.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/StoreApi$WhenMappings.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/StoreApi.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/UserApi$WhenMappings.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/UserApi.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiAbstractionsKt$defaultMultiValueConverter$1.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiAbstractionsKt.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion$client$2.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$WhenMappings.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApplicationDelegates$SetOnce.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApplicationDelegates.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ClientError.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ClientException$Companion.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ClientException.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Informational.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Redirection.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/RequestConfig.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/RequestMethod.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ResponseExtensionsKt.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ResponseType.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Serializer.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ServerError.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ServerException$Companion.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ServerException.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Success.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/ApiResponse.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Category.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Order$Status.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Order.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Pet$Status.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Pet.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Tag.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/User.class delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/build-history.bin delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len delete mode 100644 samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/last-build.bin delete mode 100644 samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/Application.kt delete mode 100644 samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt delete mode 100644 samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt delete mode 100644 samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt delete mode 100644 samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt delete mode 100644 samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject.kt delete mode 100644 samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject1.kt rename samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/{PetApi.kt => PetApiController.kt} (95%) rename samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/{StoreApi.kt => StoreApiController.kt} (94%) rename samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/{UserApi.kt => UserApiController.kt} (92%) diff --git a/bin/configs/other/kotlin-spring-boot-modelMutable.yaml b/bin/configs/kotlin-spring-boot-modelMutable.yaml similarity index 100% rename from bin/configs/other/kotlin-spring-boot-modelMutable.yaml rename to bin/configs/kotlin-spring-boot-modelMutable.yaml diff --git a/bin/configs/other/kotlin-vertx-vertx.yaml b/bin/configs/kotlin-vertx-vertx.yaml similarity index 100% rename from bin/configs/other/kotlin-vertx-vertx.yaml rename to bin/configs/kotlin-vertx-vertx.yaml diff --git a/bin/configs/other/openapi3/kotlin-jvm-retrofit2-coroutines.yaml b/bin/configs/other/kotlin-jvm-retrofit2-coroutines.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-jvm-retrofit2-coroutines.yaml rename to bin/configs/other/kotlin-jvm-retrofit2-coroutines.yaml diff --git a/bin/configs/other/openapi3/kotlin-jvm-retrofit2-rx.yaml b/bin/configs/other/kotlin-jvm-retrofit2-rx.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-jvm-retrofit2-rx.yaml rename to bin/configs/other/kotlin-jvm-retrofit2-rx.yaml diff --git a/bin/configs/other/openapi3/kotlin-jvm-retrofit2-rx2-kotlinx_serialization.yaml b/bin/configs/other/kotlin-jvm-retrofit2-rx2-kotlinx_serialization.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-jvm-retrofit2-rx2-kotlinx_serialization.yaml rename to bin/configs/other/kotlin-jvm-retrofit2-rx2-kotlinx_serialization.yaml diff --git a/bin/configs/other/openapi3/kotlin-jvm-retrofit2-rx2.yaml b/bin/configs/other/kotlin-jvm-retrofit2-rx2.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-jvm-retrofit2-rx2.yaml rename to bin/configs/other/kotlin-jvm-retrofit2-rx2.yaml diff --git a/bin/configs/other/openapi3/kotlin-multiplatform.yaml b/bin/configs/other/kotlin-multiplatform.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-multiplatform.yaml rename to bin/configs/other/kotlin-multiplatform.yaml diff --git a/bin/configs/other/openapi3/kotlin-spring-boot-reactive.yaml b/bin/configs/other/kotlin-spring-boot-reactive.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-spring-boot-reactive.yaml rename to bin/configs/other/kotlin-spring-boot-reactive.yaml diff --git a/bin/configs/other/openapi3/kotlin-spring-boot.yaml b/bin/configs/other/kotlin-spring-boot.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin-spring-boot.yaml rename to bin/configs/other/kotlin-spring-boot.yaml diff --git a/bin/configs/other/openapi3/kotlin.yaml b/bin/configs/other/kotlin.yaml similarity index 100% rename from bin/configs/other/openapi3/kotlin.yaml rename to bin/configs/other/kotlin.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java index 3d2135e03c3..c8d7a87716d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java @@ -493,14 +493,12 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { break; case gson: - supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt")); break; case jackson: - //supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt")); break; case kotlinx_serialization: @@ -511,7 +509,6 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen { supportingFiles.add(new SupportingFile("jvm-common/infrastructure/URLAdapter.kt.mustache", infrastructureFolder, "URLAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigIntegerAdapter.kt.mustache", infrastructureFolder, "BigIntegerAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/BigDecimalAdapter.kt.mustache", infrastructureFolder, "BigDecimalAdapter.kt")); - supportingFiles.add(new SupportingFile("jvm-common/infrastructure/DateAdapter.kt.mustache", infrastructureFolder, "DateAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateAdapter.kt.mustache", infrastructureFolder, "LocalDateAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/LocalDateTimeAdapter.kt.mustache", infrastructureFolder, "LocalDateTimeAdapter.kt")); supportingFiles.add(new SupportingFile("jvm-common/infrastructure/OffsetDateTimeAdapter.kt.mustache", infrastructureFolder, "OffsetDateTimeAdapter.kt")); diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/DateAdapter.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/DateAdapter.kt.mustache deleted file mode 100644 index 8756321c4e0..00000000000 --- a/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/DateAdapter.kt.mustache +++ /dev/null @@ -1,67 +0,0 @@ -package {{packageName}}.infrastructure - -{{#kotlinx_serialization}} -import kotlinx.serialization.KSerializer -import kotlinx.serialization.Serializer -import kotlinx.serialization.encoding.Decoder -import kotlinx.serialization.encoding.Encoder -import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor -import kotlinx.serialization.descriptors.PrimitiveKind -import kotlinx.serialization.descriptors.SerialDescriptor -{{/kotlinx_serialization}} -{{#gson}} -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -{{/gson}} -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale -{{#gson}} - -{{#nonPublicApi}}internal {{/nonPublicApi}}class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Date?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): Date? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return formatter.parse(out.nextString()) - } - } - } -} -{{/gson}} -{{#kotlinx_serialization}} - -@Serializer(forClass = Date::class) -object DateAdapter : KSerializer { - private val df: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault()) - - override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Date", PrimitiveKind.STRING) - - override fun serialize(encoder: Encoder, value: Date) { - encoder.encodeString(df.format(value)) - } - - override fun deserialize(decoder: Decoder): Date { - return df.parse(decoder.decodeString())!! - } -} -{{/kotlinx_serialization}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache index ca5d3288a20..e3e570e7a0c 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache @@ -28,7 +28,6 @@ import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper {{/jackson}} {{#kotlinx_serialization}} -import java.util.Date import java.math.BigDecimal import java.math.BigInteger {{^threetenbp}} @@ -97,7 +96,6 @@ import java.util.concurrent.atomic.AtomicLong val kotlinSerializationAdapters = SerializersModule { contextual(BigDecimal::class, BigDecimalAdapter) contextual(BigInteger::class, BigIntegerAdapter) - contextual(Date::class, DateAdapter) contextual(LocalDate::class, LocalDateAdapter) contextual(LocalDateTime::class, LocalDateTimeAdapter) contextual(OffsetDateTime::class, OffsetDateTimeAdapter) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache index 78c16621cf8..39495761e5a 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/infrastructure/ApiClient.kt.mustache @@ -47,7 +47,6 @@ import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime {{/threetenbp}} -import java.util.Date import java.util.Locale {{#useCoroutines}} import kotlin.coroutines.resume @@ -419,7 +418,7 @@ import com.squareup.moshi.adapter null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 09194ef9271..dc423d8a17d 100644 --- a/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-enum-default-value/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -229,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-gson/.openapi-generator/FILES b/samples/client/petstore/kotlin-gson/.openapi-generator/FILES index d1f6eddcef2..4bfcf9fb54e 100644 --- a/samples/client/petstore/kotlin-gson/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-gson/.openapi-generator/FILES @@ -21,7 +21,6 @@ src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index c8b93b33bf6..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index bcbb1cf8627..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.gson.toJson(content, T::class.java).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.gson.fromJson(bodyContent, T::class.java) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.gson.toJson(value, T::class.java).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 6120b081929..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException - -class ByteArrayAdapter : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: ByteArray?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(String(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): ByteArray? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return out.nextString().toByteArray() - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt deleted file mode 100644 index c5d330ac075..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Date?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): Date? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return formatter.parse(out.nextString()) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index 30ef6697183..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: LocalDate?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): LocalDate? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return LocalDate.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index 3ad781c66ca..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: LocalDateTime?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): LocalDateTime? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return LocalDateTime.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index e615135c9cc..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: OffsetDateTime?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): OffsetDateTime? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return OffsetDateTime.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index b80e0390de2..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.Gson -import com.google.gson.GsonBuilder -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.OffsetDateTime -import java.util.UUID -import java.util.Date - -object Serializer { - @JvmStatic - val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) - .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) - .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) - .registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter()) - - @JvmStatic - val gson: Gson by lazy { - gsonBuilder.create() - } -} diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 54df813fcee..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @SerializedName("code") - val code: kotlin.Int? = null, - @SerializedName("type") - val type: kotlin.String? = null, - @SerializedName("message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index fdefa74fda0..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index 049c89df313..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("petId") - val petId: kotlin.Long? = null, - @SerializedName("quantity") - val quantity: kotlin.Int? = null, - @SerializedName("shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @SerializedName("status") - val status: Order.Status? = null, - @SerializedName("complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @SerializedName(value = "placed") placed("placed"), - @SerializedName(value = "approved") approved("approved"), - @SerializedName(value = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index af29ef2b61b..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.google.gson.annotations.SerializedName - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @SerializedName("name") - val name: kotlin.String, - @SerializedName("photoUrls") - val photoUrls: kotlin.collections.List, - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("category") - val category: Category? = null, - @SerializedName("tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @SerializedName("status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @SerializedName(value = "available") available("available"), - @SerializedName(value = "pending") pending("pending"), - @SerializedName(value = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 28e82b1df68..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 62baf33e927..00000000000 --- a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("username") - val username: kotlin.String? = null, - @SerializedName("firstName") - val firstName: kotlin.String? = null, - @SerializedName("lastName") - val lastName: kotlin.String? = null, - @SerializedName("email") - val email: kotlin.String? = null, - @SerializedName("password") - val password: kotlin.String? = null, - @SerializedName("phone") - val phone: kotlin.String? = null, - /* User Status */ - @SerializedName("userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 5ac6cfd25b7..f25dd2bb9fa 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.google.gson.reflect.TypeToken @@ -247,7 +246,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt deleted file mode 100644 index c5d330ac075..00000000000 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Date?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): Date? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return formatter.parse(out.nextString()) - } - } - } -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index c8b93b33bf6..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 637ca64c247..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.jacksonObjectMapper.writeValueAsString(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.jacksonObjectMapper.readValue(bodyContent, T::class.java) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.jacksonObjectMapper.writeValueAsString(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index fff39c7ac24..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.openapitools.client.infrastructure - - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 8b34e629c4e..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.SerializationFeature -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import com.fasterxml.jackson.annotation.JsonInclude -import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper -import java.util.Date - -object Serializer { - @JvmStatic - val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper() - .registerModule(Jdk8Module()) - .registerModule(JavaTimeModule()) - .setSerializationInclusion(JsonInclude.Include.NON_ABSENT) - .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) -} diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index c341f8ca321..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @field:JsonProperty("code") - val code: kotlin.Int? = null, - @field:JsonProperty("type") - val type: kotlin.String? = null, - @field:JsonProperty("message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index 2ed5390c1f3..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index c7df5b55614..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("petId") - val petId: kotlin.Long? = null, - @field:JsonProperty("quantity") - val quantity: kotlin.Int? = null, - @field:JsonProperty("shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @field:JsonProperty("status") - val status: Order.Status? = null, - @field:JsonProperty("complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: PLACED,APPROVED,DELIVERED - */ - - enum class Status(val value: kotlin.String){ - @JsonProperty(value = "placed") PLACED("placed"), - @JsonProperty(value = "approved") APPROVED("approved"), - @JsonProperty(value = "delivered") DELIVERED("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index be5b168e2d8..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @field:JsonProperty("name") - val name: kotlin.String, - @field:JsonProperty("photoUrls") - val photoUrls: kotlin.collections.List, - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("category") - val category: Category? = null, - @field:JsonProperty("tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @field:JsonProperty("status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: AVAILABLE,PENDING,SOLD - */ - - enum class Status(val value: kotlin.String){ - @JsonProperty(value = "available") AVAILABLE("available"), - @JsonProperty(value = "pending") PENDING("pending"), - @JsonProperty(value = "sold") SOLD("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 7243f42ed7d..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index e8f639e5092..00000000000 --- a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.fasterxml.jackson.annotation.JsonProperty - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @field:JsonProperty("id") - val id: kotlin.Long? = null, - @field:JsonProperty("username") - val username: kotlin.String? = null, - @field:JsonProperty("firstName") - val firstName: kotlin.String? = null, - @field:JsonProperty("lastName") - val lastName: kotlin.String? = null, - @field:JsonProperty("email") - val email: kotlin.String? = null, - @field:JsonProperty("password") - val password: kotlin.String? = null, - @field:JsonProperty("phone") - val phone: kotlin.String? = null, - /* User Status */ - @field:JsonProperty("userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/META-INF/kotlin-petstore-jackson.kotlin_module b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/META-INF/kotlin-petstore-jackson.kotlin_module deleted file mode 100644 index 38c4425da8d5a75423570d04d4b47c016fb8370b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 134 zcmZQzU|?ooU|@t|0WL)@f&8L$z5IgIyu^aclKlLfVj*6~f`XjPC3=~8X+?>}B}JvlC8b5FLV}J3nT|<7equ66Z?SiYkVsH!aRHE->RM5f JnpX@F1pvVZD~A98 diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/ApplicationKt.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/ApplicationKt.class deleted file mode 100644 index d44eb27f99ac8a125e94cd99b920c3a280cbdb98..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3936 zcmbVP`BNL$9sfKDvtlhSfsN%HRbx_PKrE6mPGn5Wz-)rCe z_iKL!5Xb8b4|6A{@q%IN1ygWtx!OpfV3`?RnB1Nc3K&Dnvc9TomTu>?OAE_JhTi%a z>hij2Gx)ns%`+VBx|*y~rG#VJxpSxHgE)kG6+Q$Q)FHtO!+nw~0Cktt)S4@dyn-N! z<3+)6q$JGb+AK*DB+t8dfQWVmNiJC3Mm z!%>Du?*gB(Ov4r$Im6Xbf;+}Y!BlXJp?=7;O)<bTYZZg=N~>@@ifq?S^CP zmNsrI>P1V8aoZJ6F+v_Xn;(XO`Tv5!L-0jQoymq}1&2YK|y2oO{;(FHA;{CBRTK@pK zbJ=i(nTd|`Ty%Dc3!ZcI!qQr_q%=CiSEFa5L_N^AT*w7*mLXNqX51(^hU-Snyq+`M zzC}m3SFE+Xku`Ns?ciW+P;*UTxZ2~7#YknmU+bsec&z`-+4vc)q(YPgKh6*-$4rJ> z7UdMBo2!jg*E09ckvlBY6_*w%R(ECCZufhkk|aX%|?lUWNg?XjzerZrfZ$ z77SXsA|iOi=62LO62w*p-{+YzG&dZ;|^t)BlD z3X3una%9-mKQfsd8BJ1L^c|a?<~RQTD&%a8)>78A z;j;{(vWjaXu4_16HB|6<%H4?>8C>HGjOf3JFE!u`_%gMI9lFS(Zdyh*fUi`geWX)TcM2|RW7ex~9z$!V*}1suH36cMS8sUTj#B!5u82xaLB>RbS)CV} zYfO>T0%54ueR`qbr+eyV+5ZZDPT(q&%d{c%tS)ro_vKgpR8N_F(4^&C@V1a!8vEFa zT=?jHmb&%v?VAC0`=;t^@zKxm`WAZl`q^Jzs`n`3jO3uBbhlBm-IX&{bXm`=xSU3` zrkY{1Z-tQ6jZvW`2vlJ*D`fqgycve(q-h&7#r%Tdl;4DsJfmClx?@U;@=GIy~hcx`Wp4b#!bYoMv@w0}rj^ol{#lk>0?gp_A+Aq0_!~#FPH>MA}27 zp@BoMV=(OxJ(fz>g%YVvyk{Gu(}@QEaBre6T<53LS8>6I^xx39g(uRXiyN4JBcX;H z!s<3IwPSV@@7qE;-Hs<|75cyiKD31e+GgZ-U<1Y`mOPok#NmWmD|ul*$&FHS_;5HF zZrsN59TXBxiRMI0qBRjpv~9sjhugxTaBH|F+#GJ&Kry+6>m{@|2+&8XJ2Gt@H>WG` zKSA(&OYmp>gLQ;IO89$vH}Sb)+WQ9&-N9F0zylAxhz|c?edue6`Yk+{4%ctso7?#I z8=>cG*lyEB__0CHXW)MuHdF;aQ!uDtl+nMuC)$D5zj&LvY2$vU3N9%~DRf*Sdmil` z85IPF(Wi|kVuy$%DXq*9Hn(`eu`1>)9(2)@`Ce`ciuH zHG2B+M{H3zA4yG*%&NOHP@VEVWYq3dq_Vo8_C#WlJ!E(FlbZ7>K^*ajSNzhlM8=Iu6*e#{F8Xu`+Ehys_bq};@9}iB;C~Su7bI^jXQMY;*g8q IyZFO@0D2Hju>b%7 diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/PetApi$WhenMappings.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/PetApi$WhenMappings.class deleted file mode 100644 index 9251a566438420e501ebd3b79975c4d828e8061e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1458 zcmbV~+fLg+5QhIvfCMmYXz3w6AJPInnKQJ|1EpL<0#QLlFSs(v0*1u4Y$sJ8tFBa4 zRmB7Jp{oA&G8d8D8>G?Bx8r=9S$qEc{dEdp1|Jlr{P58B1MNA18~c7MvKuW|d$G-Z zWPjB0YT(vBA8BvX2?EzUj7m@nm1C#t*e%C9w72$;bt5jJs4!Mr_d4yJFK*m8I{SHT zN};e<&wno zc<}r=PrZ)nAWyx)v;45>dQL05Y~8{w+)n@Rj>1UYJMhD{6T3d2TexSO`wGL`y6J}e z*nDE)p{dtcU&|(DJq-QO!edh(XMIP9T^*j)Cr$l{g_60^GYe%yFDwiinzArtXvV^@ zp*ahdp#=*ghL#jYH%|PRU(DXrvD0*7XPJ}M?iM-NDqZ*?3j5g>>6YWEP89mq{H9i@ zZg;%cZR=e(a`#($)${x~yKz*R=F9G*P_9(dch7^WX~$V+zgcFtS!S@Ph2_uJ@g&dk~D7qz}>#B3?C5t4L%|c7@Q!M3_c~6x5R&* zfFV9ne4_Y7@rk{@oq!=eQGBBKMDdBe{&WI{_(buE;uFOu_WH947~&JfCyGxLpV;fq zCt!$A6rU(QQG8;rznFj_K2dz4_(buEz5dGt4DpHL6U8TrPc;5Fjs}MVYh1^fUvV&& U_fV{3C5zX1BfGbCyu&J&e|BPM-v9sr diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/PetApi.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/PetApi.class deleted file mode 100644 index c6d591f86366919c06af52f045a62cfb816c5d88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82237 zcmeFa31AdO7B^m1-Cfl)B;?{6&H&*E0=Xy2;HrR#D3^jDied->A|Z)6Koq=}74KV7 z#B+`7Evw;j6+F?^)%99k54?5N-Ss|K^Z!+KbM4Hb)K)K=7$HB{DAPdc%@qE-e35tIbu5p7i~r%DldeTnCt zRZ+L1qAntDH?U2$=J<++g>_|>)%7`L)zvi(s($r3(`y>0H&#`Rqr_ZTvuKq~x>GW6 zSxrM#Wp&Q+E0*U}RyS1CRhL!eOsQ_DL*~lzdO=bt>0Q3GqI}uRvbwV66-Y6qUK3Kx z3o~WL!s9E-8^%oy$IOysmVkLlB%NgVNgC+^YU=mKhRUj(sg>2sDi$4FR=;#wS*;+w z&@KB`R#!IcM~N{~=ITQNe$t!tr6f6=OQr2kNnwI4KD^?D#)|rei8a-WE0+i|u+urG zRWvNEStLj%7&mjqtl8+HxH8kKdv)0kg>gw_2pQ@lgGm-B<&k}hKwO&ePlGrp~SzWqG3W=eFbPx(qm+H+iE3|Jd*DxCMlpK5SOSRMU+^zWp(ux zlnfi$mP~f*3ZWXsq{L5xq?D3DVX>Q1RaLR1tZEkIz9M3DK<+aZIu*^Vtk0~hUQt$6 zxoE6SenUymSmh}J+}}_3B?lmDnEvdgbu}x?7FJaVG6C{jR$g9FU!T=jy9nitZ){kq zMoK*;%M$KbZ*CgbNx^c2T8*#+$t20+gU}<@6)Pt+R#q*ls6#iRM_Th-{|NpaOs4qJ zjfYSo(2X<88kQ!Jsj{;Mk!j$Ho*Wt~PHf0=26O$P4T8*oq+n<-2Z!r0g^rBDyrU<^ z6okXb;eIlc%mUluR7#K|Ae?e`MrCGIELn~@AG{nBqm1?%HkTafCv(U=N^CUju*QnI zRg|Q;(&>$fByu#FFI#&I5~8HKRkP%x5S=%-r7vsYD+vEvugnUaRTvs3fwCRCOcAljWE#s#SFK z@X`}*5~(4zGTjNTl)BB!nj~8!2>2(tFsH1lu_B2y%G3>HgjgO(6Ex@?TCpmLtZ}HE0%oDJ6ob7Lf|C7XbXNi+Ix8%hr;*cT2cAJmH!X!n zU}X^GEVO0H^jWjVPoFpmT`@J{NAP$p`JIpamYj{5WT6}Z;7D8fN4j&!xsv*M&h&L~ zMH$9QeG<9A5rzvXNy5l#fIy6yy{fjtCKsbi&~i$KM>b4%K%}I5eR3(eOp43p5Qs1% zCoV0knT*mTSAv~Y71c``mZ}b)l0?>%tGkh_$Ti@8S#51qWw~0pbB?dCskX_r zNLAa2I+VnyLj-f%tJQVndReO*Q1W<8TeVn$ZlZ+P-rxk89S}Az8=ecW+dk_mnznd&78edPPz4&b!dHMU4@)>Z^z8x=5Z?1 zUg|q3>7)BvcF9ES>>}p&yD7=9#@;5gTy1zV7giut-;mi*lUZF;Jx2Z1fNYr#iLs7E z+vHw9xkt|Kbev7@!=zN-xUgPrS|(I1uBofYT2!&Ptg#9_KPHkRPVN{xod_Q3G*cp? zVswm7l|-7!W;ro#p`<9GcF67-D@U%^lx-L(4K-71R#w!3IT+^;$a#D<`IDTW8zlS7 z>N8ts%N`q%Wn{KZ9-?G`+U`v{v9=D&8nyyz+VD1gNo1$9m3tVA0EUFKwUI)J={U}o zz1?k05_yz7Ca2)XDfvx;6uk8^YwpsDYV37tA$ZuV?!pcPlV0QUSt~0W%H^(7{*aYR z2|F6Y>nZYQA9<2IjhVKlZc!z+x=G|Oa$sJyNMTc+@Yrdfkckmhfgbhx+(dMNM{@~NMEO#TU8 zF2_Kv#Qw1%2Sa!H80^N%Z1QhP21ib%CyrUUa^)D60G)|>81HzCZ1Oo~7q`%ZkXv>{ zxc|STWU3zj*c<1RV-~NkXvmSXIs9=`+(jtrCF($D>cDJRuiimx>ZX;|Evu+go3%dV zYd`sld;^)n>Pg7~2~96yCbX_2IPo3%UXuL5*@U-l3=*6}{v#9oL`hzP!wfH&mDnSn zR8c2L3l=gA_e09cmti$>rZPFc#*5UlhXKlM;JR^mfd-l3Tpc)r#`#{hFdpQSJ$cJ zJEz^!x`2`8&Tb&vrg+ERH&$o43{OC0X);8X;^jLfN-~#M*%WWv{lPyhS`C@yjdgX{ zfmE%^^bQ-w+BDsd)fy|-zIAdRQQsgXH6m$EbvS)}<{`6YOwW|>`k7_bi!$Z3qn<#f zCx#zRH}F1>6O{0T7CE@W(xzkG0fGMOP5WR{qXFzpAMhGZ$%OXUpJ)TJ=_pwv zyz>s#yNc;GaxIxqS5_?-4pg#YQFwzv$N1@3xdiwyT%GM==Qp`+`I1ZXWG(Wex2Zav z9I~`f{*D*peG^?=!%Jh->pCs=5tEis5=wCF$Dku<$XWB9Ln};~5qs+y%j7|V^9uxI zU-}zA9Y=AJ)59GZktqa)2n)QYPAsd!k~+AJ1V${WG6^V7pcDOcJUtNWs7q1)A}HQ? zMa78~<&9F7yFM zYqZ=?=TNzzC0Kok*_5brTDQ{#T};Wi1gW^0CY^|PHo0e&#}pK=RVkJAAddxIy-3Md z8=UmC=~%qT(BtVcKdq!lk?6T%6k$PeWG0ql$6U4q?61Y%8%)I;d90JH*sQDf(;A9b zjik!@S&iyUX>ns!5?$el#LDR5=C)W)|ClJc(^ay(lOl#&WC}r7V*T`EcN{bfOZN)8#&RHO2cj$HG!p1$l`&6mwr*z^b$8Z)MW8QD+3s?}Fmh+lOu4 zBDFwMQXFft4!>JYtSYOo$5;=?=yH*{LilIZ1*6kU<{_>IUe=v98YUXo38@M{D>mMthw z4Laa*PdCtw7&6%9xw0c)CL~qNsfoVYIa998h`Hr@dV`-Xp*OaJ(v*eaoamQ1 zdb5xIUcRdp>_ORrHu>qT@~tk{VQ}W6nu>b0tyRym9}&}}Hik%LTK$^$a`K0is4S(33!tXri6q}^U*~Kxv+%Bzm8brfH0Tu2#pY3-&4Oqfx?0Y#N@U4{hb&Fk zP1+-(3huch4(F3liN$VO%uTA|igr&YgS*r?$C}77D$#1oN~c5%Wax79uwqnXt$>X$JcG(!rN=Dn(B zY82~LRIeC}RzIXgw^7CQ^_tn{HIkC-cH60|;xEawZhrCJ7SN%E5wDI(M#7Pw8#QfP~+zi%g#ukwU%lNzv6Wq;j5BWc+%UryjT* zuF+YwKug+79l%c|u-zVXho3GO_d3?^PfYOcVHS&;%samfVQWe6f zNE|H#9K%cIqP{M2GqbF+PB0ToB-*n8^PtT*9@Hc_V{sC*aVSGpGaSmKxJUerwN({z z6VGto!WwF@3y54D^#T)7IUSSj9>vKb$0f03*4@vNSPFn=O}V@V=y18z)2PqE`IRao z4bs275hqnu6^NRF7mqhU8O{xa_W;d>o+A&5-12J1f)8w<U*Z1_|DVdICr>BvJZfRa?!ajsnG7RnRq#f{Zk{twcj zJRD(%$;5BfIJU2!h1hSzdPC$aq;hj7vpY`2nKv;kMM-S2QxmN4Xe!6a7elzjp=Tv*F$$`;AfcS>f&FVsc9 zI^;ft&)pWG7t(PeT`AYIvMOM)WeWCUji~ct6lgPfZlt71FF-j?ZKf>8IhD;Yv5xAX zuOmtm?Bv+(Ely%*O>`bZmgh}YY$jMOm zUZ=4+AeVB39LkYQtA|EU#n}3lWlNS+)Qv^qEAnmjJ3nFM04OK2wFt3u1RLu zZuxd&1|_b#H0*$)r#qj%NJJE=@`7b zIqyj7Z9+%-J=6$Ode-5M)i^t^m{Pr>vc3{zJRPa=VZ~f*Kw2k@`qe+Hrm?QP!kIvN zI1dL_ENooj9d~1Ut0~NJiiyY%Zv?v;!K8pclxzgM%M{0kQjB0~ASIM$1k(d)TggI7wi2A`hcW^gTM6dg^<;?* z;q`O}X$bWQ^a%Adg1rJgw-QWyJIJa~ZzI?z(0ePv!FVVT2*fah&E)*h09mt((l6Ocu3$)eRk+@d zljMMZE7?HF)kK(0#5C5Ebe%eV<5qH`LFPJ-H+L%Y%~6>{{(#>reYL}DJ~#cA^jo%& z+t!m*#q~Qh*OAmMD_+vO!bzPr&3l3*ZzuQ6OW(Aa{P7`hBmI8B?pw&#P?8Z$4kUTM zZ!-l0B5Fc3(Uvz=b;5OSunW?CSpuw8lzOKzsYP|_w^+D!KkBsJ4XTj`-# zG?N3#>6geQfgXnCC)Zsb5YEyIcAO=miCA-Ks5=RO@a*+uz;-%ko(!vhj%lU~H`9t8 zbV(B(A4uLpm#-&7w$mE*V_mCcjVf7R8GGV-(u|1>9BHN}J4{J^0v1?Jq%n}%Oiv4? z2h!y-onZuf$h|_;@+^~04|GR;#oQ(ml>3TidZx2>kwF_C(H#XDXVfw%f z9!Sri>ze8L*yT7=^M&rzJTx#gs;Z%^;IPo}?eyY#f#E%e1+q5N%VgEb0@=bV*ORf^ z>3Y?|lfgb8s;hVuMPf6(T4fo%oo<*%RWsX3dmYk-cz`$4n>Nu~7Btg8sHON?y$)OO z2g8kkD}tK{w*s4+CUUydlG~$}oICYXfbXE|Lt;De&%-W{-ZO6}S$(zaO>7TP8Ep5& z+zh%&{&xRnx<#&8GRp>;B}rx39!~Zrne4&M6nhISZCbGB-iw+T>>5H+8c10Sbn|_J zFhPHoe`J9A8>IeaczY6L^fb5@GM)5@n+ypAnM09y4%`6kjwhsr6q3H3%_azp4;nyZ z6sp|V-9a5CJ6B8E5qx#3sOl(xZGm)kL`BS2EutO_;tsGh~(obLkbZFsdC1(2^ zN?D0hLM!6YBEwtAz)n$8)n604W?13(kQi2cwNt`oO#Y|3@c_!Fs1E46XBBjJBat*) za05ZYJ%GZ!)~=RPi&jSyOWq@5be-ys2vTxPw2&=$aOs z`*ntE9Z@8!F=1rv6_TdyYr>zk7i;N}l!HIL)3uD*yGvR~PE1M^w^&5(P1MlW1GX(C zVkIZH;3kb&odHVFJq_=2+NWgL{%rgyx%2HsdXi_xUZxj&6WmG8wUAzMtF@ssY@2WU z=c{Qcelz!s-d<_uWI=w*HsHN-EqNQ5&?p#~?L&IP^}>2K6mA%<`^Y9^5z4{8x%fAa zlp=0FQb5MzWqLf$62>EZAnYFIz%8crWI1hwTciC`w12Ad>*%TEcQ8Y^jGj(5(lf}D zaL>^*VYPY|&Xs-(>$0`9AN?Ke4{L(Km_vuaT46Xng=WJaO&jT07zfO!=K@4MAL4rf zy%oy)chgJg!*I_)fBx_E3i?mD@934xqSvrVaFgk^a8263Rr#mUKd{T`ZR`qqJFXnM zgWUmt6TOQ)PVa`hU-`RfGuur!vybQ&BLnULy45&@ZZoFS?ZymxzcGv6ZOnncfIeWH zME_)*0sn0JkZ}XuY1~a8Htwf?Ft*c2jHl?M#_RMk<8%7B@dbUtBy^W)!|zU?GKbJV z!~IqH6r+WsRY4TjS_E)N^nJKbl)r+0YOSFEv`(e}vTlR> z8~wNSHvPGymI{edr~ zKk^myKl~KKty$X z7qepD6|BU!5zkF5g~ z5%*}w9I51DBFD^MaQtu?xsX1Kxb8-8+|=_Na`aW9zoG`2D)c-;gN?o{frD! zLSIC>0DGStPhSG%9_%CB9U>|BWUu46>}C2llFoMHYLZtFm%%Q94d|=%?<5)Ht}lH} zmS)zwrKylAO@&lx<_fnov&JpW9PgH99_W^4mbj&v0ZEw=`?DTbgyMTbfnxmS(MROS7`w(lGXPY5X5Z1%G`18^GZ<1884R_`2MvgRlH(5sCLQkjLPm@zrZ>6Zv+w>ihYCnrxVBS^f zYG4QW9@2HUb7AQ7KK+0s+XLw)`XT*@B(ce29sLJ>?MCmm2h)!s8?d0YZ=|2lPjLas zV&CzYp+6-)GTwI~{TC!ckOO_^(SL(7wiskI{fvH21V%+BLSGPp@pB*jl75BtX+QtL z^lSPJj$eoQ%jmbDY?5C7TFmxOV;f=nPodvqd@!lmK!2b=%69|*T3E>ahfuZ=54KE2 zU>?J+ldlaF8`We4(immTQH=9E#`M0ptSzB1I z5K=%pf(0^IzYI2D&=!_y2)c!31*`xM+0cEk13sxNAx4FKM$j*nC7=coUs*RcQDKuzd_=i6p5kF-X=uQdz>Qw^Wu$ zYK6w6>(rjUgUakGFkGed4^*Su$sAUekeNeCfuzKhC6W?XmT;*8If|n!(Osf+5?OM7 zZ>21eESnmoEMWv7gRZK?D1={u`w;GXL^nZQ;s`7XhKmjklByEEP)aBh8Zrcknx_wu zto0$XBlIDp{tOf$0%;CR2wk3g=4G(qQhx(E9p!|fj&ef4jMh#_mO2*>44j;pc0v}E zA+n@)0-G9H+a~s#$VaK2!1jrZ`E@sEa1&kgzf;?xP2}1Co!Umi-cqn*z}`|3EUeLk zX|H2_p2ArAJn4bH-n@lSOxQa`!rt9A?A_giy;A}yaba&qK`qW;cVO>S5&&Tj_C|P~ zjEIK4QzBq*{8%SbL?m-zZ^SCt+ZTe4lZ3t1=uUTG?{o=!Lm5uO-mX4e4A?sr^>tux ztPt^F@1BvccaM0m_prdQsH%pB2S}>~Z3462by#{;R6882f*c;${T-Y1Gd9XLKY>-(1dm}mu_QrF3*t^@a6KdkhX-#Bm%T0K*+(f zVviPgAWNJrVNw__alk+Pf)i*MeRe$X5<}S%C4_S0!5$9C)(JwWJMfIQbAsfR!r1nN z7G|sVAhtauspioLBn#E+oiOv&^rxE|4`ADadbPz(Tzst)#Nu|QgxB^09m5t!;!opN zdy$|9*Y*NM(-vpq&&AgECPfEY>mWdSUo1K4 zEKKK+b6~Z-Ry#>9=5*Uhu1QcWPNh17f!QUtU7{v#WABpN8*OwEHTDkKf;Ds&P8?_B ztbI11;UmaMG6!?=T%c%2lKsg%>>7_Ehazq!nU9pmz#R)WpUi=M^-{PK*#vSbI}mQF z_NQroy7JFr)5&@^joiX!l6%-;)ON?pkQey$T%xGYj8;$G=V+C7poWrh$yI%P>u^Wt=*p0?LtjTzq z-D@IT%yW1Sf?lH62AI%bWAKW(OAI7$uhp`9DW7$sg zB=)d*2K=+xqvj3lar18Wgn2*mZfCp9=h&0xU)fXU^XwV(1NIlV7nR?_UNT$Q%T^M5 z%^JyGw{qbJ*_+l3_Lg-Fd)q2!yR1s~jBK%MGf%Px8!ukTg zeGUIRR%QLbKIBR4BR&Q0Q1%I*%0A^svVZbp*uQuM!qx0EeiHkfpUS@AXR$B&d3e5@ zea)|B-|*YnxBMRV9lwwLz_+s>`QO-o_-pKEYy?_FAA^Wd1{FC56UFRnG1D-`e8UpU z4KC^oAx^^cnTAjN&hU$~jc#JSkt8-6$>J8o-9hGyyGWUMoh%gZkaD03i^R`lv2Bqh z_F%X?a=cwame~ix9Y@L}TEz|`A=*QuRRd^mjaCh$$r`QdPyVIRssQ<%IA~R0;8qS= z)tkJd(W*YU(%3<(dXYOdT9t+?x*fDCo!q3+suXgIMypcUUtwP>ai$*ZMUt#=rk?CZ za*=~vu-}vO70#4uT<@kcZgSHZC%Ea11~;8K-A!j6=B6_Tx#`RyUb_Ey>7cyplxsfY zrF+gzXFaV^nZDMu8kOm1?b4`Bz`9zaGCizoH7e87x>Tbw>DCn*mB|3Y;Gi-+_^le1 zNmC(-%B1t#H7b+A57nqlDwo%I-Pt^AmO^Ec=}zktg~}w+19+7}Wd@NG zMWI4vx{+C8op(7bsK)cBlYVG%8~+WTV(V^3WTh(ZGs~82F42Kn{Q#X*Zq5#;~!(l*X%pTTl>; z80?Go$zZv#UZv62s}i=cfZV`VRa&P81XAs@g#}>~n!!r2wcEn>b1X8IWv3a_+LevZ zU=zE{U84~k&rG+=+_g1=lO`nz4HntK9&&RZ=1n=5x(18;Av_iCD7f>bZQ;eu?9h2nknYY@ zI8EJEz$P{Q-?n4C2lZ2CjNNV{b6UvRju|66tbI5~*%8J_q!5jGXpS;rOgvLeFlP@6 z*5-@x3hoq?qjZwvQTk=3i}9)A&>;SKxpNjg-ckFFOG6z(wnIhXIP#D~bU*@0+8)_L zgjC1F$}nrB2jjHQs}5`Apg6y-I!O$tt48h0ql4ch()S(1H;GV51ik5)PNLvVqLeU3 zI>2rcrG!-;t2$%aBULxi^u@7sl{KUsnK4c7ikXliwFX+xdwkOV3T-% z#$%jE(7|guM=)lOh7F;jTG~n6L0)VSX$sYvR_6elLfbBkG=$m<)EvB~Ex$UA{;0Y+ za7|2VoiQHsOrY8{uv1{o65C#a3Cgqc+Dp{5`BQ6ZooV1?!6r%LC-yUW2-~jJK;YKE zoud3c@Q0C8$pPdvTxM|!IS9W^CZ_|)IURt_8F(8x6M)TGq9ZV*!Gx}-2zxD?x|7K$V*=qDBj~j!?b4Dil(a6NH=U|#< z457uwP&&oP!Xf7{I^7sfXBi{tY@;7N(&$f*hJP$fla4b+(hH1idabb!{j)Ke{@oZ$ z-!^jTS8y!`%xjE7HVAH%QN)UkQnnIql`#%(lJ*Z${yoNI_Ly-nd)%19o-n4e*8s}A zX3SFlSH^7im2reYjH8Tx#?i)5_}RuW#sp)5G1EBCm}5*f<{M?kGGn2!#wa%~F%}t@ z8WqN6#!}-}qY|!0`8$nTW2bR~@r<#;_{dmkddlWA101 zV(xF8Y93&mVa_(rgj=Wl<;FSYa^qZcm2r`InQ^hX0sf7~rRH|ya`Q>!3iDayeaX1e z{Mfk4{KQyqerjyM8T7SqHz_}0+-wDm-&@0s+pGhO+pUA)PdDzgmKb+ijmACJ$;Oq| z>Bha*4aPy%UB(}+`;Ggox8OcB{>Uxke$I_a+;1Gjli{Zt<9NE!%(INmybP|~*v1zb z+j*_=0Bt1 zxZe1?xYu}1G#jsr2NCxuIa@qV&KF;i3+yyab}Wn_(b_YHXWuE0+Qd4&5#Bew9qp|Ds~N#=ok&{^rhWhLnNA}p`AWhJ+&bc zjF?CEMBI+zP-dggv^I;)qP&I)+xKJ?Ok?4^58Lpyz}4_$*B z>n+#d#@gf>+*tR!1~=C2uE7nAjLpH~bOT;D(pG1~)v*HMrsF zp25v3>ricQ^S1S_Hn=$sWVkIuJGaYrK|B95 zcTxUNKs)ogpdDq%gY#|}_2}zcx}Y6>8mqOz)e765kxtw5j0kQ@)0}od8TqTU(P^Is z617XE3)%@^&KDm>`xSEO*9SI*Z@`N>z>1V;M;c>b7U7W+z5}lVDqYY{M|f-(w4=oe z!&l#V*RD*t{PG~Icm_EgPr0p0#RLMnpdEMPpzfq~dDbBk6LA|~LjBnxLAj9XTkaAj z7_&#apq)K{ow}eMwTE6UA_qWQ@gl9Dom&Cv`~mJZ<@bR(Y3EY0l-wD8GCjgsg%t^*a=0V11@V_w+ zHdD+)%mL=1=1?==%r>W*` zpKh+UmYAnljpnJ=$>w6~bn`Up2D7JimwASDzj>zh7TkyC8Qe0@;@s@P{bo;|3_sQM z^K|pKJj-0m%izk*b$pR|4zD%O<&EZfd=0{D%?tP?=7s!9^CG^%yqMpN=R3_y`Tgc) z{1NkVzRSFVKW$#cUohA6f16kHFU<|2k9n=gH8+Y0=5=DSdA*onUMiNFH;M-HCh=SI zW^s=BdvOV#uQ8j%b>^+&dh-wBUh_85Y~C&&MBJm~J{-?)1+=pb(9U*1I}ZTbc@W3= z4*}YF2++>MILLnl(9R=(cDBZWc8=j;{rA=?^DAk z+z!RZQQF+6Cciu;#mDH8GW}-#Fuq&vyOM48bbO$HQb@&eO*l7r=~u% zgOBUT`_%BIIqyC-gyel{xMEG-r-l!V4G46X-{{fzsr8R}pBiq0J3ll~);;n*HLu>% z8mC*E`_!D&-hFE7F?^p|BALVYsmaXv$XmC>?^ElR_C3}r>?t8_I_^# z*(6EEMBk^@DadA^yid&zbq@`Ktpd!;lDzxWlJtFQktm0}ib{TxFjZZ)Hzv{=Cn@?g zeoXXjYPb~7y-h7CvD?&!1_lL&s@v2&YaChE2x}bq7;TO7Yi~>>WbwDB-_@X}_);-WY?mcSijyHKPS*%MFoqN<$NC1Srd(;q~CnKWoQR^OY zj~afglPMySxz;#{RrjdbA#g=H8>0Cht+hC&A=BYR-LgttMFK^I<8duXB$Y zR)%=@sP%}vM=c|R{v6X9Co7N@Rn^e2;PB80b&uMJp2Gvf!uP15h2A}Cvg%Rys71Fn z>K?TY(yDvZ1TLqP_oyvM5V8@it#QhfH4go`BWoOFTpzO4^=i1eE$;Pd_|3as4OuqG zEVy0`(NWi{;kotoYGG@fBc(OYampIU?AR8kZ4zaW(H>lraF)1sI0;jb_xU(hIB~Lc z+6E^MonK^u6PISY@Jb{|6OTf|5Ka389273*eQr1^Z)1DYKCyP7kg(-V`y~EP)yD-w zx@rSqiv}LU);8@kCow>#eHw|vG3`-N2Vikf&#+aCqb1!j9S};u%BEvF@s5w3vF+H{ zbVvn*JRY6!2Z$1(;(-&bM!K@qaX&uPDMB6GiYCF1&eDr(ThmEG@hxjQL#XXps(Tq) zqHT-Yb*@!SBGrjU1U5AX<1fOdW^Yi7u&DVZk<+LQ9oUiQc9a?QC&rWj7wV-KTole=$>~GuqV@8bEv^}Hs zi<>qXALmuJGarzxK#pI;M;Bhg$35GdG;pUZn!sa9Crsf4zAX`o2)eNg~L0g^0#S!yYg4#>iUb#ZDgbQCvvO#AbA1q z@8(0~ALb64V(z4a&4=kQ^AS4Se3b5EK1N5ITWPMjjTXQUn)lKY^KrV^e1bNbPtu#r zr|2g0X}ZCy1$5ojAs-7YnThaXg;utrcRWwNjjD zoha5>tHcG?N#Y8`Z6I%mjpQBiG!s}JoY@{v6fu7rGI?@vCpXTUAN zrF!zJvwcY^P15!-{b`D}hZ#UEZ4c9re4y=N`jCHUdzb)Z-m!=2g;C(x!}KOEXnUBR zaf@2SpM7L^tm~OO0+rtbbwb~xWPY%`gFgBU4?O}ZAf5#pM zvo3M$VQk2WV-F+9!P*{%lT7 zSyS7?;C8cx2pjTtv&=6L!tG}Mwfm%}zyfBU=*!JoVQUHQbZeuqwGPrMY>h)vL1Jr5J!}o{6lxuIZ@R<251-Q|cuyu| z1=g#MKr}8vG@(E=z;Q1|q22$1n?MRKNcwRW;~8d+%YwRF0MPHIBfl=p1Zi7z;Nzp{`NiDbbq$(&yGOSW7KR9=!GHYy+==9+Sst$Ij%LFjZJkEPT9?!L))jP_broH2 zt*5tI*U-DIYw5#q&sZDj->ntuNxG;BU9yHD9*gGv9>& zp7j9`^pC7=)<3K?>p818aPZOAC)OD2Q)`^{PirFlDb~NOW312MzES=P>st$-2eVGK zzPE0J`*nqn)Ndez#qg3FX4O% zd@1LA1sD7j_-An+zl!_efTzO0m#4v{^KCqXzt1y7I`1L+^PVD;_Y#A7su;%oVkG=L z-djxNeZ*||NAbR*p7$50^8w;_+!W{Yf#Oc`w8vl=QPRRgC_fj z&=h|*P4!QLJA!8T=hGhkD!8+#Uupmtvw_<)??z0^y%7`V4g=_;xCyZ@dELDc6Z$RA z$IkkYXWSbxap$FbBj%IdjhNSXH)3w|Zp6G;YXBsZ%iJ3=jozeyK1ZJ-eO2hMbSKGF zq301AZ1g3$^aYr8_QO51CG--YrdqRB0-tN;6lurI|HuY36vhH1j~WG_%Al4R>wo(u{w(rNIPR zmxdcLb=y=(m8L?fH0xfsH0w6EG;6h6nsusMnpN+XX032bv$EaNtkG_1{2y*G$;8Iw={f2ZvcHA{n1B!>E0A7K6P&j z6%V>Mg^Hc-O`&45dsC>`=H3))?{;qrwV!rx3RNL>Q>gu{dsC=gqctPC+qv#dq4q$n z8Ii;$i*@>@(7Wxy`lisa_Ko_c(8a#v^-ZDUeHZGRLJ#zv=iC(P&vtJL_0QLu5yJPp z{sYGAs|0(WGq5ie*O`-m^q&xjjo0~$flSgnAFIc!L z6si%G?082tV(1w#Asq$Ph;OVvF>9WY!K%h=Vg4;Fb=Eu+A9)Ly`e_TR3E>NHIOXm= zZ!>|V<$w@3RhINi(r=OJx3FIF5PZzd;z~SG_^;Cq%wgtG=&Li zVKWH<6yQxHZSHom@4WQ=Hk0uZu?!^zU}`E2O=0PGsI*C)Za#oorsf>6h0JayM}?#r zW5nl>km6WvVd|L}c{W(Rq)})!CF{u&8PYabu*?d%mZjRzw678DC+$n6p=p1Kh^tJa zWk?#D4hRg8hNc50T%IbSbZxi=8?iGbF8&-?+|+WpM#qz-p=qY9d!(VMS8r)(n%oMj zN!O`8LsOMGY-pND=CGlu%p5`?i5r?GCvIr!QuS=i+8CND`#5RS70U)K)Lk|;%Fq;Q z5*LDj^3YenNmYuKaBJbNf-1$kgqUNI#{2$QrZhG6hf+g>VMR&;meQpNK>r|MX=RG; zt}=x*mHTW9x$SE3yt}qT{X>K@MY<7G*jc(`zh|M+`g=&jr3F@~w-M|EX;Bt?u+sAc z3zo-PMh=l7Em)A8&;TPiFfc$`!43%was?$cG$KlCR%8Ww0#D0orCE{gYF5lfeI3n; zp^jz+G*GA?Xnqp(QKZ6%YNMlC(LFKMieZ7lfnid$!W`;i*pih^W{=26saj#O$e1o( z?=i2TYO%SCm3u{Op?Xo(#mc?H%1BiVIRnHnbB;F94zG0mKz$q)>sXfx*&&&)YBkQ&#_S zXN2d;h-fqC)Ce>aN(+AK(FGo5U#I~su;bDU~jqC z*g(nEM3_y)ga)x==A4H5I;t4hm&8-W=oP7o(KDVZ#_+)KsH%oW1V@Ill`2Md&yj%< zVO0#Y&@*$ERgY4|h;D6^DnIK4Hzq_(#Jf1zIib&c#!lhZ02AmjX}YsA;0E2FTuPa<OEGR&OEsIlMGT5DpW;ue+U#wr zTHR)Eku`09Z~VC`H+!9|qjs|=WMlTaQoV^sZO_zi+M(7tm6`Rnf4x@0*}F6yHJrUq zvs+w|?<6OsI!=4l>y!%3)3*O+Pf=fdT|<&Xw`2w4kv1)oN)&r|-5d>+}% zk0g)sqsd?ReDXb?PYFMUrto8F5nn(j^W*5Dyo^re3+Z9_P~_o!E}g@Vr1Rj<=QHTB z0Hx3474#ZF(ogcG^c8+Q-Oa1$7jQrE<;>4(*#Nka`~+6S8(AaVO1={AbnTy^{CoJB z>@j{8dz}B4z0B9LH{rj>&t~88b#NC--$>&Z!Ch>Oz$Z@+hdY&DYOLdz8RzrMjSKjN z#wAE|IsA?M3VbT{N_-CW3S$>vZ@kT~G5(FuqkhfLG=AjQ;_mH@W`BO2na8g;^Z5hA2V|x+*J>2ceU&HS(*Qh(U?=m0ccbT8?yUnlpJ?8iPUh@Z}`I-OTqPRA~ z&o^1a`5&#Z@C*6<)-=8uS5IuQ%J_A-R${BQns2k#@a@+5`~mB7_}B0Ut-JX{aE~c} z7k}K^#h`y!0qPW*l+P~?N9l4_UHV2`+NSa zkMSRU-T8lf8T=<-AO5p16VKU#`0@nx?Jt<`Kw@;J#%-_-cgDcbV|}?hxI4 z4~it;BO=-NXQY2mr1(A)seUTb{9L5_yNeWmZ_&fwPxSQn7rp#rL~nn-=;IF|?f{zO zpFj(tI#A?aL4#1eDfVANOa1F<$bUcFWAr!vr|EwF*WtdRg-R`FDVa<2wOYXFl2*&F>4T3%pRUw$ zdg6PNrzo|YUhH8yMychbvd8EsrIwRsKJ1pJLaHP znt762nz_a;%^d5NX6Cu2@np9&6;h?CkSdL*x}|ZSTblKnTblKzTblKlTbi}YEzMfx zmS(MXOA|-BrKylAO@&lx;%K)tG21Oo40lTt*=}hf)h$hAxTWz&-O~6IZfUqF-%-oy zXP0ZWoc{KFt(Mc*9;?-IdfItfEvJ_~LaXIu*rT*sP7mJ`)^0zq(X* z{vS|}>QdR+YnoA;%G&lS7YFw67Yzj$P+86 zf=D}75#56Q2?Y zwM(m&B2Pzz0PvvnnAMV+D6O&M#K9SdEJ7}xj29vEtx z>grgvBZ$ScuE|)B{=GUGw^HQkXvktEXuCql<)M`#Pe*i+p%aQc?NjT#B2OapWSiQq zVc}g4jR0&Dp%+gZ17$!hC{mFp0cyw-k6vpPV5Nb2W^q(xL9k=`1hfc6GEOPh!=JM=YKq&)%WhMv>>2 zk&Ua!vzN%WR^&;XY|LJ7rN|Rat&{2}b1(txyL95ok-QjYJ?0hn{yKL|%C2u)Kg0Il zgFpPz0`O|@(rm5F)28KnP)|uSQnRHE&8RI``)$WdW~4Gt8&aLSU*}!h|E`+NBb9mf z7R|lZC7N?rui_^>>kmhI6U{P_BZ@|0>RT>{$P+Y|i5bODY z;%Yt#DmGKZ1$-*}Bg8fQ1hIjyf`6*m$ghIh%`M^veup@lZxT21C&W#Bm$;d~B7V=` zg8zYN;y;L6;qH>Y$PjnK-6OKay<#@p>0*;OSNu_2DDD#%iMzyQNOL9p>&5-z0nscT zh5wY;BHk6-#OGqW_*UE~ei9GZ1H@tWDDj}3Cmyor!<8d^y4Yc#A!gcZ@!LB1=ZS;t z3&c+QdhxLR2HbA(nEjS`-2PNNVSg@m+24!DeM~&%>n{H6%Mefd`iN(InRw0?&qA5! zIVkh|70Nu%Lz(AADD%7oWuBLz%<~GAd0vGw&)=cU^BRsj01~E~~9sY|M(5>* zii%LBA~0ig9#RGKJw_K57lC<_(M5`l4x@`ob2X!jBo{TKi%Nr<(M6?Txy$HaE(%qQ z4$9&cqk{$cUc-Y01#ZKGg=nqA=wKll<1ji1=DLgy7L|lE2ElZvhl0fgUdCeZTxSG( z9YzOBz$M+W!IEMx8|tacE6xSaoovNmufyo#yl^#(^So*nLrmOk`Cc`PRqGr^7eit^ zMi&G9-~Wg zrGQ9@E|JA6Mwb+XC9I^-ldux>w{Ag6ktbm#V6MyPl3-ZIN-)|qqe~#AZbpnY&9M@& z*I{%?DY&E=T>{zA*-BAQovk$28wjOfufyolyl^#3^Sx@8LQLFj1zt5vRqGr^mqKDZ zMwb@ldW|*G8)r{k-q^^?L$%$!d3oOGK)f6taze?=larm7H$PnKJjjoiw=i7mJk?^S z5AyQl?BQe&f>u$n*9&=h7?@r+M1H;$Bh?Z4vL;SPTxJ$PmfXArsJ5H8Am1B3c?ICU?uY_88G3mOya5E# z;aV3IhHG7*TC6*wK+Y~+M-&7L!yQq8fgA3K0*H{;5rt|PsE#O9Jk}jii1kEwM4@D{ z+YxHLbULCCq7v?i!h9)Esv`3`WRhVR+8YD-2KC2#4iTu8Q7>D2$l7^9nI` zU1k zyhY(!7pWHOjwq6|kJk}J#d+b5D8fh%cSI3H$m@up8V0H(f^yY%r=}p*8{H8>$zr!7 z)OzZ4L=d79?ua0kcHI#{Srextg24#642I|QykK}zM>s5(a@F)YA{a5V=LIo#U4|4x z!d-?GW9+&eQ4H?ujwr@<#A9YLWXa2mYI}JL!lS7e+}9mZEay=?rY_^$6`>5jjfj#+}9mZD(6tQBTBJr@bW^g zyu8KX(NwBhtUIDq&Ocs9l$I2E9g&|aw>EA^hY^ow#13UP*UkoUMYr*lLun#RtW2^TT3jdlKryk2!>v;}era$*bQe5hk(>vXJqO>m1Yzz$0%DU{_oNeUtUZmiddSbMzKBDoYgY2}NR zPFo}=T^%cD0H^38**YC7H_mR+Mc7m5Btco8lO%}!s~hX}CuUnOwpdR7PFne@q0<)2 zX-3ClE9S<^*6CQeeRPX1#wx0ll*sa&Bqi9lxv}A1EeZE(shsYdv~u&U)0WBsrem@B zaARfbbgbMkxkZ=CckiOoyrFnGFOjV-&6mMa$$J%Bgg03oTO{9Po!An*cIns>`P${g zLQ-WZiUdSeC6Sc#^09q&H+%A9BCle}+0|a?8;Sf?M6Ef(WOsH7rV8Y9Xxy4N^_rN-z+yd)-=ujC{=MpMT zmL@j`I;mSl#L9CCoeRCGa>-)}Hl0zly`mj(J4K;XPZW%MHoX2o)(ePdb3(4*4q@ zD`iB55yTsg7c6mt#UXhXp<)XV)Uh%j=1?~=Ry{B1Q~+HP#GY2hhUA_~{Va1~xp$Ld zqSHZn5}|^{SW9$E8VG?K_QRK==e2o)<2A26VFEQXwuHW$$t-A=TAQP0DHgjWXgsm+}% z5MllL;)F2)C@RH>*F?~_@+iWI2hZeLg!6!~+*7CwGOQ~DW;@3bvJuY4Nwp10(#-8e84&^IjiF3qAWKQZaf;V;^j$$TrhOJTriyUx$*~8O8+2V)7_v~ zmdq^oH7bXEkgqP@gIrtG0}fo(;e>k7hZD{(;D|b%2xpQnH68_w#V`fAsgl27J0SNv zDv`{OYKF7OBML9SJfraPt3wK%Ury}d{Bn1to+L3TU*3aU@6-cYpbje316rUCD%1nI zMIBUVdf=Kmsc?RiDIreSs5m{Njw;lXT!C`+4@f1CD!lk29gphBqY5`33#vn?0ENh- z3ik&{z8CZglbJD1J2~V7ChCZXQvHC2$>R#=7g-TZFV2Hxtvs&?XM)s6Jm`vHl;CAV zS4{@pc$r_GS$J9Gp+&@lTT_`I{h@wA5c8&!Nae>yG@J!{hlmHao-)770eSKzk1jL? zbd5Z^&`;o+JiE|OG9|<-Kj?OiJiJg(A?!lY2=xO}$-@gbUNT+9qiu3U_2RwsC`2A! z{C`cIxo(v)5QT4yXn6x(0I@0xC~2r^p-e}IC@n+}CHqc~cqv{53cha^`${R!8UN$m z44dfbJ=01iQGWoRI~5rJS+s=VhmF-pFld2i5m9qMXqM^ku=-n9ke_=^t9H8$axC!q#qjUYf?7HQXCU1Phf0a!w|x&2v>_9qA* z`SX<7{_MLW(*3mko&lFed82AzX_PmLF>C4@#rRTv0}Zj3Mu8(31dSS0|w(iX2I-L6u`UDRUf= z>X@fSp(9F!Z4ZCW_I6nVux8$?S)#w|kt0y-NPGD6)Z6~Z9h;zcB+x;8Uwda9{LIH8f;B z7hG1gjk5ZBX}H7s1M;`FGP(t;2Afvfh%-Z^u)T^j16-RY|K{MU8`5!ej#~ll%yD~;$8$WH<8qFt Xb3B{l`5beOA9K8zdDnhENUPNjYDM95TSDTHSx=rkr*9qdW z2ogdF^#OP&#O!W;Q7PP18rk2B{g20E|M~mt3_ufG3{9m+o(j42Lt&H}M_w=%TpEx3 z$mizvoWZ8Cb1y@Tb!*#HXToFsS#*pt#gMderc=M83*KngqS#MGlxSQ@n>oLxr2Oqqnd+4N-rD~Q+ma)x__z+y@YqbjX(5_zfG?^nPuo(v3PLF z9V9Mdm%au&WytQTA!n#`r_zWCKNOJ|jQNg~$|N_5+y*rxfH8}`4ra)3mvPk z&p~GOgjP>z^@LVWcv1gy4l=7Jw0c6TC$xIPi~84dkXb#U)e~Ahq16+n`ft=4>IdG_ axK8sMYK+%Mrj3on8faRt)y7+F((n(lApm&* diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/StoreApi.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/StoreApi.class deleted file mode 100644 index 3240ab8d74c1ebbf3bb557f2407ad758d1922756..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 42521 zcmeHw349#Iv3GU%?#ybnx_zw=EMxh$b!#Q94cOSm$oK*q8w0_SrNtJOC83qDfk3#A z1PG9X%bej5Aq0XUGGHJMNw~umAS6H%2v&(}0;Qi3uYW6iOS*z)$qSi7L%Q7%iCh@^&L&EEep3c#M(GwlPxHc zCL<0PNo6zAFS|0A){bSJ&CRm~ z*{$5vy2b!y3)*K>Ye#caOUZF3Y%XbP>4>$r)Hj#ZwQ$4ZO$~9Ias`cS*cfZrw4%Pf zelrBsUKcmCAeCfkEnk0Jtf6CeU-Ao4J{1HhkA{JomSkr~Q*+6Zrj|{y#)IqQ8<*C% z*)&3sHK(bisbhaZYU;GrAsR*DAdRHag0d2&bl$OoD$|tmVX@;oWATpptu4nkZLn#d zA(vbl>)6=ZXj38hTd;7+!c_~=O17XPGqpQ3W`}5BnwUWos7TO=k~nK`iSCY) zlTELj5}?U~GLmkm3d&7rpQDpDO-DzbP~Y4cTYjvd$$j+0wB8*NqM0-+NHeGyif%f- zBeu1}D0=*m4x35^<+R7zn(G^4MUAmz>pPn}1Rax1-;9dh*F!d5HxIRpN&0$<_5_}^8|(aC2G@r zLH@S-_IM07un+N1>&XzwL|fz_96MB=J(mFN7GkWg^z)3`l;EbuR_!68ymUC zm9Y(*;l?1aS$)(o5clh;AxQPqC@28#5ABS#pC~BLRW(n+Lv$={;3jQEM%2`P;>s9W zl$sGqkjHVfDU-$#G&af1;*m|z{6G_IemyJ|ELKV-btWAI+UWR9Y9(aJPuOYqxlO3n z-dG=B22-Og`;j3!fwp8)Cv6qvYthN6W5w8t5S>IPbH1;+s^~VaXd$=Arc)g$tY%9X zqSH9{*XeYZ5ADS@A6jqE%%roJNegm2Bz9tm&T;ae3$dVEv?x6{C+L7aI;OXo8K|qy zr*CjqeG{_`V{Q+Jd$Z|6a9y`-<*Iqh=EIj{ElGL^X?}|?&Y+9v5*UE>tk7tCZ*@k# zZ_{^}`ga|xb8xI4svi&0At;1_(t)m@wd%ySSb(mA@X_+Y-GwLptLYk6jBC;L z2}3Y{V}1Kd_Ngrmum#scoXxS84INN3IPJO+eUEO;q#NiaxUKrOw&tb=Jp(B@F5cP_ zpj(iutrI-dBn!9q)S(Y&;c;~e$6>94U(CvaKKzBf__3g2R$9L94mj{`g zxHUi-e?)ij`;-yXTIOcqX$&xGFs6|^`xN0L?%6MTrTHn+jV{3U2Y=m3JVP>G* z-GWA$zUD5Ok4b5gNxoN5c?;%fg$;V*R=7TfSiGaKqqVT5wPlum)PZ7!4vAvN&jslI zAl=8tTFeg6gD^kw&h>FUb3HJ2EG8HUH~y7mnWuQkTiaS{R_3^@<#ikV}6`49MK#vI;r{}B- zx3;yzOTmL{1L4hFL-d3*AAJ($9z(*Jov~74H23qqG042`m-I9n+h+vrmnH?z{S~d* z7;C{4r45RQ8TWITIKaGhZeF>isiT3X#{8fN6Ek@fhS#s?g$#P0UUVk%O_;BT=+|^( z5R=N6lYEbvcNQ71XVY(k^a{_URVPnPX2MISPI+c03|Wt|Fg35y@3{EyVTv|mM%aXj zNk<8kYx69)|M~#EE@(pXVBb1x%a$#(bOuxhOVQdG!wbhBq5p2R2ch(Vt&JxpIDAXc z5~HD*bd@x~&ctIKC2VhSon7ae$&`1M17~-FkGTvsU4!`{a^k+!LZIuxnH_WELU?S#;Iq6A{x#M3m z=zaP?P+6LagIB*MOx8|{wcGR|OfwXCaec!k*jLA=b~u`nXB_N|+n zOOA80m2ju6Z)#~QNiKkH{xA9{NPnk)2%0g3f;N2&hr6X669qlY=EWV`5~5G|b>m<3 zZ@h9Pm@YP4ICZ~q+ATfHO>J=87Dn=a;F(>~E{!!d)w9{O>Ax|+J;8eEsba;*rrknd z>fVb$BBL!-4@Y6lVq!3O$D;q04FEcDhViUT4y2*(KLFsGee zcD#c%Gbw9pOCo=~aPi9J%L>pZ{5ZEU~w>mMrjQiSJ;~gQfuahtl z266d{Rdvgktqh1sU>A!Ocx@MS;6UO}w*gbcROVa26Y_9u1v@=g4z?L2{kM8)i&s13|>XVSHwD|WhRmC3!LMhMSW1L66*!cO_P17SzXF%uG?w0z)+u^ zCKb2P!mW5c;^`qTeF-e2Ah7DZa8(uf`nP*&Grbj!JZ*YuS>gjykvD z>;=%5Tf|nb7MZ+Jmz={EC&P|nUWNH*NSwkveogQjH(us9&ewW#8qYjuh|`e|{-wSd zYLl{r?l}3`EU`1iS)BFkl;uq4xh?Pto&k5+s3#DDs{69pNw1*I_3=1{d?Llv6B6eO zymJ3b;FY_i-Hhk-TppYpUdxNq)F2~qTYRfWml;O-?y^gQ;$m?r-uRp1X6?Vdy|q0g zzT+qp-sICA#!1C(ad}W&!DQ1dY_J2a+ZI<1D(wNAbahZ{6W3tmU>54?4o}jUDoks- zFH?@?<$_Sl>%{dz5fe8I(4zWe^e6QNO5B(sZsPZ&ian^^7PkaN7r#lBIwCG?Y>mbB z{L0L#3RA{0)&d;XUik#kUUZG7!Ce&b%YKoe>t-F6#Dcr32S6(XCXRLU!a8ZjHSOU}0oUg^ zi-ssMJzch$>6}y|D4y+b$FuPhbvjF_KOFTsjCvK4qPB1G&6xs z5}N6t{)Cnwr3JSh%$Nl`w}nAYb8kj?Qgkg8vyUd_nI<_y*tCg}jW$+KtVOw_Ti@mP zA_EdZmlw@RQV#vLg$&u|ZI*4DCKEIhEPZ3~07)%sRETMBbkHcBA>j6)tMH~`jHu?; zhWh5!_3aDUSYSeuZto^J5!9A;u_X6_V!3YZu59tfl`aGQ&gMY3z@^*7pcA?m=?p+XN*G}>(oEUScIhwEBSfca}> z)P~m^^&G~vP;-(joU!CdDZu4p8?dysKgg>^3s;52CmKx_SYXLDXfl92hk8I@@uaVX z#Ilh1Z>%ATo5XI%_bk9_P)G{)Jr_${SMU9`GH||sK>8d3=ua&UJh2WF_GwcW_diM4 zj2R}r_t4qV;^CY(G2=7h0j4bjm{-aSK}G#J{A5bD%# zCnVNdLPjTA`Gb#u3?oI$4~wh3wqwgN2^_|x0g5%t!f7l_$#GbilKVgzvC4sWxIX3~ zy*n)NzTL~Eg=C?efCXE*FM25H#oW!vD;%G=o!Ix0v!|)*vp7ErFTKXiB*$QyHB!qK}D-elR(`j>PnZQF%s)1G0>v zZLHlb=tHnWUJb{ZCA*VoNl9C*Lw|Wv9N$vE0rsRAeSboEKvo4w(o(?xvJx?g#hW~L z$sGVmJuez#7|P8jD14kH_#bGtT(575Z?TptHX*68OweV!PAd({QBsFprv+thc2EXz zn~R{YMTiH2{D^bqW*}LO+I3pFEENal)nbMl%K?)(i+HnKQOq)H(s23iCuPN( zfKvK+t_=^1iFd;$tgEkLU&K?wrk2>U&duv%?Is0t1IGtzZ)FmL-hv=JN6}%OEm#(b z!TdMHn?S}xn&%}x)54T$Wz&Wh%<|h&&6u7=QgQ}Ywsy8R#CRlQG&na4V(U9Mc&i$i zV;Ksoohp;c1E-VFF8WZFd%(X|<(3?NFRkmQ zSTv|2nJN+r2cuaklFd1qqB$y(8_tR5sYre}?>^crfQ3TZ(SmTneFPVKC2io?DS~#< z*Q3M2!=l4gWJGxQeRKvVofRFaBBR11@1wI(C>#!(LNhsrLebIT(Yt6ybc~9O4QFw& z^SIcI@R)A8U=4Nceij1k+WlRk?R4pyaIl*$i;iQ?uFT(dA6+Mr_l5-Dk5E=Pcpu#? z=qj>(UF1_&QohNZ-*q4TK+ziK_J>0%{KJ&O(O@{})jq?KwY4Vy&ip&?rMs`BTrKq< z8>u6!TUUQscOcrK@a={(#U^E_|fqXM?)%-6%KjNf6mXl>Cv_M zkKapAMKif=&u*ue(3`(0zD+Bi%ESfeJ+zSUc^c762yY>LjN}`L!v@1?PykXA1DBnH8cMWwCO5{H8cNB-MT3|>Fu?^Xm-$_v~H+K9@HaWMG9tWmfvHR zkh@Fgp0J(%b}#*NW;cDhHvcp5xLwF_X1B1rMOGJ04`&t#3<3x(Zzl!T7KpqZBA<2D zxf^EgqWgyT3Gdr2Ms>-#$((k{vgF%tF}6#NPfq#bHf4O5==|To>4YwN@_z@XMO`!@ znbQI>84E4byC`#~n7MX`nDrBF*Hk1YoE6Pw#SLo34d+LPsmSo~uq5*~B0R!as!EO- z^ENU(GCE2{!r|QTD9=(MrcK?9Zc)Y->oH@ivbsfOG_+k*cZ>bPp>8q%K3<-QW`(oz zxAAZm%V9c7-Jy+mkukRY4DT-TuMyE~3WM-rSJJqhV%1uXui<}=>K0$!AsTjxSeKX= z&bn7@x{~(YDK_gIZ9THZb+*x*dcu{|jZp%Lbc>T5q2xY_Z>+nhGo0Hkz8=jFV?f>z zEl`nRZ0A!FQb_C&SLz}&cZzLmg>L2md9Ov@s1>%l#rL+0o7Z)VTeTUz25n#)>PMJ>0RK%@ z2=ft6fMe>S)18*wmSVqdH+Nxcm$)Ko@1)>bcxZ9w+Mm*ltGG8|+QAH5wY{c5+{MrC z*&%kY0pudvxJXDBxj&KZ0nYZ|4)Kt-lSZ-E+yzdQJeVl+7CL-4t)~o|q)jvYHjUGN zgPwGcbG8A%9lZZtVE!-36cnd^ue@=+F=Gr}Zpj zuTf)Jsl7_AuL;8tCAOPJ^uyA&A&4tb6bKY)!_!{__l(+JXy787E|PUvcX=C&X%8`wYRlT_Wmy*NMfxn^E=$;t=01vBdXNvDEjlSmAp~9Ez|;Uq28>_&yM8eg786 z_=kyg{;|03E9(8TMT5UiH2Rl|L;Qz}n7@<$?LR|o@SiU>`tL#5iTH0slmEB$iT`(a z_ByU_(g*&x#c}?BiA`1&LbYhIYDBBGK(twP;&|&&#E%ql>sZlYZ4#YUn>fMRiu=>W zR_lCmqIJ1A$+}vcY+Wx-vAV>m*3ZP(tw+V_)?dUKwojaCj}T|sW5n6^M6uPLBhIxC z7U$V(#rgIz;v4p{xNj8~*l}^8-61Zr&lcaZzacKRFGboFRBm5I)%IglV?Rx`_Ny?4 zf2KM1hqPZH3t=414HVJ5KqbNws+NnP>vOQ>GaKvOKfzn?7-(I-_^Ei9#$rT|6F(C_ zhu3?T=89j4N8sJx!&c8n@pKgZhE|Bj#N!wpuL7xg0%;?lw}+#|<1~!A=v#ryZD26okDV@f1!8- zPcy|%|7+rpkZw>!tz*QS;w@|nYquwhw-L*rrS>7>9n@jd3h2$dpbYm!GsU08pUFn= z7b5l^+0c`F#9zewuycz8KJi!a0bc(n1*VC=fwGTA1Zu>Gh$#vL4ibNd9!SPU#D9s8 zcm^3*1_|yW!K>7;lE_8)d`d3i$t9LD(8)x3;$zxCKDmf!)Q?fkWaL~SmZ<#`I7$zU zMT08h(*p6?%vn)C)_eS6i-8p1^r)pGHUlZvKtM_W$cvAGlmG)MzTQAehKewj63%cI z?2)4>n$7Eu*=C6?X{8YhY#xw;m|1DWQku6YX@HawDl(GSA{j^-#p{n6eVNHI22y~n zFpx4@MaG0fyq0Nzl+k?xDS&`3i;iX9lYtbEZw68_daU;4o7^52q6@p=#tqSQ3MYUR zE(}B}BYhwxBYhynrMk9XAVuR`ncnjrKuVCC`niCVu?(bG(NJ_85E}p~K@Ug?_5q}@ zZZOW4t#P&)NkB?46-b$p0;B{JKuRz@AZ0>$TzEn%kiwiM0V#Z&3Z#6oo01Hqe6cxA z22#G*oE9YkDa>gfKneqqj1h+%%p$`8#2!xI;l#rk)76%$l4Hia0bX%{;T(pBjio}Y zPap-@No6$C04V?u4UiHFhx!Fl9An$h@OFTdEMic`15yxQ!wJbi%G_`$2}r@iHqMch z%>h!voC+Z2#~ARC2m>h&YVH6j9pM}XQu4xi45Tnp$`-#Dkg_zK1%4SwsbbJ20i?`G z0aEe}kdn(lN?!iBK5>+N!~3Ri8l4y^icZov%B0~%;fVJ zUX7#p0Y?Kzk@&d4;3)KC_-hwP*%$Ex5SAhwg>X^Wze`-)EfvI&%_guw`W^gx++g?$ z3SJSlG`<4preAyo&pdnuMYeGf;44T@!B=qK6JPle_;cWu5?am3NdRjA17j-%edW+^ z`~3kc;USdh6IB^%mF2vE(YqO%$syq>{gc^aFl8W;c&qP!&;KGw=8MFOhD!$R<~~3G7#1iMKhRjopd``(N(Ld4 zE=rOX8D<=z2Lfc8gn@|9A_pEw>ER>k5W$%4Z~58*N75t$eg{TIhDv7;SY!{#Y5SLi zKfq#*NK4S#^qJ=M2Z#)jpWbWUE*g?1p?*7!p^(o>1Iy+m_%kTOULs~dkk3gCfW?vc za}kieMa_XfhCr>){sZ<=+EeyJT*l|mA`JM^gBuVU8uIZ`!2ZY}AA5zA1AFW>QaCLs z)y54`Qhf|w7SWLKi7A1=6bx>Lb9ytghonAlyMS|y^KcHrS#pvNqilp6T1jIO#?dN# zPjxsI(Q2APYiKGRf$yeQQG|}9TD%n0($NS<(j0LKEkig)e1~G#)N5J-STXh?A0T#9>7@0pYlrJ`=Zy9MOf7Hf|Ne#P>y5+$KhgYsEg;4m$zY zB5@hM7yJRX%ik^Y#r+7s5cgnBb%%Hh;cxhQ?=$g$+z;UZ@esme z=K8q4ZWT|+3&oT2BJq^`mUsqO$Fm48>FWdH*YW}JvV2s$CSMo7lYheX1MvqH5O1gv z;*Y>Po>2RWH&vN;2+C>Q~~w)$3xndIx3S$0z96apY4{`h3#w8zn7-kiM45EMJ+-_RWz6zSVM=?-*Pg zMV9-kWQBjW9POVcEB*E2aes@9_&a5_|9XTj#D5`c{Evvo{7>N7FL8ZVJmh~~ z*81O+QELLiM7f_;B=@&Uo7UrS|b-&N6Up)BkniLMOLRg*g8|z zS?9^c)&+8j^=-M-x>GK*?v^X8m*t_>2l6mm$d$GwSJ~Nekv&DOwkzZsdx1Q{u9Iu+ zLveqkJjy;s9&N9aU$NWdF?Oe1XP<(!GwDeCY+7gELtnL@qk8-IwBCN78tsoL7RW^? zq>X_o)D);jSWfFS&QVS^^lyW6jHb^F&M^jO|2Q~D7}%SGbBw^bQVz~B68N2ia}1-$ z49+o}erj-z0$_Iz&XG-*8Jr`B&Nnzmh%PWVN0z(~tL2Py=2K@Y$g{qG(Lh5>sp=z%>L zM=(CpbN2`@sq^-POb6;fjwXY4c#B@%sv!1>c%TPjW>pYtg;5vfFrbJ2+8PK4gC5u_ z;(;EBG3YTSj7>8$qGMHLTsWJ-5wnztRm(nhk7P3Fu@Cc}40?EcGw6}oV`VPiKJO~Z)r-cnl0c78D(EpQ1@yqmqiuGNgwg{&CWgm{C#HfP z%xMzn!MCZP#}~UP$)Lv*bI8O+iQA( z9?QZx;Mdtb0-uloJyLg%3`^cUQcxga11{*jd!#5_l)`FsQe<*;ibg%A44)jHlt4Yu zLJ##|)>BZA)Yhh;9)sl7sE5t_Gk|*Jc&Nuc@Z&D%!MjKHN8m3QjzqXHZ1)5`@-*ln zLxX`HD0oFQph1to0H6n+d7uZ1Y~vyTJ&>FNdf>i)(BlXOJ&w_PN_@RmetGROWk*Tx zEPC0zKiGr!lcZgwPuzodlcY_7H?cT-N%|==B;I&i z0UQ87(cs7U0h;9yKnB#-W7!u9t-HGS4wC+4G$=QT{UZaD_`k)EyLaSEZqWT^1={I$ zO6(aKSU7{DAcN~~Ixxs!RMN#k(xU@$3<89tN2kBlaA#~gJ4FVPZ}R8pJ;x`*GKqa6 z=}^J28W;;nt5JHCd#J;pdqjrBm<#2mq9M)>ks%W5e}BkO2=%$1jtzp&?vQjS^``(SZL^k2i#YECouKon(k#j(ip^)pd7rh-J$!#3s zVt*1W(vzQ|;vxZGAmB^d5z>RJAz>^IEeAl@JA5%MXR|~PzJ{`U#@!3jgT&APjp{(4 z8Yaly>aureeeR|$vSla<9XSc;$jLxPPR405U&HphuTdeL0%YV=nu4EPslsosRMY7+ z4`~O{nN){gTB)P65zeF~@~dC z`6u54^3T2p<$Jz|>4%6UZ5u1hpQ>}k!q^F9`~Enbh}l}u-nv3 z`*bzSK1UVX7a{FCbf$e7ooD}?&bMEuZ`dEuH|@{p!hnx10y1(@pp-5FGID8P5yCnG zK4W%)1PwYeR%97;WE@Vra?p`6^rk^a@Y@mw9SLK{hl7rcpqC9gG7>wQoLwNp=|+Q& z(<0vYZ9kwHgBVV{Sy z3#7n*wn0aR`A;_JNS^;xgO21|H=11_1=hu87f7y-F*=e5?8Mmxl5bU*T_8FBkIXKR zZ2uc(7f6;|Zgzo$#16l+3nWuS%r209sKx982~wTe1rneoW*0~X`rkoEV08^T5`dmO zq0teW4l?M7MTLR68XfUdUSPRKM|?m>j?w4{jynUs;qC(YD)#W?_u2)LijNe?Va_Iy z2?3xcQ;33B%qWn|CvyEpZko{j5t zL>m#}2xr5_{RH0%e}cneDv}Q)N*qNs^QUs`l{5+`W6j(p$9e~1$?;vZyN?66uI~T9 zEu0r;mR3F3%v*v^>=0UPb_ntLY}h2^><}8wnA!O7Sa%&dS{P0wISbO!3E}*3A-0Ri ziF~Zlc5|#zPPd%Ai{9^|!~Vxk`BHyNmRy&5J^7Y#8ud(a%9o-|_W-r=UGlqMN^Vb% zo}17mj`~t^dm_1_BwUS;7wiL9V_f>nQ`uZx?f>1WZ2jPBU#L^r^!Oq8>g*6+qAj~TqmDntCoA8+Ch_zQoGIY<{gHDkEchA+tJg@c>5oL&zO_y25Dh>I|doVN{cHvLM+_$@O=(f39LL_N?fTJ z^i;)k8mRqq`k48U8FXhOec|SNKnz+78Kx35XDbe|wS6M59)6xKYyEbqi=lsBLMo84 z6@N)M`re|Lgr$F8lDwAY@0*Kyw^vt1zJx1CPrRQSpeX%u^y@lJ?AFl_u;RME8XfEB36S{wha0kNebdV~c zBM>&Ka%xqT2y@JJKXct*Upv(PbiUe;E>m;qdNq%pM0j2uNUvjmpRE?)48w&uzwjWj zk6MH?3=hWng>%GIwI9wdoFj@=CC)6Y6UV5pFEZQop87$Msxws=8jCrtZMqJ!+%6 zU!9>IS7)kM)LH6p>TLC)I!EnR=lX1QjxS4{@0*~$fpD?DM%5+0sJhfQUwzxxg0M|} z$9J>(uJ8NmGT&{;a|iO?h3oz5a^DN;3g4@^zM-!2eX6eZXQ*rZIqEF`aCNPJy1LFk zLtXE$RX6zO;kroO=s!x`gm9a_cBmitJJjv|Q`8Urw<5f#?(qL!-Rb|M`jP)lrvF*~dtx5ud`?0wYF?S0il_9R@3)syzY>M45#uB+A4 zz}KI(Pf^d=XR3Sc^VReA_tgfwTfJaEs9v<+MfgCy5Xe$51+vw#fqbgd2| z_3OY)^>UyIVUv0#(5zk!Y*nuXPEo%LoQ?QJ>JNdd)a!xk)Ej}D)E@)4D@h-!c}f4>Ojlzh|sbZ)LQpk21cd z{*iH^`e(+a>f?;7aDSuvB%@3HJL6XMX~uo(KN%0H&oUlC+Ea9U#?y3H#(!vgFidv` zr_epYD(Vi-p&h{^5H`~N!B*NC{5rzrbQgaYpjH9R_j#v7+V1I)*gxr>4*5Ipbja7e z(;=VnPKSKnJ00>#?{vs(%y$7fI0@1{9rD}eyMQe0q%@~Ps*zM7r{na+(K z*i6JGsL@m^XW?|iF{*%SWHIuE6orf z$8>GhpWNE4H{9B+d)(S^0Hcwl^#ivy>khXztKO~6YIJL}|6;zE7=bWsrbK zp^YDe!_VCzk!ia>iIzLocj}d77s$vGCSUE4$B&ob@B$I^>alP}0J9c0#qoWI#@qwb z`S+(}Ef?csxt8N!DG!n>@Pm2Ju3S2AMKI|%=7NW`b~HD&1gEbobYlkvXB3tdCgR#8^t7ON;PbBk4!qsb0ONt7^Q4S60=!4X><5YaKyXR--YF zperF$Sc}nS3f4lrj-YGHAtfW|TIhyb41Bu9D!qYF3-LOFu4Sv{ z7OV2utc9Am#UdV?wYqhVpljJeI3**|+L{Va(6tzPo}gigaaUP85hjs!0yH`1r9lHt z8pedl$EMuLR|^%_Wh>aK=(GwR08Sdz!lYH2varV$5#-d*E4db3rV^qtY3K-(2GwxV zs@S6Gd{w2WS(mNi!R4f}9yn=`j!COBWl>)h?7#Co!nNo!kqVc`2u#08gM^%X)jY6u zzUng6tZ7%XjyY)+F1>1QiIWyFWl>)>%%D@IhHKH!YbsqHYhVFQTCJN_%lfVJ)xwQ9 zWoubsoiz9elg2G^(%6wPU#PDZ)}XAawrpZ0x{aBvE!R=bt5YlCkW6YNJ0vGH0_$l~ zBWyjL)EW$RlUjqJK7Ci(3?MwljD10lYI#U20b!GrM%H^O2ZaHTLpv&V3)Imi1u zamV{RapU~CK8Ti`e=W1gzMmtQLa^(1(lADK8m0#DSSHQQSBk`HlL)`)JcTvaB_JYp z`fh1h882GtM609h^mQt#gj@2;LF3)bFgzy8K3_+xqwMoJ8fBNS(@-0`d^amxz85w8 zpcEwPl!BgmrC>|ltnm0=)Z>vozD})xU2u7fAa2TGV#WU6p@%$B0Ji#Cw%XtGjpOfi zas}cTPOX2)6{+wj(5j8Owawh|t%?{tWL7eTkOOFS+j#o!r zpU-{EK0i^I?XoGrUOy2x%s~Ggzt8ou-}j2LQwgoAZb$3LMLx&RL=mMWcHCJ=GDOy19YU$jX2Nwyg1sV|4k7R~ zz%9V@fJEFd1JUc502hezOdwH|J(;EhGCXH-z(m{>D5#TyA>%}#btd9iFc?5% znRzOpA5}m{OvEY0W)j|$#~JLCGx%VCTtkJfa2`QDbcCk>CgP0RC{F;K6lj4Hfiz6S zDTPY3^JkU9h%}mpL5PMsY3%$>%uUnIU#Ds3@5H=eTg}ejNn_`4Vx}zW)6Spe2sJd~ zh30u`%Ff?;%FbWMwDUJH(`)E%S3_&r`8!Y9`8zRo{v1Pn?ED?!!}Xhpkqf(hEe`GU zHK*F=J27_onws|bCZ-)eeoKk)^Cm(@$uDOgMXFBD(SJA-&%HaKPR^C{kSY&63fmCm ve7WE#%8QGS;^J3vSr(@|;$+3iuOr!U@v)BF5tmk6mU3Jc#Ko4lT=;(gidq1Q diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/UserApi$WhenMappings.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/apis/UserApi$WhenMappings.class deleted file mode 100644 index 2a3170461c2fea1aea6bc83150f91ee5384f6289..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1459 zcmbV~+fEZv6o&uZ0xd9TQ9RW1p$d2!%2`1Wk&7k}5>UM0YG^kw(9TR|rZqm6V`7Xk zJb({n{5zX<(PX?KS=sB`Yx?c3J+uD&{dERl8Xpv@et2a2f%crhjeWlv+4ZKYz1ZeH zvOh&STnpUF=VR?{IYHohM^OPvp>*PO9J}dwNA~u?iLS>5 zkIg3*9-DfF_4RaQHp0*kEj%^#an^Tr*wNv6ebUsQStytry|7R;^vc4Zp(zVPhNdkH z8=AFX8Jf2+VrWrebo11Y`Nixl9Xkytc9uA4txlekt-1?8MD8HnqPyjIs#Ar&b-$q% z$~$c@c3XPSjogE#Uh_OZPH!BQs(jgf6pE#C_uccLa<}6&v)?qc+cdM+G_%t*v(GfM z%WfN`A}--F6y5{5k+cou)K6SH`#tm>HIDaJV) z(^AQ@iesvaYig_ON^0w>OS4dZq6VRuUI&^AFK$cf7E=A*1ZtSqR zob7XL@rvTC^5TjmS#v6C>Z+V}f9JFB#MMQL?H-42`$(!)8nw02Q-aal!8R&hl|Wv%XCP1f|v+Ua%W9S6o^<7q3TV7U?b?l1eS!ETqrPUS1l0FY|K!LMAKw?P1_!Xu_=AY;L*eA&@k)AhH=)pa@o?_+N#{FgYfU1>T<c`fSWinzYxgg%DFqD9x(pq*YqwHZHp>Y!i{)|_X%VPm z`9Momadk~8XM+SYen&SrKRb;*>b0yu5TtarrC|erdw;0O4mW@;chT ztfqfi#fswcvc;oaHlDMt&9$c~aNjT+$M!?jIQ-d5t1FKyUQ}MH*#02s;*yfmnwreI zs>Nt;LS5}ry;N#ATbA_11{`W^8!5}9YQ4lJvB`wv127{MrN`}GS6055I9xBxNK>4f zm%!gaY)Tl@cra%Q(>SxZc4-QmN|V)(O#@a8cc?8rzBbF7g_=WZ6`KJ{!P;I93|H4` zCK^YMnXDrwHcJSHvctk`CYuGcwa_WW=72bh7cZvH%qm^79IPL>9M#+e?Pg%}*x_L| zm(AzQ#lQ}&E3ID1S(;Cs!J0^6N3bJlv`3*JTB=?-s}v(@To746)k5~m4y+F=Zp4i6 zO0g2uEdysPuB`;ZyESTLipd9nQg%!SwwNv9EIrQ6{P&8LVGfoS*GvblHUC?X!j`e} z4(wRA9E_(zXE$D6hU2ENN>)YXe&tiCKfKJzG$O@-Kf=P?;_|xE6jn#2YuO6FA9_pE z{m>+Rd_nXX+K!|o_^H9M6i z@HEak7%H5DtwFIfFqSFPXU(24ed1(H#ngnC!0}n^><~MXodZs?h*khFvMc?g+_~&L zf_}coz78ra##*UKVHbMD@N3Reu(E1F5TjAZB96$3ON*;#(SB4>0_JfA&{YfnCXd3+xwHRh5^O=&d{J z*qX`;mtBogRdwh?VKaS5K<@5(buIfH_3ApbJOOO0s@7#UaK>DA6VO^*T{`(!b;V%g zt!(Um3n0;Yb_;Fnw{kXmT3JmE_WS;cnCrh(qjq%v*-MG#*7UE&=*y~0iS6D7&f(Yb zIA54Puk{cxSl>u?b*FcxM|TO04D< zPVT!s#-y-^*(1b)w{tc=NeIDynK^H1X$8(YRUkZ^Rv*I&1Wd1P`K;s0YD?%?NiQlm_7N#)(5#%=k@J@)m&ECZkVHW`Lf{MN0gdG@?jSo2h zkHHqO55w#O_7R%*fi^n;#XbQG^1j6449%bhhaiLBIOuqD3GmS1U)g72_9^=taJd`{ zwG8LS+AJ*H<)d&KD|Xr6IUA73N{=6P+;PW^(giS?;KTUJTkNubg1h*Q9)Q|35%Kx| zlC!C1{o`z$RRS(vQ(Buv+#K=PDgGwZ=qqZH$2!0bYxI|BW%ab;>Sg+4lD=%d4zsV= zH=rr(o}BHM6nlvyp=lq1iGQH$ z5eC=A=lF;=R8-u?q2;)09JVx5no#2rW9!?p&u6*fZkRhfgs;H(=ti6FdYycC_03Hi z7+T_;28OvDAKBxYn=BvUNsuh>2$JRa`tIC_GMAUT9G~00fj?|owf#%#s;hAVDPP$? zkT#5Vd3qSTHFm6V)pU-isU=EHC|X$&FJIID;8`=K_ot8j{>2rG`xD#IPXN;u%MbDm ze9%LV5@%?Miz`lTCf8pOn7{742bda<;ABcWeB;lIU5oePy{UK~{ecI@oWlEg0Q#q} zYrWJ!fU2sjsZHUTUdCW>=@~O;Pnj`&mdp1+cOiYicQ|MJ?+*RR4qzA`PCddm?;vxk zm|jVH$^O;F6|`}nlckH}2Mj(c%tzA}5W;fxj*D$SF+7`kk<<8?YRb`)<$3fT zAI9U7-CW~aW24V?UJzmyFXSwilw>Pkl?)mfsEth!+b1< zD5s0RG7?KD4iZ-QPMug>jxBY-E)Qj+Vmb;aCGehXXg>(C`h| z=u^o1U? zQdTpoPRo>zsVh(6D?E}ouJLm7M@;M=jG_}?N$s7Gu-p<$D832|6z33}hEw>-)VY)R zDfr}rz+ve`O)#g@Id~Pv_qKzLrMMjQ(nu)gf4l%yXYezr=vj?q1m1ha@#!6cfPJyv zpgAjOj#(#s5SJI%)L^a0b4)ua{9Jw>?bPSvcu{Q@a&mhecDD=hIhrKt7*s2MQIokc z9cg~9E(!CC`EMY9D626d{Oan;>J)yNM@5$>zkU;{D}H5|uO+a_E`Fl|ptco<)Swk? z?{-L6hxt|f8Y~%{@_gE%j|qYbo|^2ZoyT&iB6!R1_;q2vgkQg#BWH1fR;TgT9KSKd zZ=#R2+&ySq@%k{og+A-Xco^=#xU#fHpR3Gis(+*P3&Dif^BR!PdXP^`wG#MkqdK=^ z`2%xAqAC3Mtcqq5Qi&7;r_x*Bic{ed|3S`O($w`SJL6fL#q4Ph4M zn>=aNG@r?Ap>=!}zXz>&gwWr#axZ27G0ak^N=FY(<%`D3- z&ZO_6$;Bm0N5wb)YVVYpiI1hsZ2dpM;8Oq>r$-Xb0_ZMq4WVJ1$Rx=_rh)4h?UK+1 zU+@U&dMAWB)LR zF+%3(R#4;D3`jFRg-ws!0lBm^g+8rkdx%?v&KOyyKf*BO`48O!Ec)z{x{o2HnIU-$ z#f*uxL{+p{Ag1$qjebhs1q?uh{k~B7w1g7+n~zA>e325P)nLNrn5Q2cTCR<&8iFR+ zOFfOBF5vnz=r2FhFxGc@Wl3@Q+~VrV#JX@SN_KV=b~Ln>bhU)N4AoNo)_vUKyD!-e zw0Ncj+zcOX87c5Ey-*6bU7_pM1Gp}Yz#ZhBo55onWglv^PmMA?vaksK;4LigURmwZ3DwobE2mUw<-@R{MC*@ri^T?Tls}61~iZ4+!Qg$ zLvp5f8X^quzj8W|%UMw~LvQ)?nLy209P+@)vs1)SZ%T$W-*{e%7~wTO(mSwCf`l?f zjHUzI#UhKdgOWlBme=S+8>P`D+Q4YE*P+ogB3EQ%D=V*DQdU8aaVfW+ofhY?nfby| zs0yD+$3bV|3dn-o+Dfl_iYUMl5L5)Yj=_Fb!W?ByjL#RohXtfJPC3Yb2EME_6Y<=b zRP-r}mdV%@F;0vRi?IS?oDLp+>+!e((wpYiPkxHn-^1=i)JQma;FBitSV0H@m(C2Z zgOs<~Xtt~wW+u=VMuEz@S`U9IK@X7Sii4W(LNrAj>~-M~)c1@sy!x@kA^Z4Gf=_De zFFA7#XlsT?Tael`H~NAUahTWiEKCxanve~HE9Q`01~4|MnGUpBcL2=_?ccGitg6!5 z8dw~Zj;=Ybc*&B|>d{b5tjKZ2{4f)2Kj;_)Ody1SU?G5gtm8A59o#9^#*>rdq$B2)Uiat0TO6=(u^58b?jBPc zwDG23|OujuZ5aQC3kpy>9uU(rS}~<6Qz}o6K+^ zS;pp{d01TqF8y$1<<(_)R@hG$jQRhN{Kh#$o1JxnTHRJSA$ ziD6qe5axQ#B-Dq2mH>^?e;uIBx0%DFSjJfYFOb@YvG7?V(mQWvT}MolQEMyfK7SMI zwT<T0;V~tn?nX8yq8eCU1B=by&YXId zHg78%H$VLso7jYHY~uZ~P((%S&FsKPsDT|4u^ZTQ>t1`lOwF3Jnayrs3u0jz?I5Em zk#MY|jCP_DN5?wLXlkT$EKNq!BWYXMBF?rjNd96Ok&G=2LbAHnMq_&N%jCGgM9+B=_7=&lBNF-t^jieMR#d=11Zey!ry=1g^q$5>>+zc6! zUJdN@d8~ft4j`?5=Vgp-WNYR{!VT<#SRd-yMd_DpVV4V(y)xeK?W|)YyoFuG**d1I zdS=PBEZvk&zh(=&Ub1=Kb^52J0y5 zx7AY7-^Yu3W19ac>$sKOH9vjhCiaK>fsORLp_<#ww!~6ov|}VCc)yk2H?aHWr*GTL z9*T9Ku|2wxJ-x7j?HIjY6P!H*5o}PHLKunU5`+~9=P)K70yp}RF}r9hdmcph=SZIh z_EJQ}I>!2f0NBU}*eh#UkB#ijk=xiS8`*o24h`(%2KIS9sJ%n_KQP>Nz<7uBFZ95# z+RDC~&n>=*{Y#ULjHZEd(q%LQ)%(P{$Y@uPM>iSm9_f}qNj)Mx3{f0RDMLvhl~_+1 z?G@=6>n)@GBE5aei1km%(loXzHXxE7=^q);z`i4r*=UHRa|8Qv8+)yu%|aKi(On#f zv25nn$OayspTSdrv|v=cb3Gd#>5#$Gbjh@>%teumO}q;&9`C7}d5R5;^octi9sB730vK&;;k8DTX9-(eXJsXgSx(q&) zH}H}5tix75dj2M!b-&&lWwdjoV=R?8Tv&6sNV?%~35=~9u{pg(=26Npw(gPcu^uuS ziKG&@GrJv99xH3$xx~UAGc2rQ1CPd1Hu9ndzHcO@fluDTaqfmu}-r>iL97$IX2CS~hSi zuhcKAn-r_l#d=ci@oQNF7#lFsz)$p$lKLpzH0oJhB(;IBj-^M^X`9ZF(JpjWXtX_3 zvFVXc=&zbr&!Tj$XyB)Ndlwt|LrM5R3fQ|)HT{|fem2+#ICvyIgRg1e7vPlRvF2a< zta(smP@}HKGNXfIL$>mZ=SPNg9URHr#4n|;vxPLmE7r2nTlrc&!V`hM5W1^z)Cj~T zzD`#exs_ivpX*`nrtGyS8*?H~1HWM-zj1zH`2SiH}TE1XHk`_ zs7i{ivNc}pPgLx_O&n(nY;A_H=WRewq$p>sb1f_03H#lUVnXpB>5ui%fBp2o0$(tS zjhu$ClTBw`S}cYFip}LHJQtyl3CA+FljX6VZLOvl43ujDWF-QCAnr^v6FRd3oO2dPSwGGrc>zaYdi6k_mi>S38dAIccLe-kVN|W zFXO!(>)tAE$GT<<|4;Lnt~;?)B*&?+;qSWe=oIk$PBuJA7${8q{CR{Xd>D(IvDi*F zEh$I>XUk~-(%j}pkmyyiJlKQPa<4pC@Z?Qm1N2})w9@SOJV=?zL&7Lpg2jgHWPRHN zNq7IG=6i-6eh-0R$JZw%9LDHBJ&pTuXNsPHo_p3o|1^>ab0^%Clb!)I9*lMsQ7uN@ z7+A+W0>;6-<+D ze#+TBBn&%*y>SP`Cn!E)FHmWz;w zki#ZHzCRb?7=A2U&dU*MO7x6;=2YCYjqdX1qIlMt$$2ZG6 z`4)LM|DD{*?~zaNt@3q#uly(fll+3;XEA=ivX#)7EaFzm3Ra2FN}4`k!Q!`S%nWP~|vzwnW4 zLbx2^3|1g2uoh?It^~ol@@@P9){EOL9n}30>kYX>AO0|Z1pD>tushh!AI0h9EnIW) z7~b|^PqUf)asC8W?+#q@@FeoO!6|kQYCOTZu-{_UZRbz1&g>fa+Ea~Gb}_pIYvvh< zA1-CT=FcLplkAS$Ja(W)Pn~)WJ?O7f&m%QJ_GDxDpHZ%t%wUE5FDMrgAFyNj3xM23 ze2n`A2y$2PI>co!@|Re;cnjATyo|gIaS8myUg58@j#zg+`D@ggRpYm&Q@S;s(ydu5 z{MM{Wzcp)u-*Z8g3EBw~%VSZ~^d!{w#6TdZ`(yi%~Zq513Z_W9@Z_U}{x8~gAx90rbZ_U}@ zx8^MNTf+)8t*L*2HeSbk^iW^IpY07`H=;gc1NH28SNE~mdiK-R1ME;eM;XxIABow2 zlclPAaG%CosFCKr#g_56G1KYpQ|x3tTb*_49sVv$b)Use5%1}8mGBjMALTl^W8e(% z0soM7bo=s+{3HG`OA!aEHT)C2?ZEGJ2k=ip8}PDoujhZ|pW%{%V?xJ*Lx09XY(nVQ z{Bux*Vv|DW^S=W!ju>nt{|EmkQ&<)Kk@|uute-#fFZoy4pMDWOh=0w$f%tWBxS0P7 zkS*3NTm^3b6pj&Y_+w&w>}t_l%25Jh)Vf!Gc~?(Psn4LA4_i zX@U#!Q%oZ=gw<{v(QX@|Z6{i{jj*SK=6utL5l9|`P=|0fOd}q|2Jiz+BMK9>f$i%1 zq}BKBrV;-=vy*ny2yKVdZW{4FYV6c*8qsbVK?VnV$uvT!|GlOW^E}fCd>iAhRnv%O zi)o49ZcQWFQmtjvh_*l>y9{F*(Q>u6n?|$@>!+DU><%tOeXW^B?C%K{cLPOh5_SV8 zZW_@l5Kmm(MD0c2KBV4mWEznqsN_u}k_6at-x5qCl7j^qAchwFXT}I=ZQL}XRX{Dz z9!oHdXcbI5-bo#~ckmvVMzmwSjRq;LB5XI*-j4Ogsy1V0_Fv{Panp!a=MD>O*Ur$Y ziGje!}{h&BS-Rps5t zG$Ki8Elz1*8u1eWHDemFmmnsZM*KvOfgMAF0mt3~nP3{x29V9pZrn7Y38XeE_!CVd zc7^oQOe6LRyadyTy#~+N4D1T8Ek-4QX~eEza6gegbn9bEs}?0qO(XUiyuC8aCZ-XG zLUD8$l&gn9tvU;)5wl<#F&m~4bFjP3g;~Tr7)Bhgkq8UeWD#Za z5SEA{Rw2eBOf>N%6HnH0jhM{N5tG!-WCUQM;yX?h^f4{n8y2v z>3pD=!3T+nd>=814@W#ojOAHkCO=9X%FD$pzD~^Mw~D#^E^#=22;mtqpT7p5@y`*y z6-Nn26pI584iY5@%S~LN4Tqdf-<>FW3Mo}$pN4!zgitVBf;Y1z3C02>I#7W{~ zak9)n*iW1y4;HKCbaASjAx@ODM4g z@(FRSd|jL;|0&LwUx*7VCN8vG#GS-N);Oh ztru5Yx1r3PD7z8yR&kB>qPW(26Y=}vI_n2q#8u5mkE|$C9M1>nc+*_2uG~!K|M!W^nh__%G z@h(gw-h*kx`!J380HzV|!8GC{m_~dI(}+)C8u2MiBR+y@#Ah&#_!~?kK8I<<-(ec@ zPnbr00n>;tVH)u@Oe4O5X~e%^8u4$KMtlp?h|gde@f}PfzK3bV4=|1R5vCE}h3X{> z-6nbHb}2%Ck}~w5v_elHZwFfd)$T%=M*I?{5ydc#SOn9E#ZUp4!Ze~3rV&e_1TKSV zL>WvY76zsfGBAyB0@H}^1Jj5%0@H}MnQt2LOkf)ETwogUL|__mRbU!%ZD1O4Nnjdr zS-WXOyJ^H;GmSV%onuTR?sEGZ(}*nhI%68KBvfWhBlZtnXiOs}ht5mNG-BWIfqP;a zA>7tXBf>w`G$N(lG@{)!qTMtC7fH0=8u9<^jU4T!5$&cC|MU02w3|k>n?~$S(}>RP zrV;I?5fI@uxi!OR)P3d4Zf=ceBElmR72jPAV0UBEKyPa_+3reQxf z^Q(5#2<4esfNQs#M!gm2|Y;m9%K0EB~N4#GGSkJs^P`3rHG+*e!u7LReUU`$qa=3Dy$aEy+}$|crV zxzw5@%dAR-tK_lP&2pKwUY1+8q0F5qyAknLx!ihDR#`DlHAk z7RVb_jl5Z%D(ltR@dOorV;1DG~#@i zMqB{XhznpEaS==-E{18u#W0OHyWKRR{niN9<$w9D5&sKKBT})U=^xaHjKg&nxLDbp zJ0e4*;}}$O!NPMJUvk-$5bK=)w z{QL$ppq{V%-_qAX_3Y{YEq!fQb+@a!_ok|Q@c%|tcZZwVoSm%Hy9I!)vRl6cpqWBi zzQ0>Fck-25_Ww^FMuPW$OO@L0``;3zpXT}BGSuBFr9I{Lex7o>MHrs`YPTM_!@VC0 zXaz)Tik-}%J@6A6am8;d;C9m^Qv3eg`qbVdNNQU#l8CF)TABN19A|OLG=?B?KjT)Q zB<*FqTR3g71VCLirWOLS+CQ$;w&jxEly+LQT&s@NLNk8U*aX^dj(#iH}OvbXu0Y* z{585}eeVEF@FY$eV6!tC_aklu=O=g(H-*zCA7b^btG-RVUVSe>OHh;TC1^%_)D&7^ z<3}5huXd+3uq)=le9Xn_O@XvYq2-QrU0h%kzde30LE8%h^!#jb;7@Oq5- zdfbT#9&E$krVO=IiXOm-W>?Fj4HEcq8!iclwCVyomU z2=AEqT@$~j<5T5(>~i@oyFq@y?vNj{ml58QAF3& zZ21n)m+$gI#AD?vd^|2oUMBy}Pry~lx5zK}CixY=PkzInLwH^Oi+>{j!@rmR5lVh1 zy2zbkHo{zsBXlrvijL2>I>O_&lepgMEN;MWKX0-!5F$F>Vf7R{tX|@EtH1b{H9+jN z`b*myB>P%}mX~4H3eaYj;B~N@pPy) z$C_(ZS@W#p5ua?$x2~{`ux_%Bv~EM)4c1ZCcI#;CQEQ>~n6=1y-6}yS)A85VvDVkt zGMigfc5mxfb|&KCR*gN;s>pVYpwI08?6hRTdZF@cUl)YPg)l{&sx86zOpV=Db{7GuXVW^WL=>~ zSm&xq)><{wTBnMw->PG*t5gM^kF%~(CtBC4Ro3s+1=e-y66<=k4tc+0>(%w_PPK#G zrCwwk)cb6s`hxvYear54yCMu`o86IYi#rZsHoKFQPhuP^;%R|jZWrG#mxlwt+`k5X zxt|AqxvvL)xo-u2xi1HPx$6VJ+&col+}{O$xi|QJx#DTo*<3chgQb|u#;;))n#;zo zW9NC7jmvd@IeE2TPA>Dy$qK)mb%0;an&OwUy8Gp|7vdgUjJ%t`$GR}Zu?^YYHs^%|7vdgT>olr=T84>Zs#ihYHpp|0g zn0<3KH|WH_ntPfXGXAGSa4EQVHFtM+Uvo8g$ere2&F#+hujY2=iZomk-pbY7L&QGJ zqF*hK;D;d@DOt+fqGTD~u4HNd5%WFz5%YE>i}^YBb|s7d3-o(-^K-kBrTtf^_x`U? z|M>I&6>2dmP_q0HVnb3``@cf{3#6waEI_z`elYst1~CRd#@)%&H|LPPc^m(+{{QbE zr@jmQ)4xsKVLhAMu6lt))7;w!yl7#f+~pUk8-0o=xZ4Q6^^uNBxJ0U4i8r~e8`l_6E)eHF+wMCII z7utoyOI#ZfZCm|{+*H?1-D~O>58Cdu6K(nB-8i(ppqX(VGJ5isk%&*$+g8a64 zC%FN%y)eK775|Zb(blM6o`B5oNvL0*g!<(v><3Rl{qi)_FV8^z@+{OZJD`4f4(gYu zp?>)@)GmKPcmd(hY?gHcD@CZYZf2{jTM+It@dgub)bXj-Ms~Tif!$#Jk=2;#q+HVyb$qN>lQxV`V(Jf-N#R`w((o6 z2lyuIA^bM%Bm6mp*RAdR6YFvQz4f?I))S(O^^BN}FxT3F@T!Sl)A9M%>rlVE0rkt9 zP`|tbwadE*AM1FB^$FB3pF;iecc@?f0rkt@p?>)S>X)yee)$^em)D_w`3CBje?k57 zZ>V3sh5F?`+DqsR>qmI{SWv(GD6h6{1V`Qq&!LCy6!{e5=j~4NuXd{Z7M?^qt$$m# zoo@BCGpt^A7pu43-5O)}KfiZbRJ- z_DE~HJ<5929&J5lXIrn^=$&1tuWn^b9-OAx4oa8iFmlZzdg~OWFKlzw&&R+ z?W61ipniGHKG#0TzSy2(-;3}N((l*@L;dn9)Gx0={qic*FFWkd?L!=9Pj$v4>}$_( z_OoX?Q|&{YL+!(y`A9FaXFC=49H+*f>l|;-b5`SdjXmGF*k0gVYaij z7Q!<2a=ZG)`ahw5!TkH`mx&4LmnY0GqfT@C1?rar0`<$BK>bn@s9(wh^-FoP>X%>P z(-68N`e9VjA63O423G@2BV4@nIWR&_A*^Y?X9f){7tME)Lt=LMjaVd z5j*C}Xei>sIc7wIDB3Lc-NLSyY#!xAM<(WMWNYT3xP^*|aJI63^EV3UawbG9yjC$c zq9X1lHazAG*RVITF%h?cUqZyI(Eo>2o zN`EP5u`ZD=TUZ5WYuOS?RdcqD)yBF;y2iT6X!i)jo%*WBm9ZW&8j1AS!cIV?o{^rW z(nw07Qmj`5Xj&EPEu(!Rov7L=1Zh>IcLO_p9)4tR2j-%Fr?0=k4SN^F`cls>O21?a zyIi2`mGORWXXyMEb`@vqn6m1bCD*caQ#$<`gK%B>#x_;Hu~Fq%2e^Uwt*`QM?aWKR zIsN9%^c$V28tbHA1~@bg%Gf#c7oZcWq@o|`rY_t_|0rftfP!}igXO# zH~FE}6dLNI8`;wf8`zG~>w!5)?lSO??*N z)+yEx1ORn@i4)Vy5(JrGB{bW+ouhGQ^Ze(w6=GLeN z9-g1UQ#P}QHbRq-(!f4$@H7c289YswOxwy_6v@DmfvDAc>Smr|gChMRgBp0x`naDA z^)UM!QA2Ca}5gk?w|L(0mnkhyWO^d=Mv|7 zj4{p1J2miVtm8&r)WG+pA8?$!g&zXO*D2B|{SsQ%{7|rvG5!)qI@2)S7M6KE`GCYa zvj_msUd#Gy<#Xp#TK{uY17Ea>dww$eMLKQf%h$4jTY05^S>2>q-8R0Yo<}J6__geA zEPP<3fuHChCGAoCJa|2;jifd3)v=672C>>MGTN2+eIpi2#im6%qrYliJoXkjOqn^eFM~B4r*~%}TAK9ntkjUUo z{8H*UTSx=EVl5lJm9NzUJQ3Inp|=`EjX-ST>vWZoTlrP4Zzkp#L6xhhN{X(sHD2sbRP4S@{C>?t4Y>yzoRq<&!CA+`B)QTS^1H|>Ntiei zz7ZpLvgxdA%jL8@vn3arUTv<|tQXCmHJ{^qh+u@f3{Q8vO};e!S{ch8yVJA|7z1cc ztuwLJ!L}}sC!IzA)<)@(3rg)OY{o*+Xl<-WX?1uW#FhuBe{AyS*|VQ3#(u8-(#|$X z5=1lF43EI*h4!~e5>PTOH%Wm?*6XGXz-TDDE+niX8YHwfJh^4<^{h1oQ1bmk+bsd} z+;7?hidf2Sf8B4-pta(Jv&TT2@x$rXhH233%nW!Ha9oo1J6$=Zt9{R2%g~ zbK-iUW=Gp*RndX23nc?Q!a^{y!=Jtw&C z37W;ry$x{hj1;~*t4MhyNwn69eZ^AQ*9hO}xF6z?>|glq`8O0q-{Kblzrip6eT`rJ z`wv|5|HGEx`rT#hdse}IV83ENvKsh0orJv8IA>>afglk$JIAhO>k!u4b!>xu9KtCk zUTxx2b=+W|%AT}WvzP7D*}L``ydy#v`%FH_K8sJW&*n$i=kSI08vaZBTwZFQ$B(g3 z;m6vm`EtZn_Hn%0KA->2zJT9p|C+yHU&KGNFX3O>mkI|V&Av?ZwXYP}2;=OvVv2pW zSc7n$eJ#SRCSI@Ohwas87u%1@o9)MBz5Ten#ePcOYd?+fXC1#_|3$uFzaZbS zUzOk6uUVG;sui~1um;(0S=sj6R)PJfH69)`he3ri%YM(A4K>bE`y+(E>G)K5(wu7l z-MYa3%DTn=+PVvIgZ(e-S^Hb-4f{XVd#L+~{hjrr{k^r*{=tU$+V0|T1f}Cqj%$x{ zLUxhU2`Zk>Q0sJpDksf8(aEsaI9=>t+uzxjIbH3$?e+G9PIvopr-%I&!go%0CxZWb z+P6A=?e)$8#F_TB&Jd@kQ|R<^>JW}|`Z~uu{hTwL{>~a_fO9d@>zqN(%}%Csn={zC z3#B*X`2lCB^SCq2dC3{>yzY!}-gZVgA339ybh4Ckveif@M@@8c)f^{JEpYPHB4?;N z(J4@8JB8{>r$}Ax#MDiA{=G9!ZFI(~KRCZo4?Fv+$DRGubI5xMoAN8%ab2$5Ozyfl zJml`jJGck(6t@JShIe*P;HmDp2-o8mC&{m80UL*l9QP5E`BS*$aU{zW2k?hjh#z2l zeR}gL#@DA0-xu}`5A#P@FW%qy`t;y~jIU1w-a#|@0F#_iy0fb&N7%e`kDsdfHzZ zU!NZKcH`@lVLxtseY)898(*I^`$6ODlkR-Pj^%H|GbY3N3p+{sF{SDh`TC?eFF~8| z9%dokIgbC5zmIaAokD&s|A2qUIypo52L2KMn03V3ovM9(Qn2dZ*S<{zfaCBIpfEy;6h@IqgcL?SWwci$g+!4?Vbrr(g;9tUM!l);i3+2j-=r`KHIZhf zo6>>KM_2ZhI9JA!sT@}rQRP@D5=vfS6iQxU1m(d=P&ZI>$91E#t6-FtfFzR3wMjZl$Q3`ahEh&t&zP?in%iL2K zb%ZuIL1BdSe9A~v7)^+zBq)sVvYJXH6!R2DJt-FoqXsN|V1yJ#8Y!JUg;8CkGbxPH zB59;B@(l-eQ5a3vdTde{MPt|-;tHdYjTA=dMq!jj3Zt|PzNT4?(ZI;SMqP~!ie|B>y5NPjYr!^W7JAntueAAw$>O;4KzkqV}noh`Pm20`3Msc zRzN%0nrg@<)ey`;pc-;^qZ-1yKsAIaS5XzHhLGJzHH7D;s-bxs&=b$QX9QiWHl4W; z+wGz@X`~g(Xs(3T0JNkJinO6dvznl`HkqTHZgv@l?qr*^KhU1+iVY2BkM%yg1Bs9C zmK7qNXn5johL)VJhkjtJdDNKtc#pQ4+?xbC(c^Bc<=M?(v_Nz>!!i1upG$8@chcUM zxX{|0Z^pFlrqyX~U2D@Sh-CCNtpG_@QH_}uIYq)kc> z^?|ECFj|zo0?N~$>@`pwno?*Ru|ztPW;)X*ZAlN;?E${E6Ed>B2I{AdtI_RdjQ7J~ zsXyz4(3uZly%F#OJZu2uzL`9e?ZXGNp?nC-MqZQ;#T`+@5QZZRW#gO)Y&ycx&Lmdq z9Dp$0#4}7hQ^&_TGubK540gVA7`xn=#U4O-%$dzza^|ofoVmQSGmmFDhx0BDEZdv~ zyr(mr_jP9Q0f;l51Nac<2tM06l9xC~^NXE@{C7?4Ob8eM)IqT(S#P>P3%a@$r%MYA8#fXn}w&O0b$8a~;GfGp6EPbPjTM2%bb<=3g<)nBhpR6?guvgbFLE zIx9Rvut zJ;<}v4n9V`$#c{PJlEw2X*}xo;05kbg#Gv^tp&+ph0yPH<=Y^)?g{N)I)4!I_g?Hv zqw$EqZEQcjoj;02|B}&obZ3tkjYk*un9+E2We*sQM+W@Y%!XLG;y!dJfw?rjpiXmTwpX09pzbmIl0C!C+GR)r8OQ78;5(&{*Jj+>I0+kaNHh7y+TCG1gX<>Rja}SfY`Sj8_l3c4#_+`mH3(;d zTDL(C2CB8A&HKWPdVsyMmi2%;%cyPamB5LGeO}L-bCbC$;pb$UxXF-LnCEBUiG(2r z4!o+M+%nSRgDGXC$8ej9^^(!vkzS-`=^yFii;!aj60$s5a%^BEBQhW|uz`I?P6!)~ z6GCbO`*9n4t)9(-6#2j8nj^nVL|wgnKk<?xqi&B-m#7x|zwAdfAvr&)p5#@e)nd*1QPm~qM>Re0qlz~6qiU=c^Zlr_S}da_ zwb;+gk!to{Q;Wg<>A&kS6<3R;X0YO&YJ_${?hxSRpGS|LP z|F;-YBe%y^nJx|yyDm;TSu}EbY!ys0YV;(zZL;e0Hi4r7AvD^jg5OhX%TR-LQW@ogM%i<6w_3Ylc*T7o6r&_(z&>iNCYK_6%ncgUaERm%-+#h@~>USItWb>lm%BR>dA z!YNSuPhoxe!E6M=D1Hdk{Zm;UpT;Kf>FfYL18UGip!PhJ9nKF!n1ygCJ3^(hqflozU_ECT1a+!CL!D;NLwuAv z19wrLiEy5d&sFE!=i-ja->3`i`w;%Ber7u)|qnIF}e4p-+nVReZ!SpCKs zg*aDT=1f&rI1AvK_)B$)bBtQ+oT%10tJH6ubJbPOC5W$7*EqMUYY}eJ@gwSH=Mh!! zJfm)LzE!uVA?jAB_SdUCb(_jpH>o0ZE!6xssmbbg^-FaJRQtE93U#MCTWwI6sg3Hl zYOT6X{XspT4pPskyVVP-!DR?a;YZ8VCU=NB&>gN0az`N^qsF^AYO^~@ZE;UUI9=WA zo}vEaUZn1GFH`rsS0jD1dcfVN9&|UUhunMB!|ua)ep+pJUr>*_@2SV!kJaPuXX;7! zOZ8N!vwAv|p`HyDsvV)3>bcM&^?YcF`g5pKZ4aHJUI<;PUJTu&UJ9*OFNZebd8>Lg zbiaBnv`xJpdQQC&dQrU@dJ}o?^Fu=)^10zId|tRGKRi5?&kslW5#jOt$nboGGQKce z#eW%Ijc_HOOXdmkX#A=|Byh;=9XMpB8}kG*RPf9bdcb9QJbw%d?+AO}cgSQP`3{-v z?Z6>(W8jc^ci@nDOW=@sTi}p6g5~lZaCqz`DfJu-BnIfz^GFSpquCh#XSCK^?!yZC zUr?^6_!iEMFTkC&tN5NR(S7MA{=sVXPq<}>FWIm3Pq=jvH}gK)^|6zQXXm&R-(!+qPBZKUdyc2srWGiDpa8&=TXQdU)u3XpQHn8XoUEs)nn4N7c}W#%x2eIpN91QFT;! zxp7qO8(w7`RXc~z^Bq;g>wHJm@H*d7HM|anZQt+Ws7iODHgQhntOwiIb53Ow805=T)r@_(tu zzd{@eO7fvg#s-fD;bholfD$C1DOKQt1D{8Xn)giSD7wR&H)S`S||AiCd1zM<0F&#h!hn@ ziNY~RM=7@uWwUkJF?h%iXXh3mJ1?73$VMs}&I8nu*_18_=M`!Qc{xSle5!`r+?;Se z!7V_Ns!{3OSYBREykcH{P%*zCs2Cj+RE(kSIh^}y%~x|^MZ;|;M`OMdObu(3xFjvvC)FU zpc?w=w^sz5n`%I>hvpWV96l55VYY} zLqAQmqA|fjC<1ytL>FbpyIGVSbh8L#;#bQFx>=-0=OMZX6cZr2C@(uebP<+bfaoI7 zgpcSVO~-`jB8^55(M3f>$Asu2!lFSm7z+_PVH!yw-KS|h5seV8QHzoQL&-Rq;US>2 z>@k>jGZ3T$N<*6J625X#8+^gX9Ug#xkGQkPfMSE%Sb7HQ*<*lg5AE4wihwkOcRU0O z13eB_2GYUO$i@Te5;s9Iq1V~j@m^z8LA%+x@m^=^5qlGmolUI6YdQ*8d4<6gWM^Yl z26KQ`@`6b~E5s{k7P50Rj=gEX1Ccq+1CqdvKM^@&Xd&o{$N_!CCn6`CXh=^)4)w&F zh@8AQ8D{6i8FF?`oFixF#91=ZRM$*IP6Aub&cVX;Cn5(F?N3AwmZm=uIl#V|h@2we z&!31K(2`#_7v1*j=4J;=2aVF&(G!tNoY1eEn-i=a;67MBXeL-cNK>!PMC1}{2__;p zKR-SZxmdOFiO2;B`Kuv2S1$rR5qTQNW+L*inV5;lBNY1+p*Kr!BJw~g@rlUGA%fBq zkw-o8CL%9CfiCmn3_Ck7&ash>(ofH!t4nd_7__5&6V=f{DnF z=ENr=A1gUN5&0mYU?QS=8R&_K(w1$`G}%#XHfAECgkpap^k(W!L=>bFpNJ^-bu$rB z>WMcI(fkCujK&#yb~Mh>k&e?PZJEJDL=)J0b`)#ZM@SSD?jxiCYuBHM0$|@vL;=ns z0Wu3fOMcw~bUUb<6JJdQz`mJ?0^*_mL=@mi5Yz=-1$Fb|y)MurHWN`m{3n=*f@o2E zA`0l-;_t)R1t6hdA`0~~&=XNeTe?3Hh1iVDL=+N={fW?be0E-0T?M7zs}1e!q9nngjz3;z688HEHsm+CztBx(fLW2 z%cosKm&*t9)p;0hKCK+@J+v;%p$xx@}lE)CA)(kBAt5(($x zfMts0QF~sIJW#)%8_Xek8PBDi(3GWPwbw{K@mw!ApBRA2rO}yOIyC!D=i^9WibSbB zuSgVUS3ftHPB7abw}5!RSC&3AOxXhBGA0)%F+Z0^XL9NE=r>(}P1F=Ar1rcbg*dkP zx$#*ojL&KjaXYUp9lTB1B3fT27iSMYmqurD>Ad7OT}0pA`9;}-@L^s+qb|y!WFg^R z=jP)p*5u~XSFD#?fKM)yTR@*&UM|R!TG1eo)%1p)s)Yp^=$I#qutMs z(z-MG^o{A~7t;DL`SeLNd~#g2GO2V?-IDO|Jrl4%QUT;-`|=4&Yw?86^rRCePqWNy z&??C$ygcudA94;)GNCi+tYs3KxdXH(m!M44HgXA_^jLVdkxS?To>)RBsUDb%U(Y)P z>w0tsCTNgnU`i>er4m6c?{uJx`dtJpl1i9bm`|@3rZA}GeeO{$Bb3ldEJjm{gc3UG z$t1jbo=Cz=dm;%hZ6p%Z9z;JRktm{Wl0bqIB-fx5t(S+5obpIsfp0#Y2R`DJ15j{k zok^!BlYp>;Y5+wF%k(Vrpkt9Org41K!2lc>3{leJxf~400pf-v_E#)F% z@~AcJ_kK~oi^#>I(7C7ujOtn>hR}JaMf}0kA~8ge4Eji72%Vc7BPoPeFN&SV)PuB# zgb-dn%Fvp|$wcE;3nA#i6GG^06roMj%cYG@=aT3FOUmS8(RpP7oAxH1?F%8YVzJBI1>4(=Z(%QA9j#Is;^T!U!6KcXHBW1AICZ z_*IF&n>5KIymUd#6G%{15=eNt=(1*vesS6ag0$Z?R5cfSVCtbiIIDy$IuJ($h@GBbUzt1 zM3w1OqifIueYnIQFgE>AKyOTaUo_#p0Xnp7B3_9;X#xmXh;ayXq@p*dL8l#ENY^Ja z@~hw+o%rDQ6g|K(!>>;wiglAR6@EVUQ&S#|kf6eU0kRL0L1R=IJld;4 z58%@A2P{+X0Rtmph4(-m0dMgh2(=`wh*tv1Cp?&rVTojuz(T*Fq@S zXfabmq6_^L%O=r<_X4Fzbm8X{(sc#&jkePuKPZnzNOa-9puSKAwN2gbp21e2h z?};9WU;?nTl=TA!MtiUKKpg>Z@*Xq zt3eMSnD_&hviAVQ&_?Y&P)ERaB;-hVFdd^+Lt+m7hLV0h)h9Veyh<;eArXNX(&gNXkJ8Ithay>9~g@v3CZ< zG1#1!Ny4FDk$}TX_{ZxgD9X!0k4?hBA=!q`A<+gU(1@07(8&fTKy%C#h+YY-pB?ZGze}8x;uNPh$3hWIQ)vqr}PA6d=h)kPP7F zgWmmIoWgaInkLDHW+~vE)Sk!2NV4H4>EvN@LGdO@l8qo~7#28EoU0e$_~sX&(HZuL z!>3MC(zbb$AhajsQ_Spl7Mg8-hF(> z87+1e(`6&Y5VbHPse!4<(aaVLk6?0&_@(|U7K{9+k||=bC`GO~<_KIqA(n`xN3gCn z{JR?dYK@pv!)~f!`_?dA5ragh8vcEaz!eoY)d*1|!ZjkbMx@n{hvrT;CxA+S* zCSo)(#7BRW@yxa;3Tk3ZcF*<8IcLu0%hwN|0L;D-sJiHzO_(wqPq9G(p;gk!Q0&RxLS7~);C1MhEhF~lY&YXqGrPu8+Hh2abm7-2}4t1C~6)zV!O3$%9~ z@R7aUSQdsix#5(>X|-dtvdoeksr5*ORbvcnlT6JyhMC>%{><)n#>sUV$-CRR-R)s# zmd&Sg&T#w`n~mMie14U5(zG5rtd|#lCOI&U_||GdSKu z(k!*-m;0I7G}MohZqn8bRHPEsuvHiS6FXnqOx@sKjr-E-UE|2(P#M`0W!08}Bzy74 z2GQdD>V3q0-V$_lKf$tPrG#Jdcn}C$i-EhU;pu>miF*A)HyL_XwpqiAaI7l*z#=1MWS(BC3>5FhaQlR_&f^4 tON2a2wVhi%~cL8I2+ISfkamkX)t6%{pFu96EfT;k}0Zv3T{SAy&Z*Bkp diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiAbstractionsKt.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiAbstractionsKt.class deleted file mode 100644 index 157ae0f97df153e5df29a5ca302483526b8912a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5327 zcmc&&>r)%o75`l!q-7DdSg>PZJEjIZAix6oQGzKc#imvb*fkg@#;LQ2H7rOgtX&Z& zbrU;H+B8kyPxqPHZAss)(@AmL>Ck-a_f9|cZ|L-Urta^qUaKG*$J3c=q&@eZJ@>rN zx%cXC|M}xz0L1Zof&NT(K9*TFEPdH@GMSVeOQuZ2a$=@+DXZH~HkWjAStB;QY!1(I zswW*YW7#L2AcR18QD4zxDczcnotj-VlEl^sG$k{s6elD+W~9ut=@?mo{T*Xv>PaVS zTJuLcH=+dE#-vV*hBKShP0NnymX&dIS8Qw|<4ojIsiPEK7BZU2rgcYwBJk)^#z~o0 zY;h$`3nH5JH2B zdTgn1LEfk!!UD>IZZC{v<_v+Fj?P2~8k$rzqM38YUQw`JAYfe1=_y-aTNSaL=R??m zh+NacHA%Tq!n<1w^-ky##d%+6k^I*iX=^phEx(q5|4RD+F5R zj7xeh<&5)ZPV1?hF_N)XjI0~2)-jJKFXgO!*khxGQ6D2Px(UgkN9aABIYdUg=MCrB zeRSE|(Yc8zGC8p+(F5ueLJtnq!H0taAtzJzj=;H&nFq0HGi3`|pL5JqY|OMBYX92c z)WAm8Lme|yQ&lo>69I!gRaXra%dI5X>ybi5%6QbWVAHmOekNX8Usf<6u(Oa3<*Kt| z!`ZC#z&XaWtXElT5KplkmN%lJAA^`-*EVGa zI~nd)+u2Ua>s>11nMqIM6ZN=&i$yN3-NpAo=mJ6Z{t4rX#m(PBEEJT@q;bT2#5V)J_@07x1E7d5!&$xs+}< zSNN^me+!ER8rz)(({5*noyrsmn>{{qlZx$>9l3GNupQHK4?#uJ?VkKB=QoMfcC-Cb zo-L073GQMgL9Q}N@x8#3*Q$~{j}8ymaqsQevU6BogFIX2iX_{5+Gf+z)b(qsZ--Cyg^L44PPV8%rIxUj zP|h0*aFkY&MVO7GGGvWFcMe}PM_lEZRmGx`khIlBvC67GO(7Uxr z8gEm4;c&}ttx0P<(eTdAKuD?46veOk6{VxLz(NpD!7byPvDMxm+r0;9YRevNo7S{L z^!n~2U6EG$m0(zj9tbz>ZO$vEsana(-sX5!>^pA;wn-<)W$qTL%6s&xu-d3HU^hGVm(8a<18a>>qE0%srgE>dhfWl5!zYZ6EMeZJc$_+u zvm7&RB&-$FHd*Au#}Rc#$JEn^~=o;9)sj5d}@>ZxfxYf6d& zvi-fhOEIbt5=vN>ksV3twr%hdqE2RV*`zUQ%JW-uesav1&CMUb;uyR<$pA$PoToSF zj6Uuaep$C@k>_X5ekKbQG5nk`Kzxueh=|-+Sk1rS>|cEEBYZKc)vaM`bgb)bY?Cke zS?13V@lt@WAL6h7AneAW>%S&E7I^jF5`Vf&d*p5Gyn&%rba!dH-En*sJG-{EBbl zyzvF7dOuA##?fist1h4p3mm73%X0oK=U1U}52)p@9#Yj14X1&8+fC?o#cwzdvO>5R z^hz&1nD@#qcL}Y(jYCp3;VK|K2s9MD8n0j#kw-^*OSoAIs z5-*jClXWd&*pGm+;Jdz2?$O5Fz@Lu}_-l^TM*IVTKVjmjh(D~ZVd@WfavkRff;C5!NZ<~h z5g4e8)ZGEM`Wx6IM~g(MkzjX3y@O>R?!flp-0IzbMuO|eF|nduYj}1Y&k0c@y2Fo( zHGFCf*UQN?jM{h6%>=s3(5gXP;4p}k`@A6B`FVm_VBcLPf!|93oDCx9`eQ$B=bs16 zpJp88Ujk?8naeD)>x3_3Ctk-k+~j+iZ89S-Gn_Bs)6By&I7Et9n4xm?8GM#f&Qh0G z@i~UJpJ(XT_|{LZ6ZkxFGD5eAe}zzvWX{U)->L}z#~wWVuWu6mLLycPzeeF-z!wYa z_qu8T>TRs9BlQ*z{f=r?)`cI^^D42o2th|l8Xw-oZIV7SIX-+^-Pn}XlkVR|YIL%- zI2u*ETKih7kUs3@M1Jwsi{%rV&CNh9Y^mj|j~(++oOCW;^sYGRsL?UCudS~;esG{q z?K{|auq{3iKg3agye-~+a3FqIjUF$X;WlnH`oFh@YQ%fn`lM_LOOo*xy}d&3e~D@I za@yncE3vRnzpq+31Zjxsqz^YTa6LUN)YS?N-XJW*H{VW{snd;p&O}Da>)i7-B-U zRl{W%nVl=`@iuonF6++A%AQ-*RAY?7r!F9g1Z*1?1{h{arc-;auJ~Ng;<=Pc^X^8< zN|!^=BdW~bwlj|N4E@JFWuRXC^ND1WNMWcSgBWI5`FEZ;Mi}h6tJgx|)m)!p>Wmhp zdkCsLic2;wVvJ$(v}PV5fSctU;mLJ=*i(e!@Q7x2-XYOzLod!pgAc_V;%&D`6STBEvwAOC{enRT$99M$gjR zG_D)X-B02sruu30kRf?|{}vjW_ES(b((__kx#S zg;I;ATa;}P2#V)_YnP~tQo4S@<3Zrk2@I~ws;2@W>(qo@RU>t7in`?HD?p;yRH0vW zH-srR-s9c=gB2NCb`%WsX~4MI2eqp&m8bjEPmvY!u8?J9qw@zyzNZ00mfo>WkW_50 z9+4R6at~^M#DxQlAKo|Xj^5!@271ry|c<>32x}YdlDQwf^E?^8#$?v1v20Wv`MWV=e>|?BveL~1t m>cZR`M2eX2JhyS@$h%v_0vz+oya5Yv4~vuvuoPf9K;jo{xN(C3 diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$Companion.class deleted file mode 100644 index 3cb0f55310027b00fd8c69a9bd754e9f28d95b02..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4330 zcmbVPTUQ&&5&n7*k{ARG0&H%!!4|uKjfL2F?KP}7m`fIOF#$~MkYqE61`mv8l<5&( zoXe7pt=7!()C_PO7IRF-UT3M+em1)zwvBRaaG){{5fN{{>(S ze_*)ndOK-1&mA*w`L1h=bk?@GO=l;4e{+{-{TS*PI#Q`EZu1?}=UdAjiT8Yq3x=MJg+14|Ehp{qZJW5$^Tq9h zafbK=>2@st4ny7G&^klI4);m%JU?J)9UNK+bQOHdPA{5yI&ia+HlbJoIIF&AIXmOk zlsk0t%7V0em;0NZX*nWoI*#j`K3OHwORm3Eux;WReO>3o(8SPYX0u#~R2h6Kn@^wx zx{hWT3=#jaMZTB_ApC!>Cu}Wc@yp~(>qCaFO1)|$(B7f6pJQmGa}Naf95crm+Dje` zyNn_AzuZHA|TnrRyy+P$gh06p{?*N_n%ppG)7{&#lT}&C(Uf z6j6yu;^{Koy~n?dE zt%0a_5~xSC0UEwYE({%v;Vxw_Az3%=LRD0$xp%M6*pk}sr>EytHR zVyCD1wppgQKe?`iz6N5jqp>^E$s~;D%><*FV01^~38U$9B;IVatXwdR?&f49Nl4ZAXe+VB6N2`l`i&l9=)E;d3@6W|dy;x2-e>d^*M)%V zqH&4DT&{)mN`N#)NPCTeS`2Rl3~w4OCx40#${QSGbj66uQjzx=nkEbWW7o5u2JaDN z8pWPZPx9J9o^q>o*7b7J6dsFw%Q6+MP0}8C_KcGaQJd}w*9ol?4|8^C*{E`)SkR*M z{s-@DLQP7KO01ZV3>RzGmQd0~RpFAws#bbaIJYQ{a&JJkmV!R0KU75W>5jgM?ZcDooW6WHn`IU6#Hd=s3VLs`Yu*qa9=zX3AP# z;C>Er=sV z{|rB+)dE8*%6a9zZuqMUcg3XN#>SC4R6x*=?+5_C>66b&U-TtSMC{ff9_(o0I_ zKrL*8mDqY;ifyPSwriExl%Q9{Hc|`QXeG7_FU6LriR}xO*p#4G!Dckz1_h~#xh8U` z{4f=czYZ3^p>G*>Z`0U{o48fJIE`)s=sBVvHlO0X#ZNI=H?~ywcI4{c@g;_1%t`xL z$flm+6_#RwVwCjXdma7rSSacbCCL3sM-GIPMyi#P1nL3_nhfMLjWW^dhd;wgr6Y}y zpn4^Uy0T@g77v%BmkzJhK3shZ53o+hBls<8)oG?thx#rB$nR*a;V1Y#jUTTrPA=== zI;yL;M;~78E6ry0t9_ZiGfc1h`}Oq4y*|94XRc(fWp3WMozaJ9bjX|kGvWIR-Sfi@ z)Xm{h@b^`0lvZDx!`JZ*qT+)MFoAEv+`y1Po4}?(Tp$}vwgkAqw!n_SV*yKGS71b- zOCTd~NnkHvYY@-{Y=L%xoPZ;6PhehPLBJKr3)~R6DR4{RTLPYd5Eu|roiETSa8aP} EUq^BZfB*mh diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$WhenMappings.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApiClient$WhenMappings.class deleted file mode 100644 index 9f70f9043945fa2c4f1d933ac21deba02c91fc4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmbVK+iuf96r61?PJ#g!$|c+{fhOGCmV$%|NKtB0ODT?;P=xZdNtR?=XKn0t_%1*~ z2%&xeAB8x!%R8#HTF;EnnX%9A?>|3}0BqnH!>b^g+CeB352X$QKeord6iVAteT;al zqhzd;NZ9RAcCr_Z_cNh(c^FDHjSVmc>wqt~?Q=D?z0rXfYXb#_m4>5|dH=K2r!=oOaJ{#E6U|&} zF)Viv15GoxX>@$THQ%D6m@f)+4OqHaL`NA#O6mOAAz62ViD0PjB}&V=*q5;!`J$~< zpt+WTimi1TRxvfP>gnt{$>Sue1s6uIGDvQM%N@FdN=5R|i8H+V0O6wY+G+w0U_voJhu7 z>yoYUNa>`O=oI-vC1%Q58D1SOZ45Uzl+IbUGE$dR$-$HnkDS*UNhBx7>d$8yKWt`a zsPVR%+GIT1+%SIl%-E_G$z)4q>AY0q@l2B^%n#Y1^!q&^y+e|}3uBQMjyRk37aw7GQU>Lzd^ z8HqQC8%t}N1A7xRtmoh1b$tRf= zjg_7nZH%at%aqp*XH?1uty5x6E#YPigX#G0_*ZNJjQ3F?_4QBz^<(N|BAjK8Riz@P z0Tv3Yz7vA}9y*Q&Fdf$gK?+c%oj@mgDL{ijhKbxJ2zK;? zncQ{pNH_`nV+{ry>>A&71cwkT9}T5pUK&Ef!QZCV#$*%}Crg*d;!UIK!^yBlBbl^t zJTmRP)^KB|ffz#ARV;^}<)cwFTFhiA(+T00md0qEl(W*cqt>ihGfLubjWtgkh zdX37N`kCWB6`c!}DW2RKZLE*PRjR~LCq$d0$&;C88bif&m)5Ni>`j(V(eLAHW_Bm0 zQzOg67}*p^xm4d+d{#KVDiR+*90FHG)m{qH81!$n6*4~snm%o9U8F_mhDzg@7BxdT z0(DYj0?Q&OC6a+;EYKWl9wlET(JY{&7+n`@Y=jXIdNq1hxMhM-txtT338g=ttP#|^ zz^);tfJpLA@=}N}?o6oA^45r*v=jMBrW-_TO!im|DwIIMTOicQ0 znv+4ZXfBhpSytzpxNWu(nCDTgfSV7YOJT;ail>PYsdOeLydjc2J#xN}77Ew}v?$HW z>MT-eF-8KwGsBIo5g(ncgPsF&!u9n`6T9K6O5%#6?(fY+FWleMS25J*ho!YT17CDBafn?N-dcGHF3y` zq>Y+Xj1m6sLrj&Lc=kFg3c-2Dy5}gX@3Xxr1SKF)TFA$>AEU zhBcIn%e1vE@kk;8#gepGON@`!>I(vHnOPSi#B--pNxHOb56!!3&OxgB% z1cNnN2LmYORgUkB=0s~tODvv@)X%|`Nc(0p8ta+*qZKSfGEmnVk7Fo}=Lf7Nqcyt3 zOB;l0>pCED&R-FatqCs^E8gW8ip_zr;fOV-5G4XLYUj)jEQ7ragq!OFVzrb{z<(vi zP+Xr##*0@)&M#gqbOe^hW+yC-g9UN`1{2*?Js|l;)1k%D;&8Dr-qXT$D@Iu^P_d27 z;__nHa;{g9WZK@%S=`1p&UW`wWZsP-H)%H|eudhK&>xUhE@3uKH zI<(ao5?*7gvUJfjQ}fbX$unzPA+A`#8XFUVHPPgXfI(d#9B*h9QHbwEflbgQKLIBg;38HEPD~%=Y=k&Xh^;2)@4m8mc`X6hj4m(j1=B6 zQ}N-vUaaau-2j%~9i=M$2ul%E2)?;)`cq^YocGa>sm)7w(-v6k)LY?`)C#^g*Fl-@ z1r~Ta4N0s7SSo9L^b@)-gSOKBSirD|u9yNp$VU&-eO_8Z4*?oY!;O&EG|#}CSuC~N z>0tr-Qz+Yfjdq~#cqFQtSKcr!_^&EmYS0=z1?$t=f<-?vsWrJmZoeQl<9a-1 z!#IHP%cIzT!u85Dv|6vy=+{`dd+5ESAyer$SO#D*rbD_SaZr`+regWQg8N%K;HBs2 zcd)V8b1%g*q|pn|60|$Ak73E)@98Ds?7j@m0T$^v{*kWtkV3D(D(O{oxH%D__Neg>4CrDrGxY)^fW0J=h-dL)4vcZGwE&F8-fLJ3rBUMHg+vZ z!;fLVL+=W_e}n!8Go~p? zw0?!T(ih>zNYb_hca}`y9aQ&p2~3kFm}u1yOr~!iqj-16wH}H#+?|@V7|=XpsRLnc zhg_(77EMYY=>G+g6R;GX3`(<2yEYv`rZeJ=D!UNJu#Buxn~F0)QVUu2u$whqmnVl4 z5w!EMR|u)X8BG38I8&`v&SV4tD)Ey7fhlyl7@ z9JEZQBml=G+6)&pT0dIjd@tt-pSrIu+Qpsak7-qpMF%sk$M_IWIhJ|E8q0mTpWu=o z%xjLUG0Y1%ZrenfJU3pB_wjMu-wTc-!lc3q&J8D5`1p9i?&mlFkH832B(cLT)zvX^ zdQ#;Rv5v!0X#%g}FdD1+0+i3=t#7m4L#N$0Y zjwe70yG|rTxt>oJSWm&yV>mRUWGIy=u)_F@%B6TQ;8rt#@mn#OB93sRA2U6znO@Z<=# zaFLX2b#{*?pzD+z!EG`o&c}0ju8_=cFje(v2*PlT76LTd97Qc=HW`~4TN8;Rsu%I` z8A6ekF#Mch!{n|eoCtJoHhi?L$*|!XFNAJE6=y}TgkrHDD`x$uOoHALqH`867J9sd z>7*WFu*^{Lf)$Zw5zc|EBvd{J4le>`txdJq#MP}ZUKE!xDT`}-d@hGQyp$2SI!fnF zCsk#PQ;o&zqX_l;csX_^9ARvNEE8cYS}79|_3}#LC^-<>Wh#N4HBuRd+SwGbQ(N$* zk(cK-FuhkJC z?)b4@x)7*ZVu_@WFVZX4fh}|9&aas>yH;ZadECf$NTHbAoi3Ox=;;71;Y$TYmm#KM z*rVAoG3}G%;bt+%ATm;KTL`c4@|A+;9#}`+%|3do*p)9=^S1;Q*QDDw15Vnv?}+!; zB1F|wJxED$S~7;OgU`tunL$s0^lYfXkoY~lXtMc7US^6rFW^g+LcC#xzc7xl-TfF>Zz6btFG%*i(u{aVL zKHf@mMDMW)BcBEkVgh;XR-(6B2^TSN7&BKW$U9~O`ZaHM=z z{iVtXcX*SrSt4K66mIeHF1Qf9lYb^~8B2?qDbce${Btiqz>gp$&_nVM>FukG_{R7i zVln4(+FArPMA%w7YKV1YM-$jgAkif^V}MM{MqPTGnt@6Pm#?%fwq&L0%2EPS?M=UXZz7eDwuJ5&tc)D%B z9Ty?TM6wu5un5JA?RLJ+8klZ1c7iU64;hUfqQXAUlF-h6^pPU)IyrFgJEbFJBET)O z6Cz2V$vlHBjyM8QLcHYoM7zvXra?B&>zr(mwOO`wf~+v&6^Bh4NI(RBqKT!l=+=!E zQfNmY(98wsQ;_0Z=e5@2{~^do;lW}cLZZeVK~kfN3Y{*o-EG0HPm3E-36ZGiVoxdb9vW0OPh29X8W!j7wEqs5FJp%6j}3#;s@WvgIZm z*-o$kDc|{c|YVT0ItpZuSRs`Txg01yf)$*J|#m26*8($ckZINGadG*sAocDH zV{TFJQwnua90@KPbpH4 z6F4B4eN61wE{DaD3)Cr1tHtp-7JqW^xJ*9cBp|QCQ++wJfA9K`7nFFFoW1M4_^0G# zc@@p6*J-F1@2tD6K1bGTh5h!f5A>~2$`FIqMuk^Xa(qR2UB=V*U8c<#mXnG4EIVL!kuu#=p#d;Q zU>0B!d!HGjb87Eq0W?;*cm~$lNRFnJ}IXMMDQfT%+-8rw1MX-kP7dbUoj(gu0 zH;&^e^%XehcoYl8A;a+nmQ^v9C8<6LUFZTaswI+4;OJ9ilyL?H&J~2!3eJ`fGv_w# zxZ~l^ktwHRU#ZMQC(@QkTRJn^yed*Z9qC;JXH;djSD7QM_>`kv3sV90V#Bsps0w0Y z(~g2!hH6-wW(yOxS|O#@qs&w0r=RmQv;2wDQ;mFonW`XcmT6Nf#GMty#+;2X?BYz4 zopIf?$L`tIc)U+JOIhqy7Ac5^^*2pkcME~4oa0rN3f}oF2VwLoxI4$qYi-6JFjCXJ zI+}6tH%0budMoJD50 zHZ6<9jT*R7I4W^w7{{^zVN@1(?$-)RrxD<*X>LZ`QKZZx*yws|W3BPJh&ZDIBcwk} zjVxK%QS{!Zy*dl&8WF4y+1q|>`R+q;TR@A7T$E>3$_L`d3V4E16RNE~#Vdy*6`Kgev!#jUYK4Hx#rxF2?*P&bh zlRr4ub8<;;#!l)(BY#18o2lyuQs!<7Ey|s+gHCyLFHH)09MxXGCzRo+_W3h* z(KN;h4g~2#nf}aO1aq*NW{A=mOnYfTD9fJ}%63%e__ITO9M!r0KD+2F@n%UV&sMcm zugdqU{ycwvJJl_qwvKILn9g=;*h>X%G_xc(Dv1qXNINMuvYlEN<*wOD7g%GvsEvk{ z7Vqvhl$4-F?Tji7!sl8(oH zFb*e=q0zW-@E7;FREDdZ8gTyRdR&iE1wBQT^lN&Eo(0TvfH{EsAE}x?L5nY_nsLH{ z`{LwoF-}ew(*$J&`nn8sd=Krerf*TUEL{U>%af(=pp=gpDx+)ZyU^h4X)Ij_xGWqT zT}d19>_PtxbOYXcF|JE!6WvHE=(-r~zbiDH2h&Y-Gx`yw&2$U&UX;ARtl)El6X{mK zIdt72)vh~A6pcKJXekioc<45|9pWtn_&!5`C-|LD2!X@geIL{H=m6Kc&E(FF&T{n1 zbsu zAXkslI_UmAxL%}R(Cf61-lWIqEx^1D*mrRM7{R&>+RwST_oF9~mVJuH(>7ecvZVVy zOS(l#mu^wgrTalky6>^1`$9{)*ICkCZ%KE9O}Zyo(mlbF?g@r;7n#xx+l%duZhMi* zb3#LiE`;qJ`6RjcL71j{LQcPPFKrD;Tk6_H4=_|kb+(byv01>Bz_6+d+9(uq`CaX_ z?OtFYD*Lj|dz!dV&hxu+qwUnbnF?X<{7yA@=T7>0E)3${Hqy=8zAhGR8EO9}4}V1i zV8~S3$`jc+9mNh9AXU!d-MWRtOSn5Ej9ce=r>ysNsRulaol_dLAutpUIt2rth|**j znkg`AQ(@9hg|Rq|ns99Y0y$yCrltgP}cjL4JpOWla@I%6hoNEwk|buuDHKSATuCWy*yGn9WUGZZ6l zwx)K_fG+&q3PxDdRn+D6e==Poz}^Bn8M^v34Wwr%fE8s3{RR{F9474mt)So0<@7x4 z{{d^thF}uSDZ9a%vKy=^yTQ~7I$xhMtSktQz&8>GJr9!(tziGi+-KpAKqa2feQ_84 zL4odXg*A6nJ4>E`2hvG1uGmJe8gNh0`P=Aq>tT+LVmBRJw1eJCy@4LNchX!X$mL>SThJ-!j2$ZVrpTxY`VSU?}p zLe9fCF!{6q#(A+6l@U<7ztJ%1(z*aK7zn=$OqhC8Xi)k!`eCWRDhhJ>&u0Z83hBQV zZAXI>;T-G{HdG4CHuj8YXJ0$_0gK&jl)GRz=Pk zoIiIha^#erv6F|k^Qe&9Q7zn8zgxPi04OsY)=;LSI!pMcmfxD~&o=zl22nEn)*OG1 z<**9xlq*7cj_Q1W-Y%|$vs>UVFdCJJ5*mdH{UB^fsIQ~CpWl=6bNzkWd5myppTmT= zb=*i;%uZV1cenGzkV}Y59#1x9Ek!n*AiuklZsZ!!xzUuI=JC{{YCP56IOO)bQ@tM6Cta#ke*?m|q}r`XSo`BigY6U97lB@h)u4eI?tbLldyb$zO^$#$&fIJP^i#R-Pd0j>gTBT`}KGH%D_ou)aGwLEjx=vzOW(8AHVOXei*0xIYRF@b~u* zXy-(mGt17yHb;m3v7OhnIo`L|^fI}fj+V(6v?=%W^3d4EAETgtvyCIYJp9jicySw@ zVCP{TZ{T*myp1w;^OZ28S3N3MQb%wyW~q7n;-NNyp@IH^X_SVJuMUJTsV^<^pHL9+ zAHReDXb$hS%~Z0RUzfvs9=!8_T*;m^1UvZ8qQP!{V-d?i9tQF+0@8G8y<2Hv2R0je zI1GL)wv?>0dp52Pnn5{oCo1bv1C|X(ybXWSLTVj|brl{NP^AUm zSKVE2c+~|STlq4v>qq?2WUNk_4vZIR=rL91e=5$)Ql5x`9;vw*7BySqE*b-|jFR@S zxqXy6CP{$|q2?Ts1`%)-7p6M(pF}XUumgLTBM~8@8)^R;BPi&gjGi+)3zE>w?yrsA zz0Cd^WxJQzUn8?&c2vqdq}i6XRW6<@JCHNVJ0u{im{@~W8rIRUkf9DlaSqi;ajQ5K z+hrjUHNub{zFC*P^kz8ia|jak-mpivn}5C0iHC0ldO9_uVi7+*Y)^94!&-QET7Ot1 z2ll+344|VumYRv|u91A{dsNNknvUj2MJ~EUSWb3(#Cfm}6R~yK3V*O14?QBGotY{; zwj=ShQyYioS%rUKa|fb&$J%%aoR7StZSB-NoA3|8&|~R4)q082fI#d(q!B!H4mfZQ z@)%*P?RB_T8TW{Bub1~KBui^3f|%%XT1qbC^cUq9^tSRI zz3uSRUmb(!9mi05*D;LVbd=C*j#Avm(%&5O=sm|-xSvZOIM&cdj?3upj&IQ=j_c@B z$M@+n$3t|vV?TZDc!K`nc%D9Syn_2d`qc3$eTM5xad&3ZSGYQyIQHkn4$!%d*?AQ! z&Tq5B`5pSwxe+j%aKD|M&K>M>K8pK(R-Lb~$N3I>ogdQW&VSMsE)Qq8yzF!J<4jio z_aU6^3ULmuLV2&{zOGvC=UT~r*NwRLagpm8KF;+V_jmmkFfRc1CEWka16*J5K(~Vj zxIG+j2lzzyC?4dlq$}Lx=t}o2E_To6!R{qI#9fd3N*?B3$HQ@z%KJ@R=Dvx`-S^}0 z+RI#_y17!#;h>t&RcZm3s(v1>_Q!oNSF5M+81*#VXYn|-p2w@_@dR}ZU8!C~SE;ws z2K9EjTD_OPr9Q+bsjuLAgTAFPpR6f#jpnASH4pAS+Ms38ceDUqtA%mZ(MGMFuGd=V z2CbDgX&0e<8GTQ?j&9O!q?@%{XtVYMJl{jNY7fzE+8#bddyFS)Px55#S)QW3%Tu)v z_*730pXM2jGjpfV?VhQ0hi4|;>ZzkUJu$k=vz~t7xtxCJ`3{~p(cPY#>BkzLQRp zhY0d<&|ogV3mxeL9ht>{LyKHIogt4M;{4wAPls)*}s(&D%l>^z=4>a^q z+UOGg1X+zN=)}eRPqfHZ&gP-~DGoGvlykXQ9$xS|&oFzFCE1%S$=;j`&EA~fFneYW^aytW^a!DW^b;|W^b}2dy^&Eo9i~SH`k43Z>|QjH`hwDH`iRV zH&?CMo6BwX27NNd=6==eO_pSDvLt(Rzi#&Ce%b8Jz18f^eZSe8dz0Cl`zEtD_YAW) zp;bC3)z|R@g`Z(Q@*(X-{4a34Kz#+N9&zX-PraY!%h}ITAEIx_+0RznAQPMTf5-=2 zS;U{CMW*&FHSrgi=`3wGt(UWvAxr;8_SmQGp^Ib!GE=ML#r!4UyjpK^p;sjO35f^q^8ETwqNoA<IdkgVep* zF8Vr?i@mb_HOh7`v%f}W_h!2~5d1pIJV|f13&&k#`tbih+jX(#x%k*JPDqvMjgK|k zwMFx6IreOq(OS=Torq6n3i1D`2yhMlpC>gmnP<{zJR8@U#(jZtUnuW0c_E$43lN1p z3puLAbQi8Iyad1ZeKx(y=g^0|l>Wiz;`e>S_~G7V^f~Z+#S57EOng;38$Tji$3gs( z-xOZX=WzpmuP(}0;MWLl!PSP}-1{lV_$gd3atpu7No6>$k-Qq$dgH!9-p}Prlq6rO zwDM)jrF^+^4elHHO66|83fHyrzK6f7?BVN_7kHxs2f`hr_<4S2c35T=5D}l!TlkA$oVvH zbN&wZm-%7mN8IlGl6SZqdT|wMK{D^Bd@4@xByf^TER|7xc zTE|bi?!omU|I+n3KjnIpf8}}$Fz*2NJ>37vPrI}E8FydY2k^7*AV24x#J_c)#yb(0 zKj04Y@7&Ayd3OuH;9iUSI{v-;dVUGlYx2I8|K#4vueM(v& z9nP<*qxdDY4EJ&TmRieyQ5WML=D(_I`CavL{+oIYA5b^)d+Gzc8kw#Q>K^_;-OnGY zAL06pKhO&JBdw6vYel?48-RO&S8FHo-?borthM4=!~fLQ@~7Hm{F!z&|4ZA5^3D9Y z_9Om6yNCa+-Opd*Jm}}zBiy0wS4cacu=aaJ(f+77wS$UF`$}*HUo0J^SW~GnkEo_KmGQdE%6KKLjMr)_<0U@5)iYjAX2#3mH1jmF zB=a<~B=a;5)y&g4$js9q_-kgoUNG}C%5F1HgM65o@jB1U(?FNZj91j`%_&NH#!Hm+ zj8~)Cn=@ke<{V@8<_wv=IRj>I$cGudIbJk-gC-fhx$v>3p3RdbJ>wZz`i;|x45+yz3^@-V= z`+c)F_oHTS?tSLi+*{1vkPkC@bDv}O2CXtPUY}SQug|QE*GE>yYoC?z+HYmNc3T;* zJyyo+pq26Zjg|2dB|YPHz{+^7u`*skE8}&dmGK&>wiy|(E3}z<#*5wBGe*X1vgbN0 z<8{Ewcpb1ZUI*~0pU8L>d3NdSO!}h4{GK{I(3qzWz9NAwMn0VGXPUcsX%5Z(77Vlv&%cB8=ay%vrQUnTsDZ*iNse zKfbNR7$#o90lpoAyZkW=YHHzcPyj5jJvC>-= zL~#sitG(5gqFq_2qO8(tSW!O4Y*2P-V#s-Oj2HO2z2E=vJd zr!bF6VIG^pJl2MJoQ1iv%)(q*W?`-@FSF>cEFb3`Cx%rX3{`^Y@-lECR2i&9NesLa zJ*v56u*Nheg{+h4$9GC_<~IEyIiNU8V_SE-d2@^q$)6@q`W#* zRe^`#xIq;{tj1L9Wrz~mf+`_u7`S*Js*ue@T}8PGS5aARz*SUYI&?UULT_6k2BFuD zwcy5@aFt~yTxFR7CngZWs<){Oq9kdkgdpm5!7>w15F%vM3Gt9{L5Q?bC+1tPtAcPy z8iE!LL6Zjb7Zl^G8dpB35)T#SKq?;~R08X`ib0UHstWIjX(_`Ze+SDu;=f^CgrW;! zEGZYAW4!VKWickREJh{EV?shx%PXah0|=_BKcFmFBwvWKKqP?B0NN_WPxb)u(H{T= z`LW6nAiazRQi33OvVjl-A%$XM1jDVeKqTtNV8YNtl@K|Y9ig^CQ8t80YONF;ql76J zL%~2Wkw(d&9CVAfLZhYNNTsO|lV+5R{y~X=6S^Ss@PS z9I0>lEqy@n1`-Iw1B&vgj1D+@}-SK8JLLnuLK81u%x%*50R`AwS}-&x3*c zRc|Of-P(Q|Vz4jL3dk}n4usy-Tu;^WurC-gwR)Q&s}H4Oc-Hy9LADqy+TlyV`ywL6 zYOOwxZK|d3zTgugv@c>?sqlAoB!fXKwWuSN{s+c(Yn!z0%px8N-HW&kl*@x4r0gUW z%-sp~&eZpbRf>`t?!BB)&X3+T&9l zG2E-A&LHWk6q1}ueZPdOShcW%YqQoN{}SG_ki!i+>rN8F3!!ThIMjm88!{ECD$cmlocwCmwCsg$ z_4O)~wk5D+FLoWfOj4B;)wZjr-{sfaA1j==k;y(J zFHd%nY?gjAc@*e_eg;?|?k1rIO6OQr*r*cvA~dPHMs zPJoFbdFkyKwczDM=yS3L&D-nFmEUl^@hfgN)_=j$PlOpb(~N_QHLuLMi6*T|lKGhC z3UNenHkl;)3?9!!ns`EXOtZJB2DcB8Y2*Fba|df@-Un^m#XUk%I{;Itqj7*Gg`&c` h!hMCZLPg=S!p6)cgdR&_LBUq2Dm<7Wd4+<4`!}zIlWYJ0 diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApplicationDelegates$SetOnce.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ApplicationDelegates$SetOnce.class deleted file mode 100644 index ab4fcfc583e0682a260a5befcd16ce4f3ad75046..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3186 zcmbtWTT>KA6#ja4nOTP0vfco1sB3@~Tp)C7_CFbC@+&@7#L+{P)-20QACP z7e20Ko~>YPIxxslb2%VGaWOv*pCA`_Mxd3I%=w+poQV+CTG@?8D-@O6(7G};3b)6 z8V-^2O{PHHNZGWC+|_V|K^-)0(;K2-wM!+fIHuz$jx#icu(riTLy|$GpiUAPhP~}u z;}qIki+9jggOg|{4MvGdqsY*;6>0_8mKeWeT&5N&oRYS5Qo^=Uv|6R1reT?%@nQ_8 zDGZ(yT&YDj+9Yca!@ixA_`u%PaTt9Jdp6xMz2G{Z%Ft`*XNYfN$lEc)aOO>9$oio2kb#e(TISSy3^ifkZ<4z; z43mY~$^7*2e#~X$BsK;xJ%si!M7r-6ZlD) z{}Xa`ouRQJW`cW0(eMlksj|Ehp{CE|5U1^|zlGdJ2*nbSiUjAcwTCHPX;SpHhyJ9* zgmRg6DRf$(!NyhaSg|@x1c#S;ij`ZsB+7>lIdb;Z_uYaZZjP+MK;|(oJcYJ5QUNs)` z#cW(?oT`tjbV0kl{zbhMK_I3Q#1&`{sZlb$di{Hq+MiPFCFs)(Co2wn-J?WK1a+h! z#kxw|6Q1Mpu0^A;BpjO|^A=C327{_Dd{0TqPU&}gi5{-%yg6?h@=2zmA9ac})luIp zEKL}tY1s}K8gi!1C(FyT+zly-oKrBY8N)RtM@URgm2J;l=2?5i6eiI(TKw?l14CJx zwQcT>T80puI*guo%5H&QGNq=y!DfulmgmRsdz>B(>4@e~@=PFii#Td_3KauErCE`M zOX;V`M}cVEU)TEQb*QJ*oFmGYi26y|-}$Xxoz^L2aGVxYZ2mZi3!%Y(`@n!qXz)NZ(q9$nSDT~ji1cd&;Nmx^ zOLaZL!Bq4KF8+v119bTNBh>hFv-4gedMG41nhlW zCT@bV;g!sWS2CejZXoTP?BvwzY;%e#?IpQ(xl#Q@} zf*&RC%CPJYI5!N?k=v3iSA1m}6|oEkwKeL2w3d03ri)RU>kmag{~A>+mpZkIYk?w} z4`g7>*QnA3l{CuB$HL2d=_+{?u@sB4Rosx*Ku%erQKu6HvnZe?gdBlIbOl8$)BJ6I zV)(kgO9AUw{f}Qgm2a)AF6pOQds=tne~X?{`8?NCIlbpZPiOD>fgU|IuEQoPmkGrb zA@fsX}p0$D-d0CKGh)CklG T3Lg7!G1n$;L>fRfxNa3&sj57U*V8b`X4l#o zN8$zL35lP;D^EOvkcdPjWR*95RK=OK6QHgjqLO!J&YACA=R5x6#jn2ssNgQcdKB+@ zQCEb#D|HkF%JTy$LhZ@$Y0Q<5d%o_)!rSb21L<=uqwo_Eh&`@_%7QTz_W2R_0v_&p z58L~~*IA?(vP$TOp)VNjlzaeyy;hL29F_^N}f!3~Uz`rWsP@g`}4y7ir8gIJHKz zwb|JEl#W%R|KJTKPf7YfXx`zPQx~kmqZCaJGYj?BY9}I$NTg>6r0T3P`2FK4*P6Cm ztI$7oEr$+9a5B#C-&oWAsZgfx2=Np`BEWODirNvdYY}UV!CME&#a`c zr=9+BAyaW3t6-Pt>V77HXP^II=S-*yqg*h5n&^K_6Km024(Y~lc|f4$uFy(Hu~^>c z{(*`@)1%ou-o(WmomL3=s?ooFpov;rQHQuNQJ0};^bXr1ZkdTN?1+3G?C@9`d8o`a zmycX^GXBd03bb^UK zCVwQ^!h5vZWJh;+pVl`9I202vMmvQ|bpJtu&f>!%-l6>?`m#hBMl|> vTuXk}apP2)t6?7RkQO(0!4%3^*oCWbQDIS`q>xcqQn;lsrC=*8E8PAQ>JYPm diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ClientError.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ClientError.class deleted file mode 100644 index 603a689cdcaebbd858e21f5b9e3f80ae8e0d3c73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2831 zcmbtWTTdHD6#iztzAXlf0}VJ_oQ5REgxDt620{abByJ2zv5P82t+X~1ve@3WcGjqQ zsrVI@^4h09^r5X9CCWpE^4R~-zf$$gu1ywjsMSjL?ws+teCL~U&iK#2-~9n#9$O6a zmc5g;n%vZzhGSWEk*(GZZaP`Rd~WN)v0GKAW%KN+ySrxFmK_FT_-3(ur?{){>Djt& z?qr`-c6rrVSSt4DZne?r2t{_IRj=!nIwv6E9qz2SUWU^%C;h|_LO2QqeH6`kVF-rny^`SL zlmcmjqPN7Vwapn=fuWxwmwbDH^h_a!LBwUaGlc8~*SEP%5eGe7Eyt*5*Yzejdw6tb z(FeTb*oL{Y;8Q3X!s(*1_7SRZxZ40VX|0V*8d>k_axNHL7y6G_21 zLuk=34QGkrV%nEsyBG^Tf0C6MD)(>yU9StUS)Zp<$eP)TV1!|^W;u1k%Wue%O zUJ^BdOsU zZb(p58dcgY25LSRWM0a57=}6k*14l^>yA!MpfvUZG*_8?#7V5UBBU6gmafs(cAnv{ zgZ;Foj4Il}{^2W5YbnMf-fNnc1N2R4N+dFRu%A&Q2m5h0A4#YQL|;pi3qKONhKFbBxw~+4okgUG@&J2i(E9Ph*VIscqcd4Ecd+%tqh^L+WkjAw|Jj2)9ku1)h+^~UaC(J=W&t5M;0 zSAuD); zq%2tyzX)c2N9-3@{fVn2Hz)Cwo-t1W{TLw0AC5YJLb4N%hJPkS1s@zub#X*#B1w51 zM=^06MXHOjm)N;OG%_(7x|nJ^G$_1EdlPes^KWrE^Bd;gAeWhajaX*)$UKHh zQtj1?;+oYx15PjawSC`PHE%b|TD9|Fc+xCEjiV!qyrATR!N{NtqK+e`JPBwOAI~B)> z13!clS58PAP?RG-3NhYLxNrd^%QNrIJbOIjZ{NRs1+anp3{SN=jdfQj-jz=4)W%6F zg>tb}Cx%;RdWq{95mz&I=WQaoPHMGS)txR^5?4gXP5LAML@k+Q5tmR$} z-yM2}@`fJ^d4JRfqq|VC!bqMrgt0W1m$hw%*->X!y24qfjaX^%q;0igc=&IfFX9@* z*ss}>zhjIxcD3zjs#Sd~7$)jciTz%uDa;{nro>FubwY)4Dv$6_vRqS2m}<(c74#RP z7rJK>u`9h`{-CFv?1+Z6k`&LB(vJIYXR%Jh%TXUeHt=7HUVe*EOqSY!{DaRZeagbO zY4>5EggdmCM+q21l#L~i3&eQwBeDTmFE0OCJTpodiG3wI=n$0e!bCeVfei9>q%fKr;Yv~h!U$f;06EulQEovpd}yl3sM zqe_)f{taGv;(-?gC=y60>LY&?V)pEODD6WP>wG&iH~X8J-^~2`-(UX#SVNuRZmc?f z+!vDfLlei5_S;b?r13-fLUC=>plt?9`1QoP{jx3kCX8hcjG=nK54j(4+3}wZqzQZC z!uJ$|rwum)U61z#0}B|&I>PK;u%#9jgCa7>=HVdEkTySrn&DpKYDsM{WH&<@nuiQi z3yt&ac8v;UXCqi_GR!C72g0-z52g0Glrg15HEI9pAc}Y^5(G5)mivp%BF0eikj4Z< zt|zqS9V)H-W+;a3w*Uk|qZ^wjl>WhCj~F&WNgnx6#0x%%Or26l_>R>MS6!htY`&$- zW#lkr(-`-NvkC)on4~pn^_%3cg$jAp6iQP~&x0pK{WlqExBb0ha5t&JLyq$GxYy^B z+!(g5$oc#k29Y*#THcN@e4iUmHm7%(qR7m?N~E?D6;`DYVO=uquQIewjw+s0agzVZ zk>`}gz2tB`$IZA?m6M}e`88*S-Dml&n`O^+N=`LhVJoS!OLDsEtYlvQoOMdsXA@_d zOAytxn=84mf600_(i+3eg>GFQTgn#Cx2&^PHp{D1+67 zQ=Z;+3~a+c^RSN3iyg#~D45SpQ9&xP& z?X9;P4^&%x9ojh4Bgp0u@B$8QQ~GJ!f0XU=lT^hl-Y4eolkDIFOxr3+&R_yLxb$U% zG@njt5Hhtt;QgAoZqhrO7_)dla&hQ@0!g-&v?l~;F9&qmp)1suj!~}7{0Z+jQXO1| zxHWVeLC^(U$9oBEA<5RkL%NrD$aIYaJJe&CB+W+Iq|0{Ms9W7B;nX%^EH;rvSZBHiy$s;pSe_$OsVLquEw0k>i;?jd7A(L diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Informational.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Informational.class deleted file mode 100644 index ab8af7092fd5ac457e9405a344f4d7498745a889..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2740 zcmbtW-%lGy5dQXjw$B#>hhsNDNJ2|~fC;h5ucm>}kOUGphNRd+m7-QU%!V93-&wb7 zl)O~@6_u*K^{EeiXsbqz`cNSr``ACI>g=5fHjvb6C2MzQZ}yvSW@l#o=ik5o0pKbs z4A=c&v*0(mXEz<``>rU|T!(wI;CRmiTgaeQldXUkO5SrnXxP&6J=;x!F?=~!ys!1gXXnd30xmQi!t5}y%0<)n1fQ!`XXj@b?*3n(By znGU`c893f1*%=QRZ*jRE*p4R(w&(eDh8z`z6<@BjT$i-^Ho2^HKxHQ;kAkI@{Fz*GKCt}%S|?|R1&o9aM%PZ%cG3?vxN)_v(ZUSVsyLFFQOK&3&2q7q9u zHIc-J45w-@c&+}_4(tXejgn}m6vL%XhVAM(>f7X68sj)`;v-xzkYl*kV_EE%Q}tDo zCow_!)0JTiH+s#?PNdm1@|a3t5|K-*ZYWY` zO-i?q83y+aE^}#b*wUsN(i+<_>Y7Xq7K!Vj2qng-LhH1(F~jiJ?#_8r8`8|(owt+K zA4--HP4wLwGd05)+TF?P#_o>At{NFVqdj6p?cTLa!itS(MLlB}niZ#2A~Qm(D6om+Wn!=>R%m<>>g+jSk~ST zi9zKV#f()M?)7@(?`-cBNl;lt*E8MZQb<4G(_40}E_{z+^qnWK)TxD^UTt~OY4DP_ z?FeVx!Z5vyt$CueUZAUrJ70KzTIWhF&{D7&DY^ag{*GsHcMh zQz9urvq5u4b@y&&=YK`|r%=62qXGm@VwuKt zq<}v3lhkRB(wMB8x!Ye!tI zRGc+sKs`BRG$M2kE3`KdqnN1cPu(X)?&S0&EzH=> z#2egP$xn?E$y*VtC#0xDOZA1ZRQ!_2lI0xjMiyguN;(=I;d7e5t1K@(HQ!ec=Hu`M zGV_(O{ne5=H8wN$-a|dUAYJc;nJ=3&<1?497jMs)`9%|}L~x6u@ChaG?PrLUFdP2n zaA#kdFX2<%rClsM0~5H1`_GUO=ofe(uqcoaSP~cr$6Pp)cvfIYU|3*KDCLx(ze0HU E4=Z@UZU6uP diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Redirection.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Redirection.class deleted file mode 100644 index 0fa433897dff4974540326682034a326e2511924..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2479 zcmbtW%}*Og6#vcoYrPmSh6H0ErGX}3AZrtnrkK+38C(pB0HLa=hs8`_@v>{}j8Su` z_$w;q+EWibv{56X9wNlCe^k}CyN22n5NaiR-n=*Odw%omKmYpUBY+9KWSDT=J>98t z+o+n-aV(*iEtA_)H|^K1A*5R?%bLseb-ru5yev(}j)5_JH@!JkIxvn5-7@Sw{pHR9 z9TsLvw{$mKHH%FF*14!Uw&2s7n}wMI!}I^^D26bDCZr*2V&2*146Mk|y2s^4gDf;W zQcNI1;gZR>u6{TB^}%6#x8fsL3_}fnlvqa)u__hi)P7mL-RJIYubB- z28EI-AC zR|IS@x*??m+R*Mb@D4+C+O$nM!_YZgY_Rr1j%+cME=#WnI@(}&L)4Ki6>SXnDvq>F zTR%8DB+N?g+J>bUZLg)mEQ=U=8M@2+yj*!@xW*wTjiRWxiQ(aJ5Udfz4U+oJjBF*) zk9!*W@Cn1?TSD_3(wlFpJcdshS{l&8@Z|Ow3!aAOr;xxPhT^!7&lsK!|0fq-HQjiq zA%bCsxyv_FD3-2j=>mUk)GRqqDD#Jc_S7xPj%5WyLU^zjD>8;r29+OH z-X#;zd^g0pgX6r!2Myd_EOj?cnl zL-e#OB-+h0ygNO(0M9`!P&9Uf4`n)siji zU4hf)gG93R?B^&!SlOMR5;o~BZhN2Cj!)_o2=Bplj90l7(sB9tfl;mq$7ble*78wB zGQ>B`J)0(`OXIS4y=F`EkQePEQSuZy?XtOL>!u_(flu#1hdcHLQbZgs6%*tuKhviBc~S$^MR(UudIXnO093 z=s}UzM4&*ll{l&#orK5B#&>_E!$#xG6~;k6T}}DWH6mSi_$_(xpq?H}Wj;#jZv1b_cA%qff3Kp?`di+-fWSPk@%)7&zZ8X`=)Afg6o( zJ;g8n_-NUZmLJTIP3ETZT6R&x8l`7YO;4zvr`re>@wxwbhA+;!sUixPCMmw$1{0XU jSKDY8Xcc%aFe?xhm=kF8SK81gEszrE6i@}?0`q?Z`16D# diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/RequestConfig.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/RequestConfig.class deleted file mode 100644 index 1763aca2dbe0a61403fdc6a971b423c7906449ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5445 zcmcgwTT>jz75;j5mmP)$W(QVWR+7QU7#8pX!pISbSQi8<1Cl|(QKTdumJvI!%;1?> zV&~$JIPs$&UDit;Qk6;`{E$=y>JdXY;0Ed1=#n=;*HJ6tZ5yG1AM% zdj-SwuG`i_b0Z4Ipl<5BdOELL8|m9?n?}})BE-WZIHwFfuZ?PC6XlR54g(2+aO!xF=`wk(4 z!aKT`W6&0k+_K_1rnNzRQ8M<9=x!%dYX-#7f>v&ZMniLkzHT^VNvl7w;F!mA@uCG~z?Z6Z&j=kuI}+URZiWc)!})+=?iq~~%P*L&S7)u6 zDQ>n*X20!&W}ex=lVD>w>zmv|T%9&8)0<&12cC~VweGIm{8W`VxXSRi7qnI#H`bar zQ)SVylTLEu;Hr!W!}%@S%bQkub9b8phG#gIo=;~i&U@F)x>58qbYyczcI%Gr=oA_Z zC*uZ(nBmodG7J3}64)oAN^pDzS7R8!pn_MClF=fgUB+34&;ajv8EFM!j52)og8W+L zv8l{Ly*=MB9_ocW508Gxw4FuW*)p6d{>eMUi4RSL(8+p(j&Ii9-mxtT%46lic)4(~T$rF}l(l#0F#hWQwk9|P8mK*+mG?jbYa~m55qrC>x}^Dl*K#j2U59adl0c9`51SKUuO&2XVM3xWq}mOFJCy5qBd= z6b#s)jBm#@|gC$QzvKsca7rRisa1SZxn0fBTC}* zJmnUNavv3UO14}OOgbj_qQpyI%NzV=)*WM(L!B7IOV}}NAjf04$q+AwP%>Cw*FBve zrS07i<)n-kDv4`C1Q#i*WLu)F~;Fdbp?1kGFZHw)oX6e$}H$atmpj zsOE!ZUdvBEmOBsk#-&kqZBA=YrEY07M0J?zh}JGkYD0I67S^~V%F(FSOQl^E4fubc$ z9ItEQ_}7?7knC2Q+Ch+=b#Fr)>FLtrKXYGP$)o zEH|mK<+yLwk+NBBA*HbJNZG2Y%Y9$txd1S(#-9GJ;T-?Ebf1CJNZZR94#fihmL1tK zJlC@wV`Nj$Zn?Ha)UJpDuWfk@$>oCOncGIj+BIF1IC}Ny%|K6u6?4PV`74I*MgO3+ zE|`|FRM=iKoV%RUJa4zNdVW=ROfCn?3)Q%#ET&?C<`s{Oql-J3rmWZnCu`g^IdHo# z+%VP(8?*0w1|>#(7hM7LYK_4dqrey@-iM*__X#=Wha~YjO0~ux3pF~*!)ex!s9(aF zs_~TYmio?B^tB=m89agiG0jX9Dt!Y)Qh!9#?*-IPsN@R+F?=XWF@U6IlFH4BLnW|U zptfqD<`aQB&`IaM+M;ANP)i*k-vM1!mYuH)*jo+QdMw~e6@ZNAW`Tvjq%B9t6&HuJ zSH8f|ur^HPh&DoHS6F+Es?=kQrH1y=lp5YgTWVw<$y8T(AH9E|X%dPa?n0ATe!_iWR(KbsSyErKu8^$|nmhojiHE^tsC?3;xubT%R*n>VgQ)91l{-lQ_?E z$UmIPc{)a%C;i9ri}pRZCGhZs+v zf_?1M8R4rea^!n|MdJa!|64@f38^pTNYz%Zde_$_>*#tbbe|I-!yc8Zke8y+ud=Tw z_OU2!Nuo0Q6?F#^^~8(qC@wu)4^3Z(5jcw1JO^4#4gCglLw|wv2-k)VA&ET=)4smI z<|Cx}c1UUyQZGqKl9EDdBdM39ULi%opNEdN&;aRQJbC8ii1JhVkQyQUj7kX~;OA6- zw6b{hj#7Q+DsPF0zmi(%DYkAZLp@_XH3LugFQEURQBn)aSl`(2*yQCgB{i$yBQoR@ zGH;8RnZJ)v2HWCi!7fTW8N3IFv~cf(x$sc9kMk~?UF^DuxM*D1-n2 diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/RequestMethod.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/RequestMethod.class deleted file mode 100644 index 682c76a806c3f9affc7d84c90e58d08bbd5d0dd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1652 zcmbVNU31$+6g?~1(pphk#|`-?r5_N$PD!1Feo!1j+(d2My0M8I&v^3CQEW9;VoO0Q z=Q%UX@XCMSiASI_lz}PZ$s<3C>D9_G?f@^=X!p)Jx_kHDvv=)3|N89@0IRSWZU^CE zF*tF3=fsPGpeu^)uIKtu(es~&j)=m3JL-pSao7F2?~3TD8@&iRIvB%t^~gDOie1M) zELwiQw^kh|RB64$aN+GpI#LYkBdfu1cf6ns+Ll$d8Wuxp+bVA{=(T#IQrn@5)Ae#= zbDKWYYc}nm*7s=UYgD%HMe9W53r+H0XqKyc7Wv=XA3KM&VaS>Mh*owKdj4UlQfQjU z;gW$grYW1~g(nzh7hIC^neX)6XF*7B$Mc=;!ZJhd-y#0jeT9KlNP|YW zY_sbKQ5wl(sO)HJabr?q3-~D3`D2Eu>TwX!Q5UI`osJVZ)P73uRHggC;wek;KtjY& zB_)rE>X4*Q24|+B%qfPF%^C{N@bhok+~91L=TbRkd2qJO9_U;-|6WtF%8|lV8YvoS z8X66q2B(oZ|3Ne2kgJUL#B7q!(uo_1C9Y@rKn?Z+;_hQxa-JO2# zzzrMDL6?|ZHE28CrW1NG9+DZ`JM^9S=YhengMQd{A9}I({BGZmyq??igh%dW-wz@u z@&aFMtWYIs5|(ew$Atl8sU~Tu9BHW%X{iWlDSv4xbvmHSaZ6H!6s@~}izMMwLf;XJ zpKr4IYbdRj`a8|JyXq_4YrVvMyOol}=c$BPvs-CNe34FwFYT5li483w9@s5i5}SHL zSayp`;vr9nZM&6C)>N{?MNjOPxcZY!M2Rmq6q%ewy%cwozIgM>E4&jsDA=J{qwM3k zM)UQ=1v7D#^yrwyocyk19+zoFomhn`&fr~K8P+``JpkipT>S+f3~=p7xjI8V|KUGA ziu5va%Hprc51=GI>M){;uVmyZcFFFMZ-LHeaUW_0H|6^Ymi|V!Dkx%^Sgh=W3HlfL cbRQD}y1;FLO9Gkz7sv=0BIZqjNr5|W0H0WT`~Uy| diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ResponseExtensionsKt.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ResponseExtensionsKt.class deleted file mode 100644 index 71652625e7c3140ef3d737c263fb03fa1d1a4767..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1499 zcmbu8-EI>{6vzLwYkLs#HoaYWGkcq=}+Hdww8AXgnG2D6Wm_`lhRdw;^;V3blCf!iZ2y+Wul3Fos-{_qZ4E zaMycWZwjAOn_*n)YPb`rHaFzU1BQvETGZMzrgQTsR%Q7)!+b5iK~tEz;xg1855veL zr?j^one}cEROs}A*^_$VL{t|p!)z-ufegK7uT7UWLJ`iZhDK2|>1zjBhN8bG{MHk$ zcw3N1Rrez^EH2efCQunrHsdh6mF2BbjAAT{5uBxzPbT6Z$B^=)hG4LlmaC&E;9M4Y zoM$Kur_GR+dP6j%qHWtTkn2 zEjK+kkvrI*w$@nLTC?sv{P-r5nNGO}`#GDwq=r7E5>q7Mv z>XXldEv{tj(H9psx}lM6Q4M=iOVW=<=-z*0O6}Z?y2=+1WgNQHKeP4q#DF8N!$OKG z3VN52Muu#UET0N)(K=TyocSH&d3?$>%D-Xa=b5)~p1s4!%xgHQcSza4l9!D&dgo#P ziz!$R^3*8i++`FV6q3>7(w`eNu~an7ku^!{O?s%53=VBdC?3%pefoU4P>Sj7Wu9I8 zCVc6C@M8n`dAj5&`03N|KP33S^X%1k;S0y`GpFG%oQD4~#@m18+2`-V7mwj*hw&C} zQ41`r;wM^b)RK!d441ZHS236T=CN>SU9RE^7OPmo@-~=88CSRAYD{Zf)0ouAXrwiY J8W%KHz5vj1H?IHy diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ResponseType.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/ResponseType.class deleted file mode 100644 index 93cb48a774a39821733b5672b41cad8d20bfa6a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1580 zcmbVMQEwYX5dL;;-<>bl#xbQyN(u!6*eR)#l$3%)NNU_-Fht4~OI9SR%Xt&dIp0~g z=SaNei66ofk3c1gKp-oR{3yiio{Nlt7oTo-^nIS4o%wFYfBgB&?*O*&DZ|}3IjzM* z5qZNPjpI<({4fwvS_`6+#FJ?<^3zcwYKKA&<4B6fUk`-|#_*`!_s+dq=tZZsW;7b? zv}cG^->oxT{bwK(c?Q!R`M!{nVSA>y3|CswNt_J4G>9WFWSBb?y&w_3!h{;S%4U+p z2_aV`=OURPYlkF=f^?T5SE+U=nbppI`-`T_aPMfwY>b^r#OswQ-P|+@qSJb-+Hp|A zf{g;o4Egk{fC^t+6(sAE$Qy_!aYAn|ph8wR7|Q<+@xShy46MaqoO|I&P}KXC>TESQ zxQh8AI9@U_&rtBgI1&ukD%GiM4vzbzaNWVnc*Vv|+#>Px%?Bq8t^X*!I-{Q3)3F+% zCuMyqjft+)nW+|~yk5hqQuz&rh4xvT(s!>M=MXOK+B+I zUVdj-D%2LEyRew$u|5>3OyfkX_dWki#*qcXCb`QF446vzdloDQRtDa)P;^ktz>Wpm zft`U5EzCKX%fJJMmHlBrvoJNx&u970SxVj3h5<Bt}96S4>7`xePvIYO?5s(#mS`#E~M ig>~E^7PTWVi4ANXp(tTWY)LFg7!sCLj4d%IarZ9_sC&%- diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Serializer.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Serializer.class deleted file mode 100644 index a43232fb4d33396e295eb12519b78e2695bf35c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2066 zcmb7FUr!rH5dZCA?DNGK2T}s$A8kluL-Fw^rKF~5fsoe5m=+_e5f9b*ydh_w@2tBu zB7Nei{T_X&`q(B?5(TM3^sOJGAEfH+`CL$Cia7grcE&TaGryS~|M~a3-vP{Hn_>ut!kZ{ zB8EPO;kscqeAnrSHjP$`dkiy0({1X{$QkzznzkM)=`}+bRm-V`9y;ndhPy=>Q=N;d zXIPG}8;;`&Ls%~DORgxjZJV_2^f+tsj4DH4I#Xd7DK=bTTaI4eZ|a5pW?8y2$-&4T z7lmH&>gmj-B2J(m(Kr+gFhrLv#}bbc7(`q{1Sy7ycy9R&3qe+wLYjh9^QH36N@;DK zw#!r*>73zeH>XW53<)D?D$V^qDk_r;ovKs=7LujPum*{0a}3+Zhu1V^RMC{w@u8-u zw2_P&QUCZs89hFnS7zC2OjS;PiYh5(`(~M#QTtQMctnk+ zVkf^uRq1)2(b2fxfqJIJg)dx>&xAG72%J;`*Dx$$nq-*m-4RW<*0#AG7Hs`MaL1Qr z-=OyTP{N$ha35)gY;SuBg?Q28dcD?I(hIa~1|DOW(l9Myxp%%{(28CC8HVW#RL?ef z3_3&7<9n8D@{SXRO8TNc>S*RJ+i!E2*D#9(h6m>d*#W}$7UpL40^QaftI50ReXL|be;2#X}4>9GNdsqF=(Z&(swJX<@M4I!{Rx4{=c7G0-qum$3rYLjQL!2 zXH0O{gTrL?8TffPUf}<-us*`)64oyWmmb3}&9p)uIdySQ+Lu+r5e}$wxuoGvNG6Ch32tI=$O@?$J zlnzjqNn|K~1>caqf&wHSTjXVgV7Q?-<6r+>Jch-6AP&?}GWbgNa?leGL0} T-dhCS)CwG-;qTKrXm7Bn1~$iu$mafh;z=*3KF! zeW>y)D)qHbedt456{X5Ug?Q|bs(NO3fyF?IQpuW`bM{=m`R2?S|NYOqzW_|(YlbPu z-7=gex6P*IIZi_uwT8uQ&#>%G*A$-Hs(CG!8>`&i#k|p!Z2;y@l4MmAjWd5(JN+*>*f)LR%o9V(3kk{wWRi9z*V zS%Ts2MX87|OS#l_XXEurxFNT+8^ST~e?AE!G)SWxx&+ZfkOl3dB^I0w+B+*Vbdv9C zL>DWJm($4MvUKRD*sr*`!CeC09c-`VSq)>!Y!aqtCp9yt_a8B+Si(EQV%9&^;r9{l zc#`vw@5MtnnM1xKfXeNvdcaf{(nq}mzoUG$Db<4mVf z!tD+im|}QP_@EGSH+kGmA&z?tn^6YB<`7{ZNDM7UK6#$6Yer zI(Pl@(2pBtkS2)-639r3D)1pg<}la!+`U%O|(ZT3t9c!_{*=Z`D19!IhTnSv$OJ?^?p5S7h$^Wnt)8wYF?(&o1?5 zHE7Y@70c$!t(|r5R^_WBUjV0OHr7nnl5(ibx5quY&?gdfQm3!gsVRkSsa2=t*7#FP z2JR1IterxJ+f;^eDl8RQ`JfR46_OG(Ycyx&`*KQ0Pl*4G`Y3rX(OSW^Bfsmue+C_p zCB96OK@o^t#EX9*{i|>O+&7ZSJYLY44h+zVE|Q`UGRP2&(}8;11C9JgAUa$0QJQu{ z1HVv41;>a+&j`eD14DEJ+ntBoQH-7895D3J(Y7Q*^iKpMVZiSwy*z__znUHU6O+Z? zapx^QDNgJmUA(!6-r}`A3>5p-Jq-VL1Xi+}#4w#x!OwX&h!IjKi4D$EuH-2yGJ|~n z{YH|PuOOXzfNd0C(bt?xu;j4^qnrsUb)Y=%(^~F*m69ZBF683s_dh~o`}nkyi^pjl zXG^(wQZAI);>68s{pwpx2XI%&BaT>F(|nq{2tks9_7DSCF-lT^B1YlmQGAIi&AXIx zhTJ}TiC7u4{_k@ffo^}y`QxBJl5#{K WBajuiAuuG+A?VK&t_buAeDNYx15PkOMt4nCME%b|TD9|Fc+xCEjiV!qyrAR4AZHbV2K+e`Jn{4dJb|Q`u z2Yv`AuAGoKpeRRv6k>Km;lc%wEYG|*^X&1AzkUDm6~HF$Gd$JiEYw}8L^pO?CpL_d zSSlCB>eLA9OfPahBf~>!`qJ#ajbzuwS}j#|rz;eBMKFe-CHf*vggOgfG+Q!qMR*K_ z$FYjt69#X2rBOy61s^#S8FKDTY#Fxe|9kls!^U#Gtz8nUu+{HS)lM2El5j_!ieBQX zT8-bJ&Au>gX|`4xK6qNh%u@6___~ut8P@*pG=`~j!M=3jL^we;@lM~P2D5Yv2sSf_ z6jEDQo2ZiwhU#!I?elr=^I$mec`0=!{NbQ9dhg8-2b+AIZ5K;?^r655elQt$i+nxz zYV__XWhig-v5-%X+GKPW0xL}{l7=*v#`3bZ!!S4Q%xYIU>$H)pEfKY?RtyjSt@A}( zW0?3gd-8XU(Z;T|9Zj{WPb5R79xM60*J(;~B$^2^({&wDVS>sd{F5x#l#-^J2x}$% z1^-a@OeFW>RIqT+Q!ehvMr>nJJX127Sn{|)Oe%gvmXl4ziF;)Ch_6s?a15`8sccPS<{VwB;WB24#oRHN#XJ^{QLykW7H#TW$(*Y{0Mo1I AwI=n$0e!bCeVfei9>q%fKr;Yv~h!U$f;06EulQEovpd}yl3sM zEuK*R4PJTTffocQ5=bcO6XK6T%$}VOg+8EI=i8aN+273kX6EmIe*Y7|2I>s=W7YBF zzL2~hnmCTM-;P2djUUQaiff|=Z8K29-xq2q)b6)!(Klf%b6^bBBR=GQ#AU~SF_0$g ziA͌yXJ40Js{6bvk2nCJ+zf610wS`LcHAe)DSJVV-i6KaMBjq4?~#gN?&WoRBV z%q%r7vfDQ*l%1_$xyi7YfFB9dQaqH}=TgR$64j*r=YuHXtw<2i^c(IkH;b4+$wL}b z47r}rns=zQ@_$1y?7jgY2pZkkM4|MLhCO1~2qk&sKNGL`ATo7IA>lh#dt7ye+OqkU zu9lI*j7?+GBhD%e#9@-wwAF8uzZNRwQBx>QHN6a;5%phWsNM8qe=)e*)Zh_E`Fh;z zb4hLtJJ;lV@f?Fln>s6RPZ)m44JVt^8>Vb%`zn#zN>o^tMuc_AbhysYIz6s zm(Fe@L=}cQ9+KBsqgA9Hc8Xh#`3#8} z=TU8C?gX==pr4UX8crd19zIJb7O6T$nkF1uY`(@)S$2XsdlAIN-E)^pk|`Da2R6SZ zm;1lq!N@CxC*OSpOGj5PDt! diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Success.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/infrastructure/Success.class deleted file mode 100644 index 7cc9b5cc5355daa9d27d2bf8878f19804c8a28d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2686 zcmbtWOK;mo5dM~WQH*5MjGc$;0o#t zm;GS7Ev>B{-kut<+Cx+BE zmrJ41c)l>mERipeVFpR0($J8hpz^sR7|O%u8qr3Z8A95!BkuWIoPkvtvb1}xM;FT% zsu`FVQ(KJ_y64>9;sNb8+Qrt9j$2x_+Z610g$*6Y7*02R={jC%XSYRNA$j20 zZmH@io`ut(mN?6Byz!hjnosP&ZgH}xiikUgivytdBoiH1VIza{xM1KME;3vlvH=bn zr~abNQz%f)MD@mSeb@@^jX|Y8gG*@?G0Si>|DQsrOwOQWAb~PNeL(ho=R@Z;h~Opu z%Ez z8&p;|8O9DaT;o_kLNoUF!keaR zhGy!aXwnmNg#Ocprl(Kr?-k?v{+`LM=vLg)9#{S{+^}lni4-VH zKHlBy@B`Bvd-G$`QmI{`9O-Rvci1C;?+hm@LG92zpV>B-Liz!p-LV@@;d=~I@AbUg zlnm*bv+dEG3}{GBu6I1?w0PCqb%e9&^2L8=6HVgoBpqFGJigXxZStUQlZ_hqe#3S* z?7&fSq&(Lj>uswZ3Yw*X+-OqaL~cgS?*t8g-%)|byTTIR>})T8Eje|+%IIVidgC3C zs8GEnR0Y9O?+_y9bCNXZB-5a$wWX#VX}bCoctpA+*`1_&f-KTdHM>GmiL}Hm62;$; z{h1aTR_UsYfh^YOn&}!~1fwK%LmnZWg`;%s4>Iu+8TAGk84!dahe^WU?|ix+!RP?z zE`q5;Nio%jQ9y^bj}wSfv)0G2kuUy=%db!=&b&mnIQ0?}#o3oQ{mWaFiisp8nIi5~ zy2Y+@lrDvdI94mguBJkV{Kg_OKEh+t9Z^lKs+35kRzE`@LS1&2DPW48oSBFxzWE*r z?e;`GMGGT#Bl#MitQBXbW?$jcE}|!77>Ab5hR2|=r3i^h)W@UUV)%k=G*q!p_it;f zi%*OXRlo5le9sug+VsKdzA-ahnf{>Dkgtm9#b6XyjLO-{rEBF|6{EOpphnPIl>aR% zx4EZ?RWTp_Ze!s<`mBmOSR^g(J_QrFhoz@DDljUrEO1{SDPRgb5I7cIX+ghffwZ8n Q9;5_v0+RxkP+kxJ0o97DTmS$7 diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/ApiResponse.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/ApiResponse.class deleted file mode 100644 index 5a17f40b3b3190462914368be00629c352dd9c8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3611 zcmbtW+fx%)82`@ZN)qDcW)Q2Q&`Lrufb^o^1@A#X3yMX0aS1CdB)jRJ4O3oPpX`6o z8DBf?v=2VCGZi{@rbBh65B;NRe`j|SmP@7B893+rzCGvn-M^E+{{HQEA{wA&MtQ?r zC>k|YS8AGN7!_VDS2R_(idAD?1vgUDCRJWDbgqVoF_M>*6{T2F^o8QBxh1u1g~-Rq zU&d)hsjf`<|-pY{g-5ynqfOteM_)bY~no)7AY*dR66>h2K z7u8B}NhvRLL-&NQI12u@3I9!N6+Q%3lu8|D`MPt{F>0f?BIKtdjI=j3qcpZ`SQSk# zF0E9H8WL*iN~L&3eW=tc$d%45vtG6gb6hc(k!oReVn+ppsAEgnI8KM?gfQ_?1TpOr z)GtZdX)yXKwvF#4{0 zKT14Ru%A*XdG0wKIkYd|V$?$g5&J$yVasr`!zjC%M@Mw2u2tq$GeoB&G$^Vn;Ta9x zqW{l@={*#`Qo}TvXVmLWje`Np{snd@Mjy}_fqZt`&8APUyE!awoU=VVrQS%tJH|e8p6+3LHi!cY*Q5q6r+MTXZ`@6Z9bh+~~e>)l%jaOF@N6)fFE` zHxr8tcFtx=uo%M(16`W$XKZ-mQAb2-lOmG5@hE~nNe(+(JR*hhFGsQa!!I6(+cq8z zNPX;5E*S~?WU1ZX#`=6V?YHTGO$QzN#kWC84vork+&OpSH z19GBW>VqPW3Y&IS*tDwx*O?8O98Jk7TuTpx<%|u+ZoK@)H`*c}gwzL`fzE;s2zoNp zFdnxf@G#Qu4~ONJ$&|clya)osQ8@;&s~pE&ajP7A@nf(}#1P|#Fi;I^Q8m#FPO^Jz zs>Lzx)LwTMGm3kf;MB6k=y(A}V_d1Z*pVrtZkE++n$Uh| zt0E6R^1QaGNYn2?~>VKg+mP#8|gD&PBzvOnXy*V8r|H*beG?RrZ18R3LkP$IYzZl%SK3ut%<`h*XmX~+Lz zj+0F?zDcHO0q0WUoXC-9#l*lv3yCoG9ux<$7czeTmrp3nHt6_R#vgF$&hd;t)SxHw zJ%!$NdfRbf5w`;5i$$Y$-r}$<1d~#91mGQj$4?JeN!HD3G|w25Lu{Q+3JgNzyPNgU ziNjm!0q;7Fysidv&D41>+cmKF<@~Of?Y!@O8LuS*CjxjKK@hDGeNNJh6CY7J4uq4| zXfv(RW?G}ov_{>uHp;sfxBqvFTj-SCV8X)7+fpq0t&w8TsYZ%HXYCZPQNQDYC&f&> zm~O*e#4a*5_?!l3*6H2k`)f2LP}k^u@}fhhuq7`!bXL$;u&mKF0leAD!dE69T&%*> zuTew-`HVoD`IB1KX!HjP-1EuD7KN!^(E~@8-6DHx0}8u`DL4_L<0I@9Mg@j|}mdpgte2T4z8uxEp$abaZv|G(1Y6FM#o1edb8 z6u2z7tjz`dPko!F`ANbfF4{9BN?x?5M4G)Sw1oXDNT*OLcV@{~qPzCrG~H`(AC+i^ z?n6qmv&1;Y%_p;Th*K-4PcaVcHEyqIF63cOEu4a!GMo~eWKP|ja-8yt0-LwyX M#_2kz0ZtG80e)!lZvX%Q diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Category.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Category.class deleted file mode 100644 index 630089b53ed2fe8e5c9966dd698684875ef7b912..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3046 zcmb7FTTk3Z6#mA0GiCwrZU}^gBu#)U3&cRuD@mJ#+?MW=6jD+`FENV)hFzQ5UQ}MH zJVojssFc@ARr`>KR%)PXq>3g|ANr%3o@1NE&|HXQ&zv(e=R0S-^1Vte3Et#%BzYn^PfC)Kn={19ZBe2t+WBS3R$m^s(ePEa0a6uZaXk*V=f#f;U zGQAH4dh-z^f0GeCH0+-d&`K4%rrpzB&v3q}RkdZkvf|oSgaB=V^qUTC!|~RcgEhTc zr%+@0{+Tompi@B{hXiiz!(*|uVtZB7(w5h1nrV?wORs8|jeB~%>WvfGo>Q-Qwo}%f z6~h_h09$wGDupAvavN+Vg`*rwyFx4+XX!9YCj=DQ-KuR-k&Hx@Q6juzudWM}_Yw7* zK}0T8u0SDt~PM8%U!Mrtiy#OY%_Xcnp*HKh(4HE*H?Nd@V zJbgj;bgCGswics%P;jG?I`6Asm990hLPHB9LZr6t=M||_QY3ZjzCxd*HU(X)BFW99 z(l7J0%)R{df!w)ue^eS4m%6ix98;yPc&8YS`EuNs6Hk9gN@{XKRnx)T^=A)a{+K+` zthNMecx<9iZS9hV2`&QU%OMag624*EL{3#{X=YSbvp#^h{_OkMM3b7M(E}t4lG{m6 zusqei9Tr(Dyrr(VoKoefoVpXDOxvVkMQwiibMhe5L5Cc4UD@7};ZO+&c^g_aJeO`5 zV<^1o1e&)?_wbtw+ z-#&yaw$NSbPK4sIa$#U_6K@59>9i~ksaf&q<102v^kr~_py&||0o#4|KvO}8q}aqs zHU=&0X(Z$%E!~w6@fz+j=xrn+YV0TB^~UrdP~g1VbJR2O$`eSl{?<5+0YbpD(%@NX z@T`P9Z`VbhY~GafCiJ5aQgmiF=UkQ{=OpHs^9>9Jf$eZkZ%KoLv&20Un12Fob`!(d z(G9%AFdKM3I~K?}>aypl*}zAPwNus{zTgKV3}=?YVYFUGnEe|~8yNoyiQ6&t*b)a6 z9lHC-H|DTTAU>Hw_eJrXj)+K6ND{Tjo)cE6ah5OR3e7P0*QjUiM+yT!VqoAeNDt9B zum!2ieh2CQ9UnhLj$M+L^R-0$QEbO0Ro{^CD>}v4T+tHd{q_zj)UVTMiSkySL#&8N z|GR;k+uA2ZOktWvacd63#iy8=;{(&;;x-){zisu~b{DdXCKpK;s*8+^9v8hX`dplH QaoJz*zH_vH|MUA_0G99-!<^$DYEGNm zM%(lq$MUp>WpdlsT27ObwCy&zo38kV-|=E#43G39qiblEVIOKmyVF|HM~JZeaG4=_ zF+dDqhIzf=w6v#&=X3X)mZcpTjbqQTHN&RXL69Tv*ImQ3y>rxi+Lq&Qbu5d#)QlK$3ZshOn;iCNAEobg-K@$c^=RKf?r^C9m4Cp{<;rz@nzNBdwN9^%nHu6W{E^~AK$deg(ShZzrwhcOT1 H9t!^gBIfhd diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Order.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Order.class deleted file mode 100644 index 4f0ee8cafa6bb73a1f79b4b0fe21e243db310fbb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5914 zcmd5=>r))Z5%1Z19|zh6Avh2c(jmkh;L|Hk1Xg4{EO7{sEEH@>j^pKS1q*k(=bb%b z=i$hCC{E%e&P!GLnyOUt!5@;UAf@7}M3JlVA%9H%fmFr$&FtRYf({@06j89--81u> z?w;=HUjFspzy6JgPS9@{jo8jg-mV&!UNv3YF7te`Y#NrEuh=C6+*PM!I5A?3)HQuW z&zE&;C4Y5!%_zDt3Ncd55{BlQV{^8(G7a200la3o%Z_eZJg-}p?dq;+gI=hW%ldNJ zz_iGU;TC|(@HQjPe z_gzLkflUjRYpfU!R(D|4tBpCmTU4vhN>MlU2<`R(kguB6i@Iwt8t?#Jvts10-nqjK zSIBRG^>G&)Q}@?#TTM<;KcxlyenwFa$JJo|Lj)TBiGDMjwp@4nRiE z=kRsc@9g4dvM{hyUB~Pa95n}P^LKRa8qPbFa(+!Ou5;T81aN*9{51z*=(z8~`pAY} zuE95xyIXn5b}G6n*6~%nighQSW!=c4ScKKl#T(ZP3zr$is=5nZEgVj%G&w&%`7VBj zS68Phl_`#>35{i!Qk0`pNea^!82$bE@_Auy-FC~Sm0#PaS#k zUKY+BPa?9<3+ju4y2vOglE$`hl^zc=CxXn$Aag3n;GCKOFX93$+Ev_Fo6pzT?e0oJ zux4at?obVER}=)yN(m!JO5V{k`uEtb@_9Ot$p8N(5tBOD7BNp z81nIg#dizbbc$}#ZGrg4wv`Rzc2GpFd{eCa8tj=EmK7PQ=%}v~!}SsjK~W0oB@_Z& ziHV6}ujqk=53rzKf*>#%v22{yQ?y7o#0C{?u&VRb3usy7eOE}4O;vH z(p?=Vs8lvW=)#zIpes?9B};-uU&YoTDjjFap~rVmC6#_9si=?dCh@DNiKG%2d|a{^ z5>o%Ac3^N2gI!`${K>s||KqzSlw)j)WzWxdC*vVi83^~YVeG??@n;>c51VA&Xa%Q$i9RYOeL|i>0w`DV* z-VeOeT&rS5^;cPvnaya#ek?S|afFd*M6<-WGQ zybtqx)qU4{R9|z*#R)^)ucjgPjcAGo)WIizh~`9~psWx&3fo;Z9MK#29b=yt+LK5= zjv8uA`rQlyTHX#Xth_X@)t))iG8Sr;Wy854dUv$! zb9PZLFX@gccwczf$6E4`uIY|mLF4FbfgIVsVe4s~u%fs=uUCESRKcXUdy^cPF@@x*F|i38ZZY z8g2`;mwH=h)VCcd(-vre23r6PZ3h}_3p7lJS^#CX15LCA8l|HxfU?_x@@;^aXzXwy zi&Og$fFfQ-bC2l7-1sJSkImuvko-L5&8(gM+C62^>d#nS!i}KM|kHx<|pueqc;|Q?*YZxV>&(8 z8;jKG`QBK}r>7TsV`>~s0+Y^6g~6#lcXlcQZrJC}O+|C#6O-w1I+Bh)q6?l+e}P@% z6isz>bar;i#2J7;Vo01G8itoLuyBl~@SKsEhVLF<#{p<4QmiY-ZRA^UvCOyji?1|t zEVx+aSo_83bP?Gia@KL0BG$A|NVyq2Zjr1Wke4=EBW<)s+Gvfm(Hd!^HPS|Fq>bjM zP5mZa0QU2cLJ7J`*I=b^#KyK164jxeLZG#J3W4rxq!5^)W(tAJG*bv%Hkd*W>AL6B zttrGr7mZ6o=upC2g#PQF(9+FE^ji1LhxAq8bUdWDx|cm#6LiU=`viT*qlW~&>d_fN zuX%J<&}GmM$rAfF>zOzOCK`3m15CrUCw8xi9dG`V5)aAwJw;v%sRvgf(t@J5JXv20 z*-#5vriCoKMfR~&M!4q3lv;?<>2vHeQi;Xj5(UrGpFuaD!-!U=V>G?v$eA5S&h9vJ zE;xcMIl2DfypOl|I52bLzoX*#KS+5%Z;n4EWnTDe0)Ky@Z#>oBg#4RG)NkFUP=UTJf8V3;)VaF_dY`@vDShuYF;3s7AKa#KPMw_Yp`6KQ z7pHDX^m9scI>6~5rx7W^%u!B9IUV8n?<*xZ{z*!EIPK-s%c+Oc0H;At!<-Iry2R-+ frx{KKPP3e@aGK*Z&xv#TAt#&DqQv}w(~tfKX)f>E diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Pet$Status.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Pet$Status.class deleted file mode 100644 index 280b4167bab08ed0ed10f22b766c63fa92a5fbe6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2093 zcmb7ETXWk)6#iDe$*Su(qRp*=($;|OG?A0GK%2CUb1N>Y6Qaam!c34IHB}-@8Lgaw zx4iK`c;XQ#PzDCZlSh6O!&%8>l5rTC8ELiW?74jBJ4gH1-@p9{U6g_`e^A0T6 zJg@`LbGX)WY|9O_wzp%Ev}Of)BQS#wPk}K!)c4FoQ*%srS6g;F?K%Cm{bwJ|GGx!X zrx0hD)LUL#dv5Z;^1o_3+Me0k=bo#XuIo`|o3>9$Uh(|48BmM_e_r-?n=F`EwUQ)|n$ zrE2X7?TG&!+udb|8>{*feYofBFvxS%4A%}GF~kbRIvM8c6@7ErV7R??A;jvbz8Qf} zxd_y)FvOk}G=0-{`6_Nzo`SI;pO`k{05)nYw^w{Sy20yi0k^A?TbwrjSnZO^BNxHO%7`9Dvl8CaEI zhD{;7Q-$J1=*-|MhD6216o#m`Eyr`IpJ&-wZSGmEU^au>m{c%PDfaDOwMP|;q{bC{H=thj2Xe&9fm=D-wSBGv}aae?wEl|y_VXCF}fL;SaKvb zLlHuZ5oi0P+9C3`yGN=bjYx`=%PHL>`eYSJPRYmLu#xW3jI730soXs(vxNa!Qj7OmF)5yQCu0%rL@%;Rxg8ffew;^R3C=Xj6oS{27{4YW4QVMS5^vZG#=5tM;p2Xr}hJe z(e;iS*lnwBbDMtQ%E<*qGjy$YR&@{0IgKyUb;>ZH+pbmXw40W{5nTeR?zK#(Zu+*6 zd&;z7@49s7`s9+Sx~}Di9kwWqVt5_DWv$qbH9t-DCa5)u`B70m(X~O6_-5$6%#o!7 z;-UW_M+Zbm|ACqt6T?kmRPkGr!6xmK^c@k2Ama^OA*oJM6KPt3h2$TQ8jaZRw5kg+ zb@3IJ8!z$1Xv9O+M{%_psXjIuiBP2{)Mt@u)p&{04-|#rQ(Ch$Ygs(N4b0*$<_P2{ z#;8n@Pa_)|3M5KDVf=gANTG`W2i(VJw2Ha~%r~hvoPjQhQRxNRpd@i&U78qwg{4q5qA4a+6e|y7WF2LdsO`U zTZmQhLHK-#`~ON0s>JCWY4LCijN=g=Z{ZRb&pa2?LhE&oQI0VVg=2tYkfZVsL^$gD diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Pet.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Pet.class deleted file mode 100644 index e16b319a5abfe1249d3f6da5f77c8a96da207858..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6141 zcmdT|>r)%o6+c(cl@NF(z#w6483P7MSeQK8+OcaJ$3Yl~iyx^=>ShsZSP&A~yCQL$ zCQcu2lD^WHTlev$GoAKBJ~T7M_B1mY*O}>ue(oR8|D!Wae`j|kEg)O|)@BCn-gE9b zzkAQ~-sKFC;3@K>P#(n&j0UX&_saTcEW(g{t3%ij8 z#jx~+hEVs&XcMs*bobqGOYt?l&a#^^AO z@Zwo4{+v-ZtdoL19Pvcd&E6)7;1RMz)@sXj_dbzZTA_K27`-AWKU1u%=dWwh(#_Y` zOZio;xF#!QPmSfLL0>RYCZ=_RlW$WiRdt1eg7&XftdddAuWqjAjWQ6*S}9*BbKOd# zD8n=%sHeE17uPOmCQ1_$1?g5S2ioHarxhIca9jtDUWw7u^h}hVqGuKA5ab_W));*u zN&z}1=wDu#&w$qpGtInqR==)QOV%WMnq^jtR>hpv%r)IS&Oz#EG)2ysFr9$+T9imF zYr^!!Fb$vsw2*J)MVQX8e~(0w-e(0xksuqDGCKKDFM-fDW}fmAPkV`Hyu`C;3&qL? z`q4i>V?k@#1K~c@MvSc+TykP5MBB&{RAZBz|9@^81y6~(Mf*g~iO~$ra!Osm!DLmO zLPdLMq_)F4Q#DFUx*4X6QM$zS9f4~{_;zqYA=E-h+rS+Ihu>I}6xx06yKp!yzD!pc z@hgZ@E?qy;0s3<7PExguQvS4QYB$iju5p9%2BL24&K(1Lo?eO4*GNNm%%zPbfEIUb z@R8cy4eGqX>o|dP>7sic18N1QV=m3dDTq}#B$sxMJCG$oVpO3rZz00k8}ROmCRZkL z>9TueAx0)i?v<9Hy-h8$MK;-h*J`e?uV+p`!gM1{d*FEe)vCsKpl+|@Yj(k{ie~E1 zvrNm@URR3IoAeg9_M3v@wZ1s3TiTLlX{aaP`lcWEOTiBnVXC-b8MNOX;n=-=yhIVx=lUktYT~KRR_H5)aCX;?vS&d zEq6^F#A>ig!PabJCORe1>?k7A34UBn%*UNgH-x*??)jv5 z|E@wW6!xk;z;C$Q#ZRiK`M&LOah3X^)Ti!y_@~eq=MxS#dV+5Q=h_;qSSz}T;;3CC zdz{04Y(uvs4sm_Vy-+~}eeB2@im-3KTDFXJy-?mXq=6g#>BjdA4oIhR_ske&eXhE` zsGFDg*3X|tm7-RD^;_opEGzf$?fZUmZPKS@c|TQh!XtC1z-NmrqIRkPViUIE*`#FJiNWO96lv> z@o?kc#luB>2d|Ujq!8cEe-5NPW)V^fX8uBLf5yN^zrd3>Ms$E~;~8@V@NNg?-EN#z zfb9nA+zB+$5~zoIn*gPD0u4O|h#eEBe%jvzD7_PCq$SWH8f*eIyb~zf5@?h%O@MMc zf$}YYaAeXEGvTGLcOjy-%OZB|eX5<{ll-WVfg-liQ-s%-9yCGReRer8CLk z77b^Tp)JaN2(3nlV{jLTc*;R@L(KoOaB`DJoRL0Wi@%-i!)1a$WbG`T;IB-`@+@as zh<=IjBxesN*0{u6eb~_$b~T25jp4z@@Gwjy8e$-}v-ac=17t=Twnb*{-72%2V~q z@haPu^EhRvS_<`Q@haQZ(pq`CULjs(yFywkpRZSiSJ|$L*2=gnBMKbv*U-z@iT&P6 z_=tR0y@BLXb3mO$@2@9%e?8Ir>xtf9PxStJqW9Mmz28lAZy)?$Bz=VD=tVc_H{GOv zxjP)-q~~5f(;W`F%pj_fX|^ul}7Pcd7bE3clo553GRI$*lYIy3KmU;ibG{ zE-&4LH{3)ww@vN?EG&o}^d80L!u0ji;!~WDA`Hj)@chQ7n06`5#B1X)oqXiXsYlM7 ze&o!gcLqzoLEm&k^fuo7abRS!f1qOaZ{)i}*Rl`DH_QIY;dh_jzC-8PRiF?pP$xj8 zK&5Od4=N2RZBqw94TD0!AlV5j2P$V%!N3RphD$=^`#0fc#9cki{gK;`pMH&J6x1Yk z_Wr3P{RXs;eoDW^`(yCGh4TFN0{IK{9sBRQbgM>vuR!n6yWrA$3nV0cpMJ1FM71k&Buz;wNSc;(Ueb)DSxIl$_&=6p+JkvX?@Rj0e*r9zRTBUJ diff --git a/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Tag.class b/samples/client/petstore/kotlin-jackson/build/classes/kotlin/main/org/openapitools/client/models/Tag.class deleted file mode 100644 index 7b2a6a300d7119002c713acd069c79884d48a57e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3011 zcmb7FTT>KQ5dO~WZ5S4q-4#KUXb^B&zyUN@G*R)wk_8PA43dk(GQz;_44Ijw;!EO_ zKOt4VrYe;@_>fdZNX4oY(W*S;N5yo{49h@NNY%_a-RJV1?yvjw`TL*W{{S$8C4ny6 zS=Q`z!_wDH&$cVBR<4+a?sH^&hu2pnvS-ZKoYLvYcVgiy$5Nc_6 zu4G%wqXOL}hFvwhMMpO+SJN%a_H@s*NuH`zD*9r@pk;|=!z&U(Hs7}&BaH--4UnJ+ z#Jv^M-2r{Qtppmk^r}Ia5yTnKF@3vIbl{XfePqv(;es@p(ZYvj1(Fv`%k(}F=*dTr zeE%YPxUp|eKr5B)s&-FzJ;V9BTG3YZ@|tT~5#O~5(r-EBf#cn0_c!!PjZBT@`{vR( zf_4RQ921y5#EHeyn(b9gOIzKjYNkbJT6#shYTVOn6>p4q_MBSTvznbHn4eb zm{K^gC#-=hDZIg^v?|2HDVC12)Fq&hck8xAsWBW?Mu_mTy?$R{{18_6`FU|*2v5H* zeQb|2i0Di6x!p^F%L3o#4+9>F-78{Qj4TOKee_Ufr_qZuOjf^u?AZaG0&Tmj2SZnC zW@X86QaGzX<8Y_wj^)jzi!zAWq`pps>*fj3^3twoFPrE8Ym6s{A#?ikk?N8rp$U?RTPfzudAQNayN2xN9{#H8WrOS-31 zib&Os7*#sKjY{gGuYy&oUSf@gmWG8$Z9m8>QoE!`>h=SLK1po|x@JX^8%d>K=4qLG z`PoCcefz%nOj<}ps<>{QdYobhU(y*d7KKm(olvv6UIS=9G==CZB$6??DlK4AT{kQ-aVd zz;6(du|OL4DeANQMC=<&BLf-yZhS^7G@2z2ktqC%#-B-$@Hw>%035>?)TV<4)Hjh9 zh0j1Gu>S((_5+x-_pIKSA=9XWsJ}h)OU8qzj*{%Y@@T( znFz&`lZF0)ExZ{Rrqi-Gq(;T3j|*#(=*!>)LD5?o0=D|c0}TZsl41*|c{6BPcRe7d zY3ZJThy%FGpr;;$=w?3%2XCflfDC7EFHq0KD^DTK`>t^q1B8HQrOvZb=UEAP-pPwR z?fJi)H=qxNkfL*YIp?$tIVUm4oNrhS|h> z+0j7GQJ1|)%_cr%tlhL`^98>Zp*izp4x{xj!u(%o*u>b6NZgL8Cs){@=+NEA{$@6- z3-PHGIxmYCbVWppOp>TQ`GT-QjiY=O*Jy^hzd=27KV0bl0sZ}dLVASW{%uH;eC`1K zzu}`t$nlY+<$Ns>e;nIAlCp15_!*sIY|dy2i++0tW$N$KXo=!Bxqw&^Q~q}ow|2CT zijz6+W}q*=0eqtk$qX5{Lz}EUZ=#D~gbn=x%`l$&!sj z*_M-7iJiM2T%`xUq$-s>=pm^JC>2+^B)KXN`7!wesfzNQp4pw*W#iRTN)$|=?@agC zeNK0O-NQfs^Y<@_XqrA%C|$0u=gSqNq*qL+7RX+3{sWz$%-!sJ)TXRhJZy!&pxTv|V+(8xUVZW`7~RX0l_ua`UD;wn!V&e8!*^JSM{qlK* zq8#&eq_~DeB|K5jmMml4s3I-hXvbmKYbBckuh)xFhQ>MaNrgf$nkCcvwnCp~JdARR zJ=jUv|HV@u<@l09`T5myF@F=8HmdIw3;9ibbxV{>p0$>r1HM|tim6(+c)4xsg&H#G z&x|j{=qOD`DL~&)=+Uzl-t7EV*(#W&{N{EsZ(;_qRtxzH#!bCeu+C!>S=HLARjw}R z)h)~|XQQWi4~FTRO?%d!q%eI;p}1SqNoSa5I34*Yru{{>jf5w_){uQ`s?JbY_Z~D`NcTOku`f375Z1^ zsn|XH>RH%%v!3zT2f?YQ%TkOk(=4y61xT1xwil#AeeP&t8^Wjq*riSK_+wF#bP(bNd5=gsTjRROHBBBOUp(KU)OS(TYeAHJUPTV%LfNW z^9H7La;R}S!1DuHrG6B^@g{~pIV6Q2XhpuRD?J-R-{+QU0h{Q9(rUGzkKY6wt8nL^oxGN3-btM)&ngK zLAyTtfDSdG!%b+g2@N%&BOat_!xF_B{q)b3wDbYrF$C-hRoYId(sn|XwiBwfolvFi zgeq+(RB1b*qDw`FHZqscM$zT-)2cQmhofBn>NEdbM9aX7p?#*n9)}%d`&vSCdO>Ry z6L%n>_GtUyb_V6THMo=Y>4H0oIZdE?TpbQWO=;B$88f{B7)=D(hktj(m`#OtD4k7(cW5k|Qg4h`$Tvd&x-P z{d=S;59!2wG7@y`lMBg6xNa{dBbo{jL8X&30U)h`fGmJUZ#2Ef>VYq-XscqX4gdlcA_o{u=^UK05IT+0?^=0Lll70GYwGy8k=!N z0WjAp3cIvuPfe>RDEy)294fa_@(!+iL9Z-7pliLa?$UR`*0oDFdcSYm2^76QwCz5& zb=w|bd)2lF**0uD&Gx!&kFjmqc8)o>VDD0qN9JBocuE!i#

          B6me4Us6OYBEdPTd zyY$u{Dfqfy8{B{^;dQ-f`}*4W2HN-r+xXILd}D2VxhCIzIcQGqm!vI*>BL#(2`*Vm z7%BDPdGZNja1h?a>-Mwo=9G7A7-p4(vmic4$=|FWWheeXA51(V-#vPF;vxAKcrGUK z_cywAkJfn_fD#fd1N8y*N%S(%0MLL$r-2561|`Y^rGe5C9RV5x8j~milmp616b#(= zyD1Kl@89&HB9H4ZA3A(o`{=jw`E&Xm${l#$h2s3^2Ki^{w)}mM-mjw%X6X)n2rvEk z1}OrX_R||QA*fr>N4QnUXODdD7t}B4pr9c^BZ4y0nHO|OP+U+_kSZu5C?qH)=!l?E uL0Q36KPuzlNJSxv5{k#nCU&(jYEEjnNW?4lflE zG)Uwk!5jTLFZP0yyKoNN`<#28b1&!qdY8kjEDF&UM{bdnHl(JdSVWcO9={cbj)tI(&m0)9x$O_oVa-oTsFVXPBAZ25_}6^(RnEONlX@WTe^?gr?!c;@_)g ech3np0Vm)DoPZN>0#3jQH~}Z%1f0M+5cmT(yir?p$K@b!~5idTIY3+)xS1$p3 zYD+u(@+DuAM|YT!vzsBGVF}DZ{EVX8W2zXM1|;ay5%D}H@R;40Ay(+d3FCwo?9q|l zLJETlBQglF%h04+zx8#%C@!I7eT{BTQinJ=0YA@rYG&^m2(f?fh^y6MLR5eKAL5iD z3opDZ^ppv5fI3_tZ_ee?0DnUzYBUE>De#pY;I=Z15NrKqw}(=spu{%@H13Eett~#8 z-wiOY8BxJ^epquKbE240Q}ARjoP9i9V3u8!8I>A>q1K|6ufX^AG#@b&XJx-Oz}{K5 zZHk|ceKvsn+p)#5PEzpgSZ{T=>(e2{X=o?vt${rBE5Hy0E8?Y6zZjritDdc;V8IN_ zqJ$)7c7r0NI{0ppRox%#>8|Z&*lp5^|7s6^wH1uc1!L~}&Ygicdef@>s}M8+ZwA2E deEZD++gM|zO~}f~?Nc!3vTHXR|JNTY@Bx`AznuU8 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len deleted file mode 100644 index b92ca80caa0659b9a68734e5c7672abddf481663..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00F*r007bey#N3J diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len deleted file mode 100644 index 8fe89d82d540f0f9c8b866f249f77e7623cde7a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00Bk?001fgA^-pY diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at deleted file mode 100644 index 4fa36e1334df1f2ec8e7b6dca4eca0953e92cdb6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11858 zcmds7%T5$Q6s^SA$+%+cjzw>wqkk|NArLbTVNjN)=)Tia(ofT=)o}1W^e= zjR^_y6HMH>Fy85xlScO3T1+yJN==oh7%o$Y z1{&m0jK|v+ciqZGmf#|8 zEiNv9j3!*jNSU0QMQyM9Fp?; zs{4Sa4~LGs+#|8_V~(AX;-Z!9tNgedgZ`KCNoSQ7qOhkXn#-n|Ag{aMz z56$AU4tql?L=-KiX_vBTXV4lz%%0!VZpQH)c23HsT4@I@tGk6WB3|fB`>-l&etLx| zOkl+G%=PglijiJVNz`u+OnA?qV%igpgWQaSN8_=hfbElVr%EOCxPw%gJ%1eJ@D}r- zj`?$&y`*7KU9B?_7q=qn%;Ez9mvihp4FclwPRZ4zUy8H;6lJuAu-5@AW7bzcNNNe^ zOV3b+rICjB{Yf+z0sBUorMmyWw2OD)EVgVKVc0NN_@}BUnX(fx(N*Wej*vF_IPM_ihCB E7d8J4W&i*H diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i deleted file mode 100644 index dd1f4b65dd53913193b6ec9d909a4f4977a35db1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeI%u`7ge9LMnog-mpm#Udt)46<0vN)p{An@u4ji@L>VFv!9r${_Wt_q9BAmvv@MnGXR11PBlyK!5-N0t5&UAV7dX%?WHqaba+B zD)sQY2pk+O45Z$v??+%gzWQe?BRmKYAV7cs0RjXFq$qG7QOzs+Hz~GhB0zuu0RjXF z)RRDKLzYdywT;))&2A+?fB*pk^&+qlhn`Iq7wYBSRPOwUkdvOip;UTw5FkK+009C7 z2oNAZfIz+i-SNBoSh=*E@2WKd`3k(nTw!AAGv8Hf1PBlyK!5-N0t5&UAV7csf&2va zV(RqasX4zzOMfYF5#vWQ2VZ~LV4DB|0t5&U_+5eRc-;Hq*3R!f)zgv{i2vy?S9j-< z?Gr|T0D*rla1i%Z*NTm)pV=Poi|XD>IrUC`wJGoz+3T0LtF>9Lng9U;1PBlyPBJke@ Fz5zm>FuVW& diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab deleted file mode 100644 index 9a71d23556cac4de8c63cc41ad133aea73b83225..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIuKTASU7{~F)(k(1-2$G;7XzB&D1Pv}$L!-1tw1k6eLqm&;bKnvUO@cHvL@%Kr zq9LTQrOe9I?2mr^9qfWrYs>S%y`OXMxm-Bk^4fXQG_&Cr&D3zQ6EoY_5>0qB`i-_M zT+xKRrQe6q_tE}eUg`hy`d~(80!m2Uk3A^Ua>Y%_6^73;4zU0W)JcBhE9>}}zF zCX*+_42Ww*9!`53iJG8HW8tDo|3SSV-g|qvHB&}nq}0LI)N25z(AlPtbraSha%*DC zP$^n;ecbE{sDh?mJ4^0Th>j3Exq$J^LkXF(H3lJE3FA+0LOj(mb)}mNAv8i|8D#`t_6vNniI`G_ zv}V!}Eyw1lCt9TWsEKDAH_W2skSp+MPq8kf%BW)-_It8v{T=s5gvG|X9`qEOFUh_9 XWdqqjHjoWu1KB_}kPT!5|7YMErB5)* diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len deleted file mode 100644 index 55d7e48d140bf665ee6f630c52b8eb4041d3a716..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00GvC005%^mjD0& diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len deleted file mode 100644 index fa432244558c364281f5897ea3a81444683a68a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00G7f0043TY5)KL diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at deleted file mode 100644 index 173b53e8670138e83cdc4aae3e46b49d98a620ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5659 zcmeHLOHRWu5Vh2c^a9{BpaOygYSr>tkDMVjO+04oAi=5l3j_iLD_Fpln3NXrS+PLi zD!asTChyIA{>*5#f{-D%`)G)>_A+t1ha7B(=;8{5;Trf&C@LI8V#x7W9qElAGxQL7 z4>Mr4(G1Dy9#hUxmJqGHZ4r-x2ZKR(8C;IK>(LFUVuPCG5xkwt(IJBb)&WXi$Xruc z`LFgEgAAh{Q7o*R+W|8Q5;d^VC0I8Z*TnfWSR^Xmzn9=a_b@JaJ3or2>LeA+b(ZlB z^@%!81$AwRH_*50CIQgaZ8L<(m5G&@OrUqhz7ww`PvE7co|BYd^^+)l44zy-k)&bt zN4x0vWzuN$-%h$lqyK*!`GH1HE%lh-(i3KhnYfms zK|ie%ey`~Gvdm{B_YW;~pPupixLaX}9dg??7yl>CVh!VvGGTGoQn%@8F+jFZ*aKvt zaH%d5U{F$q(oK-U@IxJPuFled-jOpnC*GHor_o55q`b@0jY<{tkvdGrA<`a`JU5Vk WsRcRl^E%YWPa0j*3FNw<63nkn{G^@$ diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i deleted file mode 100644 index a17670a8ff12ba23078adc25157efdd57ee3f00c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeI)PbhvIf+t)LJq@)16nO{KvR-Z^5>#V z?cm_(X36B}KrOZS%E>|7>gjp*+wZ;0+Ouch@Avb1+S70A=`kt{hrt5@1Q0*~0R$`+ zsLC>omV@SMOPkUR0R+-oU|psQIih`OJtV^+fPm5h1G4_`x|_U8htP2NMmcV=r|o0i zqB|vbm%lYvx7_4K00DgjTymZ}>O36MCoxG8K)`MRkDPa+ZTudv`#8`a0R;3Bc$26% z<>MiJ5|b1G1Q0*~0R#~E6*!Tn>?@xi4+Id%9D%SznVWVmr+cCY88CkNSeEW{G9Lm~ z2)s&@$<>t$D|*qx0s;AdztmR%${iN+5s$0thG|upl#zxWaV` zjLL`zAb>zh0{ybC?O3ZhPw7MKjKDtvyRyC8=NbIxZ8j$KM=omx{L(J8IpwsrE8SET__+|h z_+`Sa>ioLR{c|IUy_v6P-Exx`0Xqe*rFnhrLcX0dn9gxS1t|goWO0ZHe)1gDeEh0LWk*9` nGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLtr!n$PEDi_PYwp diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream deleted file mode 100644 index c0e36ab9e46a26422cb0b690807dfcf4585bf523..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIu(FwpH3;@w?l&(-ZiAXE~F%skcg>F%}`@O$+dOYG&N12xHeM#-6BgICGvNCqf f9V*wf`x^%#fB*srAbUEvZxFQ-@7ISG|CHDH1n*rD%~4wtuic zC7?&f0u2&s{6N^%>{bTfGv@RdHwGj@{d~qZebk62TcZ-gkh2R+-EE0mcN5GhP|;O3 zD3iFvlF_2aX*o)~P4GTYOA;)qIC3NSLR7>Z(}Z!+D-v2(q+4(S-<85^l=$*0|C#hI mXzK+USDw?JgxS1t|goWO0ZHe)1gDeEh0LWk*9` nGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qLtr!n$PEDi_PYwp diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab.keystream deleted file mode 100644 index c0e36ab9e46a26422cb0b690807dfcf4585bf523..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIu(FwpH3;@w?l&(-ZiAXE~F%skcg>F%}`@O$+dOYG&N12xHeM#-6BgICGvNCqf f9V*wf`x^%#fB*srAb9z!NtXE^K7Fb7cUn<-CP~}ANUveXNkL; zpx>QBtv1rZ9G82Sd++;kFEJ9)so1D117p*uV{CLRw#q6eg-dibI@INf&THv8WA#v8 zmcVC`Gl7MmLJ5O{t6+ywiW_X;fYBvJa2zFCh|z7xRm{DB#x-Y*obLidMm<(qWMQYU z*^qUFKC1--W~;~c>H698c#Yb|LE9DT!0Nsf*??@QNQkSsW~?(DIrYax$@#^fIqp37 zIdL@4yp}q!)B*X^&jf#$7(P2ALzAN^t-+BYmiPKUirT@?-XE%e_CP&sy)O3`-tT#1 go#1QY=zA|`^=I16ygi)tSN!Hw``fEeZ!34VA8|&E;Q#;t diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/inline-functions.tab_i deleted file mode 100644 index 28d0f1a654db9847fbf5e5eaf1f509e47abf970f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeIuQ4s(T6h*;nRFgp-*(gQ`UvKs_IGdIp5ghzsdMcgK64>Q+XPHE;d7Ev${kRJgMBH zB@2%71ZxAoHwmeY_qS?8v+R=-Uoa=vKVeH2Kj29A$cSFP@D5#a{|&}vi%iPl zS18Km5=5)aGA}SD>t#yzKf|G%d4h1Y+1ev?%j^Rrq{&s;c@J4RT7;&s*-`<9}{)4{M#|wA?FW?2dfEVxrUcd`@0WaVMyuiN-d;^2?o38)> diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream deleted file mode 100644 index 3e846733e62108a00ec1617239cf84d000f4a455..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeH|O-sW-5QhCF9&|-iuvSGx5iHSzl%h0#oY!QUE~LBb>_n=+-ffy{o3eH+cuOFs zyzflrnVH>9gIUX1(9$Y0CU>olwYf?pDWkizz4STB6=-UCxobTDb*#DyX_OwIbc97h z1%eN(qS7p0hM;@WTBS306mrjHSTOATYKX}o_)Nzv)k0wLtL4c7`nYY5Xd&!*$gzy4 z^Xh5IWP;vx>1kb~NMRt0oO=FM&oVC{GWs2m07W~!-MZlaM%CWPjI7kYh-iJQ zn9i9vK4He_gR>qRJbqX>WP0KvNx->Nruzk! z6W`Oy&0DelYu=jeCogyW`tVkOBfrZ7mHpAw0~(r?+u7M9+>Qyfo1R9&gReI4zDy-^ z^$EBi>f^|yP+l}@mS}f{H1e~R8T<$y(N)NMOaTv81S>@%CP{_cTA}qf+}>&lGuWfd eg7;}vz~q+MXr6{ZL!cqh5NHTA1R4VWN#G0A+xd?G diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len deleted file mode 100644 index 167eee53012f56c4480c8c5d9c0ead1d76efc0ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00H*N005}~n*aa+ diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len deleted file mode 100644 index b67c22714fc81ab1e8e714908a8527742ca907c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00G7g006oGvH$=8 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at deleted file mode 100644 index 7af9d581310d2bbff463ff0aa13722a403b8cd87..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7371 zcmeHM&2G~`5MIeIk{4+A8KSgRIaG-fe$LbN)Y-<~U1rw^c&h#)5Qw4{ROq3+663^; zC^>N`bRyqu%U*x;eKWH&vs&#U^UU-_t00yHT61W2OFrb_Gnha{smk{hmfes0H zVI83gCBJJ*%m38@Q{=~}XFiqIZ5)D`MP4Nlm8na4jz7kiHO4gX?!Xr8|Dvtf!!-3dTk$ u%NVk?ln;qdPo#oAR!4F?gpWp;=MM4%9htTM{1lpGD7{~FE5Uh(LB1;%{Q9P=rEkcV5yeSH5UF?vul!bK?WkF;Qdx-K6h#~$# zN|p*Txz`N1fHnu_Nj+2{i#k>1oA5o(S7Ri&*mTbtx7cn z5U@d@Uhglbqp2PnX5DMXF*)>>@I0`W5y$KinAYo|VWoPrP$$l)@zI%heWCVG--Ru( zp!PrYzrSO8iZ;DYGeh4-P1hkG0TTjs`u%M>w%KhWn@sltCAuzKp^ahp39R%&phefA zqkW*%i>zESzG(5*p_?yq$zUx42q1s}0znr@=)QY4I$`90+ys4goBKPe>%M)xYRYDV zAkH4rb%_q&o(*De^n?Hc2q1s}0tg_000IagfPifR(;E25a@|GS=JtEuu)ZHz&kXft z`-p3Q@paSF>^|FI3#8QE+U2{UV0TG(2q1s}0$vNG75M1;WZ3Imw|OJ_{7_L7x$1Vk z>2<$VV5%>&YP!yT^ULHFYbidr-}5;S0R+qoyj6)aok{*~(LA*$72YZ3#)-KuPr?X6 z009ILKmY**JQP?~R%|VK(8EZgauDd&^Y^XPwaFYJSc-tP0%MxI`O3XUYXJ-mKA`ud o=U*=^8Hy(s0R#}RP9Uy{my*X<{2qKz@9%>}pEvyOBj5G^0@Pb#rT_o{ diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab deleted file mode 100644 index 9d08a3624d7371fad9176044c5e824a3f553dd31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmbR3vzw0r2$(?x3A^zoiXg`t~Nih!9 z=4ml&TuZP@j`{MgjY%T0?7evOv&PwJM7(Tcmip~H$Ma_RBDWFH`VJERwG$2k5P$## VAOHafKmY;|fB*y_0D->>d;kTPI?ez9 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len deleted file mode 100644 index 9a568e9309b6c9894e7c66f76936239e410ea0c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 LcmZQz0D~z20Gt4o diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len deleted file mode 100644 index a9f80ae0249093f1db8b14f71053acce35747e3d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 LcmZQz0D~C-0H6Sw diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at deleted file mode 100644 index 33c7d6ca799638d1815cc94c15997eb434b7d667..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 58 zcmdOA@JLNeNi9+cN=?o$N>OmjFH#6dEh^3|E=kQR@klJr@J%cTOUx-v4KB$qN=#2> IWMG6K07@GY3IG5A diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i deleted file mode 100644 index 94e43615882bac166535bc748a7451df99d21b80..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeIup$&jA5CzanIv@!W!vYL}L^23tum*uCswuXbR=soo#Q({Q6e$|qRyv2}cp6lz zBtU=w0RjXF5FkK+009C72oNAZpc2?io~QGw-XZ}41PBlyK%l$8`Yn$6?mldg009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ Hzz+g1{dfpx diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab deleted file mode 100644 index 25bef240969e4b5e4f87a124dfd74a3c4f5b4270..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIuze@sf7{~F)ehooUL*N#H?nV6pL7M~ytql#9nM&ICDuD-%Vms#osQnFQpLs@--XPJA1c(>W`JuJw2753%0EX)2o80j%f-a8NzfE|xr-iwI#%wl)g)vPysEWU z_2dA(=&DX6^$3L{EK({Ee2ud6;vYpiE7SGpgl~+?2Cg?Xv|=;1Li=>*OzQxg^~J$( zYN5^aBt@Ena~Dkcy&f4Hm$MS;jA>4(7yrTAN`U%0g-d3P3ezM7JKIZc-z&D|rg8IDtT)ZOVq50ruHOLO z3vd)0J(Br`rU#%`lW`}z*o5wcK)d-jf6APSZ&L~-KLL;G9AlF~dHUoc(LsYW_PdoE zoYtPTDr6rsz~hEsrKpvVpu+7oX#LGSY?d&C4Mkpi;j0E_mwCJWW=Ki>?EfniY=vJS U5C{YUfj}S-2m}Iwz`rH%1#KL0fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len deleted file mode 100644 index b1c61efb430c2edd7858c26c389d6ead81b91298..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00A}=002k;I{*Lx diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len deleted file mode 100644 index b797c4d2ee86fd517925c6dfd186e4c359366499..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00G7h005EziU0rr diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at deleted file mode 100644 index 5ac90143bf1f50fa9817523e2b42678109ec2d51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18862 zcmd^HO>7)TcCO*f^z`)nusK6g6h&FIL`jrniLgqjBG}}xKmz2F7!xZZ}#xlXn`e$ql#FuC_h5?kzj* z{ku-{fm1tl?|F@uv*&(CB!m#drX{Qad%zOohAqYiDv2Xw0QE_cI&i9Wlumuv@M_ii z^``5!@k{smV`uxrcBB6DJZ_4__3u~%V*~u5j*8ZRi7V<**7H?X)ehksWol3L_!eVg z7K1JhmP`}B!UU3E7z1`{wP>etVaytK2H)oDn4MME7QS<{rkx*8jU_6{)pK@X+$^O^ zXjLiB=Iudsm8=x0D;o`lA`MEN4T^S|#=uzIH^v@TW6814+an!gkIJzzi$OJu^Y$sU z8Pk2>&S}5RIG4^G853Bsv*O}fqqR5FXu5T$S@jx?T6<=@R>dyO;JQ7t;d%?r>b#hZ zZC0)Cww$)tI^6aSTkZ^6-{RlT3-giFb~hYv9|Mg{uRV4?a%O5yeQ)NT*Q(a{=C3>u zhO@JSAG-@y6tA8-gf6j2`g3gs*So+yX$%mMsh@Im-;En zXR0=4sN4Bi8To~Qr4ZtW6^VJmdqhU0tW2Sf#gOE}CRs`LCl$%nl5LI`8T(28->PJR z-W-saSCUh}bx~ap()SVMT!!%1!6-JF8i9wp}@Z#Cn`A`_C*7^v{=K_DSk8+B?!< zR)4!=uAWvpD-Ru}HIzj6S!8|_ci+@@(hl28vZ86AZBp7v zMjh#f3DzGMVXTW0b7+ijLg*#Lj7t7|$`p11*ec4paReU?tt=lL7p7w1YNr82DcKEJXCqRQLDK; z@NKtNJwVSbVF#6DwH#06y+$y3jGWjKX_^Gt)#QQG6dy#4>iVO{=yU$Kne8>7EAl6Y zUbQwuGC*rl2u229L`58c|5wsK^QKgpfG?>>0&YsyD1xVnUZfuM5cTHhn3z08^zUZk z)MBAzg!$ifXf3N`l)&+pvla8a0Z3=Z5(;v;Sqm_h3^1|$sku7MO0yVh2Bo>2oh4Su z>Jp6@)vGt4Cb?6;t)`M??$nmFO|>6hwVC{l>VcP2n?rh@602$3I5NhtRHvVbvcdEb zX}jO5p^F&KMx19+H5vxcj`2E?X}Q05=(atv7^?-3v&NMOj|_+p09R1`L3Vbld*aQ0 zd)<`NkUxV6F~!WO&K8Mpj;u94-1ofZ>ock?)y|8|cB4+7ipUO5!@fP;{l@Vn4zIeJi?F4pUpVykS$B|xW^XkPnob?cC02HR zNeoOR{@^uVb|eub>B&QiF5(;NpWP%aO?mS(%?dLn)F+&!&7z%zN>4rfbPLy(z%}_y z;cKJgnwUWNzS(h2K34cXnT+6i0tSJ6uGGWN;93<~Q|Ijh%ndlo=2-}u9>rLv=8T7*r?_ueq%jCu$~?-Ca>7%(82j*le@r^o5JKK?2E_lUgEo#?ZG2s8vAiYyxlL#L6D@!HRW$M zDbM6I`Bw|u+isI6Nr7kXPe;XdfT_5dbs)8C=s&5CCg;luP z!Das80elfHA2|m@wcA^b58b*bLPyZh`ntQGD7K@mVib;c?Eq)$R{D8ETJx~QfO(h~ zd2mL!fEz7$xB9Ud^xLY6%%j6xsnP5v@eC9~t~n7B%8 zHzC(z8Psy|bubAi#yP<;r4$rL8X=zn+ZdO`(e&x0S;K(eqvC4dth8AYt`pm?KS;SZ_I7roitMZY}VMbMvNJL9zYS5j*Kdb(q$q@x%} zt=_M0lKWPP+`Ob@ZZXoE_4h7Yv843oSer9b)e?v;35j&aZ$cX?wK?mEP;E$?_r0MZ zv-iR_RJv17mD>~PbasuR0{9a2_b+60^_N#WkN^h)`nwYkq{R_oJtn&g5iAfc(u@m( zals+Z5+#YGjSuVeT!n+Kd7wi5M5BUK^`*Gqg!Ui$`#7YA>=I<32M#qY+rv5%)i+c^ zr09h~C365z0BJsGp*~RaR+tAU9emuVcTpI`44xfDq;Br2c}8KV?Lc5Gdh>*Tk{aj7 z(yjKf<+H~yZ=~p|38W>>OFq^Hz#SRD&4lT@Q>)j223v+9D+vl~ET=0ej<2UVS_lXr zK$#}S06&Wqoh5#|-{)FrHfz;w_I42uX6Lf)#}P8{4cF`2F4Dy+Xx(ffXWa6tZX2O9 zXXk?!g2EfJ4sIwQkyoK_j(UsV3d^)o>wb*->3wDHsj=gX`~OLm{tsc5F4r>&!OCG> zb^MClHW}^3@+zgS7nF0B?6M89a!=7>&Iww~^y(DlE9T(is-RPH)?yV5BMSyEgsMbRWkWoM^^Y90BG5`THN}uwOT$937v)XH0dY(<3QtQXN z(&zp`o+H~AiOlHjdw@(p8=V7Z>5u3z2T~eAFj(7e6S5{Tkn#4b?M-(VK?(&FF|Of+ zm<=T(X5I}j^xZCyiErL5B5DG)a%dqIPSo4+=YWoh!{5KANRY+vj7dqBVFCmNNa>SW zPjhY|D{~9k#WM^q1QY4N2=fK@*9m9_w70sD{yb7oM}~#Yb7HPv3@EPmF$Mk*0+|;R zp{LnAtb5f1cPY3VvdvKsY&5)L+UdeFbW?JD#F>A}i!@h?sym!85Kjpv|3C(lj|@_l zM*o3`jy32K8MP7isyej?bSkM)zrS)D1N@q7uwrPz7XAiqaK{=v=LUZ@NZ?HT`5Qhs zA-fSdMw%PaJPBzg7m;j=3;|N+@H2ReB;1SdfUohXF?`EN-!Mn|WFkT)w9}Ogd;6yH z4br~HnD*m;t64rhkzD>Vi6R{bOH*;gPg?k0QS}+*1f`$R(HGrZ=S&6+7be0};}TD9 zw(I0(DL5H3x#cett7UbxOdlyrEPqXt9LFTjEPtIqaf0XjbplBiLnT@K`D$N>f>j-v zOBtz(Xg~6FF2qencQs_=6wz61-z)uxvpN!kP%X%`?>BZ%+yjnc;b%xKHsvw55DiTu z1e@GBqc>+U0wxqqLZ z+}cL&u~A2o>02Tw&xXpchstk=)OMr!L>S1~IyDLjryJfrvNh(u)81E6BhzchrHED4 z|0eSjx5N2~>`C$yj}f-T2h>ZN-IFGpH6n15BgTFv-&xuc#_grGrL85AT3%YXEi&sH zTPy4D-4p4Jg{@o5BDJx8Z%ZUM?r+6D=>H`7$ZTEG3@9Y_EYs&lR*AoP4(l=~i~4BiY1*#|dhRd9ijJ0S*H1OZOtm z-70&Bx~N-@L)kXA4r1dQo`*brdM2g51~#*A$VV>$FmiKYhkhVy2xNSUwL6uFgPw%j-7wtZCe#aA!Sg;R@Awy5V3GJ$#Dn1D z^U_ZMz@$H+ybAIl&M43Y9>mSWmBqU;I7@Q9PBV~d%rLxgfBiCS)Pl^6D|wD zrnJ% zR8yXWxDZ<`ssE{Zn5+GS40Un})g$&O+B?H)^f|0@t2$rdD<2(CKW}6_zmk4?r;cBitSlUD}ZfXAeG<1O&xbWQw^_Q;Y5HAx`q_71e7r{K;L6?%gYj891+Twi# zw-YkzR4SsB@?Uif`v*Ag0t3ORk4hFfkR(zq7N6P85qaXfl3L*f5qKhqFuel3&%v=_ zm??SeFv*?+H8=$mCGAy4nWz#hm^4~hvS6dISD^t^qX{&+z-FO9jeeJn55>*Mzo9pr ziYSGifK8TkLNZ)dPcVDz3HYvh0%hDT!nlzgyA0zt9X4)PPpctJC;j@NqW7}x<{+x}@6 zIqdSzXh<@pk?f(;eVWSP8S3y`VOD|dS zHOYl!SvtzHj8Lo3>3ok}Mk&rnmpnw-WZXhUhh@k@UC3yKx{!eibs>qLx{#cYFKqQb zmX2DCt=7Tz;-eOHp2`nkb6Gtem(}BOSv?+?)#GtF8qJsj;k$_OE`jh}4immbC> zk6{KX{;u1O)5~fy=F#U%^IBwsH<0iu&~CNWmSI4%hHME31k*15;7cv^Hd7i5vQB?L zqwThopC`m0^&wy(s-{HlCDiDk0O%O`XG=W!?*17Or91u;pD1WS5r;LsLUa+l(M1=$ zKy)~VUgA<~bkcx^|Nd7%Z=R0=1^v7gqDgZq9PyKH+y?ei$Fx9CB|kw#BF@?VA^F&UbQXzCI^Igw+-@4S<CuVn`!- z?WAN9BAc=BSd929Hd9PpbKJvxXEWW$`ThUrGtIeorfF1~ic}gNGm=@>vgFkeO(X&c zdy24NFaa!0tg_000MRk^t?Av z@px``AJj(xf#3r1@;PE}A$vIZnVf+D0tg_0fIfjXxgL2FhY$2sAQ=G!5I_I{>jK$w zomzP)xVN6bNCXf-;0pm+Uy7Wb`Y(=#&F%(qXpH9bK-j$CO!Qj;hrA!M)>E#(J;~sM z8`4|vq$|_l7HRDt3k=EJE?Z9LbWbr=-lx8tc=m`M?5I_I{1Q0*~0R#|0009IL_zi(*`Mz?` z*VXh{t46kG_w(02w|PbY0R#|0009Jo36#tILqfWvHQ0G}9rsA#u_nj1UG)R&dSypn zX;f|Cezp-nz&?QmDP3IUHuiUmJ+jXFj}M>h6Edsvvb58mH(hO3S9F5_0tg_000Iao zH7*E!yY3h)%n->3wfB*srghs$6G4t-+_0XhQ SPbro4y))wK!g|8r9Qg*C%2)UR diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab deleted file mode 100644 index 539c1455905e8f168b5784d09602e3235e9b259c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeH@s|o@^6o!BAcQF`Di((M=0mN(;j5d=f;!9ZUf>AKpMXP3uut|J|&4TyK@n6;j z({|w;nE7VTnK{gS)5barM&6mc$hnJR02p#93@7t@h9x+|3#V53ZhrG#-H#UguXtca zc6hl)7J`8F7TJ+qavTD-FOg=Le2N$mp#BiC$>m*S9t9RRkzNewlV%(!lSlG!W&Z>) zAqPpIMV3;4LGH=TMP!r)+GI5Yn50df&hEec-mWz@pa#@{8c+jjKny3Y`64<4kYRXmTIX}TuaU1uj^d@8F5f}kLZc=4H>q_L=HF9YV3 zU6SSZee)-iwK+~m$*hnrFb5*Xb``vtQ78!N8raF|Bv6?mSWIS0;0rX_}#YoJA+Zw_1o7U6eM=H(Hpx^xYu8C_r|8NsyQt%Z(I-fM=(&1lyHa zl3aOIDPr6gy5N7P#6S2El{uy;!9bDou2IgmS?*(n1u%Ab^`KA5geXwQ{;ZFEj^_;~ z9tXd4g=z_h$g7Zxgg1>**i`c5lF_H3!#?TLu|RTAxho`z!@UCjI^-zxn|$8BHPbsi z;A82UMW9yf)-VVSc26nqGvr#2(J~{8$BKZDpljzE{y~PM=;mV~epQeYzlP(zmN6rO QHp?M$uVUx_`eO$^0otX%od5s; diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len deleted file mode 100644 index b92ca80caa0659b9a68734e5c7672abddf481663..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00F*r007bey#N3J diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len deleted file mode 100644 index 8fe89d82d540f0f9c8b866f249f77e7623cde7a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00Bk?001fgA^-pY diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at deleted file mode 100644 index 4611327238bd07e1b3d51da0669532d540815aa2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2331 zcmbtW(QXql5VTZ@NB9F2fe`|v98D3RA|#?~QBf4N%C+!<1m|vzK?^IrG0G)FYn9A}mqw5L&HiWOmDC?*rl=JZ?Cx59t|XBsgm=ji_@R}L zBWn1&DQG&4mAZ0)%9P#P$S^-Vkj@~gYLimQ_(qNs2S`HOF-4nnez50l6jGNcoX0x% zH3GRWho9)H$mauaBY$#TATOX4wen;7$Y$uN(O&^QAm0ugKi^_6<8{(z;(ztqI`Z}Q z7UqGe>tb7pk|MLdhiDaFCvoshuKC{q|#AJ1zgL6+J%irkI;H|clIKh@$!Y*0|k}v z;NnBEj^!EnL!Co#po=Z`H1b4CCr@**^J^PxO#tJU5s%efj^nDj0qnPK;J_Y>jqC)z z)Zje5Fr}>imt_ooYKnkm6djLMzV=UP>$$}%8juZH>ysW_E3!%oCBFd%6uazUTR3P} zLbFKa>L>yB8N1(sO)1lr!LtDPv3*}HMGuko|Dz7}rif==_&VIZ@7bLWFzxsU-6j8K aA9S)Gi!eSr?f*HJJVFv!9r${aBi~hP1PBlyK!5-N0t5&UAV7csf&2v4 zW9s<+v5?=QrN0z7i}8cWz0bdFuuXsf0RjXF{I0-SJnnUVW9xUH>S?J8+(p>=^7c%s zeYyw`An@M>4&%W0m8tsF?>znP+<7ji-l?xT1uBufdVaH9o%N~-5FkK+009D3C=man z&^mB2n`-%Ogf))rU#8lpivR%v1kx7RjJ%_#u9vhc)e#_&r$9%%|CZYOJM!GLMc}^+ Fd;#pyFuVW& diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab deleted file mode 100644 index b9ad114a5e961e577ebc41e55426c167cca38762..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmbR3vzw0r2v|V`3003+N8dd-R diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream deleted file mode 100644 index 718f8d66e4678a6ab09c220c3273852eea8996a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIuF$w}f3SrQ-ypI!rPdSWQ8>q z3A0>j$if;Vdht}l+Yrr}c18A|U^{=|@OPr;T1+diuIZjACmpG88ZvSB7`TL(E^iiD xlsawG`qvkKf9D}wspoV)xdb1-v*!W@0SG_<0uX=z1Rwwb2tWV=5P-lOffpYDN@D;3 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len deleted file mode 100644 index 47c1102697649603a57d748104b04c9ace30fce6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 LcmZQz0E4{%0L1{l diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len deleted file mode 100644 index ec8f944c8acd49bcace4e4c78d4306ebd9e28078..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 LcmZQz0D~0(0I&e5 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at deleted file mode 100644 index 96d372e9e9242d9ea6e6a3c14002e84144ab0daa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 793 zcma))!AiqG5QYQ3NI^YFVFeZMrB&*ov?S_%+5Alx(w%i?BKmYbncybGi;%j>VqEJJY|<=d z2VF#ed6MZ@AyF46sTTn!==-cNQ=AWbwxZlQ?HH!&oP)?+CjJ!m#7C>1f^Bayr4qGg zxL(Rtmcx4Cse~pP@bh0t9vfLu}SpJ?=g%2oNAZfB*pk1PBlyK!Cu3z#op-4dMU* diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab deleted file mode 100644 index 826a296d7622d7bdfb51d3b580f2ac289576016c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIup$)=77>4011_$_B5+=ZO0TO~jlj??qV3Bp5psEJK2CZZV1d0JV1P1=T7r3OV z3-J9(`}FRb6K}P-O&l}zuQ0Rk#|v^EWBgA4pNO@8!uYe*Z_(cm=R@APf6fmTt}(+S zF7b*Bd|>-A8*}*u6HM`dF`n`HHfyoQc;sA(TRdTbdu(urT&Gb16;J^cPyrQC0ToaI N6;J^cP=UWG&;jO+LN5RS diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream deleted file mode 100644 index 3aeb44950ad90adce547f0fdfd6809374909ec2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeH_!Ab)$5Qcph^&mnHD&9-=;6W-IeSnbtTLWn(&diFwz3H+&w&npQx4`#>$;Vt0 z?;KT>P?Hj6aWN+pb?q+h4Z5o7`Yhv>7>&9*OMM8qLHDPiRJI&Md5StQ+yJRm1n<8U zuG8^Tj1YO~#9zvmcpo%T3Hh#58ZahCJV?FDdhYqmOx&w@@Hco?)}4c`YRxImzj;E& zE-1u#=%z$GcD}Jp`V&zPAMDkZX^&cO{{deUL|>twG~S*XaZe-KQf_zzJFh_}x%r1} fOS_O4cC3IEumV=V3RnRvUp&gZ6K@rg zX|63R`ZCh|0z5`CcB5ahKf~w?W$KJOup(q k=SRtKb={pN?qv^u-~({$tIS3RTpVkRM#6(&zr3O83>V@BX#fBK diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i deleted file mode 100644 index 33f1fc37d8058ea99b64ae51b7355883c8c3a9b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeI)FG~Y)7zgmfSxhTpGKxW8fb2H8sZ5M7@@#Z%xWDrPDeP>C;|k=EYOSj2j^$cV~#OCCxMU1*=Y9va*7i} zfB*pk1PEjhXvf{1wcb*OM_eU9fIuk(exv2e#X|a8$RR+0009C72oNAZfB*pk1PBZz zkbW@My17~(>at4&2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5Fk)lflh2T_r2e! z?1B|rEd7zh-O=E)VryB4z(fl?M!V(3_RK_=RE_`v0worBjqcN(-R%;upgI8p1WGB; PkJk0(@oXu}XDIy-tPdtW diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab deleted file mode 100644 index 8efbaaa2df5..00000000000 --- a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab +++ /dev/null @@ -1,2 +0,0 @@ -19 -0 \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab deleted file mode 100644 index 1b617c8bee657b3d7f04b4de48a4ab52d04ec5bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIutqQ_W9ES1N?{5(-OM=x4(3=pv2N4tmlgVV!WDt`en3hbkV9{g}1d|tG_6GDh z=wQh%{10ruvz@cCJ)8EiEJoFx!cqB5yqGj)`eL{{(LF559pP|mt?xzjez^Y28}AR; zaKRoApV5m;C%obTmkDW)oustGT1xWqfm`&`(i;02X@!lfw7@6MG05>RILu2EtQVv) r-f@JpqBOu}N$TRS@3l26Uy3bH*4<4kYRXmTIX}TuaS!XArK9yAjK~NAuy!cE`+E^<10t3w{ zyClo+`{qw3D|eQWvs)rxV*$)T{F0)ZGL;NX0}^y~PF&>#9kVVqOT9v$f| zq%bHkB7+dS3{9%_SziZ?;u1>MZFCh$9pc~;e3kXo%-%H+V!!W*%iqI$Vt$^fz2k=+z!n1T{NS|OfyQQ9y+SYhtccZ2+406D}3Ll$nmv|11fKD^K+_^!;d z=E|!{5u60Ds zk#^0J_*U(W{Nun6_=R!n diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len deleted file mode 100644 index bc1721ad72a1f49a7d7b438e2237f366381e833f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00G_?009aB_5c6? diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len deleted file mode 100644 index 14f7c061cc4bef2fdb72d8ebd5cc8c9a23a22d1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00Bk`001HY8UO$Q diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at deleted file mode 100644 index dbc6bf90fdef9c972ed7287004893d199a230471..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 163 zcmW;6TMB|e6o6q(%S%^X!R)|Yh%Z4D^nS>L3gN_=Y5&pxJ$zj%F;~ xT3ABVH4YNyt9+jF{^}!olS%XBk5k@o#yM|!#|4*Mam{-^@R3h^<_kC6{s7lI68iuE diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i deleted file mode 100644 index 3bee32461ba7012d1c138fd7f1420a942392a00c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeI)F-u!f7zW^LT|_z*9NZo1E`=@~1ec17IJ7v4(4lrq8W015ORS6FA}w_3){YSe z-Rw{rQ3OGRf(W4?C@zAFgM(jxz#Rff%(;E;c+biC-uJnXA&{F5W&N3};{wn6vh3rp z^H&`oWB>sI$p~CV($lvGGsy%NlmLNTfj_bGX}Msv)M-(m9{XpnKiszX zG200cXoJ9yIAiQ$YP}6dIf4KI0t5&UD5$_q^lCnTc~#JQY7rnnfB*pk1PBlyP#}SU z_`k}Vt(~I+RZ@ij0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+0D(jWRwDQI@Zjr2akejYR*dA0`P6#JOMn1@ WZVNPHVD0)iEdoxV{ diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab deleted file mode 100644 index 6843312afb2220972b906c00a787235613655d82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeH@%L&3j7=+jN`;8!;1WT|13lQwWn-?p{QETvG3El-u@RCk^Yt(UmVuB|NkQvx~ zlig(D|CXao)iEu5M5%|RlW@*s1!Ftk-|z@rahh!X&s((b#izf^j`!O?T{1~dUO(xH%`x4F^Rg;3AOkWW12P~3G9UvoAOkWW12XUz2Hp_bO9}u0 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream deleted file mode 100644 index 54555db390322005a3d6c3030f581ae72805c531..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIuff0ZZ002NzAqwq3Yb*1`HT5V8DO@0|pHI GYv2R8Spcj6 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len deleted file mode 100644 index 2b895e774deea3bb925caf1a5567bf65555bbe6b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 LcmZQz00UtF02=@l diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len deleted file mode 100644 index 14f7c061cc4bef2fdb72d8ebd5cc8c9a23a22d1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz00Bk`001HY8UO$Q diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at deleted file mode 100644 index 9acac0d4af7a0a3a7231b2734a204d8a6502d5a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3654 zcmdUyT}~S@5XUX;MRI}EXNW=&eL#s4+CC57VPmrEF=KDla;oyts#Ou77R1K`T#4Bv zL~w+8TU*}Q-+#V#Y|RcriQJo_BQAT}#Jve}@+o7;JCNqP5I;lR;w%$Gg{S7keoAt} z&XK=j3CupbIR!gmsu-FEvX|8t;zf$!FxfFfsL+lhh8eZ&(2_ht^!*A0GKgWDpoz7d zb+wo8+K4&HHrfT{+K2ujxJ44HiJfi0hxNWCu3n90qI&cGAjaCeCCP_H*1;?eNp^yH z5WO&;n==J|UNU!?fh+1WbE<{9OX3yuZDDQ{Q2TJekTSO}w^A9xKG>HfxUSxkq|BAM zR4HS)ta%aeT$m@73O>FI%@k9Vh@dEXEX;#OMVs!qg*8@?vCFRu^H-mi5i@Z||GzN* z^x;qOsKu0r6b^i)UBxcuIhCT~zA$$hW3j61(Knfm(z@wh7v@Tzlo_&z+8-lJH2#?1 z3KTR{q6~QQ+k4Yrf0>_p(1+4TE8_3savgKh+T~-G3xYtOm>+taErYZ+T9{t|3I~zv diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i deleted file mode 100644 index 41018a93c6b30454cefa6b650cadc18598d5f17c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeIut4>2f6hP72Ck6WcY9tbgL{=h^NMvOtvJ%O@u3u2KPO@_*lSw97!*Q4mH}leY zQm-|ww;CV3*StPzQKwqgXFb$ct?IiT>!+UTT+el>b^X?+uC=Yd+ST~!zO`x}+WYo# zyf*|05FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U tAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAVA;_0{@WQ3>*Le diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len deleted file mode 100644 index 131e265740f37d77b7c4a3676d2a7704ca3e4a29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 McmZQz0D%Su009U9fdBvi diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab deleted file mode 100644 index 6a1c931aff7b65bd925f5b37369c83eb965476b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI$ai~-MUkC7$J=uCPTV}S*Y?;}zn~jUeLF6(-WQfQRk%L@hh{zC;AtFOWhKLLi z86q-FWQaT*L}ZA_Fp(kha1gO&X3NZ$nXQ}IGJm$ro?kB`i2m!J{`0{0;@rD?@Av)Q zIiGXx{$T4LE(~n{@l#)(|9dMi9|U!LdHmRh|Mi-mu>a-pWt;Eu<>!C&3qkPyoB#Rx ze|_`+@buX4PkG%frg?)Io@bV)nPZ)n6&z*A!z}P1i>$E3J&ZWZGIz4V606+88aJ`d z88#TQ$!WGY#Wq(lW|kc;WtWTD<3c7(vCnxN@beEp{_&9SIpSN6`Gyk?`K83?Oz|nx ze9R0JW_gD>-eR6N7&2yoS6F0=C7xr%Gc5BID?G+3kFdrn>)g)<_p-^|Y%yY+TNpEB zhpX6SmOU|z8SYwrkSmOcKxtk3}Y;rYQT*)?;yMPS|DelR~hQ=Uoqhe_W6th_BrH3j@aXvH#p%{2Ij?O zrdVZ~`V~$su z=VgX$vA}aI@(fEn#fWv5d6X3%W|jL`W0`eMv%x7gxr!}j*ybX}OtHiF6Z!d;J-%VW z0sDNy0UvS5?>SUoFvlkIJk5|NS>SONS!0QZ81Vqh z+{X&bta2A?+`&4xvB4sn+{hL;u+4RhnP-Qq+2u<1xSR>o>~kIm{QR%-^CL$bbIdtT z_?p2_n-@%Rz%-vQ!$-{Wd*;|@v$9moni3_Bo#e1|0I!2l@Gd zW6p8H*9^XO{4>P?(|p1V6J~jzIo@TSHyN_Y0*|uDGE3aWh&x#3Hda_s&#T<_@&m#<3Wr6!y)5pXBF=b-rSQPub*SwwSQZ z`;2*)9o}Y_9rk#Q39qux%N(%9ARm|>Y&?qZHRnCCWz z+{6NBSY*f&rx`KFGFPy|Wvp@$O=knojIqDKex38#V8A9nz0(8Vvd!m=nXtqA?D8&q zyupMq`@F&dFLB7T9I?(Z4|2i^zpP~sQ=Da*JDFjTS#D&G8<^)hhRn0T)hu!)OI*%~ z8J4+-6)s?v^I7BMALZwJHu!)|-eZehwt0;)ud>67?D8agJkEqQ_PL(}?&XlXIby^y zw{ya+419L7nJE^S=6YthmRYW0jydMJf+3f&z$Gj)%@V(5#LsW#=SNmJW|ecS@ipsw z&IX^d$;WIlVVn0Dv&#-|vdfq~USYyZ?DGN#Y;wpG9I?tVcXPss!6JPy#Z63eh8c#; za+*1=WS&bH@*5WT!#~K+2}^v>h;LcuOIA2wl}}jXBi8vn8|<;kJ8bb5+q}V;F+04% zE-$givrO1vpSw8V4i34EBNjO3dQO;U@QbcXOmQ*OT*wRqX8CDOetuw{?-+8#0$;Jn z7cB7^BlcP5Lss~JRo-KbUDkP%4PIxH-?7Cu+q}q_XV~E>c3EeSN15<2``pg~_j1VH z95LdU+c{y8!D8n(Q{2Ebr~I&m+`%5VF=3H?ZsdR)IOIBxnCF%&4v(_S!|ZV%6YgN28#&+x z4!Mpa<~ZgGPPmN0FPmpfF~u}Ly^)_IX8DRazF?lu7_!d-@3Y9eEb%rYc39>$R(O?F zUS^Fg)_IN%o?(-x*kYY+9%9S`>~Mx%hU{^g30Jbu!QBzUPFm8Dt#K zOmV<8pD@Em%<_BY*khh|81fbiyul)4mUx8`FR{!Etgy){PqW68tn&yPtg^}dY;iB! z+|8If*x@#IS!9nJnJ{FZ(;RS$L$2V6%Q)r|PMBu!E3Vf}@$+l>ImZkK%<>6ye8fEO zF=Uqo-ei&2S>k0zY_iPbtgyx^53$ArtaBe5jM(IMwz!pTZf48^J6z8$*RsboOqgSz zD>&dX4!MLQra0z2PWbe1rWWo~r+`<7jamX2t7;?;MPB_J2nLe3fmT4|!hKrfyLgtua zp7R*;^Iyx)k1TS`66YB4HOqX-3ZJsd$E-17o%h+`T{d}}Eq2)EHO9Qk4llFI7JEF$ zglE|2DGpfYkViSsjKd4UZ!+2kp_PB)!H?hwd4j6LCX^uF>F;{WI zEQ96VZ>G4IX)a`jDP}p3Iez{t`T3C{$1HG;MZRWcX z$Q(B?&vgu$XMw9(-_Xm5B$I;-?7CJ+kC~C zFWBKTcG+i-51H@*`@F{iyBzW+N4(B4zvF~$ep%B+rg)xdo@Is&W_f}+9%G(I7_!O& z_p`{oEO9p@Ml5qXE8NN|H?zh9>s-$U*RshqY%#|+S1{%>cDRIHrrG1SO!y7^{NXR< z=Y&JP=ZJ4P<{M5pWbhm2K2vDoeb~h-X;lQC7H@ zRqkeu5$oK}2Dh@wb!>4Z+g#3=8FsjcT`pjc^O$h*LVmvEfFln1iX*<@n9n$2pTP>} zB~$D&&6~_HW|kM2V}p5~V8|K^Jj5brS>i@U%(Ki@tT4?gfA|aeIboe|*kGSce$N(r zZ1WCd-eQM0*k#NfuQ1^y_IZH=HaX;Jj(Cz|9_NHL2ES?jOz{BI+{X-OndMIAxRrTs zX2=2yT+brcvcxrvm}8mCSz(4%E@F)fSm%5;7_iBY&*kTsZO$>~Yj*gOT@Kje6DEAb zKJReATO9HRM~pe<1y0yxuu?xv@g&nc#0>W`%iYW|VxHR>aw`km%pwacaXllhWtnSO z;YwDyoHeFd=MR4_KPPPRJzIRsHs3JjkR3i}mkE2k&4eBHd4&UB;*h5~;xUf7pA$w5 ze#`oqVu5K+GsBh4auIV}z&z(OWWWMH4dmwsmiUelhb;3sD}2f-AG5}Ub>3%#ciH4^ zw%B2t*BJ9EJG{&;TkP>16P{t8r#N7pLmuUbhdJg!PFP{E%6$-1oMoCjnPG`pZefm_ znCA>bhAeQJMNYBARg9QrnM+yWVph43HKthSJU00G&*bMvwm4>+bBy_#9lm6j1NQik z2_LY}dmOOKA#ZZTm}6exgiQv&?f77dCzK32AsbAw$$4z?^E3JRkuk^YaE@KRW{)qKaKJtva=-^1@*YR*a?G2Y z@H&H>`vIodW||k7;dy3xmN_<<=Lv>9#sZJ9$SOFlO*O<^@wc&os|6!#cA( z${Y_f&w~tEVS#&Cwz-rs7qi28?DF$d z`8mggui58I4%p|A_c`KSj(M9Cb{MQSUzp-mrg@newwUEP=6HsAo?^&43p~mq53|IB zj96irdsyKttK7*NORRGX8{EVuXV_xMHdiy|N_M!MU1r$hA|_nGKIe15fJ1)z6Z!dp zW4_~rFBtr;`yr;7FwOhS@Gi5w%^W+-^BO~5Wr3GjWQ!%9W5hEo^Aszrv&y5a@i6N= z$ObEHat~XaWt-a=v&arNvdazZaUB!p+2?8wxROII=ZG1Oxrh@kU@)aGrWi2IPfz6M z2WI(>IgXg;D~5c*0-v$SK1+Pah!0riZC2P}l~-8fdDeNB4K~>13AT8QZ60CF3On4x zE@#=}P9`j|&n+Bq6NjAPh#|+E=7duWe$V;F6thfoDKlKmEEh7z6!V@0`IWM>n!m*Mr^api>&ZGt31mZ z>#XxA8$8S=53d_33K^UmN(^z}E)8Ht@B9uMK={;A;b4 T8~ED5*9N{e@U?;e*9QI*St!Jp diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream deleted file mode 100644 index f63557d8cf674d326eb75d17cceeb04fe9e4345d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmZwNdz_AS-oWvDa>_beRFdP+)H*cSacC-5#6GDf5o&rF$)bnB8qAssiH5awz*@A6 zOv;c$YK>GX3Zt}X)@enaJf00{wMj(J@BO={|DIm2UhmiMntSG+>$*PQ>%QFgXITZ{WrP8Dn#vuEa)w|1(M z*Q;H#;@{q$H^1|=F>lr{&FB7|7tU~Rxt!{JV0dvUJ#O&ctJixRJ&qnnkK=}h=ceSG z&1mECn>wsL;_>u&dOSUzHJS{(_ryKdkGT0C!}15@k1JZZeC55@e>yuq(PYGu=Vsjg z+eZiAaNFbO`Yr4>yVJ|;wDtH*=FVQ0R&r&F&W9`49LRFViU+X&(#*qb(P+mC-r3<| zJ2tM~;6>g&y3bAgwpNuI>_2|xM!wvtUI+R;==WlNIKFgz`Nhay_1OB(OLLh>>G&h} zAN+DQS3EUqG>5Ib@fqf2qOq$>Yfd3|K7-<>_7M4EqP$Z@&D#G zr}sq@i9}!PL|X5-KaX9}>v`*%2)9Y9#64m4RIaxLRob~Ruj}>!E`r!raKf2&_+@6#B9BcKhaUU1d>obyf ze4h3tk3C+P%|uG0J>~n2$WNqpUPAj3*J1ngtz(L8r|n#GXlhPLl@r$_8V~uXr0SD* z>Co2_DJi>IZs!x7s7ns3Q~t{M^~RMZP@mK%^+|nFpVTKu*SfxAnepf9)mpFg`%|~n zEpOF1`y;JYhJM~Vz z({*&p{>6h_M|p73=0$6ol&d-~W8 zFSs%_+j`ZCnjQGjt0hZW>+8A4`1z@NtLXgG`KS4=`ue#{^Gx$g^Gowf^Gowf^Gowe z^Gb6{b4qhcb4qhcb4v3_uQN10^YG>0^YG>0^YG>0^YG=DUAG=>W7Xy9e0{Lnmd|1YB+8Wa~BPBM{}247iQ7i(cID8 zQKvL_GWn&z>(Ci>Mx9Y-)ERX~ol$4h8FfaTQDWn(0&Zsl$j5?#v;`Y!Pbw-_0XVh8T9y+7Ws59z}I^)@o6IJW9ELpg$ zX;w?VR?w$K()*%SZyD0%V3W?_tZUgPkqyMl=`N=sc-6=`li0AZ|a-+roO3f>N~DO-_$qt zO?^|})Hn4_eN*4mH}y?@msv`EQ{U7#^-XYMte zzNv5OoBEF1L*LXl^-X*B_)Dd+=9Z^Tr5p_fzQAgAfbwnLeN7NB@L>*B_aUD9Mj;JH*h&rNE|>WDg`j;N!!J#-We9Z^Tgbzv5DL>*B_)Dd+=9Z^TrQQRInqK>E| z>WDgu+e1gx5p_fzQAgC#lmi**B_)Dd+=9Z^Tr5p_fzQAgAfbwnLe zN7NB@L>*B_)Dd+=9Z^Tr5p@*Tp(E;uI--uKBkG7cqK>E|>WDg`j>;^hj;JH*h&rN< zs3Yo#I*QvvN72v`b(CBeW>H7f5p_fzQAgAfbwnM-?V%&;h&rN)D?9_T~SwY9lD~fs4MDZ;6A>WaFeuBa>O zin^k%sH?a=bQKLOin@y1Ls!%lbwyoK zSNyEighuP<_UzBqJq{h1_F0?LXK&2;xZ}nTy71zZ1$hH%G$^?^we~{V?`XS8zi*n} zeYqYl?9FbjN9vJ!q#mh9>XCY+9;rv_kUFFesYB|JI;0M%L+X$^qzX1654yi-x zkUFFesl&Jq9a4wXA$3R{Qis$bbx0jjhtwf;SY|18NF7p#)FE|9=Yu+=4&(OFVKj6| z9VXX>S=1qQNF7p#)FE|99a4vJd+3llqzM(8(9a4wXA$3R{Qb&vKIebA!)Dd+= z9Z^Tr5p_fzQAgAfbwnLeN7NB@L>*B_)Dd+=9Z^Tr5p_fzQAgAfbwnLeM{ylGqK>E| z>WDg`j;JH*h&rNGexIJ_f4INQO$#r2CbwnLeN7NB@ zL>*B_)KT0XI--uKBkG7cirYg+)Dd+=9Z^TjUB2rdtM9-4Zk=#VueB@rU8R(Ube`$F za^+XU*YnIXd4oATZfGJUZ&}*(`DdMn=;HUIj<R*%4ga2{fA5xALO-v;8+X6Z{QbcVKl|B|53J8`?0#jl%qvbYJ!9t~j=OZZMf+d& zo&Wv%w(rvOM#J;c^F+h*(DA!C{$DfvoZ3y^z0Gm^Q?>b*{QRspmwYtpn;i{VA$;)}+c?pB&1nw1uj^sHF#b>n zJ~-?2n>^B{##Q`l`(uA#n_;78aOp47$MM34xAf-n+`qJ7zjZ4gX2+9>O5Ctx^4ov- zVfC?HrP;M;&IhI}uIqCGnj`9)iFOr=sb}geZV#Wo)UQ-?n(Gq1&qeQVaZb;Ti|Kkn z*9*E{(Di|jw0rGO^!)Vs1YIBKb2z#_@cwc2+R*ulUk~$2b4tHA%_Get%^!W9Me`L6 z^F(tLzaIAM#vNULGph9H19bhR{iOY5x6YFuru~iE!*QhjrTwM-rRyT?H|;N77iqs~ zziGc|zghIlujBLDZ)+V!Lx<5VkHp6vnp>$`T$kj;^}rGNab0&v-MByA|Mzw8|I_>Z z^nMb(pG5EPmwkOKy}v~7FVXw>^tm%#H|adk@u%ZY$3J@4+4wxpgSGPz4d;Q*1AV^t z#gCI#IR13}>A2HzXZbmQY)!|VjyoN9I_`Ab>A2Hzr{hk?osK&lch0yp>qR=QbUf)e z(s88YK>JVoP5T`U`%U}R`*^u+_KWt5x}yD~{iFS&{i6M%{i6M%{i6M%{i6M%{i6L! zt_Pi@o~Wm2=!xEcr1u|b|7rhe|7rhe|7rhe4(T}1afpWFK=(OU9lWWUUqtss^f@lQuTS?$be}}`M|6Kg z_eXS|l6GDa4e#sId86}2udj6fM6a`SKIweY`K0?NIHdk%FP&dHzjQxE=aufC z=>CcBpXmOH&NtmZ(d!W1H}O>S5tZrnyv+DKT{Hgk18etDbRR{pJ9IxquRnBOMXy7A z?5^yKbe~1n3%bvuZsPWEpA`-FS=3Q-U6@7J73zxauaaNi@(|ru(R~%&572!S-4Aeg zxZcp~FWom$muVB{Z__39NUsOfA@xW7QGfJzG}Iw=NF7p#)FJgneNkW0&=qw>T~Swb z-J{oU>Wn(0`#I{3dZYWgXy}f*qwc6X>WzA%-l#XauEce?u26r;^`Mi~A$3TvU(wJb z^+-KZhdkA?;4|ux@xC%?eE!YznO9k7w-x4VSUbjrHDPyiZLUpWo-}w)=dYUJvMVcKV#1jazq%`_nXW^LN%h zcTd_U>h(9d9ubeP&)t*jQE~0_cWa-!)93E=xjTLCPM^2a=j`-3JAKYhpR?2F>oliy zeWrP(d8K)!d8N6ed5r5YkI^uXG>0^Ybe)fe>pX9Na_isNZ)VnoF8XnoE8Y=91=;<}w=Qk>-)+ zkmitH4`}{q{%HPK?Y%RLY5r*b%8bur&aBNDeO^iPMDtT-{C<56-8A1c z-!$Je-!$Je-!$Je-!$KG9p*b4=9}i5=9}i5=9}i5=9uOzUcet`&i*p>;3fothoA_vGj8ay5~J=KcZnjlIvEP zv>&t|aeMgpKkW~zZ++=UdcR=XmRO|~E9(LS{wXZaavX>oh=rF=ny=Z|^U@#{~Xj5?my?px`+4jukddB-Ul z_CL99l}X2m_MhH&q4P=S^V_36|HJo3!+E3g_0#sN=3T1neA4sN*W>o^eG8v@;|k{| z8qN z3%gp=`jzL8owuf+d-dzD&a<6s7JWY_4P5l{rqsDN`#yR+ef_8H+3DTm-)Pd~3ePv(?&}Qm{{Q~>f3b%7 diff --git a/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/samples/client/petstore/kotlin-jackson/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at deleted file mode 100644 index 79e307948f7c756df989b3a040787718564bcffb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12507 zcmeHN%WmXE6wRX_3F%Cd5epV9`U8;IvSfv3gM>h0-(p&Tgb3<{|EKOb_Di+aLG8JRUx7zk57vf7lr!MD)Zn~K7;C|xW|RtVh?PoxCN#@Zp1Hi2p5SGeS%Lbh z%>yf{*QgBTrLgOEX_{bVA?t-5GOxBOym5Z!Ip)UVs|1!7r+ag6I}J!Fjc+?76etE332{*l0=~~004g)r) zn|tc#Yskqof0HiqR&TjK#43%@vd?SJyH1j%6tww#!ga1UNgcunNNu|*S&gcxb77*_a%6jR7$IuC&L~kWMO%y z(G=M&8LE@Q5r23!FhA>E`N6?d2?H zl+F+?VqEoQeGebXG*;%seA}9)_Sfp)*S-UH80hRcGj}t(L-8a+{R-rCQB(5cDgx(krV10z{44=dxFBugCZNq8GX;P=(2~f!snCtltTG&%=JL79>vpZ zXJXY*4#vW&QgX=Xcv6{jygNbX2*QJwd*~_f@Tc|cGiMq)LmE(B>3`u7sf_;2GIvw> zOnn1*xSJM!Ejvr#lyUtWIiEba|IjZ*k8b%+=KpW+b2M9WCcPrxZs5szC!MoyxW6$^ zZsI8k`BTZs*8D4Sb(B4R>AJ6+-Ep@ zz)!(%;Uh+DWGr{2@~(f=QJF`rmGjf@z}YxlOs5&b#D07HX6C%4AP&Z(l?op7|5F$l zzv-Hsia(w6bj%BQ`K?D<`Z6i{*6zOx^DUh@+rMGPGivpFCEw<8C(!55n>u#jTKx6_ z(LU~IYwv9{D4g zQge({ai%7%MLnid z=ebwO?VvN`aQ>3W23~59=C8uU(HVu6Lj|5@|DawKt`R?aBhHYjtxRCt(b?0I@h?hSisOoHmF z@UY%I+y8GR;8}x9kPPwk;>S_9nk_@r{M5}6GzRB;uI8nLY!fZ=ooR_ zGIW8k9?zsNoPiec%-)>w6D2W5eCSqG`arn`Jt`6Ad=s}Rze2%ttDW+0v6=wFTEq^=h*3g~ zaFp1wqgIOYy!-3-if`|V_Bg-ic|F%3=gKuc>zbe3x%DuqxpFc9S1E=W6y)DN?Q

          hQJP`a4(}Mp<{L{gjO5L=2sYmazK>t)kHps& zV3;R)yGV)V3mK+RYNv3bojis)VH@0wXu>uw!`NzFeMK}I8_O`vL!Z*sIG8_tqW>yg zF@_Pe4uG}Nfma#ho8LQT%*`-2mM6v%UxjfYc}itkkK}~an0Hld@+hJSyI|jT>f}>y zx(dVee6z9x(QGX7Wte2mXaf&^TOAbv>!*XR0>gB9<~xN0|F!y9Wv9Lx!{jb;Zjhxs z!<;$t{h^^8!@Ol0_qD@6Uv>;QXoP>bYY)w&@&6V(3Nwtom)C}@=F!5RbtM%74A`Hf z?1KJmeJS=OSlj(CB`iN=NbES0OA0YeqfHxI5UmbknB~V4GTB{@DEAq)d_CzAc9dY4 zHS1jsIKXGW?CEY3FwB+MwQntD8D{dkX5OUd2}_~3-yXJ<FZsI zFU-d<-M6WltKo-t59*yJz6|>p7f6{!w4*q~B>G3_H1M~6>70Ya|6Qy^eDUhs%ruV) z_PAZ8mq?9$Z5-jsV?Z2Nl(gj;rQxp%7&)#)HZ{?ypm>k!dg)PYx`!&8VRtbsk& z9p4;6G#e|BZ~k}oA7k^Ch|_xUbI!8)MBB07=sAIN`H1uPr6YLKK!)iZaQrVd>{M&# zuoa~DyI6yKh<*S(SciHr`~6*a-61_S`ar>Ax7~Gx_$u&sziz7_ny?FT5P3qfSAhLAzBc12@jYQ% zE{5T3t+`&3n_=!bO1bxMLB8}^(0iw+aXk2~^P|K2*m5!INlNtV4{W{*_72^Ww4crA z@)^e5wlJ)m5je=limi%Ycc3nOui7Znd>OTWP*T(}@wf)AADr}0GVJ%+%BaI^KGAx_ z*_t{v-2Fh0y0mWCiC1RSm1(_WR*{|w^!R;=FEsE-&7Q`K#3#(n!7w|Yjc~`0H9zuo z{AqVyDo_{JFLnl65T6fkOlrwNURJ!*<*OZW7?D&VQ{7W@80JDr-_uE$8AKyZ!gF*$gi&Z(hVd zkniod&D&+I$sMnK7QH6aUSrNRzit(jmO+Li8px@j(5%QU6!eaPCGpB_?h(4qZ zUwq4fafddoTtsp<=0jh4by<5hUkCrp=e`=t=9{oz&MNLZCF(_^52DR7+@I<{A7nG5 zPS-xZE5?XA99BCiQ-0DsW}N4y|EC*7v#|{Ek~7-N9T%KR=vTZ0seGK{)SPkd`o|u} zrX}#}`nByZvH3*X@u9x=v#qu=4D&edel6mA!p4fQXUG*lE#h?TpkpIE=@H+8dN%TP zmr$ZJVZ_xc?q~P968PcmfSSuQ>9H6(&_5=z1v+%&!{!-ja4Q0O0Cp8!Bf3(5D zIz+Rvh|e(RCVv{oMcu3K8#jP0&n~S(KKgFE>Gl(QoCAN)3dCX9BC2)NdWpN)o zFt-bPoC5Xbh5o6I_&g!*fhD`hi56g8+4zLEL_5nt&aqYD1J4c_eM}Djyl&c1MshZ` zp-wcmrv@va_pIK~rViA*{!8nN*m|C59qMiA2dxnG*#igS@YM4QTs!<0xj}!J!MWeR z7ca>%OxnBziUnHyBH zwhQ-}a{+{q|AyXKwmGA6(#n>3ko%`DY-@kNd#AZLQd&(zQ>C=L?v{h(M&xVI zn{IXNu;hW_0q*z`!+*_RKA&yH`D#4->k}7!x%w6TWf9_Pa>M;CXgpyq;<4=Un=wQa zHex?>1{EJpG+`d<*Xlb(b`VY24tty)P)R|w1$ic|E}W>vKCX4F^NIL8toQQ$Yj`sw zSiv_Z57K1hf`|S85&pi33U&`Wmx!$TXTXI=x7ALx*kQRY4gT7~9<6}AW+*0}CcYi< z6I9JKm}oYZU>~gtFKMm==69LgR|dacjY=6L%L{(UkNxX#?sxxnZYA^*1_~lLs9Vv) z;$G>BGR(L?h6x0?7jOg0)Mu|_Lfx$Enh?(BvuPtLYn@B-gL>RYR-8#{!~^#BIq&u} z7ja#r_4&Wls0SYt8+5i|y~^j4+;K+p8NrvY`4O)?*y~)oo?SIK$5F2q{Yj5759esr zw(2*c*;tQz$c)<;(5^Ptwbp8h{$Iz46D8`H5_O^>H|#adZ$>-^ zoO$WXz;7KZ*SjM{oPXy9>q+hjYhVw{G-;;iou2gBd?D@uiGK{}%;u|MPxZP1>o?jV-v?&0u{n zpiUKgesiG;`{PIqlUU+RqyqhBwqQbEwm^z=$1FIBsLcpGRQPUO#$DgI(CBw?N}K?B z#V|R-TsUvn5`T54QD)Q&1#`gHg!@GDZpKD@HWub$7-zU^w*hf@ZPdzhY&p>;e}=hJ zzD*sX37b$)3Uu84ifBIk5K`|ps>{zofPD8;+$+bHs;e=~VJAn&=If!Uzb`$*<`Zp4 zT`ySV{#&9M^viY^iyyVXA1BBE{Xf=m%l}8mJ5H6* zyHZ6NOIjAh?dGYxZdDpn>ewcp=5yfu>k8yq#g=nn`HA@lU1al#b|6osSGH%pU-Y{h zl`4y99AP2sKYmmMx^?y-?P3uyGvri*+WNAcgEgE%Mdn-iwb{J9kG3E+gex7N3^J6 z)$pBcxhL8Rzqau@AEZJ(k2%OsQNd5={ygT7UFRz!0~u!BGC%PO}$q{#D*4GTpI(BD=)+Lp(Gdvuey@E95P!~59qf(7;VT;*}c zHSkx@*7v4ooXs<(L_giNxm6vZ7sD*dxv{w&b}Opxag9Afg8pP|Q@H>Ke%dGH9MvHH z{ZGVpVe9=Z!PLr>$ZVIh_6SzIPs=y3egPm-ac@CTQ|-6;PAnH zWK)=##dee2G-$xa@QG$)mjL&mA*aU(5wFR^`i*1D z<*>)RVSgM^B2I(Lgim72*|Y+72~a%^a=;Egt?zCoxfwTwBtudwq6u4Ze^s8Zlb3^g zURz6@7R2|2CCF1l%-I7f#OZ>VA$Qq&JjBa`z#W_Us58wz-*Ai5Ea1vFd! z&h#K=tgwVBvY$I{WqjOk*Iyh?`exXn&g=7Ah;~8$#iR=Pi6*Q=q@KTB6IS|XU=GH; zBFC34V$|J^M=$PYk2d38kzeumWH$eIX&K_`K(N#Q2Ar7fWdzVIJbB!J(LzM6Bic~x-x9g=5-O*p5a(%n|1XGGkD)a(u~r2`l7RA|`_odcXx zIrpq4K4Ga3&iQ^fs(w0X;2+J|me_4N$PwQ&-nVoTP1uBfJNoGhG0|+y%LV&~Ea4O1 zfqXsXt^b?otgsFGamfSJ4E*%HsyI^~IWR#;-|d<5UkCrp?0u*|dwwnKI(N;;kzB-W zl~*N`)WA7~dB0c?XNJPxcbVbunngoxeAKCasiQiw$Nw&E!p=iRRBJ-x#qd|@Z^uUn z_*idaggb6HsPkV3J@c_t#y!5o`4rOEL4Ru5-C;x%mLu<)wF!(gz~5)59BV`Ttgr#= z1hrU}oRuD1ZsX(mZJ)N!iEl20=LNOe^ds66Hlm+Y+9h|1QBV4%JS!oFe`e+A6bP3UHEJcP!?<@9__-fRn4ucavYl`E&hFse)YesOwpZn|2bjLqQMexJ)stdmn zon351e)$zW8X_0E6TC?o@gWXZNFRmf(f|V-JnoUdM?z#4h8n6h4(MPjJ#M7 zuF!Z=a-i<6F5CsXOb0&dK#SVDbVNH5@Ah4)L>2h08eB~vK4CHL1!3`W#)e8Ts5f^6 z@$JZ?>$j5*5^V!ry1;pNzm~%zQOW-6NbW*B`z^~+LIyvEckup7{H(A6_l{oeE{jRe z!NK>>sl{dy&BhAk?S--@eXQsghGx0k{f2{aore#7ZNxe1?c80L#!1jOl(wcZJlMN@ z=|7GVUzZ>Gbh=f98T`GglggW6hYj+P3rU_8mcXvH?j8P^m7WxO!8f1V1+dTgE2V6t zZ--xp?2VW}G+`q?c#Yn5g6OQU36Xg>e^nnXDtm0>QLs)rsQ7q~re6zKB^?}~&x~yz zPBaI0dD&0w$G zU)X%6DEh$l5JXw_K#RQg-&7A?N(XHY^nuO25l!i!LHwWGS?M0pp0Eje4c-ly=Sfa{ zYeCpOzH|qo*;rBl&&wxA$rXsGl1X=bh3MNe%D3)sLc|sMkh_2!ZHeo-ww>3I!cF*AyVW! zCx%@r44(1cg?-0XzS)`dJYhQ@-#P7o-?;=4E(tiXM;bwMflAyA%1#2suJf(kN8^HD^xxB z8quDx3-i7nJT=*q+!J4q^L!i0X-o370$BFu=CUI6Bb~X9yMK_JFdy-iBc|F;qIs~_ z$u&U|GyGQRY}-A=&o1WT9#Ob+o{6L{&x5|&vHJxs{Bt?P>8>}TK-81N^%ikaPv$F6 zoF#o8)=dfbODoSAfQLR(_36e~A?#hz5S>CogE!unO3pRFQ4RGVEZ_$5b%>W%qNX0> zm-PNER%2g5N9(Aiu$yt^#%ApKq}WHZ>0WP$uf~20zRTzCkHoj|aZkOqFo9?@;{Vd+ zt%sOOcrLIl`HUL(trh$B;`G@Afft@57L0Lu(iWjYc5X6E$f=C)qrrYdoUmWO%>(e# z?*Sk6;`|9qPA>NSw0pq^62#T>ybFd}5zia@#|YT7O3_!$r@F_o`JQNJE`0x+wRf5) zIh)VPf%>svZhjl$@kVIP^$h$Z-O+F_={b-u!%9}IL9`Ix3x?*-nd#mvhh0w9P7NhJ zIqVt|acCjY{}x+tuC2DmP95@8zJB-M77 zIk)|li1#|Z|44HB;5lyIC1%nSl}G<=)_F3~|65oIe?5BZ*Ug3R$>rj@_hZk?!+oH} zrkP`jZ-IV`qTlKgofS4APR7M=dn-hoJbKbRDl2_8;_LAqMJONV-7;~lz=}NGH?nBS ztj4kB8stabx;rxE2V2h*t;dQprw=T}M_ox-)=9+H)8RgrCsZ+?&1chkKJIzlYqli5 zwgT?Ey(>>8`ggG$@%7}^^CLE#bLoRzsS^0fcwlEP2K@Z*Ie*c-0@RNMJ@=(`-Cu$l z@s{6v=ZIe_L8yjZayus$;-k)OEY{?+4&w|d^IS5-anh9YC$bu!N$!jHrH{>g%ST*o z(Vso6g`JK>RZ6b{x?0ziElwX+hS&~BHD&})1z$8k3?(XSHI`Ui-;yH z@WXTAlEK@F_JmD==*LIPefA{x#FwM~94_7p-ugKRvG1*TpNTEip>DK$HFq_eudj^0 zckM=91Nzv^mN{U>j39@9Qm*=BdCyir@BR6Za~Vg&hL|^D{NqOk)VnTks?KMSpC$5F zyTH~X+E4(`>6LSy=nyBpd)N=?(6=UCmzhcK39FH*h3?9@7SxLhjt;B%W$<3YvW^b6 zz5sq}!<;vZFn@z(@&vVWe*g=s82HspEF?n`753AdN2Gt zfkl^*4L=77>e|vk?t!06(YtYJ&l(k|A*D_MpZ}$2kiA>%8>6w zd&1g+_?_N2*k*x3r=EXK5F-w)*Lue*@}OQ7Fu7=)0OzfEd3YhKxFNxRuoHEy>9*~`2H+0^OCDs284>EKaBIFydB)Zg1mRv8@OmekZ$N!( zU*^asCGukTm52dsIh!`aF0b!RkB}ihT~TAKY`F+=SH1o_H(LqMB;4h@&#QzV9&t}~ zGaw=wtuJty6#3u}s~X!=*Z{ zCX<|lb?y0!v~bgivv!GjR77VNOW^0;qy6e?5ND02%vdGleOJPK5X+pS+5 zBEB80GT z1S>e217R2RsEeUdS6Y!&k9r{&-%=AzSPnnsocnPl(OF@2CB%2H8L0m0poKlo4|(pU z4cM1`+h%mzbP&N$_SQ>V672~)xOk45gTF>r0Pp`d&*!!`>2u+){T&CKRO5WDSI>14 z-xF3qpQq}i_aqm>KH7I9XLynmUk$rOb)No6gLCKa{o~vuXJZHAYt+{o-T4^z;ZWTu zww#A}@TvNA74e0|@IKhtP7PJ?!=v&wW|@#Ly=!@YA~_p#pttpKbbI34VBe4 ztb-qd`gz|cny>)*_0+W$-8vmas6V~e=5&v@f!@_;>_n1#!Umkfd-}jmB$sh9&y?$# z>MzL+s24B0y*#Ez9bHqS-#Y^$W|r5mz9eU34f@5|cG0j-Iw(<>com@n_Xc$t3h}dxt?)zMp$`+CxCeZXD7D>y{aIhs98Keeh~rYPfBZXK8T_%Q z`WO+(Jz+Wawc>uzR3q-gUC!)46lDY_;&$cgHHF29&%Ld_X);Q)rp)Mz$&+dxAx#tV zr!JqrS&ldxe>2}yQw6+-6qphyfc?)@SybJM`{d0HW8&qgG_lpzp%>Sz8LX;e_x!~h)6T^o{ntJ2x9c5 zi;504iL1xCb3f)8iIyWz&e^^O6Rm(fy-$tEpqKQdeX0m?dar+u+oaEf+@`JEiGe*71Eo*os4u+b+?4|4 zXYQ6MpDoz;`-Qb3O$R&99X4b5I-&)*hxV#c{{qp3g_t)WpHyu?{vFbu{z7~k@@Yau zvE4jA`Zd>jM}!D!b2VSq{-g>1gE@$^3MKD{vDl0jb*90)D%e#z@ImLyIb5R1jo(Yl z_pQl=9f}{DW0qAz90ZurdyG6zh)#Fu0Lx%g8>D)1#&ZeVmem|>^z z3#)3&5l`WNzOSdpI&YpoyU)kGjX$T}BR#@q>}Y;7mA4Kv?CG}E#|8Zk{LA#6I>{pWA}wk-~3dH|$%h zMx8v6_mi3Up0ES^JwNVqe@}85;<|feBL4eputFU9WcPKwANqdqJ&*cQ__J2%z%=#$ z0ZkzM>l&6S!+uNoq#_zKf)xEUF;DlM#C0KGaxHjP)dj}J36hP(x1!(t{bhlZXeP~r zGt-_%rh@=>D&N-EOf+G8DSRK&3ODGnuL*un7ZX1#Z1#u0QfIpRqooq&G3{N>9;bz$ z-xnJ@g!pFM3(rj5sU}(iOBJ(LgV!>G81t1l*g7&J7w<|U-#hy){-1wonQ)}(Cbpc1 znY^nx*0A|R>yfXCMGMU&ng_cuZ}f##utTNw!Dos8yV!uZJh?pftsMJbI-;t-6z47W z-giuP=i?&&H4{Fr)FCeRzPZsxjtu>qJJFKWcr)_4#-lO?oVcGa*x&heR{Cr?2OZpd z_?_Mc_|^O3;{haBA}@tKL&AtQq8>Po)mveN-uJ%>cObqLe)QcmDuie@Ho?C0Ld{3n ze4>Te_q%J{i#o*N#$quSiT_Wr8g(p6zd0`t^ZDJ%<@ToodFlLP$qDv+hWz+@6Z$DF z9LS%XZ!cTrxYu}J=e8w1OA++fg+JcIBR*j(`e5F^{2F@n8_mf}yNJ(6T{%6;ew}Cr z^XBZ@wm;EMD6Gm`!;V{(pjqeA!?_VO^=Z!(p z!K9~wKV|be;FKA`jPpm8v29=wC!tHOXi2I@9DX}mw;j=9iMh#I-e+?GwGuO9fS^@6C9ojDK{%dXg_6dLIziGThdMd=l zjsAmb5KUN#eVqGCp(HvJMjsj%lyWQ+KMRHv`PCs;ugrGMVjPKOuy5qTY0ZdcV^cNM z;rrv|_PN7#z|IMZtd zte6fW=#6jpVX78+wB`Mf3+A$TzPh4EHerdHIzn>FdgL56xKFCWn8%xm-^sZek zRk#3DUc6ZRcAPyCVO4E)kz=8#5i zn)N|}I4-*2*<~B{(NL9d3ro!C_{i_4-$sa$|0#8Iw<5U_c0StYl9^~WHlqH-*e17N z^Vzf(>kfHe^ah)6!g)$9)RlC>{=p?aH72y8rf(c^n+s2z5FwM(*%^syN*qV?#dpblY)+!MH^& zhs>vO7Q}hP=0PJAu+!FNfwhUB6;`0a98I2v=>0iJkPp0S5BvOFir=`ZBCi@Pc8@o~ zZuK@z4RMwMf8zwJ5OrnHmce13#>?^jBu^P{M149aG2Zt@n8!Nf)v@8qmLU4Xp$5LL@U{On={_8Ztm>&{0mEG20b(@GADyR;#=#ixT2@f6kf zLKq+QeQeataYgZ{IJUNAiD)Ias&xoB8ek z={Pa+XxY26C;#a<(w89KnX|c7a>UEAw`p(nrh^FmE~(#1cfS_neEz8gWj5%a9$C_* z#642kbzdn5EZ07EVIK?p8C9k>pT=hwOEI7Kj$Av8n7@;#NFFol(zY=ve`PgZg`F0X z`J7|xxlpItPW$m59?8@GQbb7i*%gUqV?Fjiu4tr^%_rK7xLde;`3j;5>(la%pVXCT zCG^g$+30Z{(#tN^;GV3AOMCkuBk16tlWSY9BcTyVLP(MFQVv@9|W2Sqv`)AbpL8+miEK0sa96jt2JK@ts zHTvmYrcO=bv$05k_m7SZ?8}4yZBv>ql%lU)=|64}4|PGu$!&Aue38YXBG}`ImiQt5 zZWQRkL4U1YCqKNM5d`1_C#*4NQ~bHKmTyR!dLKKxd#1f zNOW^pCml4{_c?RVF+}sq;`gS7P2!0*z#bb)H-+qzfLA;iq z7g67nocLL`b}f$hvP(h!b-%?suo4hX>o5lwd+}D72>6ds-Kvx z??k_dOT5~E_%ifCbDmQ=G1e(}UOJligthR$*V*{*MC*O<_ij2B`2N>#Wd4vT54B$SU1vtrz@Lx$!R2DT@Bj5a(ho`c zC!;U^y;5UsCpMpGBkZx*5O4fj$`>`{VhO19`Y`m& zUx{%Kf+u*aGXmUydIvGRNZ%9I!vD|q7wn}%etFlN)`YERK>R1v|CFhp^H4W8?C|01 z(YO37mJGB(ujTYwcwpFD7|*u^x*0+E;P=%?OG> zJYU&YzD-8%4@wI=E}HbZA948bPp2JSx)7aRtcQJ4AA0_~s2t??)+>(?{9)6 zhY3HIX67nkC*K11d-0LEi^rUF*EOwQ+Iw4$nVCnVa|Gq^cOAa_o+%T~HS}YtOwT(R#BZTLcewAtM#NcsiQF4J&14M1@6<=1f3joTu{i}% z9e)m1oV!Th(RD~_MPJ=htKvZ^?0<0L8+Y83+!I!yKKt1|#afW3y9!MUVe3f|=ef^E z?$IKD!d`{d6r+CRZ}_!3Th9)^)#?%;BEA`Q=v&i{pSXzo>z`kow!_}Tqn2JFxf< zr>|}!nvL!7r{S~W0-MjKMOfGS;oojMu;oMxkZJL8gIf|UMjsn;kq z*gv)K`7G;z5Psa$^K&c*^O%BSZqRrh)@hRGVJ8LhyhUI2RpJxYAWmwx^UgzbR+wKH zzk@$5_(YFL__pY}OH(23-kJh$X9NN2ZPRGcWG>?3S)L?2Nd?%4BO%#scj6nc|G&#! zyv@VB``@fZwEa6UA*0ux9bdsv7QYwgcvD}Ab-SlJU(&2*tTV2)X{*d1`Tf*>Q-u4` z@MTkwZNCRP_^D4^)fOTz^l#ylbL?4!SU=CDay}?ww@SqRMEV&xe9s@*X%(xPX{GVs87DtmuSLT*vq+o zTqZw~oG>5fxH2J!*ok>7Utaov_@1zfk9=OWuenHwyl6B;OnM^R`zDl~-j|0ww9Ccl zG8sVu|BQdzWLZWo{!KC}WORM6!VK(fVm{sEqptFAjJm{w-3NZok5i|E2z6oU$|7qx zxF-s{FMqNj&i{Bg(S6^u;k*fjE{`C67czj?RJ(&{!d!2}Yf@O|I{F_4J>sjwj&Im) zIw(*g_w*=od3<2W?@`L$nn8N}9C2v>o}&yYw|s%g6KZfu~I*mlem~ z**P%08PWf*u^sWXz4Lg16@HAu|Nq2^{RUUbB~*iNRj$YsFP`=%LgcqPYrfBxyWm%? zxKSH6-xF;_T^%*8<8wzDJXib{mhJT|@KjvuyGd@qL%q%exeBr z3gErW2|wP$GxG88`=^GSCOKg~{69J|OesZ1bdxV{PJ9LI`C(D$2}8Yp}^noDg#UGQzz+-+wa?38=NquVsz z9*FmA)^187T7o|575g<<0>66Cj_OK$!gkcDk*$knI={0L-p@PsKtg(4Xw=j!1|-UbW|!J_bu+*6^X<{l|S=P#%5YYsz4f3!p!2 zey6Ki#C?D~`YZ9X!b;4mzHfgfL_ZFmG2KG?@?40|oI*R%{}gMH$I}WXwb$ePZ-%xT z!5*)H{TuAR)SQn#@@zufKDJzo{7_!#d0LCQKToTDNpd^%rq{qe@_^aQS0?UZ6M?I)r)Vo*#iLw?<;SuGKaKe-btUZ z$RBY=5*LS+&z8}h9kA#_1Go7C!!1v|2o6p$u@eAO4 z+r^ku#McDjep!FFyU!4xum<<9dzQxoL z&Sdk6mf-$SV$r&FMB8z`;K*j5b+BK2gKv){s6%b-?bec.main") - val inventory = StoreApi().getInventory() - println("Inventory : $inventory") - val pet = Pet(name = "Elliot", photoUrls = listOf("https://jameshooverstudios.com/wp-content/uploads/2015/04/Majestic-Dog-Photography-Elliot-Nov-5-2014.jpg", "https://express-images.franklymedia.com/6616/sites/981/2020/01/22105725/Elliott.jpg"), id = 123456453, category = Category(id = 13259476, name = "dog"), tags = listOf(Tag(id = 194093, name = "Elliot")), status = Pet.Status.AVAILABLE) - PetApi().addPet(pet) - val elliot = PetApi().getPetById(123456453) - println("Elliot : $elliot") - assert(pet == elliot) - println(".main") - -} diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 4d9d2e534de..2c33cebc9cb 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.fasterxml.jackson.core.type.TypeReference @@ -247,7 +246,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index d939e3d5a43..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,494 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get all pets - * - * @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional) - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List { - val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getAllPets - * - * @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional) - * @return RequestConfig - */ - fun getAllPetsRequestConfig(lastUpdated: java.time.OffsetDateTime?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - if (lastUpdated != null) { - put("lastUpdated", listOf(parseDateToQueryString(lastUpdated))) - } - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/getAll", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index e1d5bc9c412..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,245 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - return value.toString() - } -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index c344dff4af6..2e95b6cbadc 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -26,7 +26,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -254,7 +253,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES index d1f6eddcef2..4bfcf9fb54e 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/.openapi-generator/FILES @@ -21,7 +21,6 @@ src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 78223583f64..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - suspend fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 4ab794d6608..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 911bbee5b6b..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - suspend fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index bcbb1cf8627..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.gson.toJson(content, T::class.java).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.gson.fromJson(bodyContent, T::class.java) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.gson.toJson(value, T::class.java).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 6120b081929..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException - -class ByteArrayAdapter : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: ByteArray?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(String(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): ByteArray? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return out.nextString().toByteArray() - } - } - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt deleted file mode 100644 index c5d330ac075..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Date?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): Date? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return formatter.parse(out.nextString()) - } - } - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index 30ef6697183..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: LocalDate?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): LocalDate? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return LocalDate.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index 3ad781c66ca..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: LocalDateTime?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): LocalDateTime? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return LocalDateTime.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index e615135c9cc..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: OffsetDateTime?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): OffsetDateTime? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return OffsetDateTime.parse(out.nextString(), formatter) - } - } - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index b80e0390de2..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.Gson -import com.google.gson.GsonBuilder -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.OffsetDateTime -import java.util.UUID -import java.util.Date - -object Serializer { - @JvmStatic - val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) - .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) - .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) - .registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter()) - - @JvmStatic - val gson: Gson by lazy { - gsonBuilder.create() - } -} diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fc89bf34e7f..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName -import java.io.Serializable - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @SerializedName("code") - val code: kotlin.Int? = null, - @SerializedName("type") - val type: kotlin.String? = null, - @SerializedName("message") - val message: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index b483bee69b3..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName -import java.io.Serializable - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index d6bacf867c4..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,58 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName -import java.io.Serializable - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("petId") - val petId: kotlin.Long? = null, - @SerializedName("quantity") - val quantity: kotlin.Int? = null, - @SerializedName("shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @SerializedName("status") - val status: Order.Status? = null, - @SerializedName("complete") - val complete: kotlin.Boolean? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @SerializedName(value = "placed") placed("placed"), - @SerializedName(value = "approved") approved("approved"), - @SerializedName(value = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index afa65785d38..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,60 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.google.gson.annotations.SerializedName -import java.io.Serializable - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @SerializedName("name") - val name: kotlin.String, - @SerializedName("photoUrls") - val photoUrls: kotlin.collections.List, - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("category") - val category: Category? = null, - @SerializedName("tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @SerializedName("status") - val status: Pet.Status? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @SerializedName(value = "available") available("available"), - @SerializedName(value = "pending") pending("pending"), - @SerializedName(value = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index a1a282cb38d..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName -import java.io.Serializable - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 59ba0254f60..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.google.gson.annotations.SerializedName -import java.io.Serializable - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @SerializedName("id") - val id: kotlin.Long? = null, - @SerializedName("username") - val username: kotlin.String? = null, - @SerializedName("firstName") - val firstName: kotlin.String? = null, - @SerializedName("lastName") - val lastName: kotlin.String? = null, - @SerializedName("email") - val email: kotlin.String? = null, - @SerializedName("password") - val password: kotlin.String? = null, - @SerializedName("phone") - val phone: kotlin.String? = null, - /* User Status */ - @SerializedName("userStatus") - val userStatus: kotlin.Int? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 43f89e88cbd..8ed9955f644 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException @@ -261,7 +260,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt deleted file mode 100644 index c5d330ac075..00000000000 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.google.gson.TypeAdapter -import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonWriter -import com.google.gson.stream.JsonToken.NULL -import java.io.IOException -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter() { - @Throws(IOException::class) - override fun write(out: JsonWriter?, value: Date?) { - if (value == null) { - out?.nullValue() - } else { - out?.value(formatter.format(value)) - } - } - - @Throws(IOException::class) - override fun read(out: JsonReader?): Date? { - out ?: return null - - when (out.peek()) { - NULL -> { - out.nextNull() - return null - } - else -> { - return formatter.parse(out.nextString()) - } - } - } -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index c8b93b33bf6..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 7a8dcc91cd4..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 25447c818e6..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 18d2ce3dbbe..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ -@JsonClass(generateAdapter = true) -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index 8396fa42357..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,30 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A category for a pet - * @param id - * @param name - */ -@JsonClass(generateAdapter = true) -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index d7091dd4c0c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,55 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ -@JsonClass(generateAdapter = true) -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 8b4e6b44d4c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,57 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ -@JsonClass(generateAdapter = true) -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index e7cdab2bb5d..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,30 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A tag for a pet - * @param id - * @param name - */ -@JsonClass(generateAdapter = true) -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 1bfad844904..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,49 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ -@JsonClass(generateAdapter = true) -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 7282e53200b..2abf02f23b4 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -248,7 +247,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index b6b38fa42f3..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 19b7acdbd31..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 979bb1b81f8..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index d26cda9091c..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -internal typealias MultiValueMap = MutableMap> - -internal fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -internal val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -internal fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -internal fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index c4da8e3989b..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -internal open class ApiClient(val baseUrl: String) { - internal companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index c618544573e..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -internal enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -internal interface Response - -internal abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -internal class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -internal class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -internal class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -internal class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -internal class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index d7f9079c0d5..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -internal object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index 86bcb51fba6..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -internal class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index 204b69dcb08..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -internal open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - internal companion object { - private const val serialVersionUID: Long = 123L - } -} - -internal open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - internal companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index e86215d5717..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -internal class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index fe7069904ca..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -internal class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index be7703c103d..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -internal class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 68f41c5497d..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -internal data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index e0fbb1e6526..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -internal enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 858d1b7339b..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -internal val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -internal val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -internal val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -internal val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 7265f759142..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -internal object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index 02fa692b57d..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -internal class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index a695278dfa3..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -internal data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index 376994a9b25..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -internal data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a943b97c1ea..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -internal data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - internal enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 544fab20f5a..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -internal data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - internal enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index d9b84e93eaf..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -internal data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index e0e821cd7e3..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -internal data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 6ef92322fb1..90c872b1e36 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -248,7 +247,7 @@ internal open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index d7f9079c0d5..00000000000 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -internal object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 95f695cb9f4..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List? { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List? { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet? { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index c442f866100..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map? { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order? { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order? { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 6e6c329144c..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User? { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String or null - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String? - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 7a8dcc91cd4..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 77066de4e55..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T?, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 7d40c8efbc2..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index ceb0fbc8fe6..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index ed8f8b13a43..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,58 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 105f485f021..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,60 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 944b1cd0a14..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 9697f07d5bf..00000000000 --- a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 7282e53200b..2abf02f23b4 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -248,7 +247,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index c8b93b33bf6..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 9d526273d7a..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,249 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.MediaType -import okhttp3.FormBody -import okhttp3.HttpUrl -import okhttp3.ResponseBody -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> RequestBody.create( - MediaType.parse(mediaType), content - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.of( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = MediaType.parse(guessContentTypeFromFile(value)) - addPart(partHeaders, RequestBody.create(fileMediaType, value)) - } else { - val partHeaders = Headers.of( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - RequestBody.create(null, parameterToString(value)) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> RequestBody.create( - MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content) - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code(), - response.headers().toMultimap() - ) - response.isInformational -> return Informational( - response.message(), - response.code(), - response.headers().toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body(), accept), - response.code(), - response.headers().toMultimap() - ) - response.isClientError -> return ClientError( - response.message(), - response.body()?.string(), - response.code(), - response.headers().toMultimap() - ) - else -> return ServerError( - response.message(), - response.body()?.string(), - response.code(), - response.headers().toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 037fedbd18b..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code() in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code() in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code() in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code() in 500..999 diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 17646c1df12..08053e0e04b 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -23,7 +23,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -245,7 +244,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES index 247ff9a7238..fd9029f0887 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/.openapi-generator/FILES @@ -30,7 +30,6 @@ src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/CollectionFormats.kt -src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt deleted file mode 100644 index 0c8a4fa54d2..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/DateAdapter.kt +++ /dev/null @@ -1,28 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlinx.serialization.KSerializer -import kotlinx.serialization.Serializer -import kotlinx.serialization.encoding.Decoder -import kotlinx.serialization.encoding.Encoder -import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor -import kotlinx.serialization.descriptors.PrimitiveKind -import kotlinx.serialization.descriptors.SerialDescriptor -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale - -@Serializer(forClass = Date::class) -object DateAdapter : KSerializer { - private val df: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault()) - - override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Date", PrimitiveKind.STRING) - - override fun serialize(encoder: Encoder, value: Date) { - encoder.encodeString(df.format(value)) - } - - override fun deserialize(decoder: Decoder): Date { - return df.parse(decoder.decodeString())!! - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index e769dec78ea..bbb13638034 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,6 +1,5 @@ package org.openapitools.client.infrastructure -import java.util.Date import java.math.BigDecimal import java.math.BigInteger import java.time.LocalDate @@ -20,7 +19,6 @@ object Serializer { val kotlinSerializationAdapters = SerializersModule { contextual(BigDecimal::class, BigDecimalAdapter) contextual(BigInteger::class, BigIntegerAdapter) - contextual(Date::class, DateAdapter) contextual(LocalDate::class, LocalDateAdapter) contextual(LocalDateTime::class, LocalDateTimeAdapter) contextual(OffsetDateTime::class, OffsetDateTimeAdapter) diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 90e791f37af..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,125 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import okhttp3.RequestBody -import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.core.Completable; - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import okhttp3.MultipartBody - -interface PetApi { - /** - * Add a new pet to the store - * - * Responses: - * - 405: Invalid input - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @POST("pet") - fun addPet(@Body body: Pet): Completable - - /** - * Deletes a pet - * - * Responses: - * - 400: Invalid pet value - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return [Call]<[Unit]> - */ - @DELETE("pet/{petId}") - fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Completable - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * Responses: - * - 200: successful operation - * - 400: Invalid status value - * - * @param status Status values that need to be considered for filter - * @return [Call]<[kotlin.collections.List]> - */ - @GET("pet/findByStatus") - fun findPetsByStatus(@Query("status") status: CSVParams): Single> - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Responses: - * - 200: successful operation - * - 400: Invalid tag value - * - * @param tags Tags to filter by - * @return [Call]<[kotlin.collections.List]> - */ - @Deprecated("This api was deprecated") - @GET("pet/findByTags") - fun findPetsByTags(@Query("tags") tags: CSVParams): Single> - - /** - * Find pet by ID - * Returns a single pet - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Pet not found - * - * @param petId ID of pet to return - * @return [Call]<[Pet]> - */ - @GET("pet/{petId}") - fun getPetById(@Path("petId") petId: kotlin.Long): Single - - /** - * Update an existing pet - * - * Responses: - * - 400: Invalid ID supplied - * - 404: Pet not found - * - 405: Validation exception - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @PUT("pet") - fun updatePet(@Body body: Pet): Completable - - /** - * Updates a pet in the store with form data - * - * Responses: - * - 405: Invalid input - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return [Call]<[Unit]> - */ - @FormUrlEncoded - @POST("pet/{petId}") - fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String, @Field("status") status: kotlin.String): Completable - - /** - * uploads an image - * - * Responses: - * - 200: successful operation - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> - */ - @Multipart - @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String, @Part file: MultipartBody.Part): Single - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 11acb2eb8b7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import okhttp3.RequestBody -import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.core.Completable; - -import org.openapitools.client.models.Order - -interface StoreApi { - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Responses: - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of the order that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("store/order/{orderId}") - fun deleteOrder(@Path("orderId") orderId: kotlin.String): Completable - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * Responses: - * - 200: successful operation - * - * @return [Call]<[kotlin.collections.Map]> - */ - @GET("store/inventory") - fun getInventory(): Single> - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of pet that needs to be fetched - * @return [Call]<[Order]> - */ - @GET("store/order/{orderId}") - fun getOrderById(@Path("orderId") orderId: kotlin.Long): Single - - /** - * Place an order for a pet - * - * Responses: - * - 200: successful operation - * - 400: Invalid Order - * - * @param body order placed for purchasing the pet - * @return [Call]<[Order]> - */ - @POST("store/order") - fun placeOrder(@Body body: Order): Single - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index d6fad78e88f..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import okhttp3.RequestBody -import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.core.Completable; - -import org.openapitools.client.models.User - -interface UserApi { - /** - * Create user - * This can only be done by the logged in user. - * Responses: - * - 0: successful operation - * - * @param body Created user object - * @return [Call]<[Unit]> - */ - @POST("user") - fun createUser(@Body body: User): Completable - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithArray") - fun createUsersWithArrayInput(@Body body: kotlin.collections.List): Completable - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithList") - fun createUsersWithListInput(@Body body: kotlin.collections.List): Completable - - /** - * Delete user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("user/{username}") - fun deleteUser(@Path("username") username: kotlin.String): Completable - - /** - * Get user by user name - * - * Responses: - * - 200: successful operation - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return [Call]<[User]> - */ - @GET("user/{username}") - fun getUserByName(@Path("username") username: kotlin.String): Single - - /** - * Logs user into the system - * - * Responses: - * - 200: successful operation - * - 400: Invalid username/password supplied - * - * @param username The user name for login - * @param password The password for login in clear text - * @return [Call]<[kotlin.String]> - */ - @GET("user/login") - fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Single - - /** - * Logs out current logged in user session - * - * Responses: - * - 0: successful operation - * - * @return [Call]<[Unit]> - */ - @GET("user/logout") - fun logoutUser(): Completable - - /** - * Updated user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid user supplied - * - 404: User not found - * - * @param username name that need to be deleted - * @param body Updated user object - * @return [Call]<[Unit]> - */ - @PUT("user/{username}") - fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Completable - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt deleted file mode 100644 index 524d5190ef8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt +++ /dev/null @@ -1,50 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException -import java.net.URI -import java.net.URISyntaxException - -import okhttp3.Interceptor -import okhttp3.Response - -class ApiKeyAuth( - private val location: String = "", - private val paramName: String = "", - private var apiKey: String = "" -) : Interceptor { - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - var request = chain.request() - - if ("query" == location) { - var newQuery = request.url.toUri().query - val paramValue = "$paramName=$apiKey" - if (newQuery == null) { - newQuery = paramValue - } else { - newQuery += "&$paramValue" - } - - val newUri: URI - try { - val oldUri = request.url.toUri() - newUri = URI(oldUri.scheme, oldUri.authority, - oldUri.path, newQuery, oldUri.fragment) - } catch (e: URISyntaxException) { - throw IOException(e) - } - - request = request.newBuilder().url(newUri.toURL()).build() - } else if ("header" == location) { - request = request.newBuilder() - .addHeader(paramName, apiKey) - .build() - } else if ("cookie" == location) { - request = request.newBuilder() - .addHeader("Cookie", "$paramName=$apiKey") - .build() - } - return chain.proceed(request) - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt deleted file mode 100644 index 311a8f43979..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt +++ /dev/null @@ -1,151 +0,0 @@ -package org.openapitools.client.auth - -import java.net.HttpURLConnection.HTTP_UNAUTHORIZED -import java.net.HttpURLConnection.HTTP_FORBIDDEN - -import java.io.IOException - -import org.apache.oltu.oauth2.client.OAuthClient -import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException -import org.apache.oltu.oauth2.common.message.types.GrantType -import org.apache.oltu.oauth2.common.token.BasicOAuthToken - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import okhttp3.Response - -class OAuth( - client: OkHttpClient, - var tokenRequestBuilder: TokenRequestBuilder -) : Interceptor { - - interface AccessTokenListener { - fun notify(token: BasicOAuthToken) - } - - private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client)) - - @Volatile - private var accessToken: String? = null - var authenticationRequestBuilder: AuthenticationRequestBuilder? = null - private var accessTokenListener: AccessTokenListener? = null - - constructor( - requestBuilder: TokenRequestBuilder - ) : this( - OkHttpClient(), - requestBuilder - ) - - constructor( - flow: OAuthFlow, - authorizationUrl: String, - tokenUrl: String, - scopes: String - ) : this( - OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes) - ) { - setFlow(flow); - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); - } - - fun setFlow(flow: OAuthFlow) { - when (flow) { - OAuthFlow.accessCode, OAuthFlow.implicit -> - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE) - OAuthFlow.password -> - tokenRequestBuilder.setGrantType(GrantType.PASSWORD) - OAuthFlow.application -> - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS) - } - } - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - return retryingIntercept(chain, true) - } - - @Throws(IOException::class) - private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response { - var request = chain.request() - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") != null) { - return chain.proceed(request) - } - - // If first time, get the token - val oAuthRequest: OAuthClientRequest - if (accessToken == null) { - updateAccessToken(null) - } - - if (accessToken != null) { - // Build the request - val rb = request.newBuilder() - - val requestAccessToken = accessToken - try { - oAuthRequest = OAuthBearerClientRequest(request.url.toString()) - .setAccessToken(requestAccessToken) - .buildHeaderMessage() - } catch (e: OAuthSystemException) { - throw IOException(e) - } - - oAuthRequest.headers.entries.forEach { header -> - rb.addHeader(header.key, header.value) - } - rb.url(oAuthRequest.locationUri) - - //Execute the request - val response = chain.proceed(rb.build()) - - // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row. - if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body?.close() - return retryingIntercept(chain, false) - } - } catch (e: Exception) { - response.body?.close() - throw e - } - } - return response - } else { - return chain.proceed(chain.request()) - } - } - - /** - * Returns true if the access token has been updated - */ - @Throws(IOException::class) - @Synchronized - fun updateAccessToken(requestAccessToken: String?): Boolean { - if (accessToken == null || accessToken.equals(requestAccessToken)) { - return try { - val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage()) - if (accessTokenResponse != null && accessTokenResponse.accessToken != null) { - accessToken = accessTokenResponse.accessToken - accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken) - !accessToken.equals(requestAccessToken) - } else { - false - } - } catch (e: OAuthSystemException) { - throw IOException(e) - } catch (e: OAuthProblemException) { - throw IOException(e) - } - } - return true; - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt deleted file mode 100644 index bcada9b7a6a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapitools.client.auth - -enum class OAuthFlow { - accessCode, implicit, password, application -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt deleted file mode 100644 index 93adbda3fc9..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException - -import org.apache.oltu.oauth2.client.HttpClient -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.response.OAuthClientResponse -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException - -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody - - -class OAuthOkHttpClient( - private var client: OkHttpClient -) : HttpClient { - - constructor() : this(OkHttpClient()) - - @Throws(OAuthSystemException::class, OAuthProblemException::class) - override fun execute( - request: OAuthClientRequest, - headers: Map?, - requestMethod: String, - responseClass: Class?): T { - - var mediaType = "application/json".toMediaTypeOrNull() - val requestBuilder = Request.Builder().url(request.locationUri) - - headers?.forEach { entry -> - if (entry.key.equals("Content-Type", true)) { - mediaType = entry.value.toMediaTypeOrNull() - } else { - requestBuilder.addHeader(entry.key, entry.value) - } - } - - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null - requestBuilder.method(requestMethod, body) - - try { - val response = client.newCall(requestBuilder.build()).execute() - return OAuthClientResponseFactory.createCustomResponse( - response.body?.string(), - response.body?.contentType()?.toString(), - response.code, - responseClass) - } catch (e: IOException) { - throw OAuthSystemException(e) - } - } - - override fun shutdown() { - // Nothing to do here - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 30f649932fc..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,203 +0,0 @@ -package org.openapitools.client.infrastructure - -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.openapitools.client.auth.ApiKeyAuth -import org.openapitools.client.auth.OAuth -import org.openapitools.client.auth.OAuth.AccessTokenListener -import org.openapitools.client.auth.OAuthFlow - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import retrofit2.Retrofit -import okhttp3.logging.HttpLoggingInterceptor -import retrofit2.converter.scalars.ScalarsConverterFactory -import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory -import com.squareup.moshi.Moshi -import retrofit2.converter.moshi.MoshiConverterFactory - -class ApiClient( - private var baseUrl: String = defaultBasePath, - private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - private val okHttpClient : OkHttpClient? = null -) { - private val apiAuthorizations = mutableMapOf() - var logger: ((String) -> Unit)? = null - - private val retrofitBuilder: Retrofit.Builder by lazy { - Retrofit.Builder() - .baseUrl(baseUrl) - .addConverterFactory(ScalarsConverterFactory.create()) - - .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) - .addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build())) - } - - private val clientBuilder: OkHttpClient.Builder by lazy { - okHttpClientBuilder ?: defaultClientBuilder - } - - private val defaultClientBuilder: OkHttpClient.Builder by lazy { - OkHttpClient() - .newBuilder() - .addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger { - override fun log(message: String) { - logger?.invoke(message) - } - }).apply { - level = HttpLoggingInterceptor.Level.BODY - }) - } - - init { - normalizeBaseUrl() - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authNames: Array - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) { - authNames.forEach { authName -> - val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") - else -> throw RuntimeException("auth name $authName not found in available auth names") - } - addAuthorization(authName, auth); - } - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authName: String, - clientId: String, - secret: String, - username: String, - password: String - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { - getTokenEndPoint() - ?.setClientId(clientId) - ?.setClientSecret(secret) - ?.setUsername(username) - ?.setPassword(password) - } - - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder - */ - fun getTokenEndPoint(): TokenRequestBuilder? { - var result: TokenRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = tokenRequestBuilder - } - return result - } - - /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder - */ - fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? { - var result: AuthenticationRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = authenticationRequestBuilder - } - return result - } - - /** - * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken Access token - * @return ApiClient - */ - fun setAccessToken(accessToken: String): ApiClient { - apiAuthorizations.values.runOnFirst { - setAccessToken(accessToken) - } - return this - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - * @return ApiClient - */ - fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient { - apiAuthorizations.values.runOnFirst { - tokenRequestBuilder - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI) - authenticationRequestBuilder - ?.setClientId(clientId) - ?.setRedirectURI(redirectURI) - } - return this; - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - * @return ApiClient - */ - fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient { - apiAuthorizations.values.runOnFirst { - registerAccessTokenListener(accessTokenListener) - } - return this; - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - * @return ApiClient - */ - fun addAuthorization(authName: String, authorization: Interceptor): ApiClient { - if (apiAuthorizations.containsKey(authName)) { - throw RuntimeException("auth name $authName already in api authorizations") - } - apiAuthorizations[authName] = authorization - clientBuilder.addInterceptor(authorization) - return this - } - - fun setLogger(logger: (String) -> Unit): ApiClient { - this.logger = logger - return this - } - - fun createService(serviceClass: Class): S { - val usedClient = this.okHttpClient ?: clientBuilder.build() - return retrofitBuilder.client(usedClient).build().create(serviceClass) - } - - private fun normalizeBaseUrl() { - if (!baseUrl.endsWith("/")) { - baseUrl += "/" - } - } - - private inline fun Iterable.runOnFirst(callback: U.() -> Unit) { - for (element in this) { - if (element is U) { - callback.invoke(element) - break - } - } - } - - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt deleted file mode 100644 index 001e99325d2..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt +++ /dev/null @@ -1,56 +0,0 @@ -package org.openapitools.client.infrastructure - -class CollectionFormats { - - open class CSVParams { - - var params: List - - constructor(params: List) { - this.params = params - } - - constructor(vararg params: String) { - this.params = listOf(*params) - } - - override fun toString(): String { - return params.joinToString(",") - } - } - - open class SSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString(" ") - } - } - - class TSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("\t") - } - } - - class PIPESParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("|") - } - } - - class SPACEParams : SSVParams() -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt deleted file mode 100644 index 1804d1ae2bb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.JsonDataException -import com.squareup.moshi.Moshi -import retrofit2.Response - -@Throws(JsonDataException::class) -inline fun Response<*>.getErrorResponse(serializerBuilder: Moshi.Builder = Serializer.moshiBuilder): T? { - val serializer = serializerBuilder.build() - val parser = serializer.adapter(T::class.java) - val response = errorBody()?.string() - if(response != null) { - return parser.fromJson(response) - } - return null -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index e8b980bc872..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,124 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import retrofit2.Call -import okhttp3.RequestBody - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import okhttp3.MultipartBody - -interface PetApi { - /** - * Add a new pet to the store - * - * Responses: - * - 405: Invalid input - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @POST("pet") - fun addPet(@Body body: Pet): Call - - /** - * Deletes a pet - * - * Responses: - * - 400: Invalid pet value - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return [Call]<[Unit]> - */ - @DELETE("pet/{petId}") - fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Call - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * Responses: - * - 200: successful operation - * - 400: Invalid status value - * - * @param status Status values that need to be considered for filter - * @return [Call]<[kotlin.collections.List]> - */ - @GET("pet/findByStatus") - fun findPetsByStatus(@Query("status") status: CSVParams): Call> - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * Responses: - * - 200: successful operation - * - 400: Invalid tag value - * - * @param tags Tags to filter by - * @return [Call]<[kotlin.collections.List]> - */ - @Deprecated("This api was deprecated") - @GET("pet/findByTags") - fun findPetsByTags(@Query("tags") tags: CSVParams): Call> - - /** - * Find pet by ID - * Returns a single pet - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Pet not found - * - * @param petId ID of pet to return - * @return [Call]<[Pet]> - */ - @GET("pet/{petId}") - fun getPetById(@Path("petId") petId: kotlin.Long): Call - - /** - * Update an existing pet - * - * Responses: - * - 400: Invalid ID supplied - * - 404: Pet not found - * - 405: Validation exception - * - * @param body Pet object that needs to be added to the store - * @return [Call]<[Unit]> - */ - @PUT("pet") - fun updatePet(@Body body: Pet): Call - - /** - * Updates a pet in the store with form data - * - * Responses: - * - 405: Invalid input - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return [Call]<[Unit]> - */ - @FormUrlEncoded - @POST("pet/{petId}") - fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String, @Field("status") status: kotlin.String): Call - - /** - * uploads an image - * - * Responses: - * - 200: successful operation - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> - */ - @Multipart - @POST("pet/{petId}/uploadImage") - fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String, @Part file: MultipartBody.Part): Call - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index be05f2bb696..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,62 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import retrofit2.Call -import okhttp3.RequestBody - -import org.openapitools.client.models.Order - -interface StoreApi { - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * Responses: - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of the order that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("store/order/{orderId}") - fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * Responses: - * - 200: successful operation - * - * @return [Call]<[kotlin.collections.Map]> - */ - @GET("store/inventory") - fun getInventory(): Call> - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * Responses: - * - 200: successful operation - * - 400: Invalid ID supplied - * - 404: Order not found - * - * @param orderId ID of pet that needs to be fetched - * @return [Call]<[Order]> - */ - @GET("store/order/{orderId}") - fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call - - /** - * Place an order for a pet - * - * Responses: - * - 200: successful operation - * - 400: Invalid Order - * - * @param body order placed for purchasing the pet - * @return [Call]<[Order]> - */ - @POST("store/order") - fun placeOrder(@Body body: Order): Call - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 66c1e7fbd26..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,113 +0,0 @@ -package org.openapitools.client.apis - -import org.openapitools.client.infrastructure.CollectionFormats.* -import retrofit2.http.* -import retrofit2.Call -import okhttp3.RequestBody - -import org.openapitools.client.models.User - -interface UserApi { - /** - * Create user - * This can only be done by the logged in user. - * Responses: - * - 0: successful operation - * - * @param body Created user object - * @return [Call]<[Unit]> - */ - @POST("user") - fun createUser(@Body body: User): Call - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithArray") - fun createUsersWithArrayInput(@Body body: kotlin.collections.List): Call - - /** - * Creates list of users with given input array - * - * Responses: - * - 0: successful operation - * - * @param body List of user object - * @return [Call]<[Unit]> - */ - @POST("user/createWithList") - fun createUsersWithListInput(@Body body: kotlin.collections.List): Call - - /** - * Delete user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be deleted - * @return [Call]<[Unit]> - */ - @DELETE("user/{username}") - fun deleteUser(@Path("username") username: kotlin.String): Call - - /** - * Get user by user name - * - * Responses: - * - 200: successful operation - * - 400: Invalid username supplied - * - 404: User not found - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return [Call]<[User]> - */ - @GET("user/{username}") - fun getUserByName(@Path("username") username: kotlin.String): Call - - /** - * Logs user into the system - * - * Responses: - * - 200: successful operation - * - 400: Invalid username/password supplied - * - * @param username The user name for login - * @param password The password for login in clear text - * @return [Call]<[kotlin.String]> - */ - @GET("user/login") - fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Call - - /** - * Logs out current logged in user session - * - * Responses: - * - 0: successful operation - * - * @return [Call]<[Unit]> - */ - @GET("user/logout") - fun logoutUser(): Call - - /** - * Updated user - * This can only be done by the logged in user. - * Responses: - * - 400: Invalid user supplied - * - 404: User not found - * - * @param username name that need to be deleted - * @param body Updated user object - * @return [Call]<[Unit]> - */ - @PUT("user/{username}") - fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Call - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt deleted file mode 100644 index 524d5190ef8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt +++ /dev/null @@ -1,50 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException -import java.net.URI -import java.net.URISyntaxException - -import okhttp3.Interceptor -import okhttp3.Response - -class ApiKeyAuth( - private val location: String = "", - private val paramName: String = "", - private var apiKey: String = "" -) : Interceptor { - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - var request = chain.request() - - if ("query" == location) { - var newQuery = request.url.toUri().query - val paramValue = "$paramName=$apiKey" - if (newQuery == null) { - newQuery = paramValue - } else { - newQuery += "&$paramValue" - } - - val newUri: URI - try { - val oldUri = request.url.toUri() - newUri = URI(oldUri.scheme, oldUri.authority, - oldUri.path, newQuery, oldUri.fragment) - } catch (e: URISyntaxException) { - throw IOException(e) - } - - request = request.newBuilder().url(newUri.toURL()).build() - } else if ("header" == location) { - request = request.newBuilder() - .addHeader(paramName, apiKey) - .build() - } else if ("cookie" == location) { - request = request.newBuilder() - .addHeader("Cookie", "$paramName=$apiKey") - .build() - } - return chain.proceed(request) - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt deleted file mode 100644 index 311a8f43979..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt +++ /dev/null @@ -1,151 +0,0 @@ -package org.openapitools.client.auth - -import java.net.HttpURLConnection.HTTP_UNAUTHORIZED -import java.net.HttpURLConnection.HTTP_FORBIDDEN - -import java.io.IOException - -import org.apache.oltu.oauth2.client.OAuthClient -import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException -import org.apache.oltu.oauth2.common.message.types.GrantType -import org.apache.oltu.oauth2.common.token.BasicOAuthToken - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import okhttp3.Response - -class OAuth( - client: OkHttpClient, - var tokenRequestBuilder: TokenRequestBuilder -) : Interceptor { - - interface AccessTokenListener { - fun notify(token: BasicOAuthToken) - } - - private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client)) - - @Volatile - private var accessToken: String? = null - var authenticationRequestBuilder: AuthenticationRequestBuilder? = null - private var accessTokenListener: AccessTokenListener? = null - - constructor( - requestBuilder: TokenRequestBuilder - ) : this( - OkHttpClient(), - requestBuilder - ) - - constructor( - flow: OAuthFlow, - authorizationUrl: String, - tokenUrl: String, - scopes: String - ) : this( - OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes) - ) { - setFlow(flow); - authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); - } - - fun setFlow(flow: OAuthFlow) { - when (flow) { - OAuthFlow.accessCode, OAuthFlow.implicit -> - tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE) - OAuthFlow.password -> - tokenRequestBuilder.setGrantType(GrantType.PASSWORD) - OAuthFlow.application -> - tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS) - } - } - - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - return retryingIntercept(chain, true) - } - - @Throws(IOException::class) - private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response { - var request = chain.request() - - // If the request already have an authorization (eg. Basic auth), do nothing - if (request.header("Authorization") != null) { - return chain.proceed(request) - } - - // If first time, get the token - val oAuthRequest: OAuthClientRequest - if (accessToken == null) { - updateAccessToken(null) - } - - if (accessToken != null) { - // Build the request - val rb = request.newBuilder() - - val requestAccessToken = accessToken - try { - oAuthRequest = OAuthBearerClientRequest(request.url.toString()) - .setAccessToken(requestAccessToken) - .buildHeaderMessage() - } catch (e: OAuthSystemException) { - throw IOException(e) - } - - oAuthRequest.headers.entries.forEach { header -> - rb.addHeader(header.key, header.value) - } - rb.url(oAuthRequest.locationUri) - - //Execute the request - val response = chain.proceed(rb.build()) - - // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row. - if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) { - try { - if (updateAccessToken(requestAccessToken)) { - response.body?.close() - return retryingIntercept(chain, false) - } - } catch (e: Exception) { - response.body?.close() - throw e - } - } - return response - } else { - return chain.proceed(chain.request()) - } - } - - /** - * Returns true if the access token has been updated - */ - @Throws(IOException::class) - @Synchronized - fun updateAccessToken(requestAccessToken: String?): Boolean { - if (accessToken == null || accessToken.equals(requestAccessToken)) { - return try { - val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage()) - if (accessTokenResponse != null && accessTokenResponse.accessToken != null) { - accessToken = accessTokenResponse.accessToken - accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken) - !accessToken.equals(requestAccessToken) - } else { - false - } - } catch (e: OAuthSystemException) { - throw IOException(e) - } catch (e: OAuthProblemException) { - throw IOException(e) - } - } - return true; - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt deleted file mode 100644 index bcada9b7a6a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.openapitools.client.auth - -enum class OAuthFlow { - accessCode, implicit, password, application -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt deleted file mode 100644 index 93adbda3fc9..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.openapitools.client.auth - -import java.io.IOException - -import org.apache.oltu.oauth2.client.HttpClient -import org.apache.oltu.oauth2.client.request.OAuthClientRequest -import org.apache.oltu.oauth2.client.response.OAuthClientResponse -import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory -import org.apache.oltu.oauth2.common.exception.OAuthProblemException -import org.apache.oltu.oauth2.common.exception.OAuthSystemException - -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody - - -class OAuthOkHttpClient( - private var client: OkHttpClient -) : HttpClient { - - constructor() : this(OkHttpClient()) - - @Throws(OAuthSystemException::class, OAuthProblemException::class) - override fun execute( - request: OAuthClientRequest, - headers: Map?, - requestMethod: String, - responseClass: Class?): T { - - var mediaType = "application/json".toMediaTypeOrNull() - val requestBuilder = Request.Builder().url(request.locationUri) - - headers?.forEach { entry -> - if (entry.key.equals("Content-Type", true)) { - mediaType = entry.value.toMediaTypeOrNull() - } else { - requestBuilder.addHeader(entry.key, entry.value) - } - } - - val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null - requestBuilder.method(requestMethod, body) - - try { - val response = client.newCall(requestBuilder.build()).execute() - return OAuthClientResponseFactory.createCustomResponse( - response.body?.string(), - response.body?.contentType()?.toString(), - response.code, - responseClass) - } catch (e: IOException) { - throw OAuthSystemException(e) - } - } - - override fun shutdown() { - // Nothing to do here - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index f19c5861dd7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,200 +0,0 @@ -package org.openapitools.client.infrastructure - -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder -import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder -import org.openapitools.client.auth.ApiKeyAuth -import org.openapitools.client.auth.OAuth -import org.openapitools.client.auth.OAuth.AccessTokenListener -import org.openapitools.client.auth.OAuthFlow - -import okhttp3.Interceptor -import okhttp3.OkHttpClient -import retrofit2.Retrofit -import okhttp3.logging.HttpLoggingInterceptor -import retrofit2.converter.scalars.ScalarsConverterFactory -import com.squareup.moshi.Moshi -import retrofit2.converter.moshi.MoshiConverterFactory - -class ApiClient( - private var baseUrl: String = defaultBasePath, - private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - private val okHttpClient : OkHttpClient? = null -) { - private val apiAuthorizations = mutableMapOf() - var logger: ((String) -> Unit)? = null - - private val retrofitBuilder: Retrofit.Builder by lazy { - Retrofit.Builder() - .baseUrl(baseUrl) - .addConverterFactory(ScalarsConverterFactory.create()) - .addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build())) - } - - private val clientBuilder: OkHttpClient.Builder by lazy { - okHttpClientBuilder ?: defaultClientBuilder - } - - private val defaultClientBuilder: OkHttpClient.Builder by lazy { - OkHttpClient() - .newBuilder() - .addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger { - override fun log(message: String) { - logger?.invoke(message) - } - }).apply { - level = HttpLoggingInterceptor.Level.BODY - }) - } - - init { - normalizeBaseUrl() - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authNames: Array - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) { - authNames.forEach { authName -> - val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") - else -> throw RuntimeException("auth name $authName not found in available auth names") - } - addAuthorization(authName, auth); - } - } - - constructor( - baseUrl: String = defaultBasePath, - okHttpClientBuilder: OkHttpClient.Builder? = null, - serializerBuilder: Moshi.Builder = Serializer.moshiBuilder, - authName: String, - clientId: String, - secret: String, - username: String, - password: String - ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { - getTokenEndPoint() - ?.setClientId(clientId) - ?.setClientSecret(secret) - ?.setUsername(username) - ?.setPassword(password) - } - - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Token request builder - */ - fun getTokenEndPoint(): TokenRequestBuilder? { - var result: TokenRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = tokenRequestBuilder - } - return result - } - - /** - * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return Authentication request builder - */ - fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? { - var result: AuthenticationRequestBuilder? = null - apiAuthorizations.values.runOnFirst { - result = authenticationRequestBuilder - } - return result - } - - /** - * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken Access token - * @return ApiClient - */ - fun setAccessToken(accessToken: String): ApiClient { - apiAuthorizations.values.runOnFirst { - setAccessToken(accessToken) - } - return this - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - * @return ApiClient - */ - fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient { - apiAuthorizations.values.runOnFirst { - tokenRequestBuilder - .setClientId(clientId) - .setClientSecret(clientSecret) - .setRedirectURI(redirectURI) - authenticationRequestBuilder - ?.setClientId(clientId) - ?.setRedirectURI(redirectURI) - } - return this; - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - * @return ApiClient - */ - fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient { - apiAuthorizations.values.runOnFirst { - registerAccessTokenListener(accessTokenListener) - } - return this; - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - * @return ApiClient - */ - fun addAuthorization(authName: String, authorization: Interceptor): ApiClient { - if (apiAuthorizations.containsKey(authName)) { - throw RuntimeException("auth name $authName already in api authorizations") - } - apiAuthorizations[authName] = authorization - clientBuilder.addInterceptor(authorization) - return this - } - - fun setLogger(logger: (String) -> Unit): ApiClient { - this.logger = logger - return this - } - - fun createService(serviceClass: Class): S { - val usedClient = this.okHttpClient ?: clientBuilder.build() - return retrofitBuilder.client(usedClient).build().create(serviceClass) - } - - private fun normalizeBaseUrl() { - if (!baseUrl.endsWith("/")) { - baseUrl += "/" - } - } - - private inline fun Iterable.runOnFirst(callback: U.() -> Unit) { - for (element in this) { - if (element is U) { - callback.invoke(element) - break - } - } - } - - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt deleted file mode 100644 index 001e99325d2..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt +++ /dev/null @@ -1,56 +0,0 @@ -package org.openapitools.client.infrastructure - -class CollectionFormats { - - open class CSVParams { - - var params: List - - constructor(params: List) { - this.params = params - } - - constructor(vararg params: String) { - this.params = listOf(*params) - } - - override fun toString(): String { - return params.joinToString(",") - } - } - - open class SSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString(" ") - } - } - - class TSVParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("\t") - } - } - - class PIPESParams : CSVParams { - - constructor(params: List) : super(params) - - constructor(vararg params: String) : super(*params) - - override fun toString(): String { - return params.joinToString("|") - } - } - - class SPACEParams : SSVParams() -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt deleted file mode 100644 index 1804d1ae2bb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.JsonDataException -import com.squareup.moshi.Moshi -import retrofit2.Response - -@Throws(JsonDataException::class) -inline fun Response<*>.getErrorResponse(serializerBuilder: Moshi.Builder = Serializer.moshiBuilder): T? { - val serializer = serializerBuilder.build() - val parser = serializer.adapter(T::class.java) - val response = errorBody()?.string() - if(response != null) { - return parser.fromJson(response) - } - return null -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index a66c335904e..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index 4fbeccdbc00..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param apiKey (optional) - * @param petId Pet id to delete - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit { - val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param apiKey (optional) - * @param petId Pet id to delete - * @return RequestConfig - */ - fun deletePetRequestConfig(apiKey: kotlin.String?, petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 7a8dcc91cd4..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 7d40c8efbc2..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index ceb0fbc8fe6..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index ec768d1acef..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,58 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: kotlin.String? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 66667bf07cd..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,60 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A pet for sale in the pet store - * @param id - * @param category - * @param name - * @param photoUrls - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 944b1cd0a14..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 9697f07d5bf..00000000000 --- a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 7282e53200b..2abf02f23b4 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -248,7 +247,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index c8b93b33bf6..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 135bcdc790e..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import org.threeten.bp.LocalDate -import org.threeten.bp.LocalDateTime -import org.threeten.bp.LocalTime -import org.threeten.bp.OffsetDateTime -import org.threeten.bp.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index ff5439aeb42..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import org.threeten.bp.LocalDate -import org.threeten.bp.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index 710a9cc1317..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import org.threeten.bp.LocalDateTime -import org.threeten.bp.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 28b3eb3cd70..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import org.threeten.bp.OffsetDateTime -import org.threeten.bp.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index fafca8738f6..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,32 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index a4c17c3b49d..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index 300f94d8545..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: org.threeten.bp.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) { - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index a3df06cb6eb..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) { - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 6e619023a5c..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,29 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index af1e270325d..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) - diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 8ae5de40f5d..8467a2ab7da 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -20,7 +20,6 @@ import java.io.File import java.io.FileWriter import java.io.IOException import java.net.URLConnection -import java.util.Date import java.util.Locale import org.threeten.bp.LocalDate import org.threeten.bp.LocalDateTime @@ -248,7 +247,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt deleted file mode 100644 index e504c876ce6..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt +++ /dev/null @@ -1,89 +0,0 @@ -/** -* OpenAPI Petstore -* Test for issue 4062 -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.PetEnum - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Get enums - * - * @return PetEnum - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getEnum() : PetEnum { - val localVariableConfig = getEnumRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as PetEnum - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getEnum - * - * @return RequestConfig - */ - fun getEnumRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/enum", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index c34e9e42d08..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,232 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt deleted file mode 100644 index a447bf92052..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt +++ /dev/null @@ -1,43 +0,0 @@ -/** -* OpenAPI Petstore -* Test for issue 4062 -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json - -/** -* An enum with complex-ish naming -* Values: MY_FIRST_VALUE,MY_SECOND_VALUE -*/ - -enum class PetEnum(val value: kotlin.String){ - - - @Json(name = "myFirstValue") - MY_FIRST_VALUE("myFirstValue"), - - - @Json(name = "MY_SECOND_VALUE") - MY_SECOND_VALUE("MY_SECOND_VALUE"); - - - - /** - This override toString avoids using the enum var name and uses the actual api value instead. - In cases the var name and value are different, the client would send incorrect enums to the server. - **/ - override fun toString(): String { - return value - } - -} - diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 09194ef9271..dc423d8a17d 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -229,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt deleted file mode 100644 index c8b93b33bf6..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt +++ /dev/null @@ -1,492 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.ApiResponse -import org.openapitools.client.models.Pet - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun addPet(body: Pet) : Unit { - val localVariableConfig = addPetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation addPet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun addPetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { - val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deletePet - * - * @param petId Pet id to delete - * @param apiKey (optional) - * @return RequestConfig - */ - fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun findPetsByStatus(status: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByStatusRequestConfig(status = status) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByStatus - * - * @param status Status values that need to be considered for filter - * @return RequestConfig - */ - fun findPetsByStatusRequestConfig(status: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("status", toMultiValue(status.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByStatus", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTags(tags: kotlin.collections.List) : kotlin.collections.List { - val localVariableConfig = findPetsByTagsRequestConfig(tags = tags) - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation findPetsByTags - * - * @param tags Tags to filter by - * @return RequestConfig - */ - @Deprecated(message = "This operation is deprecated.") - fun findPetsByTagsRequestConfig(tags: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("tags", toMultiValue(tags.toList(), "csv")) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/findByTags", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return - * @return Pet - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getPetById(petId: kotlin.Long) : Pet { - val localVariableConfig = getPetByIdRequestConfig(petId = petId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Pet - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getPetById - * - * @param petId ID of pet to return - * @return RequestConfig - */ - fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePet(body: Pet) : Unit { - val localVariableConfig = updatePetRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePet - * - * @param body Pet object that needs to be added to the store - * @return RequestConfig - */ - fun updatePetRequestConfig(body: Pet) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/pet", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit { - val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updatePetWithForm - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return RequestConfig - */ - fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse { - val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation uploadFile - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return RequestConfig - */ - fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig { - val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file) - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt deleted file mode 100644 index 215ed63420c..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt +++ /dev/null @@ -1,253 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.Order - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteOrder(orderId: kotlin.String) : Unit { - val localVariableConfig = deleteOrderRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteOrder - * - * @param orderId ID of the order that needs to be deleted - * @return RequestConfig - */ - fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return kotlin.collections.Map - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getInventory() : kotlin.collections.Map { - val localVariableConfig = getInventoryRequestConfig() - - val localVarResponse = request>( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getInventory - * - * @return RequestConfig - */ - fun getInventoryRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/inventory", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getOrderById(orderId: kotlin.Long) : Order { - val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getOrderById - * - * @param orderId ID of pet that needs to be fetched - * @return RequestConfig - */ - fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun placeOrder(body: Order) : Order { - val localVariableConfig = placeOrderRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as Order - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation placeOrder - * - * @param body order placed for purchasing the pet - * @return RequestConfig - */ - fun placeOrderRequestConfig(body: Order) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/store/order", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt deleted file mode 100644 index 53748b93463..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt +++ /dev/null @@ -1,476 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.apis - -import org.openapitools.client.models.User - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2") - } - } - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUser(body: User) : Unit { - val localVariableConfig = createUserRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUser - * - * @param body Created user object - * @return RequestConfig - */ - fun createUserRequestConfig(body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithArrayInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithArray", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun createUsersWithListInput(body: kotlin.collections.List) : Unit { - val localVariableConfig = createUsersWithListInputRequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation createUsersWithListInput - * - * @param body List of user object - * @return RequestConfig - */ - fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.POST, - path = "/user/createWithList", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteUser(username: kotlin.String) : Unit { - val localVariableConfig = deleteUserRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation deleteUser - * - * @param username The name that needs to be deleted - * @return RequestConfig - */ - fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getUserByName(username: kotlin.String) : User { - val localVariableConfig = getUserByNameRequestConfig(username = username) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as User - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation getUserByName - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return RequestConfig - */ - fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String { - val localVariableConfig = loginUserRequestConfig(username = username, password = password) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation loginUser - * - * @param username The user name for login - * @param password The password for login in clear text - * @return RequestConfig - */ - fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf>() - .apply { - put("username", listOf(username.toString())) - put("password", listOf(password.toString())) - } - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/login", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Logs out current logged in user session - * - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun logoutUser() : Unit { - val localVariableConfig = logoutUserRequestConfig() - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation logoutUser - * - * @return RequestConfig - */ - fun logoutUserRequestConfig() : RequestConfig { - val localVariableBody: kotlin.Any? = null - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.GET, - path = "/user/logout", - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun updateUser(username: kotlin.String, body: User) : Unit { - val localVariableConfig = updateUserRequestConfig(username = username, body = body) - - val localVarResponse = request( - localVariableConfig - ) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * To obtain the request config of the operation updateUser - * - * @param username name that need to be deleted - * @param body Updated user object - * @return RequestConfig - */ - fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig { - val localVariableBody: kotlin.Any? = body - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - - val localVariableConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/user/{username}".replace("{"+"username"+"}", "$username"), - query = localVariableQuery, - headers = localVariableHeaders, - body = localVariableBody - ) - - return localVariableConfig - } - -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a6..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index 7a8dcc91cd4..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,251 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Credentials -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.MultipartBody -import java.io.File -import java.net.URLConnection -import java.util.Date -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime - -open class ApiClient(val baseUrl: String) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - - @JvmStatic - val client: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = - when { - content is File -> content.asRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == FormDataMediaType -> { - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" - ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) - } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) - addPart( - partHeaders, - parameterToString(value).toRequestBody(null) - ) - } - } - }.build() - } - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map - @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) - } - }.build() - } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - protected fun updateAuthParams(requestConfig: RequestConfig) { - if (requestConfig.headers["api_key"].isNullOrEmpty()) { - if (apiKey["api_key"] != null) { - if (apiKeyPrefix["api_key"] != null) { - requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!! - } else { - requestConfig.headers["api_key"] = apiKey["api_key"]!! - } - } - } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } - } - - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - // take authMethod from operation - updateAuthParams(requestConfig) - - val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() - - // TODO: handle specific mapping types. e.g. Map> - when { - response.isRedirect -> return Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> return Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> return Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> return ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> return ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String { - when (value) { - null -> { - return "" - } - is Array<*> -> { - return toMultiValue(value, "csv").toString() - } - is Iterable<*> -> { - return toMultiValue(value, "csv").toString() - } - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> { - return parseDateToQueryString(value) - } - else -> { - return value.toString() - } - } - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt deleted file mode 100644 index 9dc8d8dbbfa..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiInfrastructureResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiInfrastructureResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiInfrastructureResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee8..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f13..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479a..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db94811..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a31..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 0f2790f370e..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val body: kotlin.Any? = null -) \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd7..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc14..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index 9a45b67d9b1..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory -import java.util.Date - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(KotlinJsonAdapterFactory()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index a4a44cc18b7..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String) = UUID.fromString(s) -} diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt deleted file mode 100644 index 7d40c8efbc2..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt +++ /dev/null @@ -1,38 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * Describes the result of uploading an image resource - * @param code - * @param type - * @param message - */ - -data class ApiResponse ( - @Json(name = "code") - val code: kotlin.Int? = null, - @Json(name = "type") - val type: kotlin.String? = null, - @Json(name = "message") - val message: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt deleted file mode 100644 index ceb0fbc8fe6..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A category for a pet - * @param id - * @param name - */ - -data class Category ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt deleted file mode 100644 index ed8f8b13a43..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt +++ /dev/null @@ -1,58 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate - * @param status Order Status - * @param complete - */ - -data class Order ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "petId") - val petId: kotlin.Long? = null, - @Json(name = "quantity") - val quantity: kotlin.Int? = null, - @Json(name = "shipDate") - val shipDate: java.time.OffsetDateTime? = null, - /* Order Status */ - @Json(name = "status") - val status: Order.Status? = null, - @Json(name = "complete") - val complete: kotlin.Boolean? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * Order Status - * Values: placed,approved,delivered - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "placed") placed("placed"), - @Json(name = "approved") approved("approved"), - @Json(name = "delivered") delivered("delivered"); - } -} - diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt deleted file mode 100644 index 105f485f021..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt +++ /dev/null @@ -1,60 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - -import org.openapitools.client.models.Category -import org.openapitools.client.models.Tag - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A pet for sale in the pet store - * @param name - * @param photoUrls - * @param id - * @param category - * @param tags - * @param status pet status in the store - */ - -data class Pet ( - @Json(name = "name") - val name: kotlin.String, - @Json(name = "photoUrls") - val photoUrls: kotlin.collections.List, - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "category") - val category: Category? = null, - @Json(name = "tags") - val tags: kotlin.collections.List? = null, - /* pet status in the store */ - @Json(name = "status") - val status: Pet.Status? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - - /** - * pet status in the store - * Values: available,pending,sold - */ - - enum class Status(val value: kotlin.String){ - @Json(name = "available") available("available"), - @Json(name = "pending") pending("pending"), - @Json(name = "sold") sold("sold"); - } -} - diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt deleted file mode 100644 index 944b1cd0a14..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A tag for a pet - * @param id - * @param name - */ - -data class Tag ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "name") - val name: kotlin.String? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt deleted file mode 100644 index 9697f07d5bf..00000000000 --- a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt +++ /dev/null @@ -1,54 +0,0 @@ -/** -* OpenAPI Petstore -* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import java.io.Serializable - -/** - * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone - * @param userStatus User Status - */ - -data class User ( - @Json(name = "id") - val id: kotlin.Long? = null, - @Json(name = "username") - val username: kotlin.String? = null, - @Json(name = "firstName") - val firstName: kotlin.String? = null, - @Json(name = "lastName") - val lastName: kotlin.String? = null, - @Json(name = "email") - val email: kotlin.String? = null, - @Json(name = "password") - val password: kotlin.String? = null, - @Json(name = "phone") - val phone: kotlin.String? = null, - /* User Status */ - @Json(name = "userStatus") - val userStatus: kotlin.Int? = null -) : Serializable { - companion object { - private const val serialVersionUID: Long = 123 - } - -} - diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 7282e53200b..2abf02f23b4 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -25,7 +25,6 @@ import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter @@ -248,7 +247,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index dd34bd48b2c..00000000000 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.client.infrastructure - -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -object ApplicationDelegates { - /** - * Provides a property delegate, allowing the property to be set once and only once. - * - * If unset (no default value), a get on the property will throw [IllegalStateException]. - */ - fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - private var isSet = false - private var value: T? = defaultValue - - override fun getValue(thisRef: Any?, property: KProperty<*>): T { - return value ?: throw IllegalStateException("${property.name} not initialized") - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { - if (!isSet) { - this.value = value - isSet = true - } - } - } -} \ No newline at end of file diff --git a/samples/server/petstore/kotlin-server/ktor/.openapi-generator-ignore b/samples/server/petstore/kotlin-server/ktor/.openapi-generator-ignore index cabbe3494d4..7484ee590a3 100644 --- a/samples/server/petstore/kotlin-server/ktor/.openapi-generator-ignore +++ b/samples/server/petstore/kotlin-server/ktor/.openapi-generator-ignore @@ -1,3 +1,23 @@ # OpenAPI Generator Ignore -pom.xml +# Generated by openapi-generator https://github.com/openapitools/openapi-generator +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject.kt deleted file mode 100644 index 257970fa6be..00000000000 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.openapitools.model - -import java.util.Objects -import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.constraints.DecimalMax -import javax.validation.constraints.DecimalMin -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.NotNull -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size -import javax.validation.Valid -import io.swagger.annotations.ApiModelProperty - -/** - * - * @param name Updated name of the pet - * @param status Updated status of the pet - */ -data class InlineObject( - - @ApiModelProperty(example = "null", value = "Updated name of the pet") - @field:JsonProperty("name") val name: kotlin.String? = null, - - @ApiModelProperty(example = "null", value = "Updated status of the pet") - @field:JsonProperty("status") val status: kotlin.String? = null -) { - -} - diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject1.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject1.kt deleted file mode 100644 index 60e6e76df23..00000000000 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/InlineObject1.kt +++ /dev/null @@ -1,31 +0,0 @@ -package org.openapitools.model - -import java.util.Objects -import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.constraints.DecimalMax -import javax.validation.constraints.DecimalMin -import javax.validation.constraints.Max -import javax.validation.constraints.Min -import javax.validation.constraints.NotNull -import javax.validation.constraints.Pattern -import javax.validation.constraints.Size -import javax.validation.Valid -import io.swagger.annotations.ApiModelProperty - -/** - * - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - */ -data class InlineObject1( - - @ApiModelProperty(example = "null", value = "Additional data to pass to server") - @field:JsonProperty("additionalMetadata") val additionalMetadata: kotlin.String? = null, - - @field:Valid - @ApiModelProperty(example = "null", value = "file to upload") - @field:JsonProperty("file") val file: org.springframework.core.io.Resource? = null -) { - -} - diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES index 612ea14bbdb..50a9d2bc75d 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES @@ -5,13 +5,13 @@ settings.gradle src/main/kotlin/org/openapitools/Application.kt src/main/kotlin/org/openapitools/api/ApiUtil.kt src/main/kotlin/org/openapitools/api/Exceptions.kt -src/main/kotlin/org/openapitools/api/PetApi.kt +src/main/kotlin/org/openapitools/api/PetApiController.kt src/main/kotlin/org/openapitools/api/PetApiService.kt src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/StoreApi.kt +src/main/kotlin/org/openapitools/api/StoreApiController.kt src/main/kotlin/org/openapitools/api/StoreApiService.kt src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/UserApi.kt +src/main/kotlin/org/openapitools/api/UserApiController.kt src/main/kotlin/org/openapitools/api/UserApiService.kt src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt src/main/kotlin/org/openapitools/model/Category.kt diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION index 3fa3b389a57..4077803655c 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION +++ b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts b/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts index 2b99799bd53..ea7f93398da 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts @@ -30,7 +30,7 @@ plugins { } dependencies { - val kotlinxCoroutinesVersion="1.2.0" + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-web") @@ -46,7 +46,7 @@ dependencies { } repositories { - maven { url = uri("https://repo1.maven.org/maven2") } - maven { url = uri("https://repo.spring.io/snapshot") } - maven { url = uri("https://repo.spring.io/milestone") } + maven { url = uri("https://repo1.maven.org/maven2") } + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml b/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml index 1bfa3bec626..f7094ec0e10 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml +++ b/samples/server/petstore/kotlin-springboot-modelMutable/pom.xml @@ -7,7 +7,7 @@ 1.0.0 1.3.30 - 1.2.0 + 1.2.0 1.3.5 @@ -111,8 +111,8 @@ - javax.validation - validation-api + jakarta.validation + jakarta.validation-api jakarta.annotation @@ -127,34 +127,34 @@ test - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/settings.gradle b/samples/server/petstore/kotlin-springboot-modelMutable/settings.gradle index e9bd5d32d7c..14844905cd4 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/settings.gradle +++ b/samples/server/petstore/kotlin-springboot-modelMutable/settings.gradle @@ -1,15 +1,15 @@ pluginManagement { - repositories { - maven { url = uri("https://repo.spring.io/snapshot") } - maven { url = uri("https://repo.spring.io/milestone") } - gradlePluginPortal() - } - resolutionStrategy { - eachPlugin { - if (requested.id.id == "org.springframework.boot") { - useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") - } - } - } + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } } -rootProject.name = "openapi-spring" \ No newline at end of file +rootProject.name = "openapi-spring" diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt similarity index 95% rename from samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt rename to samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt index 9de503175ac..a26504324da 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -43,7 +43,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 405, message = "Invalid input")]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/pet"], consumes = ["application/json", "application/xml"] ) @@ -59,7 +60,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid pet value")]) - @DeleteMapping( + @RequestMapping( + method = [RequestMethod.DELETE], value = ["/pet/{petId}"] ) fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long @@ -77,7 +79,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"] ) @@ -95,7 +98,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/pet/findByTags"], produces = ["application/xml", "application/json"] ) @@ -112,7 +116,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/pet/{petId}"], produces = ["application/xml", "application/json"] ) @@ -128,7 +133,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) - @PutMapping( + @RequestMapping( + method = [RequestMethod.PUT], value = ["/pet"], consumes = ["application/json", "application/xml"] ) @@ -144,7 +150,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 405, message = "Invalid input")]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/pet/{petId}"], consumes = ["application/x-www-form-urlencoded"] ) @@ -163,7 +170,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/pet/{petId}/uploadImage"], produces = ["application/json"], consumes = ["multipart/form-data"] diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt index f3f2fd68b6c..ee0e3bef83c 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -2,21 +2,93 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet + interface PetApiService { - fun addPet(body: Pet): Unit + /** + * POST /pet : Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid input (status code 405) + * @see PetApi#addPet + */ + fun addPet(body: Pet): Unit - fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit + /** + * DELETE /pet/{petId} : Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return Invalid pet value (status code 400) + * @see PetApi#deletePet + */ + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit - fun findPetsByStatus(status: kotlin.collections.List): List + /** + * GET /pet/findByStatus : Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * @param status Status values that need to be considered for filter (required) + * @return successful operation (status code 200) + * or Invalid status value (status code 400) + * @see PetApi#findPetsByStatus + */ + fun findPetsByStatus(status: kotlin.collections.List): List - fun findPetsByTags(tags: kotlin.collections.List): List + /** + * GET /pet/findByTags : Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @param tags Tags to filter by (required) + * @return successful operation (status code 200) + * or Invalid tag value (status code 400) + * @deprecated + * @see PetApi#findPetsByTags + */ + fun findPetsByTags(tags: kotlin.collections.List): List - fun getPetById(petId: kotlin.Long): Pet + /** + * GET /pet/{petId} : Find pet by ID + * Returns a single pet + * + * @param petId ID of pet to return (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * @see PetApi#getPetById + */ + fun getPetById(petId: kotlin.Long): Pet - fun updatePet(body: Pet): Unit + /** + * PUT /pet : Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return Invalid ID supplied (status code 400) + * or Pet not found (status code 404) + * or Validation exception (status code 405) + * @see PetApi#updatePet + */ + fun updatePet(body: Pet): Unit - fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit + /** + * POST /pet/{petId} : Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return Invalid input (status code 405) + * @see PetApi#updatePetWithForm + */ + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + /** + * POST /pet/{petId}/uploadImage : uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return successful operation (status code 200) + * @see PetApi#uploadFile + */ + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt similarity index 94% rename from samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt rename to samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 3b82141c4df..e2be73b4ec3 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -41,7 +41,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @DeleteMapping( + @RequestMapping( + method = [RequestMethod.DELETE], value = ["/store/order/{orderId}"] ) fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String @@ -58,7 +59,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/store/inventory"], produces = ["application/json"] ) @@ -73,7 +75,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"] ) @@ -89,7 +92,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/store/order"], produces = ["application/xml", "application/json"] ) diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt index d4a4ef9507f..6de3e6cc1de 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -1,13 +1,48 @@ package org.openapitools.api import org.openapitools.model.Order + interface StoreApiService { - fun deleteOrder(orderId: kotlin.String): Unit + /** + * DELETE /store/order/{orderId} : Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @param orderId ID of the order that needs to be deleted (required) + * @return Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#deleteOrder + */ + fun deleteOrder(orderId: kotlin.String): Unit - fun getInventory(): Map + /** + * GET /store/inventory : Returns pet inventories by status + * Returns a map of status codes to quantities + * + * @return successful operation (status code 200) + * @see StoreApi#getInventory + */ + fun getInventory(): Map - fun getOrderById(orderId: kotlin.Long): Order + /** + * GET /store/order/{orderId} : Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @param orderId ID of pet that needs to be fetched (required) + * @return successful operation (status code 200) + * or Invalid ID supplied (status code 400) + * or Order not found (status code 404) + * @see StoreApi#getOrderById + */ + fun getOrderById(orderId: kotlin.Long): Order - fun placeOrder(body: Order): Order + /** + * POST /store/order : Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return successful operation (status code 200) + * or Invalid Order (status code 400) + * @see StoreApi#placeOrder + */ + fun placeOrder(body: Order): Order } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt similarity index 92% rename from samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt rename to samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt index 7071afde110..f7c4144fbdb 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -41,7 +41,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "This can only be done by the logged in user.") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/user"] ) fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User @@ -55,7 +56,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/user/createWithArray"] ) fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List @@ -69,7 +71,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @PostMapping( + @RequestMapping( + method = [RequestMethod.POST], value = ["/user/createWithList"] ) fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List @@ -83,7 +86,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "This can only be done by the logged in user.") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @DeleteMapping( + @RequestMapping( + method = [RequestMethod.DELETE], value = ["/user/{username}"] ) fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String @@ -98,7 +102,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = User::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/user/{username}"], produces = ["application/xml", "application/json"] ) @@ -114,7 +119,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = kotlin.String::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/user/login"], produces = ["application/xml", "application/json"] ) @@ -130,7 +136,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @GetMapping( + @RequestMapping( + method = [RequestMethod.GET], value = ["/user/logout"] ) fun logoutUser(): ResponseEntity { @@ -143,7 +150,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "This can only be done by the logged in user.") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) - @PutMapping( + @RequestMapping( + method = [RequestMethod.PUT], value = ["/user/{username}"] ) fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt index 491705c3b50..a1bcf6be237 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -1,21 +1,87 @@ package org.openapitools.api import org.openapitools.model.User + interface UserApiService { - fun createUser(body: User): Unit + /** + * POST /user : Create user + * This can only be done by the logged in user. + * + * @param body Created user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUser + */ + fun createUser(body: User): Unit - fun createUsersWithArrayInput(body: kotlin.collections.List): Unit + /** + * POST /user/createWithArray : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithArrayInput + */ + fun createUsersWithArrayInput(body: kotlin.collections.List): Unit - fun createUsersWithListInput(body: kotlin.collections.List): Unit + /** + * POST /user/createWithList : Creates list of users with given input array + * + * @param body List of user object (required) + * @return successful operation (status code 200) + * @see UserApi#createUsersWithListInput + */ + fun createUsersWithListInput(body: kotlin.collections.List): Unit - fun deleteUser(username: kotlin.String): Unit + /** + * DELETE /user/{username} : Delete user + * This can only be done by the logged in user. + * + * @param username The name that needs to be deleted (required) + * @return Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#deleteUser + */ + fun deleteUser(username: kotlin.String): Unit - fun getUserByName(username: kotlin.String): User + /** + * GET /user/{username} : Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return successful operation (status code 200) + * or Invalid username supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#getUserByName + */ + fun getUserByName(username: kotlin.String): User - fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String + /** + * GET /user/login : Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return successful operation (status code 200) + * or Invalid username/password supplied (status code 400) + * @see UserApi#loginUser + */ + fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String - fun logoutUser(): Unit + /** + * GET /user/logout : Logs out current logged in user session + * + * @return successful operation (status code 200) + * @see UserApi#logoutUser + */ + fun logoutUser(): Unit - fun updateUser(username: kotlin.String, body: User): Unit + /** + * PUT /user/{username} : Updated user + * This can only be done by the logged in user. + * + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return Invalid user supplied (status code 400) + * or User not found (status code 404) + * @see UserApi#updateUser + */ + fun updateUser(username: kotlin.String, body: User): Unit } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt index d621c166966..0d3ccd3989f 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -3,7 +3,6 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet import org.junit.jupiter.api.Test - import org.springframework.http.ResponseEntity class PetApiTest { @@ -11,138 +10,121 @@ class PetApiTest { private val service: PetApiService = PetApiServiceImpl() private val api: PetApiController = PetApiController(service) - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.addPet + * + * @throws ApiException + * if the Api call fails + */ @Test fun addPetTest() { - val body:Pet? = null - val response: ResponseEntity = api.addPet(body!!) + val body:Pet = TODO() + val response: ResponseEntity = api.addPet(body) // TODO: test validations } - + /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.deletePet + * + * @throws ApiException + * if the Api call fails + */ @Test fun deletePetTest() { - val petId:kotlin.Long? = null - val apiKey:kotlin.String? = null - val response: ResponseEntity = api.deletePet(petId!!, apiKey!!) + val petId:kotlin.Long = TODO() + val apiKey:kotlin.String? = TODO() + val response: ResponseEntity = api.deletePet(petId, apiKey) // TODO: test validations } - + /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.findPetsByStatus + * + * @throws ApiException + * if the Api call fails + */ @Test fun findPetsByStatusTest() { - val status:kotlin.collections.List? = null - val response: ResponseEntity> = api.findPetsByStatus(status!!) + val status:kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByStatus(status) // TODO: test validations } - + /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.findPetsByTags + * + * @throws ApiException + * if the Api call fails + */ @Test fun findPetsByTagsTest() { - val tags:kotlin.collections.List? = null - val response: ResponseEntity> = api.findPetsByTags(tags!!) + val tags:kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByTags(tags) // TODO: test validations } - + /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.getPetById + * + * @throws ApiException + * if the Api call fails + */ @Test fun getPetByIdTest() { - val petId:kotlin.Long? = null - val response: ResponseEntity = api.getPetById(petId!!) + val petId:kotlin.Long = TODO() + val response: ResponseEntity = api.getPetById(petId) // TODO: test validations } - + /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.updatePet + * + * @throws ApiException + * if the Api call fails + */ @Test fun updatePetTest() { - val body:Pet? = null - val response: ResponseEntity = api.updatePet(body!!) + val body:Pet = TODO() + val response: ResponseEntity = api.updatePet(body) // TODO: test validations } - + /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.updatePetWithForm + * + * @throws ApiException + * if the Api call fails + */ @Test fun updatePetWithFormTest() { - val petId:kotlin.Long? = null - val name:kotlin.String? = null - val status:kotlin.String? = null - val response: ResponseEntity = api.updatePetWithForm(petId!!, name!!, status!!) + val petId:kotlin.Long = TODO() + val name:kotlin.String? = TODO() + val status:kotlin.String? = TODO() + val response: ResponseEntity = api.updatePetWithForm(petId, name, status) // TODO: test validations } - + /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.uploadFile + * + * @throws ApiException + * if the Api call fails + */ @Test fun uploadFileTest() { - val petId:kotlin.Long? = null - val additionalMetadata:kotlin.String? = null - val file:org.springframework.core.io.Resource? = null - val response: ResponseEntity = api.uploadFile(petId!!, additionalMetadata!!, file!!) + val petId:kotlin.Long = TODO() + val additionalMetadata:kotlin.String? = TODO() + val file:org.springframework.core.io.Resource? = TODO() + val response: ResponseEntity = api.uploadFile(petId, additionalMetadata, file) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt index 82b91cd652b..fcb00e99e99 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.Order import org.junit.jupiter.api.Test - import org.springframework.http.ResponseEntity class StoreApiTest { @@ -10,68 +9,59 @@ class StoreApiTest { private val service: StoreApiService = StoreApiServiceImpl() private val api: StoreApiController = StoreApiController(service) - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.deleteOrder + * + * @throws ApiException + * if the Api call fails + */ @Test fun deleteOrderTest() { - val orderId:kotlin.String? = null - val response: ResponseEntity = api.deleteOrder(orderId!!) + val orderId:kotlin.String = TODO() + val response: ResponseEntity = api.deleteOrder(orderId) // TODO: test validations } - + /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.getInventory + * + * @throws ApiException + * if the Api call fails + */ @Test fun getInventoryTest() { val response: ResponseEntity> = api.getInventory() // TODO: test validations } - + /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.getOrderById + * + * @throws ApiException + * if the Api call fails + */ @Test fun getOrderByIdTest() { - val orderId:kotlin.Long? = null - val response: ResponseEntity = api.getOrderById(orderId!!) + val orderId:kotlin.Long = TODO() + val response: ResponseEntity = api.getOrderById(orderId) // TODO: test validations } - + /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.placeOrder + * + * @throws ApiException + * if the Api call fails + */ @Test fun placeOrderTest() { - val body:Order? = null - val response: ResponseEntity = api.placeOrder(body!!) + val body:Order = TODO() + val response: ResponseEntity = api.placeOrder(body) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt index 14917f70aeb..c3f07290cfe 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.User import org.junit.jupiter.api.Test - import org.springframework.http.ResponseEntity class UserApiTest { @@ -10,134 +9,117 @@ class UserApiTest { private val service: UserApiService = UserApiServiceImpl() private val api: UserApiController = UserApiController(service) - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUserTest() { - val body:User? = null - val response: ResponseEntity = api.createUser(body!!) + val body:User = TODO() + val response: ResponseEntity = api.createUser(body) // TODO: test validations } - + /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUsersWithArrayInput + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUsersWithArrayInputTest() { - val body:kotlin.collections.List? = null - val response: ResponseEntity = api.createUsersWithArrayInput(body!!) + val body:kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithArrayInput(body) // TODO: test validations } - + /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUsersWithListInput + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUsersWithListInputTest() { - val body:kotlin.collections.List? = null - val response: ResponseEntity = api.createUsersWithListInput(body!!) + val body:kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithListInput(body) // TODO: test validations } - + /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.deleteUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun deleteUserTest() { - val username:kotlin.String? = null - val response: ResponseEntity = api.deleteUser(username!!) + val username:kotlin.String = TODO() + val response: ResponseEntity = api.deleteUser(username) // TODO: test validations } - + /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.getUserByName + * + * @throws ApiException + * if the Api call fails + */ @Test fun getUserByNameTest() { - val username:kotlin.String? = null - val response: ResponseEntity = api.getUserByName(username!!) + val username:kotlin.String = TODO() + val response: ResponseEntity = api.getUserByName(username) // TODO: test validations } - + /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.loginUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun loginUserTest() { - val username:kotlin.String? = null - val password:kotlin.String? = null - val response: ResponseEntity = api.loginUser(username!!, password!!) + val username:kotlin.String = TODO() + val password:kotlin.String = TODO() + val response: ResponseEntity = api.loginUser(username, password) // TODO: test validations } - + /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.logoutUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun logoutUserTest() { val response: ResponseEntity = api.logoutUser() // TODO: test validations } - + /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.updateUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun updateUserTest() { - val username:kotlin.String? = null - val body:User? = null - val response: ResponseEntity = api.updateUser(username!!, body!!) + val username:kotlin.String = TODO() + val body:User = TODO() + val response: ResponseEntity = api.updateUser(username, body) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt index f43c6ecf7ca..bbc9b118e24 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -3,7 +3,6 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet import org.junit.jupiter.api.Test - import kotlinx.coroutines.flow.Flow; import kotlinx.coroutines.test.runBlockingTest import org.springframework.http.ResponseEntity @@ -13,138 +12,121 @@ class PetApiTest { private val service: PetApiService = PetApiServiceImpl() private val api: PetApiController = PetApiController(service) - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.addPet + * + * @throws ApiException + * if the Api call fails + */ @Test fun addPetTest() = runBlockingTest { - val body:Pet? = null - val response: ResponseEntity = api.addPet(body!!) + val body:Pet = TODO() + val response: ResponseEntity = api.addPet(body) // TODO: test validations } - + /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.deletePet + * + * @throws ApiException + * if the Api call fails + */ @Test fun deletePetTest() = runBlockingTest { - val petId:kotlin.Long? = null - val apiKey:kotlin.String? = null - val response: ResponseEntity = api.deletePet(petId!!, apiKey!!) + val petId:kotlin.Long = TODO() + val apiKey:kotlin.String? = TODO() + val response: ResponseEntity = api.deletePet(petId, apiKey) // TODO: test validations } - + /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.findPetsByStatus + * + * @throws ApiException + * if the Api call fails + */ @Test fun findPetsByStatusTest() = runBlockingTest { - val status:kotlin.collections.List? = null - val response: ResponseEntity> = api.findPetsByStatus(status!!) + val status:kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByStatus(status) // TODO: test validations } - + /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.findPetsByTags + * + * @throws ApiException + * if the Api call fails + */ @Test fun findPetsByTagsTest() = runBlockingTest { - val tags:kotlin.collections.List? = null - val response: ResponseEntity> = api.findPetsByTags(tags!!) + val tags:kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByTags(tags) // TODO: test validations } - + /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.getPetById + * + * @throws ApiException + * if the Api call fails + */ @Test fun getPetByIdTest() = runBlockingTest { - val petId:kotlin.Long? = null - val response: ResponseEntity = api.getPetById(petId!!) + val petId:kotlin.Long = TODO() + val response: ResponseEntity = api.getPetById(petId) // TODO: test validations } - + /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.updatePet + * + * @throws ApiException + * if the Api call fails + */ @Test fun updatePetTest() = runBlockingTest { - val body:Pet? = null - val response: ResponseEntity = api.updatePet(body!!) + val body:Pet = TODO() + val response: ResponseEntity = api.updatePet(body) // TODO: test validations } - + /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.updatePetWithForm + * + * @throws ApiException + * if the Api call fails + */ @Test fun updatePetWithFormTest() = runBlockingTest { - val petId:kotlin.Long? = null - val name:kotlin.String? = null - val status:kotlin.String? = null - val response: ResponseEntity = api.updatePetWithForm(petId!!, name!!, status!!) + val petId:kotlin.Long = TODO() + val name:kotlin.String? = TODO() + val status:kotlin.String? = TODO() + val response: ResponseEntity = api.updatePetWithForm(petId, name, status) // TODO: test validations } - + /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.uploadFile + * + * @throws ApiException + * if the Api call fails + */ @Test fun uploadFileTest() = runBlockingTest { - val petId:kotlin.Long? = null - val additionalMetadata:kotlin.String? = null - val file:org.springframework.core.io.Resource? = null - val response: ResponseEntity = api.uploadFile(petId!!, additionalMetadata!!, file!!) + val petId:kotlin.Long = TODO() + val additionalMetadata:kotlin.String? = TODO() + val file:org.springframework.core.io.Resource? = TODO() + val response: ResponseEntity = api.uploadFile(petId, additionalMetadata, file) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt index 31c0a2e0713..1db01446d86 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.Order import org.junit.jupiter.api.Test - import kotlinx.coroutines.flow.Flow; import kotlinx.coroutines.test.runBlockingTest import org.springframework.http.ResponseEntity @@ -12,68 +11,59 @@ class StoreApiTest { private val service: StoreApiService = StoreApiServiceImpl() private val api: StoreApiController = StoreApiController(service) - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.deleteOrder + * + * @throws ApiException + * if the Api call fails + */ @Test fun deleteOrderTest() = runBlockingTest { - val orderId:kotlin.String? = null - val response: ResponseEntity = api.deleteOrder(orderId!!) + val orderId:kotlin.String = TODO() + val response: ResponseEntity = api.deleteOrder(orderId) // TODO: test validations } - + /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.getInventory + * + * @throws ApiException + * if the Api call fails + */ @Test fun getInventoryTest() = runBlockingTest { val response: ResponseEntity> = api.getInventory() // TODO: test validations } - + /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.getOrderById + * + * @throws ApiException + * if the Api call fails + */ @Test fun getOrderByIdTest() = runBlockingTest { - val orderId:kotlin.Long? = null - val response: ResponseEntity = api.getOrderById(orderId!!) + val orderId:kotlin.Long = TODO() + val response: ResponseEntity = api.getOrderById(orderId) // TODO: test validations } - + /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.placeOrder + * + * @throws ApiException + * if the Api call fails + */ @Test fun placeOrderTest() = runBlockingTest { - val body:Order? = null - val response: ResponseEntity = api.placeOrder(body!!) + val body:Order = TODO() + val response: ResponseEntity = api.placeOrder(body) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt index 3d467deb14f..126e0700f79 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.User import org.junit.jupiter.api.Test - import kotlinx.coroutines.flow.Flow; import kotlinx.coroutines.test.runBlockingTest import org.springframework.http.ResponseEntity @@ -12,134 +11,117 @@ class UserApiTest { private val service: UserApiService = UserApiServiceImpl() private val api: UserApiController = UserApiController(service) - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUserTest() = runBlockingTest { - val body:User? = null - val response: ResponseEntity = api.createUser(body!!) + val body:User = TODO() + val response: ResponseEntity = api.createUser(body) // TODO: test validations } - + /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUsersWithArrayInput + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUsersWithArrayInputTest() = runBlockingTest { - val body:kotlin.collections.List? = null - val response: ResponseEntity = api.createUsersWithArrayInput(body!!) + val body:kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithArrayInput(body) // TODO: test validations } - + /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUsersWithListInput + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUsersWithListInputTest() = runBlockingTest { - val body:kotlin.collections.List? = null - val response: ResponseEntity = api.createUsersWithListInput(body!!) + val body:kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithListInput(body) // TODO: test validations } - + /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.deleteUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun deleteUserTest() = runBlockingTest { - val username:kotlin.String? = null - val response: ResponseEntity = api.deleteUser(username!!) + val username:kotlin.String = TODO() + val response: ResponseEntity = api.deleteUser(username) // TODO: test validations } - + /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.getUserByName + * + * @throws ApiException + * if the Api call fails + */ @Test fun getUserByNameTest() = runBlockingTest { - val username:kotlin.String? = null - val response: ResponseEntity = api.getUserByName(username!!) + val username:kotlin.String = TODO() + val response: ResponseEntity = api.getUserByName(username) // TODO: test validations } - + /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.loginUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun loginUserTest() = runBlockingTest { - val username:kotlin.String? = null - val password:kotlin.String? = null - val response: ResponseEntity = api.loginUser(username!!, password!!) + val username:kotlin.String = TODO() + val password:kotlin.String = TODO() + val response: ResponseEntity = api.loginUser(username, password) // TODO: test validations } - + /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.logoutUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun logoutUserTest() = runBlockingTest { val response: ResponseEntity = api.logoutUser() // TODO: test validations } - + /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.updateUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun updateUserTest() = runBlockingTest { - val username:kotlin.String? = null - val body:User? = null - val response: ResponseEntity = api.updateUser(username!!, body!!) + val username:kotlin.String = TODO() + val body:User = TODO() + val response: ResponseEntity = api.updateUser(username, body) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt index d621c166966..0d3ccd3989f 100644 --- a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt +++ b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -3,7 +3,6 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet import org.junit.jupiter.api.Test - import org.springframework.http.ResponseEntity class PetApiTest { @@ -11,138 +10,121 @@ class PetApiTest { private val service: PetApiService = PetApiServiceImpl() private val api: PetApiController = PetApiController(service) - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.addPet + * + * @throws ApiException + * if the Api call fails + */ @Test fun addPetTest() { - val body:Pet? = null - val response: ResponseEntity = api.addPet(body!!) + val body:Pet = TODO() + val response: ResponseEntity = api.addPet(body) // TODO: test validations } - + /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.deletePet + * + * @throws ApiException + * if the Api call fails + */ @Test fun deletePetTest() { - val petId:kotlin.Long? = null - val apiKey:kotlin.String? = null - val response: ResponseEntity = api.deletePet(petId!!, apiKey!!) + val petId:kotlin.Long = TODO() + val apiKey:kotlin.String? = TODO() + val response: ResponseEntity = api.deletePet(petId, apiKey) // TODO: test validations } - + /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.findPetsByStatus + * + * @throws ApiException + * if the Api call fails + */ @Test fun findPetsByStatusTest() { - val status:kotlin.collections.List? = null - val response: ResponseEntity> = api.findPetsByStatus(status!!) + val status:kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByStatus(status) // TODO: test validations } - + /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.findPetsByTags + * + * @throws ApiException + * if the Api call fails + */ @Test fun findPetsByTagsTest() { - val tags:kotlin.collections.List? = null - val response: ResponseEntity> = api.findPetsByTags(tags!!) + val tags:kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByTags(tags) // TODO: test validations } - + /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.getPetById + * + * @throws ApiException + * if the Api call fails + */ @Test fun getPetByIdTest() { - val petId:kotlin.Long? = null - val response: ResponseEntity = api.getPetById(petId!!) + val petId:kotlin.Long = TODO() + val response: ResponseEntity = api.getPetById(petId) // TODO: test validations } - + /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.updatePet + * + * @throws ApiException + * if the Api call fails + */ @Test fun updatePetTest() { - val body:Pet? = null - val response: ResponseEntity = api.updatePet(body!!) + val body:Pet = TODO() + val response: ResponseEntity = api.updatePet(body) // TODO: test validations } - + /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.updatePetWithForm + * + * @throws ApiException + * if the Api call fails + */ @Test fun updatePetWithFormTest() { - val petId:kotlin.Long? = null - val name:kotlin.String? = null - val status:kotlin.String? = null - val response: ResponseEntity = api.updatePetWithForm(petId!!, name!!, status!!) + val petId:kotlin.Long = TODO() + val name:kotlin.String? = TODO() + val status:kotlin.String? = TODO() + val response: ResponseEntity = api.updatePetWithForm(petId, name, status) // TODO: test validations } - + /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test PetApiController.uploadFile + * + * @throws ApiException + * if the Api call fails + */ @Test fun uploadFileTest() { - val petId:kotlin.Long? = null - val additionalMetadata:kotlin.String? = null - val file:org.springframework.core.io.Resource? = null - val response: ResponseEntity = api.uploadFile(petId!!, additionalMetadata!!, file!!) + val petId:kotlin.Long = TODO() + val additionalMetadata:kotlin.String? = TODO() + val file:org.springframework.core.io.Resource? = TODO() + val response: ResponseEntity = api.uploadFile(petId, additionalMetadata, file) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt index 82b91cd652b..fcb00e99e99 100644 --- a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt +++ b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.Order import org.junit.jupiter.api.Test - import org.springframework.http.ResponseEntity class StoreApiTest { @@ -10,68 +9,59 @@ class StoreApiTest { private val service: StoreApiService = StoreApiServiceImpl() private val api: StoreApiController = StoreApiController(service) - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.deleteOrder + * + * @throws ApiException + * if the Api call fails + */ @Test fun deleteOrderTest() { - val orderId:kotlin.String? = null - val response: ResponseEntity = api.deleteOrder(orderId!!) + val orderId:kotlin.String = TODO() + val response: ResponseEntity = api.deleteOrder(orderId) // TODO: test validations } - + /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.getInventory + * + * @throws ApiException + * if the Api call fails + */ @Test fun getInventoryTest() { val response: ResponseEntity> = api.getInventory() // TODO: test validations } - + /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.getOrderById + * + * @throws ApiException + * if the Api call fails + */ @Test fun getOrderByIdTest() { - val orderId:kotlin.Long? = null - val response: ResponseEntity = api.getOrderById(orderId!!) + val orderId:kotlin.Long = TODO() + val response: ResponseEntity = api.getOrderById(orderId) // TODO: test validations } - + /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test StoreApiController.placeOrder + * + * @throws ApiException + * if the Api call fails + */ @Test fun placeOrderTest() { - val body:Order? = null - val response: ResponseEntity = api.placeOrder(body!!) + val body:Order = TODO() + val response: ResponseEntity = api.placeOrder(body) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt index 14917f70aeb..c3f07290cfe 100644 --- a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt +++ b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.User import org.junit.jupiter.api.Test - import org.springframework.http.ResponseEntity class UserApiTest { @@ -10,134 +9,117 @@ class UserApiTest { private val service: UserApiService = UserApiServiceImpl() private val api: UserApiController = UserApiController(service) - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUserTest() { - val body:User? = null - val response: ResponseEntity = api.createUser(body!!) + val body:User = TODO() + val response: ResponseEntity = api.createUser(body) // TODO: test validations } - + /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUsersWithArrayInput + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUsersWithArrayInputTest() { - val body:kotlin.collections.List? = null - val response: ResponseEntity = api.createUsersWithArrayInput(body!!) + val body:kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithArrayInput(body) // TODO: test validations } - + /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.createUsersWithListInput + * + * @throws ApiException + * if the Api call fails + */ @Test fun createUsersWithListInputTest() { - val body:kotlin.collections.List? = null - val response: ResponseEntity = api.createUsersWithListInput(body!!) + val body:kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithListInput(body) // TODO: test validations } - + /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.deleteUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun deleteUserTest() { - val username:kotlin.String? = null - val response: ResponseEntity = api.deleteUser(username!!) + val username:kotlin.String = TODO() + val response: ResponseEntity = api.deleteUser(username) // TODO: test validations } - + /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.getUserByName + * + * @throws ApiException + * if the Api call fails + */ @Test fun getUserByNameTest() { - val username:kotlin.String? = null - val response: ResponseEntity = api.getUserByName(username!!) + val username:kotlin.String = TODO() + val response: ResponseEntity = api.getUserByName(username) // TODO: test validations } - + /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.loginUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun loginUserTest() { - val username:kotlin.String? = null - val password:kotlin.String? = null - val response: ResponseEntity = api.loginUser(username!!, password!!) + val username:kotlin.String = TODO() + val password:kotlin.String = TODO() + val response: ResponseEntity = api.loginUser(username, password) // TODO: test validations } - + /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.logoutUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun logoutUserTest() { val response: ResponseEntity = api.logoutUser() // TODO: test validations } - + /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + * To test UserApiController.updateUser + * + * @throws ApiException + * if the Api call fails + */ @Test fun updateUserTest() { - val username:kotlin.String? = null - val body:User? = null - val response: ResponseEntity = api.updateUser(username!!, body!!) + val username:kotlin.String = TODO() + val body:User = TODO() + val response: ResponseEntity = api.updateUser(username, body) // TODO: test validations } - + } diff --git a/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION b/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION index 3fa3b389a57..4077803655c 100644 --- a/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION +++ b/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin/vertx/pom.xml b/samples/server/petstore/kotlin/vertx/pom.xml index 9d151636971..f7dce917e48 100644 --- a/samples/server/petstore/kotlin/vertx/pom.xml +++ b/samples/server/petstore/kotlin/vertx/pom.xml @@ -1,14 +1,14 @@ 4.0.0 - + org.openapitools openapi-kotlin-vertx-server 1.0.0-SNAPSHOT jar - + OpenAPI Petstore - + UTF-8 1.8 diff --git a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt index f3dfdd42e31..a25f7e74bc7 100644 --- a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt +++ b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt @@ -34,7 +34,7 @@ data class Order ( var shipDate: java.time.OffsetDateTime? = null, /* Order Status */ var status: Order.Status? = null, - var complete: kotlin.Boolean? = null + var complete: kotlin.Boolean? = false ) { /** From 8fbd11073a57e08e3413f59a292e2bcaaa7511a9 Mon Sep 17 00:00:00 2001 From: basyskom-dege <72982549+basyskom-dege@users.noreply.github.com> Date: Tue, 14 Dec 2021 11:23:18 +0100 Subject: [PATCH 13/18] [QT][C++]fixed integration test for Oauth (#10921) * fixed missing package, fixed namespace issues * using older function to check if token is valid * using time.h to check if token is valid --- .../resources/cpp-qt-client/CMakeLists.txt.mustache | 7 ++++--- .../main/resources/cpp-qt-client/oauth.cpp.mustache | 9 ++++++--- .../src/main/resources/cpp-qt-client/oauth.h.mustache | 11 +++++------ samples/client/petstore/cpp-qt/CMakeLists.txt | 3 ++- samples/client/petstore/cpp-qt/client/CMakeLists.txt | 5 +++-- samples/client/petstore/cpp-qt/client/PFXOauth.cpp | 5 ++--- samples/client/petstore/cpp-qt/client/PFXOauth.h | 11 +++++------ 7 files changed, 27 insertions(+), 24 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/CMakeLists.txt.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/CMakeLists.txt.mustache index b78e15fb97f..86b1d5affeb 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/CMakeLists.txt.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/CMakeLists.txt.mustache @@ -12,7 +12,8 @@ else () endif () find_package(Qt5Core REQUIRED) -find_package(Qt5Network REQUIRED){{#contentCompression}} +find_package(Qt5Network REQUIRED){{#authMethods}}{{#isOAuth}} +find_package(Qt5Gui REQUIRED){{/isOAuth}}{{/authMethods}}{{#contentCompression}} find_package(ZLIB REQUIRED){{/contentCompression}} add_library(${PROJECT_NAME} @@ -31,9 +32,9 @@ add_library(${PROJECT_NAME} {{prefix}}Helpers.cpp {{prefix}}HttpRequest.cpp {{prefix}}HttpFileElement.cpp + {{prefix}}Oauth.cpp ) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network {{#contentCompression}} ${ZLIB_LIBRARIES}{{/contentCompression}}) - +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network{{#authMethods}}{{#isOAuth}} Qt5::Gui{{/isOAuth}}{{/authMethods}}{{#contentCompression}} ${ZLIB_LIBRARIES}{{/contentCompression}}) if(NOT APPLE) target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto) endif() diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.cpp.mustache index ebe53654851..7d4ec2b44f6 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.cpp.mustache @@ -1,6 +1,8 @@ #include "{{prefix}}Oauth.h" -namespace OpenAPI { +{{#cppNamespaceDeclarations}} +namespace {{this}} { +{{/cppNamespaceDeclarations}} /* * Base class to perform oauth2 flows @@ -343,5 +345,6 @@ void ReplyServer::read() emit dataReceived(queryParams); } - -} \ No newline at end of file +{{#cppNamespaceDeclarations}} +} // namespace {{this}} +{{/cppNamespaceDeclarations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.h.mustache index 03aa0dde901..91aae71a1b4 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/oauth.h.mustache @@ -21,8 +21,7 @@ #include #include #include - - +#include {{#cppNamespaceDeclarations}} namespace {{this}} { @@ -32,19 +31,19 @@ class oauthToken { public: oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){ - m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() + expiresIn); + m_validUntil = time(0) + expiresIn; } oauthToken(){ - m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() -1); + m_validUntil = time(0) - 1; } QString getToken(){return m_token;}; QString getScope(){return m_scope;}; QString getType(){return m_type;}; - bool isValid(){return QDateTime::currentDateTime() < m_validUntil;}; + bool isValid(){return time(0) < m_validUntil;}; private: QString m_token; - QDateTime m_validUntil; + time_t m_validUntil; QString m_scope; QString m_type; }; diff --git a/samples/client/petstore/cpp-qt/CMakeLists.txt b/samples/client/petstore/cpp-qt/CMakeLists.txt index 5d408c92e72..6938aca8993 100644 --- a/samples/client/petstore/cpp-qt/CMakeLists.txt +++ b/samples/client/petstore/cpp-qt/CMakeLists.txt @@ -10,6 +10,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) find_package(Qt5Test REQUIRED) +find_package(Qt5Gui REQUIRED) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/client @@ -23,7 +24,7 @@ add_executable(${PROJECT_NAME} PetStore/UserApiTests.cpp ) target_link_libraries(${PROJECT_NAME} PRIVATE client) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Test) +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Test Qt5::Gui) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_EXTENSIONS OFF) diff --git a/samples/client/petstore/cpp-qt/client/CMakeLists.txt b/samples/client/petstore/cpp-qt/client/CMakeLists.txt index 414d1c08636..29b96a13aae 100644 --- a/samples/client/petstore/cpp-qt/client/CMakeLists.txt +++ b/samples/client/petstore/cpp-qt/client/CMakeLists.txt @@ -13,6 +13,7 @@ endif () find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) +find_package(Qt5Gui REQUIRED) add_library(${PROJECT_NAME} PFXApiResponse.cpp @@ -27,9 +28,9 @@ add_library(${PROJECT_NAME} PFXHelpers.cpp PFXHttpRequest.cpp PFXHttpFileElement.cpp + PFXOauth.cpp ) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network ) - +target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Gui) if(NOT APPLE) target_link_libraries(${PROJECT_NAME} PRIVATE ssl crypto) endif() diff --git a/samples/client/petstore/cpp-qt/client/PFXOauth.cpp b/samples/client/petstore/cpp-qt/client/PFXOauth.cpp index a5cc0da2606..f5617124bb5 100644 --- a/samples/client/petstore/cpp-qt/client/PFXOauth.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXOauth.cpp @@ -1,6 +1,6 @@ #include "PFXOauth.h" -namespace OpenAPI { +namespace test_namespace { /* * Base class to perform oauth2 flows @@ -343,5 +343,4 @@ void ReplyServer::read() emit dataReceived(queryParams); } - -} \ No newline at end of file +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt/client/PFXOauth.h b/samples/client/petstore/cpp-qt/client/PFXOauth.h index f86a29e944f..df282d47cee 100644 --- a/samples/client/petstore/cpp-qt/client/PFXOauth.h +++ b/samples/client/petstore/cpp-qt/client/PFXOauth.h @@ -31,8 +31,7 @@ #include #include #include - - +#include namespace test_namespace { @@ -40,19 +39,19 @@ class oauthToken { public: oauthToken(QString token, int expiresIn, QString scope, QString tokenType) : m_token(token), m_scope(scope), m_type(tokenType){ - m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() + expiresIn); + m_validUntil = time(0) + expiresIn; } oauthToken(){ - m_validUntil = QDateTime::fromSecsSinceEpoch(QDateTime::currentSecsSinceEpoch() -1); + m_validUntil = time(0) - 1; } QString getToken(){return m_token;}; QString getScope(){return m_scope;}; QString getType(){return m_type;}; - bool isValid(){return QDateTime::currentDateTime() < m_validUntil;}; + bool isValid(){return time(0) < m_validUntil;}; private: QString m_token; - QDateTime m_validUntil; + time_t m_validUntil; QString m_scope; QString m_type; }; From 8ef49bbaa2363e24573b25ecdfa1a70022d95d8e Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 14 Dec 2021 18:24:21 +0800 Subject: [PATCH 14/18] re-enable cpp-qt test in travis ci --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index d55abd2e50d..999440c675f 100644 --- a/pom.xml +++ b/pom.xml @@ -1148,9 +1148,7 @@ - samples/client/petstore/rust samples/client/petstore/rust/reqwest/petstore samples/client/petstore/rust/reqwest/petstore-async From e5d58a35a2ff1adc0e1667b162627ac428ba782f Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 14 Dec 2021 18:32:37 +0800 Subject: [PATCH 15/18] update dependencies to newer versions (java) (#11116) --- .../src/main/resources/Java/build.gradle.mustache | 6 +++--- .../libraries/google-api-client/build.gradle.mustache | 8 ++++---- .../Java/libraries/google-api-client/pom.mustache | 6 +++--- .../Java/libraries/resteasy/build.gradle.mustache | 4 ++-- .../main/resources/Java/libraries/resteasy/pom.mustache | 6 ++++-- .../Java/libraries/retrofit2/build.gradle.mustache | 2 +- .../main/resources/Java/libraries/retrofit2/pom.mustache | 8 ++++---- .../Java/libraries/webclient/build.gradle.mustache | 8 ++++---- .../main/resources/Java/libraries/webclient/pom.mustache | 6 +++--- .../src/main/resources/Java/pom.mustache | 4 ++-- .../client/petstore/java/google-api-client/build.gradle | 8 ++++---- samples/client/petstore/java/google-api-client/pom.xml | 6 +++--- samples/client/petstore/java/jersey1/build.gradle | 6 +++--- samples/client/petstore/java/jersey1/pom.xml | 4 ++-- samples/client/petstore/java/resteasy/build.gradle | 4 ++-- samples/client/petstore/java/resteasy/pom.xml | 4 ++-- .../client/petstore/java/retrofit2-play26/build.gradle | 2 +- samples/client/petstore/java/retrofit2-play26/pom.xml | 6 +++--- samples/client/petstore/java/retrofit2/pom.xml | 2 +- samples/client/petstore/java/retrofit2rx2/pom.xml | 2 +- samples/client/petstore/java/retrofit2rx3/pom.xml | 4 ++-- .../petstore/java/webclient-nulable-arrays/build.gradle | 8 ++++---- .../client/petstore/java/webclient-nulable-arrays/pom.xml | 6 +++--- samples/client/petstore/java/webclient/build.gradle | 8 ++++---- samples/client/petstore/java/webclient/pom.xml | 6 +++--- 25 files changed, 68 insertions(+), 66 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index 2a8fa65cc5f..d9718c1e5f8 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -125,11 +125,11 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.12.1" + swagger_annotations_version = "1.6.3" + jackson_version = "2.12.5" jackson_databind_version = "2.10.5.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index b705c38ff8d..6341f027177 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -109,14 +109,14 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.12.1" + swagger_annotations_version = "1.6.3" + jackson_version = "2.12.5" jackson_databind_version = "2.10.5.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" - google_api_client_version = "1.23.0" + google_api_client_version = "1.32.2" jersey_common_version = "2.25.1" jodatime_version = "2.9.9" junit_version = "4.13.1" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache index bcd5b7d3bff..81e0ee46521 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache @@ -315,12 +315,12 @@ UTF-8 1.5.22 - 1.30.2 + 1.32.2 2.25.1 2.12.1 - 2.10.4 + 2.10.5.1 {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} {{#joda}} 2.9.9 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache index d43c2b7874b..0a801b9ff86 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache @@ -97,11 +97,11 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" + swagger_annotations_version = "1.6.3" jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" threetenbp_version = "2.9.10" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache index 4f7c83977d5..cf39a160cf0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -272,11 +272,13 @@ UTF-8 - 1.5.22 + 1.6.3 4.5.11.Final 2.10.5 2.10.5.1 - 0.2.1 + {{#openApiNullable}} + 0.2.2 + {{/openApiNullable}} 1.3.5 2.9.10 1.0.0 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index bb1ca7c917b..35a63779f64 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -115,7 +115,7 @@ ext { jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" {{#play24}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache index 66609e17c2d..39da1fd02e8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -407,7 +407,7 @@ ${java.version} ${java.version} 1.8.3 - 1.5.22 + 1.6.3 {{#usePlayWS}} 2.12.1 {{#play24}} @@ -420,7 +420,7 @@ 2.6.7 {{/play26}} {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} {{/usePlayWS}} 2.5.0 @@ -431,7 +431,7 @@ 2.1.1 {{/useRxJava2}} {{#useRxJava3}} - 3.0.4 + 3.0.4 {{/useRxJava3}} {{#joda}} 2.9.9 @@ -441,7 +441,7 @@ {{/threetenbp}} 1.3.5 {{#useBeanValidation}} - 2.0.2 + 2.0.2 {{/useBeanValidation}} 1.0.1 4.13.1 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache index 08917cfd909..8481b945bca 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache @@ -124,12 +124,12 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.6.2" + swagger_annotations_version = "1.6.3" spring_web_version = "2.4.3" - jackson_version = "2.11.3" - jackson_databind_version = "2.11.3" + jackson_version = "2.11.4" + jackson_databind_version = "2.11.4" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" reactor_version = "3.4.3" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache index 3e8e1d6da3f..b5e01dff5e9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache @@ -148,12 +148,12 @@ UTF-8 - 1.6.2 + 1.6.3 2.4.3 2.11.3 - 2.11.3 + 2.11.4 {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} 1.3.5 4.13.1 diff --git a/modules/openapi-generator/src/main/resources/Java/pom.mustache b/modules/openapi-generator/src/main/resources/Java/pom.mustache index ccb784c095d..5705ea7df67 100644 --- a/modules/openapi-generator/src/main/resources/Java/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pom.mustache @@ -360,9 +360,9 @@ UTF-8 - 1.5.21 + 1.6.3 1.19.4 - 2.12.1 + 2.12.5 {{#threetenbp}} 2.9.10 {{/threetenbp}} diff --git a/samples/client/petstore/java/google-api-client/build.gradle b/samples/client/petstore/java/google-api-client/build.gradle index 6b3f54f8166..d4334f128b5 100644 --- a/samples/client/petstore/java/google-api-client/build.gradle +++ b/samples/client/petstore/java/google-api-client/build.gradle @@ -97,12 +97,12 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.12.1" + swagger_annotations_version = "1.6.3" + jackson_version = "2.12.5" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" - google_api_client_version = "1.23.0" + google_api_client_version = "1.32.2" jersey_common_version = "2.25.1" jodatime_version = "2.9.9" junit_version = "4.13.1" diff --git a/samples/client/petstore/java/google-api-client/pom.xml b/samples/client/petstore/java/google-api-client/pom.xml index 7614163bc46..b3016450008 100644 --- a/samples/client/petstore/java/google-api-client/pom.xml +++ b/samples/client/petstore/java/google-api-client/pom.xml @@ -266,11 +266,11 @@ UTF-8 1.5.22 - 1.30.2 + 1.32.2 2.25.1 2.12.1 - 2.10.4 - 0.2.1 + 2.10.5.1 + 0.2.2 2.9.10 1.3.5 1.0.0 diff --git a/samples/client/petstore/java/jersey1/build.gradle b/samples/client/petstore/java/jersey1/build.gradle index fdcf9b78ae4..36ce7cd1fdc 100644 --- a/samples/client/petstore/java/jersey1/build.gradle +++ b/samples/client/petstore/java/jersey1/build.gradle @@ -113,10 +113,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" - jackson_version = "2.12.1" + swagger_annotations_version = "1.6.3" + jackson_version = "2.12.5" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jackson_threetenbp_version = "2.9.10" jersey_version = "1.19.4" diff --git a/samples/client/petstore/java/jersey1/pom.xml b/samples/client/petstore/java/jersey1/pom.xml index 04222d57919..76365cd391b 100644 --- a/samples/client/petstore/java/jersey1/pom.xml +++ b/samples/client/petstore/java/jersey1/pom.xml @@ -288,9 +288,9 @@ UTF-8 - 1.5.21 + 1.6.3 1.19.4 - 2.12.1 + 2.12.5 2.9.10 1.3.5 1.0.0 diff --git a/samples/client/petstore/java/resteasy/build.gradle b/samples/client/petstore/java/resteasy/build.gradle index c794b8613ba..0515f918a1e 100644 --- a/samples/client/petstore/java/resteasy/build.gradle +++ b/samples/client/petstore/java/resteasy/build.gradle @@ -97,10 +97,10 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" + swagger_annotations_version = "1.6.3" jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" threetenbp_version = "2.9.10" resteasy_version = "4.5.11.Final" diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index 6fbca0739e0..6e8a8cd96ff 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -253,11 +253,11 @@ UTF-8 - 1.5.22 + 1.6.3 4.5.11.Final 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 2.9.10 1.0.0 diff --git a/samples/client/petstore/java/retrofit2-play26/build.gradle b/samples/client/petstore/java/retrofit2-play26/build.gradle index a34a4271847..0ea8f2fe7a9 100644 --- a/samples/client/petstore/java/retrofit2-play26/build.gradle +++ b/samples/client/petstore/java/retrofit2-play26/build.gradle @@ -101,7 +101,7 @@ ext { retrofit_version = "2.3.0" jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" play_version = "2.6.7" swagger_annotations_version = "1.5.22" diff --git a/samples/client/petstore/java/retrofit2-play26/pom.xml b/samples/client/petstore/java/retrofit2-play26/pom.xml index baf6f9835fc..b6c323b6416 100644 --- a/samples/client/petstore/java/retrofit2-play26/pom.xml +++ b/samples/client/petstore/java/retrofit2-play26/pom.xml @@ -307,14 +307,14 @@ ${java.version} ${java.version} 1.8.3 - 1.5.22 + 1.6.3 2.12.1 2.6.7 - 0.2.1 + 0.2.2 2.5.0 1.4.0 1.3.5 - 2.0.2 + 2.0.2 1.0.1 4.13.1 diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index e184e4db6c6..aa4e1008af8 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -266,7 +266,7 @@ ${java.version} ${java.version} 1.8.3 - 1.5.22 + 1.6.3 2.5.0 1.4.0 1.3.5 diff --git a/samples/client/petstore/java/retrofit2rx2/pom.xml b/samples/client/petstore/java/retrofit2rx2/pom.xml index c841514837e..ef8ef477ff0 100644 --- a/samples/client/petstore/java/retrofit2rx2/pom.xml +++ b/samples/client/petstore/java/retrofit2rx2/pom.xml @@ -276,7 +276,7 @@ ${java.version} ${java.version} 1.8.3 - 1.5.22 + 1.6.3 2.5.0 2.1.1 1.4.0 diff --git a/samples/client/petstore/java/retrofit2rx3/pom.xml b/samples/client/petstore/java/retrofit2rx3/pom.xml index adb7eb9927b..2eefb139885 100644 --- a/samples/client/petstore/java/retrofit2rx3/pom.xml +++ b/samples/client/petstore/java/retrofit2rx3/pom.xml @@ -276,9 +276,9 @@ ${java.version} ${java.version} 1.8.3 - 1.5.22 + 1.6.3 2.5.0 - 3.0.4 + 3.0.4 1.4.0 1.3.5 1.0.1 diff --git a/samples/client/petstore/java/webclient-nulable-arrays/build.gradle b/samples/client/petstore/java/webclient-nulable-arrays/build.gradle index 6cbf60d744c..1c32235d403 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/build.gradle +++ b/samples/client/petstore/java/webclient-nulable-arrays/build.gradle @@ -112,11 +112,11 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.6.2" + swagger_annotations_version = "1.6.3" spring_web_version = "2.4.3" - jackson_version = "2.11.3" - jackson_databind_version = "2.11.3" - jackson_databind_nullable_version = "0.2.1" + jackson_version = "2.11.4" + jackson_databind_version = "2.11.4" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" reactor_version = "3.4.3" reactor_netty_version = "0.7.15.RELEASE" diff --git a/samples/client/petstore/java/webclient-nulable-arrays/pom.xml b/samples/client/petstore/java/webclient-nulable-arrays/pom.xml index 6a4e433806c..45b15e6002c 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/pom.xml +++ b/samples/client/petstore/java/webclient-nulable-arrays/pom.xml @@ -125,11 +125,11 @@ UTF-8 - 1.6.2 + 1.6.3 2.4.3 2.11.3 - 2.11.3 - 0.2.1 + 2.11.4 + 0.2.2 1.3.5 4.13.1 3.4.3 diff --git a/samples/client/petstore/java/webclient/build.gradle b/samples/client/petstore/java/webclient/build.gradle index 4d1f7d9b7f4..6b7058e6a94 100644 --- a/samples/client/petstore/java/webclient/build.gradle +++ b/samples/client/petstore/java/webclient/build.gradle @@ -112,11 +112,11 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.6.2" + swagger_annotations_version = "1.6.3" spring_web_version = "2.4.3" - jackson_version = "2.11.3" - jackson_databind_version = "2.11.3" - jackson_databind_nullable_version = "0.2.1" + jackson_version = "2.11.4" + jackson_databind_version = "2.11.4" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" reactor_version = "3.4.3" reactor_netty_version = "0.7.15.RELEASE" diff --git a/samples/client/petstore/java/webclient/pom.xml b/samples/client/petstore/java/webclient/pom.xml index fa73267d009..ff3255b2379 100644 --- a/samples/client/petstore/java/webclient/pom.xml +++ b/samples/client/petstore/java/webclient/pom.xml @@ -125,11 +125,11 @@ UTF-8 - 1.6.2 + 1.6.3 2.4.3 2.11.3 - 2.11.3 - 0.2.1 + 2.11.4 + 0.2.2 1.3.5 4.13.1 3.4.3 From 3eb0465ec450ddfe1eb7cb872553afefb32bbb71 Mon Sep 17 00:00:00 2001 From: Tal Kirshboim Date: Wed, 15 Dec 2021 04:38:10 +0100 Subject: [PATCH 16/18] Update samples (#11119) --- .../kotlin/vertx/.openapi-generator/FILES | 2 +- .../server/petstore/kotlin/vertx/README.md | 2 +- .../server/api/model/ModelApiResponse.kt | 34 +++++++++++++++++++ .../server/api/verticle/PetApi.kt | 4 +-- .../api/verticle/PetApiVertxProxyHandler.kt | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt diff --git a/samples/server/petstore/kotlin/vertx/.openapi-generator/FILES b/samples/server/petstore/kotlin/vertx/.openapi-generator/FILES index cf01966a4dd..bfa6fd2a60c 100644 --- a/samples/server/petstore/kotlin/vertx/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin/vertx/.openapi-generator/FILES @@ -1,7 +1,7 @@ README.md pom.xml -src/main/kotlin/org/openapitools/server/api/model/ApiResponse.kt src/main/kotlin/org/openapitools/server/api/model/Category.kt +src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/server/api/model/Order.kt src/main/kotlin/org/openapitools/server/api/model/Pet.kt src/main/kotlin/org/openapitools/server/api/model/Tag.kt diff --git a/samples/server/petstore/kotlin/vertx/README.md b/samples/server/petstore/kotlin/vertx/README.md index 4e9992d66cb..47e035f66db 100644 --- a/samples/server/petstore/kotlin/vertx/README.md +++ b/samples/server/petstore/kotlin/vertx/README.md @@ -51,8 +51,8 @@ This runs all tests and packages the library. ## Documentation for Models - - [org.openapitools.server.api.model.ApiResponse](docs/ApiResponse.md) - [org.openapitools.server.api.model.Category](docs/Category.md) + - [org.openapitools.server.api.model.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.server.api.model.Order](docs/Order.md) - [org.openapitools.server.api.model.Pet](docs/Pet.md) - [org.openapitools.server.api.model.Tag](docs/Tag.md) diff --git a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt new file mode 100644 index 00000000000..ce832696033 --- /dev/null +++ b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/ModelApiResponse.kt @@ -0,0 +1,34 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.server.api.model + + + +import com.google.gson.annotations.SerializedName +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonInclude +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +data class ModelApiResponse ( + var code: kotlin.Int? = null, + var type: kotlin.String? = null, + var message: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApi.kt b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApi.kt index 07f92471774..5968aa12cac 100644 --- a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApi.kt +++ b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApi.kt @@ -1,6 +1,6 @@ package org.openapitools.server.api.verticle -import org.openapitools.server.api.model.ApiResponse +import org.openapitools.server.api.model.ModelApiResponse import org.openapitools.server.api.model.Pet import io.vertx.core.Vertx import io.vertx.core.json.JsonObject @@ -41,7 +41,7 @@ interface PetApi { suspend fun updatePetWithForm(petId:kotlin.Long?,name:kotlin.String?,status:kotlin.String?,context:OperationRequest):Response /* uploadFile * uploads an image */ - suspend fun uploadFile(petId:kotlin.Long?,additionalMetadata:kotlin.String?,file:kotlin.collections.List?,context:OperationRequest):Response + suspend fun uploadFile(petId:kotlin.Long?,additionalMetadata:kotlin.String?,file:kotlin.collections.List?,context:OperationRequest):Response companion object { const val address = "PetApi-service" suspend fun createRouterFactory(vertx: Vertx,path:String): io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory { diff --git a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApiVertxProxyHandler.kt b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApiVertxProxyHandler.kt index 6d4fcafa98b..644fc1cee83 100644 --- a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApiVertxProxyHandler.kt +++ b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/verticle/PetApiVertxProxyHandler.kt @@ -16,7 +16,7 @@ import io.vertx.core.json.Json import io.vertx.core.json.JsonArray import com.google.gson.reflect.TypeToken import com.google.gson.Gson -import org.openapitools.server.api.model.ApiResponse +import org.openapitools.server.api.model.ModelApiResponse import org.openapitools.server.api.model.Pet class PetApiVertxProxyHandler(private val vertx: Vertx, private val service: PetApi, topLevel: Boolean, private val timeoutSeconds: Long) : ProxyHandler() { From b2daa5a836fcea8be2e64542b9a57abfd799b204 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 15 Dec 2021 11:41:16 +0800 Subject: [PATCH 17/18] update jackson-databind-nullable to 0.2.2 (#11121) --- .../Java/libraries/apache-httpclient/build.gradle.mustache | 2 +- .../main/resources/Java/libraries/feign/build.gradle.mustache | 2 +- .../src/main/resources/Java/libraries/feign/pom.mustache | 2 +- .../main/resources/Java/libraries/jersey2/build.gradle.mustache | 2 +- .../main/resources/Java/libraries/jersey2/build.sbt.mustache | 2 +- .../src/main/resources/Java/libraries/jersey2/pom.mustache | 2 +- .../src/main/resources/Java/libraries/native/pom.mustache | 2 +- .../Java/libraries/okhttp-gson-nextgen/build.sbt.mustache | 2 +- .../resources/Java/libraries/okhttp-gson-nextgen/pom.mustache | 2 +- .../resources/Java/libraries/okhttp-gson/build.sbt.mustache | 2 +- .../src/main/resources/Java/libraries/okhttp-gson/pom.mustache | 2 +- .../resources/Java/libraries/rest-assured/build.gradle.mustache | 2 +- .../resources/Java/libraries/rest-assured/build.sbt.mustache | 2 +- .../src/main/resources/Java/libraries/rest-assured/pom.mustache | 2 +- .../resources/Java/libraries/resttemplate/build.gradle.mustache | 2 +- .../src/main/resources/Java/libraries/resttemplate/pom.mustache | 2 +- .../main/resources/Java/libraries/vertx/build.gradle.mustache | 2 +- .../src/main/resources/Java/libraries/vertx/pom.mustache | 2 +- .../main/resources/JavaSpring/libraries/spring-mvc/pom.mustache | 2 +- samples/client/others/java/okhttp-gson-streaming/build.sbt | 2 +- samples/client/others/java/okhttp-gson-streaming/pom.xml | 2 +- samples/client/petstore/java/apache-httpclient/build.gradle | 2 +- samples/client/petstore/java/feign/build.gradle | 2 +- samples/client/petstore/java/feign/pom.xml | 2 +- .../petstore/java/jersey2-java8-localdatetime/build.gradle | 2 +- .../client/petstore/java/jersey2-java8-localdatetime/build.sbt | 2 +- .../client/petstore/java/jersey2-java8-localdatetime/pom.xml | 2 +- samples/client/petstore/java/jersey2-java8/build.gradle | 2 +- samples/client/petstore/java/jersey2-java8/build.sbt | 2 +- samples/client/petstore/java/jersey2-java8/pom.xml | 2 +- samples/client/petstore/java/native-async/pom.xml | 2 +- samples/client/petstore/java/native/pom.xml | 2 +- .../petstore/java/okhttp-gson-dynamicOperations/build.sbt | 2 +- .../client/petstore/java/okhttp-gson-dynamicOperations/pom.xml | 2 +- samples/client/petstore/java/okhttp-gson-nextgen/build.sbt | 2 +- samples/client/petstore/java/okhttp-gson-nextgen/pom.xml | 2 +- .../client/petstore/java/okhttp-gson-parcelableModel/build.sbt | 2 +- .../client/petstore/java/okhttp-gson-parcelableModel/pom.xml | 2 +- samples/client/petstore/java/okhttp-gson/build.sbt | 2 +- samples/client/petstore/java/okhttp-gson/pom.xml | 2 +- samples/client/petstore/java/rest-assured-jackson/build.gradle | 2 +- samples/client/petstore/java/rest-assured-jackson/build.sbt | 2 +- samples/client/petstore/java/rest-assured-jackson/pom.xml | 2 +- samples/client/petstore/java/resttemplate-withXml/build.gradle | 2 +- samples/client/petstore/java/resttemplate-withXml/pom.xml | 2 +- samples/client/petstore/java/resttemplate/build.gradle | 2 +- samples/client/petstore/java/resttemplate/pom.xml | 2 +- samples/client/petstore/java/vertx-no-nullable/pom.xml | 2 +- samples/client/petstore/java/vertx/build.gradle | 2 +- samples/client/petstore/java/vertx/pom.xml | 2 +- .../extensions/x-auth-id-alias/java/jersey2-java8/build.gradle | 2 +- .../extensions/x-auth-id-alias/java/jersey2-java8/build.sbt | 2 +- .../extensions/x-auth-id-alias/java/jersey2-java8/pom.xml | 2 +- .../petstore/java/jersey2-java8-special-characters/build.gradle | 2 +- .../petstore/java/jersey2-java8-special-characters/build.sbt | 2 +- .../petstore/java/jersey2-java8-special-characters/pom.xml | 2 +- .../openapi3/client/petstore/java/jersey2-java8/build.gradle | 2 +- samples/openapi3/client/petstore/java/jersey2-java8/build.sbt | 2 +- samples/openapi3/client/petstore/java/jersey2-java8/pom.xml | 2 +- samples/server/petstore/spring-mvc-j8-async/pom.xml | 2 +- samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml | 2 +- samples/server/petstore/spring-mvc-spring-pageable/pom.xml | 2 +- samples/server/petstore/spring-mvc/pom.xml | 2 +- 63 files changed, 63 insertions(+), 63 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache index 2c1de17903a..5ae33f37e67 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/build.gradle.mustache @@ -129,7 +129,7 @@ ext { jackson_version = "2.12.1" jackson_databind_version = "2.10.5.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index 3ce02e7a06e..c9bf7c357c2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -105,7 +105,7 @@ ext { jackson_version = "2.10.3" jackson_databind_version = "2.10.3" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache index 5f87e95f569..f57614c584a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache @@ -365,7 +365,7 @@ 3.8.0 2.10.3 {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} 2.10.3 {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index bb3a427f266..1dc7b62fa42 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -114,7 +114,7 @@ ext { jackson_version = "2.13.0" jackson_databind_version = "2.13.0" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" jersey_version = "2.35" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index 3b16db61065..a1375400af0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -29,7 +29,7 @@ lazy val root = (project in file(".")). "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.12.5" % "compile", {{/threetenbp}} {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", {{/openApiNullable}} {{#hasOAuthMethods}} "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 11857cbbcdd..243be3921b0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -391,7 +391,7 @@ 2.35 2.13.0 2.13.0 - 0.2.1 + 0.2.2 {{#threetenbp}} 2.9.10 {{/threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache index d81feac5e79..c0c151cda0e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache @@ -229,7 +229,7 @@ 11 11 2.10.4 - 0.2.1 + 0.2.2 1.3.5 {{#threetenbp}} 2.9.10 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/build.sbt.mustache index 907e8a916ec..5e0c74c55c0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/build.sbt.mustache @@ -15,7 +15,7 @@ lazy val root = (project in file(".")). "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", {{/openApiNullable}} {{#hasOAuthMethods}} "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/pom.mustache index 5d33c6ce25b..10dfc15ab7f 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/pom.mustache @@ -398,7 +398,7 @@ 2.8.8 3.12.0 {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} {{#joda}} 2.10.9 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache index 907e8a916ec..5e0c74c55c0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache @@ -15,7 +15,7 @@ lazy val root = (project in file(".")). "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", {{/openApiNullable}} {{#hasOAuthMethods}} "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index cae64378818..94c057b1424 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -388,7 +388,7 @@ 2.8.8 3.12.0 {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} {{#joda}} 2.10.9 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache index 2294f8808f2..e80ea1813d0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache @@ -104,7 +104,7 @@ ext { jackson_version = "2.10.3" jackson_databind_version = "2.10.3" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache index 22390e12e0e..6a048b92f88 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache @@ -18,7 +18,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3", {{#openApiNullable}} - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", {{/openApiNullable}} {{#withXml}} "com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.10.3", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache index 7a26d17a1d9..c6e924ecb89 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache @@ -358,7 +358,7 @@ {{/threetenbp}} {{#jackson}} 2.10.3 - 0.2.1 + 0.2.2 {{#threetenbp}} 2.10.0 {{/threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index c915f08bb2a..75b4478ea8e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -113,7 +113,7 @@ ext { jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" spring_web_version = "5.2.5.RELEASE" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache index ae3ceab2455..6bd56372de2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache @@ -319,7 +319,7 @@ 5.2.5.RELEASE 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 {{#joda}} 2.9.9 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache index bd45198caa8..bc33a077439 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache @@ -35,7 +35,7 @@ ext { vertx_version = "3.4.2" junit_version = "4.13.1" {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" {{/openApiNullable}} jakarta_annotation_version = "1.3.5" {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache index cd17acbc20f..2306edbfe84 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache @@ -308,7 +308,7 @@ 1.5.22 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 4.13.1 diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache index 909113d7013..9230b32c9d3 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache @@ -302,7 +302,7 @@ {{/useBeanValidation}} 4.3.20.RELEASE {{#openApiNullable}} - 0.2.1 + 0.2.2 {{/openApiNullable}} 2.9.8 diff --git a/samples/client/others/java/okhttp-gson-streaming/build.sbt b/samples/client/others/java/okhttp-gson-streaming/build.sbt index 903c7739e54..f37a72fb4b8 100644 --- a/samples/client/others/java/okhttp-gson-streaming/build.sbt +++ b/samples/client/others/java/okhttp-gson-streaming/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", "org.threeten" % "threetenbp" % "1.4.3" % "compile", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", diff --git a/samples/client/others/java/okhttp-gson-streaming/pom.xml b/samples/client/others/java/okhttp-gson-streaming/pom.xml index be9a75c0b54..2b89ca0c1c2 100644 --- a/samples/client/others/java/okhttp-gson-streaming/pom.xml +++ b/samples/client/others/java/okhttp-gson-streaming/pom.xml @@ -324,7 +324,7 @@ 4.9.2 2.8.8 3.12.0 - 0.2.1 + 0.2.2 1.5.0 1.3.5 4.13.2 diff --git a/samples/client/petstore/java/apache-httpclient/build.gradle b/samples/client/petstore/java/apache-httpclient/build.gradle index 8aec91e0bc0..bc0d4214099 100644 --- a/samples/client/petstore/java/apache-httpclient/build.gradle +++ b/samples/client/petstore/java/apache-httpclient/build.gradle @@ -116,7 +116,7 @@ ext { swagger_annotations_version = "1.5.22" jackson_version = "2.12.1" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jackson_threetenbp_version = "2.9.10" httpclient_version = "4.5.13" diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index 8cbc10e5c13..aa0a64e08f8 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -104,7 +104,7 @@ ext { swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" jackson_databind_version = "2.10.3" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jackson_threetenbp_version = "2.9.10" feign_version = "10.11" diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index b6ab732f2d4..1f08498e796 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -331,7 +331,7 @@ 10.11 3.8.0 2.10.3 - 0.2.1 + 0.2.2 2.10.3 2.9.10 1.3.5 diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle index 7618c2e444b..e1a7e57a0b0 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle @@ -101,7 +101,7 @@ ext { swagger_annotations_version = "1.6.3" jackson_version = "2.13.0" jackson_databind_version = "2.13.0" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt b/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt index a5e716d7c18..c8adbf8c486 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt @@ -20,7 +20,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml b/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml index b850beee9e1..e4b20a617b3 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml @@ -342,7 +342,7 @@ 2.35 2.13.0 2.13.0 - 0.2.1 + 0.2.2 1.3.5 4.13.2 8.3.1 diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index 57f7cc9b703..44c89afeab5 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -101,7 +101,7 @@ ext { swagger_annotations_version = "1.6.3" jackson_version = "2.13.0" jackson_databind_version = "2.13.0" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" diff --git a/samples/client/petstore/java/jersey2-java8/build.sbt b/samples/client/petstore/java/jersey2-java8/build.sbt index 424fe3d4581..5a45537b120 100644 --- a/samples/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/client/petstore/java/jersey2-java8/build.sbt @@ -20,7 +20,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index 2fc62928ae5..30b4ba4016a 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -342,7 +342,7 @@ 2.35 2.13.0 2.13.0 - 0.2.1 + 0.2.2 1.3.5 4.13.2 8.3.1 diff --git a/samples/client/petstore/java/native-async/pom.xml b/samples/client/petstore/java/native-async/pom.xml index eb1bf8a993f..97c223f6767 100644 --- a/samples/client/petstore/java/native-async/pom.xml +++ b/samples/client/petstore/java/native-async/pom.xml @@ -215,7 +215,7 @@ 11 11 2.10.4 - 0.2.1 + 0.2.2 1.3.5 4.13.1 diff --git a/samples/client/petstore/java/native/pom.xml b/samples/client/petstore/java/native/pom.xml index eb1bf8a993f..97c223f6767 100644 --- a/samples/client/petstore/java/native/pom.xml +++ b/samples/client/petstore/java/native/pom.xml @@ -215,7 +215,7 @@ 11 11 2.10.4 - 0.2.1 + 0.2.2 1.3.5 4.13.1 diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.sbt b/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.sbt index 2957b77a9e6..7de5adcd583 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.sbt +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", "org.threeten" % "threetenbp" % "1.4.3" % "compile", "io.swagger.parser.v3" % "swagger-parser-v3" "2.0.23" % "compile" diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml b/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml index 9c060a66c62..9e8777894ce 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml @@ -334,7 +334,7 @@ 4.9.2 2.8.8 3.12.0 - 0.2.1 + 0.2.2 1.5.0 1.3.5 4.13.2 diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/build.sbt b/samples/client/petstore/java/okhttp-gson-nextgen/build.sbt index 6aebfa8e21c..504c16ccb00 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/build.sbt +++ b/samples/client/petstore/java/okhttp-gson-nextgen/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", "org.threeten" % "threetenbp" % "1.4.3" % "compile", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", diff --git a/samples/client/petstore/java/okhttp-gson-nextgen/pom.xml b/samples/client/petstore/java/okhttp-gson-nextgen/pom.xml index 931f95599d3..e9f84b263ee 100644 --- a/samples/client/petstore/java/okhttp-gson-nextgen/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-nextgen/pom.xml @@ -339,7 +339,7 @@ 4.9.2 2.8.8 3.12.0 - 0.2.1 + 0.2.2 1.5.0 1.3.5 4.13.2 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt index e566d0fb4fb..a90f98e2152 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", "org.threeten" % "threetenbp" % "1.4.3" % "compile", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index 098e028ec8f..08ffdd44ecb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -336,7 +336,7 @@ 4.9.2 2.8.8 3.12.0 - 0.2.1 + 0.2.2 1.5.0 1.3.5 4.13.2 diff --git a/samples/client/petstore/java/okhttp-gson/build.sbt b/samples/client/petstore/java/okhttp-gson/build.sbt index a791297fd3e..95fad49a330 100644 --- a/samples/client/petstore/java/okhttp-gson/build.sbt +++ b/samples/client/petstore/java/okhttp-gson/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp3" % "logging-interceptor" % "4.9.1", "com.google.code.gson" % "gson" % "2.8.6", "org.apache.commons" % "commons-lang3" % "3.10", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", "org.threeten" % "threetenbp" % "1.4.3" % "compile", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index da2dbbe58e7..43e3d9f548f 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -329,7 +329,7 @@ 4.9.2 2.8.8 3.12.0 - 0.2.1 + 0.2.2 1.5.0 1.3.5 4.13.2 diff --git a/samples/client/petstore/java/rest-assured-jackson/build.gradle b/samples/client/petstore/java/rest-assured-jackson/build.gradle index e99cf39b119..eefeb332bdd 100644 --- a/samples/client/petstore/java/rest-assured-jackson/build.gradle +++ b/samples/client/petstore/java/rest-assured-jackson/build.gradle @@ -102,7 +102,7 @@ ext { junit_version = "4.13.1" jackson_version = "2.10.3" jackson_databind_version = "2.10.3" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" okio_version = "1.17.5" } diff --git a/samples/client/petstore/java/rest-assured-jackson/build.sbt b/samples/client/petstore/java/rest-assured-jackson/build.sbt index 4422008b635..78811a4180d 100644 --- a/samples/client/petstore/java/rest-assured-jackson/build.sbt +++ b/samples/client/petstore/java/rest-assured-jackson/build.sbt @@ -16,7 +16,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3", "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.10.3", "com.squareup.okio" % "okio" % "1.17.5" % "compile", "jakarta.validation" % "jakarta.validation-api" % "2.0.2" % "compile", diff --git a/samples/client/petstore/java/rest-assured-jackson/pom.xml b/samples/client/petstore/java/rest-assured-jackson/pom.xml index 0c2e6e4bc45..43201004cbd 100644 --- a/samples/client/petstore/java/rest-assured-jackson/pom.xml +++ b/samples/client/petstore/java/rest-assured-jackson/pom.xml @@ -287,7 +287,7 @@ 2.8.6 1.8.4 2.10.3 - 0.2.1 + 0.2.2 1.3.5 2.0.2 1.17.5 diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index f07930b7b5d..96a7e7dd413 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -100,7 +100,7 @@ ext { swagger_annotations_version = "1.5.22" jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" spring_web_version = "5.2.5.RELEASE" jodatime_version = "2.9.9" diff --git a/samples/client/petstore/java/resttemplate-withXml/pom.xml b/samples/client/petstore/java/resttemplate-withXml/pom.xml index 8c6793c1c40..a63c67fcf20 100644 --- a/samples/client/petstore/java/resttemplate-withXml/pom.xml +++ b/samples/client/petstore/java/resttemplate-withXml/pom.xml @@ -288,7 +288,7 @@ 5.2.5.RELEASE 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 2.9.10 1.0.0 diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index a5719c67de5..b70d21521b5 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -100,7 +100,7 @@ ext { swagger_annotations_version = "1.5.22" jackson_version = "2.10.5" jackson_databind_version = "2.10.5.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" spring_web_version = "5.2.5.RELEASE" jodatime_version = "2.9.9" diff --git a/samples/client/petstore/java/resttemplate/pom.xml b/samples/client/petstore/java/resttemplate/pom.xml index 9921e8011ee..7421690cdc9 100644 --- a/samples/client/petstore/java/resttemplate/pom.xml +++ b/samples/client/petstore/java/resttemplate/pom.xml @@ -280,7 +280,7 @@ 5.2.5.RELEASE 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 2.9.10 1.0.0 diff --git a/samples/client/petstore/java/vertx-no-nullable/pom.xml b/samples/client/petstore/java/vertx-no-nullable/pom.xml index c0c0281f9eb..c7c3a930c97 100644 --- a/samples/client/petstore/java/vertx-no-nullable/pom.xml +++ b/samples/client/petstore/java/vertx-no-nullable/pom.xml @@ -278,7 +278,7 @@ 1.5.22 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 4.13.1 diff --git a/samples/client/petstore/java/vertx/build.gradle b/samples/client/petstore/java/vertx/build.gradle index c067ccdc2ad..0f060495d96 100644 --- a/samples/client/petstore/java/vertx/build.gradle +++ b/samples/client/petstore/java/vertx/build.gradle @@ -34,7 +34,7 @@ ext { jackson_databind_version = "2.10.5.1" vertx_version = "3.4.2" junit_version = "4.13.1" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" } diff --git a/samples/client/petstore/java/vertx/pom.xml b/samples/client/petstore/java/vertx/pom.xml index e751a57d090..5c152ae84fb 100644 --- a/samples/client/petstore/java/vertx/pom.xml +++ b/samples/client/petstore/java/vertx/pom.xml @@ -278,7 +278,7 @@ 1.5.22 2.10.5 2.10.5.1 - 0.2.1 + 0.2.2 1.3.5 4.13.1 diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle index b33e0d64186..58eba25952e 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.gradle @@ -101,7 +101,7 @@ ext { swagger_annotations_version = "1.6.3" jackson_version = "2.13.0" jackson_databind_version = "2.13.0" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt index e5074a14e31..90ede61e7a7 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/build.sbt @@ -20,7 +20,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.12.5" % "compile", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.brsanthu" % "migbase64" % "2.2", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml index dbeb9684fd3..bee91f77194 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml @@ -342,7 +342,7 @@ 2.35 2.13.0 2.13.0 - 0.2.1 + 0.2.2 2.9.10 1.3.5 4.13.2 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle index c39ff494aa6..459364339f3 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.gradle @@ -101,7 +101,7 @@ ext { swagger_annotations_version = "1.6.3" jackson_version = "2.13.0" jackson_databind_version = "2.13.0" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt index 423d4e3b58f..6cc3961e303 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/build.sbt @@ -20,7 +20,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml index 8feb1611f5e..9828623b301 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml @@ -337,7 +337,7 @@ 2.35 2.13.0 2.13.0 - 0.2.1 + 0.2.2 1.3.5 4.13.2 2.17.3 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle index 6ffa4c5ad7a..841a3c55eb5 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle @@ -101,7 +101,7 @@ ext { swagger_annotations_version = "1.6.3" jackson_version = "2.13.0" jackson_databind_version = "2.13.0" - jackson_databind_nullable_version = "0.2.1" + jackson_databind_nullable_version = "0.2.2" jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt index a427b720ebd..a420957d37a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt @@ -20,7 +20,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.0" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", - "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", + "org.openapitools" % "jackson-databind-nullable" % "0.2.2" % "compile", "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml index 0a3a077b03b..d088ea0a7aa 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml @@ -347,7 +347,7 @@ 2.35 2.13.0 2.13.0 - 0.2.1 + 0.2.2 1.3.5 4.13.2 1.7 diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml index 8d2528b1b2a..75642d4fca4 100644 --- a/samples/server/petstore/spring-mvc-j8-async/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -176,7 +176,7 @@ 2.8.4 2.0.2 4.3.20.RELEASE - 0.2.1 + 0.2.2 2.9.8 diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml index 6155fc3e512..869d354af92 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml @@ -176,7 +176,7 @@ 2.8.4 2.0.2 4.3.20.RELEASE - 0.2.1 + 0.2.2 2.9.8 diff --git a/samples/server/petstore/spring-mvc-spring-pageable/pom.xml b/samples/server/petstore/spring-mvc-spring-pageable/pom.xml index c448133c798..1407e73ebaf 100644 --- a/samples/server/petstore/spring-mvc-spring-pageable/pom.xml +++ b/samples/server/petstore/spring-mvc-spring-pageable/pom.xml @@ -176,7 +176,7 @@ 2.8.4 2.0.2 4.3.20.RELEASE - 0.2.1 + 0.2.2 2.9.8 diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index c61218492ae..42dc38e182e 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -176,7 +176,7 @@ 2.8.4 2.0.2 4.3.20.RELEASE - 0.2.1 + 0.2.2 2.9.8 From c27ddc67fe309298b2914c946ceb60b576c09a2b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 15 Dec 2021 22:18:39 +0800 Subject: [PATCH 18/18] show error when schema in discriminator mapping is undefined (#11127) --- .../org/openapitools/codegen/DefaultCodegen.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 32947d78706..a9780140f4c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3170,10 +3170,16 @@ public class DefaultCodegen implements CodegenConfig { List uniqueDescendants = new ArrayList(); if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) { for (Entry e : sourceDiscriminator.getMapping().entrySet()) { - String nameOrRef = e.getValue(); - String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef; - String modelName = toModelName(name); - uniqueDescendants.add(new MappedModel(e.getKey(), modelName)); + String name; + if (e.getValue().indexOf('/') >= 0) { + name = ModelUtils.getSimpleRef(e.getValue()); + if (ModelUtils.getSchema(openAPI, name) == null) { + LOGGER.error("Failed to lookup the schema '{}' when processing the discriminator mapping of oneOf/anyOf. Please check to ensure it's defined properly.", name); + } + } else { + name = e.getValue(); + } + uniqueDescendants.add(new MappedModel(e.getKey(), toModelName(name))); } }