mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 02:32:45 +00:00
Merge remote-tracking branch 'origin/5.3.x' into 6.0.x
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/swift,xcode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=swift,xcode
|
||||
|
||||
### Swift ###
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData
|
||||
## User settings
|
||||
xcuserdata/
|
||||
|
||||
## Various settings
|
||||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
|
||||
*.xcscmblueprint
|
||||
*.xccheckout
|
||||
|
||||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
|
||||
build/
|
||||
DerivedData/
|
||||
*.moved-aside
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
@@ -15,49 +25,81 @@ DerivedData
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
|
||||
## Other
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
*.xcuserstate
|
||||
*.xcscmblueprint
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
|
||||
## App packaging
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
## Playgrounds
|
||||
timeline.xctimeline
|
||||
playground.xcworkspace
|
||||
|
||||
# Swift Package Manager
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||
# Packages/
|
||||
# Package.pins
|
||||
# Package.resolved
|
||||
# *.xcodeproj
|
||||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
|
||||
# hence it is not needed unless you have added a package configuration file to your project
|
||||
# .swiftpm
|
||||
|
||||
.build/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
# Add this line if you want to avoid checking in source code from the Xcode workspace
|
||||
# *.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
Carthage/Build/
|
||||
|
||||
# Add this lines if you are using Accio dependency management (Deprecated since Xcode 12)
|
||||
# Dependencies/
|
||||
# .accio/
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# It is recommended to not store the screenshots in the git repo.
|
||||
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
|
||||
# https://docs.fastlane.tools/best-practices/source-control/#source-control
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/screenshots
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots/**/*.png
|
||||
fastlane/test_output
|
||||
|
||||
# Code Injection
|
||||
# After new code Injection tools there's a generated folder /iOSInjectionProject
|
||||
# https://github.com/johnno1962/injectionforxcode
|
||||
|
||||
iOSInjectionProject/
|
||||
|
||||
### Xcode ###
|
||||
# Xcode
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
|
||||
|
||||
|
||||
## Gcc Patch
|
||||
/*.gcno
|
||||
|
||||
### Xcode Patch ###
|
||||
*.xcodeproj/*
|
||||
!*.xcodeproj/project.pbxproj
|
||||
!*.xcodeproj/xcshareddata/
|
||||
!*.xcworkspace/contents.xcworkspacedata
|
||||
**/xcshareddata/WorkspaceSettings.xcsettings
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/swift,xcode
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
6.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
6.0.0-SNAPSHOT
|
||||
=======
|
||||
5.3.0-SNAPSHOT
|
||||
>>>>>>> origin/5.3.x
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
|
||||
github "Flight-School/AnyCodable" ~> 0.4.0
|
||||
github "Flight-School/AnyCodable" ~> 0.6.1
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "AnyCodable",
|
||||
"repositoryURL": "https://github.com/Flight-School/AnyCodable",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "69261f239f0fffaf51495dadc4f8483fbfe97025",
|
||||
"version": "0.6.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -19,7 +19,7 @@ let package = Package(
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
.package(url: "https://github.com/Flight-School/AnyCodable", .exact("0.4.0")),
|
||||
.package(url: "https://github.com/Flight-School/AnyCodable", from: "0.6.1"),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
|
||||
@@ -11,5 +11,5 @@ Pod::Spec.new do |s|
|
||||
s.homepage = 'https://github.com/openapitools/openapi-generator'
|
||||
s.summary = 'PetstoreClient'
|
||||
s.source_files = 'PetstoreClient/Classes/**/*.swift'
|
||||
s.dependency 'AnyCodable-FlightSchool', '~> 0.4.0'
|
||||
s.dependency 'AnyCodable-FlightSchool', '~> 0.6.1'
|
||||
end
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
open class PetstoreClientAPI {
|
||||
@available(*, deprecated, renamed: "PetstoreClient")
|
||||
public typealias PetstoreClientAPI = PetstoreClient
|
||||
|
||||
open class PetstoreClient {
|
||||
public static var basePath = "http://petstore.swagger.io:80/v2"
|
||||
public static var credential: URLCredential?
|
||||
public static var customHeaders: [String: String] = [:]
|
||||
public static var credential: URLCredential?
|
||||
public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory()
|
||||
public static var apiResponseQueue: DispatchQueue = .main
|
||||
}
|
||||
@@ -32,7 +35,7 @@ open class RequestBuilder<T> {
|
||||
self.parameters = parameters
|
||||
self.headers = headers
|
||||
|
||||
addHeaders(PetstoreClientAPI.customHeaders)
|
||||
addHeaders(PetstoreClient.customHeaders)
|
||||
}
|
||||
|
||||
open func addHeaders(_ aHeaders: [String: String]) {
|
||||
@@ -41,7 +44,7 @@ open class RequestBuilder<T> {
|
||||
}
|
||||
}
|
||||
|
||||
open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { }
|
||||
open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { }
|
||||
|
||||
public func addHeader(name: String, value: String) -> Self {
|
||||
if !value.isEmpty {
|
||||
@@ -51,7 +54,7 @@ open class RequestBuilder<T> {
|
||||
}
|
||||
|
||||
open func addCredential() -> Self {
|
||||
credential = PetstoreClientAPI.credential
|
||||
credential = PetstoreClient.credential
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
open class AnotherFakeAPI {
|
||||
|
||||
/**
|
||||
To test special tags
|
||||
|
||||
@@ -15,7 +19,7 @@ open class AnotherFakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||
open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||
call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -34,21 +38,20 @@ open class AnotherFakeAPI {
|
||||
- returns: RequestBuilder<Client>
|
||||
*/
|
||||
open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
|
||||
let path = "/another-fake/dummy"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/another-fake/dummy"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Client>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PATCH", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,15 +6,19 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
open class FakeAPI {
|
||||
|
||||
/**
|
||||
|
||||
- parameter body: (body) Input boolean as post body (optional)
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) {
|
||||
open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) {
|
||||
fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -32,21 +36,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Bool>
|
||||
*/
|
||||
open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder<Bool> {
|
||||
let path = "/fake/outer/boolean"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake/outer/boolean"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Bool>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Bool>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +59,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) {
|
||||
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) {
|
||||
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -73,21 +77,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<OuterComposite>
|
||||
*/
|
||||
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
|
||||
let path = "/fake/outer/composite"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake/outer/composite"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<OuterComposite>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<OuterComposite>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +100,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) {
|
||||
open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) {
|
||||
fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -114,21 +118,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Double>
|
||||
*/
|
||||
open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder<Double> {
|
||||
let path = "/fake/outer/number"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake/outer/number"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Double>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Double>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +141,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) {
|
||||
open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) {
|
||||
fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -155,21 +159,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<String>
|
||||
*/
|
||||
open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder<String> {
|
||||
let path = "/fake/outer/string"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake/outer/string"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<String>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +182,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -196,21 +200,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
|
||||
let path = "/fake/body-with-file-schema"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake/body-with-file-schema"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PUT", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +224,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -238,24 +242,24 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
|
||||
let path = "/fake/body-with-query-params"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake/body-with-query-params"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
var urlComponents = URLComponents(string: URLString)
|
||||
urlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"query": query.encodeToJSON(),
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PUT", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +269,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||
open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||
testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -284,21 +288,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Client>
|
||||
*/
|
||||
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Client>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PATCH", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,7 +325,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
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)) {
|
||||
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 = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
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 -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -356,9 +360,9 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String: Any?] = [
|
||||
let localVariablePath = "/fake"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableFormParams: [String: Any?] = [
|
||||
"integer": integer?.encodeToJSON(),
|
||||
"int32": int32?.encodeToJSON(),
|
||||
"int64": int64?.encodeToJSON(),
|
||||
@@ -375,20 +379,20 @@ open class FakeAPI {
|
||||
"callback": callback?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,7 +476,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -498,35 +502,35 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String: Any?] = [
|
||||
let localVariablePath = "/fake"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableFormParams: [String: Any?] = [
|
||||
"enum_form_string_array": enumFormStringArray?.encodeToJSON(),
|
||||
"enum_form_string": enumFormString?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||
|
||||
var urlComponents = URLComponents(string: URLString)
|
||||
urlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"enum_query_string_array": enumQueryStringArray?.encodeToJSON(),
|
||||
"enum_query_string": enumQueryString?.encodeToJSON(),
|
||||
"enum_query_integer": enumQueryInteger?.encodeToJSON(),
|
||||
"enum_query_double": enumQueryDouble?.encodeToJSON(),
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"enum_header_string_array": enumHeaderStringArray?.encodeToJSON(),
|
||||
"enum_header_string": enumHeaderString?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -541,7 +545,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
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)) {
|
||||
open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -565,28 +569,28 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
let localVariablePath = "/fake"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
var urlComponents = URLComponents(string: URLString)
|
||||
urlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"required_string_group": requiredStringGroup.encodeToJSON(),
|
||||
"required_int64_group": requiredInt64Group.encodeToJSON(),
|
||||
"string_group": stringGroup?.encodeToJSON(),
|
||||
"int64_group": int64Group?.encodeToJSON(),
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"required_boolean_group": requiredBooleanGroup.encodeToJSON(),
|
||||
"boolean_group": booleanGroup?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "DELETE", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -596,7 +600,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -614,21 +618,21 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> {
|
||||
let path = "/fake/inline-additionalProperties"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
||||
let localVariablePath = "/fake/inline-additionalProperties"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -639,7 +643,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -658,27 +662,26 @@ open class FakeAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
||||
let path = "/fake/jsonFormData"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String: Any?] = [
|
||||
let localVariablePath = "/fake/jsonFormData"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableFormParams: [String: Any?] = [
|
||||
"param": param.encodeToJSON(),
|
||||
"param2": param2.encodeToJSON(),
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
open class FakeClassnameTags123API {
|
||||
|
||||
/**
|
||||
To test class name in snake case
|
||||
|
||||
@@ -15,7 +19,7 @@ open class FakeClassnameTags123API {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||
open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||
testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -37,21 +41,20 @@ open class FakeClassnameTags123API {
|
||||
- returns: RequestBuilder<Client>
|
||||
*/
|
||||
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
|
||||
let path = "/fake_classname_test"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/fake_classname_test"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Client>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PATCH", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
open class PetAPI {
|
||||
|
||||
/**
|
||||
Add a new pet to the store
|
||||
|
||||
@@ -15,7 +19,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -36,21 +40,21 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
|
||||
let path = "/pet"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/pet"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +65,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -83,24 +87,24 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
|
||||
var path = "/pet/{petId}"
|
||||
var localVariablePath = "/pet/{petId}"
|
||||
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"api_key": apiKey?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "DELETE", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +123,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) {
|
||||
open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) {
|
||||
findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -141,24 +145,24 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<[Pet]>
|
||||
*/
|
||||
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
||||
let path = "/pet/findByStatus"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
let localVariablePath = "/pet/findByStatus"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
var urlComponents = URLComponents(string: URLString)
|
||||
urlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"status": status.encodeToJSON(),
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +173,7 @@ open class PetAPI {
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
@available(*, deprecated, message: "This operation is deprecated.")
|
||||
open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) {
|
||||
open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) {
|
||||
findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -192,24 +196,24 @@ open class PetAPI {
|
||||
*/
|
||||
@available(*, deprecated, message: "This operation is deprecated.")
|
||||
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
||||
let path = "/pet/findByTags"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
let localVariablePath = "/pet/findByTags"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
var urlComponents = URLComponents(string: URLString)
|
||||
urlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"tags": tags.encodeToJSON(),
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +223,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) {
|
||||
open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) {
|
||||
getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -241,24 +245,24 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<Pet>
|
||||
*/
|
||||
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
|
||||
var path = "/pet/{petId}"
|
||||
var localVariablePath = "/pet/{petId}"
|
||||
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Pet>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +272,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -289,21 +293,21 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
|
||||
let path = "/pet"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/pet"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PUT", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,7 +319,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -338,30 +342,30 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
|
||||
var path = "/pet/{petId}"
|
||||
var localVariablePath = "/pet/{petId}"
|
||||
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String: Any?] = [
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableFormParams: [String: Any?] = [
|
||||
"name": name?.encodeToJSON(),
|
||||
"status": status?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,7 +377,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) {
|
||||
open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) {
|
||||
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -396,30 +400,30 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<ApiResponse>
|
||||
*/
|
||||
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
|
||||
var path = "/pet/{petId}/uploadImage"
|
||||
var localVariablePath = "/pet/{petId}/uploadImage"
|
||||
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String: Any?] = [
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableFormParams: [String: Any?] = [
|
||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||
"file": file?.encodeToJSON(),
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"Content-Type": "multipart/form-data",
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,7 +435,7 @@ open class PetAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) {
|
||||
open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) {
|
||||
uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -454,30 +458,29 @@ open class PetAPI {
|
||||
- returns: RequestBuilder<ApiResponse>
|
||||
*/
|
||||
open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> {
|
||||
var path = "/fake/{petId}/uploadImageWithRequiredFile"
|
||||
var localVariablePath = "/fake/{petId}/uploadImageWithRequiredFile"
|
||||
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String: Any?] = [
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableFormParams: [String: Any?] = [
|
||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||
"requiredFile": requiredFile.encodeToJSON(),
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
"Content-Type": "multipart/form-data",
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
open class StoreAPI {
|
||||
|
||||
/**
|
||||
Delete purchase order by ID
|
||||
|
||||
@@ -15,7 +19,7 @@ open class StoreAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -34,24 +38,24 @@ open class StoreAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
var path = "/store/order/{order_id}"
|
||||
var localVariablePath = "/store/order/{order_id}"
|
||||
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
|
||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "DELETE", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +64,7 @@ open class StoreAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) {
|
||||
open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) {
|
||||
getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -81,21 +85,21 @@ open class StoreAPI {
|
||||
- returns: RequestBuilder<[String: Int]>
|
||||
*/
|
||||
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> {
|
||||
let path = "/store/inventory"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
let localVariablePath = "/store/inventory"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +109,7 @@ open class StoreAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) {
|
||||
open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) {
|
||||
getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -124,24 +128,24 @@ open class StoreAPI {
|
||||
- returns: RequestBuilder<Order>
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
var path = "/store/order/{order_id}"
|
||||
var localVariablePath = "/store/order/{order_id}"
|
||||
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
|
||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Order>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +155,7 @@ open class StoreAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) {
|
||||
open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) {
|
||||
placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -169,21 +173,20 @@ open class StoreAPI {
|
||||
- returns: RequestBuilder<Order>
|
||||
*/
|
||||
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
|
||||
let path = "/store/order"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/store/order"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Order>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
open class UserAPI {
|
||||
|
||||
/**
|
||||
Create user
|
||||
|
||||
@@ -15,7 +19,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -34,21 +38,21 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
|
||||
let path = "/user"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/user"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +62,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -76,21 +80,21 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
|
||||
let path = "/user/createWithArray"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/user/createWithArray"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +104,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -118,21 +122,21 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
|
||||
let path = "/user/createWithList"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let localVariablePath = "/user/createWithList"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +146,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -161,24 +165,24 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
var localVariablePath = "/user/{username}"
|
||||
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "DELETE", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "DELETE", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,7 +192,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) {
|
||||
open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) {
|
||||
getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -206,24 +210,24 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<User>
|
||||
*/
|
||||
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
|
||||
var path = "/user/{username}"
|
||||
var localVariablePath = "/user/{username}"
|
||||
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<User>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +238,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) {
|
||||
open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) {
|
||||
loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
@@ -254,25 +258,25 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<String>
|
||||
*/
|
||||
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
||||
let path = "/user/login"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
let localVariablePath = "/user/login"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
var urlComponents = URLComponents(string: URLString)
|
||||
urlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"username": username.encodeToJSON(),
|
||||
"password": password.encodeToJSON(),
|
||||
])
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<String>.Type = PetstoreClient.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,7 +285,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -298,21 +302,21 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
||||
let path = "/user/logout"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String: Any]? = nil
|
||||
let localVariablePath = "/user/logout"
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters: [String: Any]? = nil
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,7 +327,7 @@ open class UserAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||
updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
case .success:
|
||||
@@ -343,24 +347,23 @@ open class UserAPI {
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
var localVariablePath = "/user/{username}"
|
||||
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let localVariableURLString = PetstoreClient.basePath + localVariablePath
|
||||
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let urlComponents = URLComponents(string: URLString)
|
||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
let localVariableNillableHeaders: [String: Any?] = [
|
||||
:
|
||||
]
|
||||
|
||||
let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)
|
||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
let localVariableRequestBuilder: RequestBuilder<Void>.Type = PetstoreClient.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PUT", URLString: (urlComponents?.string ?? URLString), parameters: parameters, headers: headerParameters)
|
||||
return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import Foundation
|
||||
|
||||
open class Configuration {
|
||||
|
||||
// This value is used to configure the date formatter that is used to serialize dates into JSON format.
|
||||
// You must set it prior to encoding any dates, and it will only be read once.
|
||||
@available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.")
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
extension Bool: JSONEncodable {
|
||||
func encodeToJSON() -> Any { return self as Any }
|
||||
@@ -184,44 +186,3 @@ extension HTTPURLResponse {
|
||||
return Array(200 ..< 300).contains(statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
extension AnyCodable: Hashable {
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
switch value {
|
||||
case let value as Bool:
|
||||
hasher.combine(value)
|
||||
case let value as Int:
|
||||
hasher.combine(value)
|
||||
case let value as Int8:
|
||||
hasher.combine(value)
|
||||
case let value as Int16:
|
||||
hasher.combine(value)
|
||||
case let value as Int32:
|
||||
hasher.combine(value)
|
||||
case let value as Int64:
|
||||
hasher.combine(value)
|
||||
case let value as UInt:
|
||||
hasher.combine(value)
|
||||
case let value as UInt8:
|
||||
hasher.combine(value)
|
||||
case let value as UInt16:
|
||||
hasher.combine(value)
|
||||
case let value as UInt32:
|
||||
hasher.combine(value)
|
||||
case let value as UInt64:
|
||||
hasher.combine(value)
|
||||
case let value as Float:
|
||||
hasher.combine(value)
|
||||
case let value as Double:
|
||||
hasher.combine(value)
|
||||
case let value as String:
|
||||
hasher.combine(value)
|
||||
case let value as [String: AnyCodable]:
|
||||
hasher.combine(value)
|
||||
case let value as [AnyCodable]:
|
||||
hasher.combine(value)
|
||||
default:
|
||||
hasher.combine(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
|
||||
self.mapString = mapString
|
||||
self.mapMapString = mapMapString
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case mapString = "map_string"
|
||||
case mapMapString = "map_map_string"
|
||||
@@ -29,7 +32,5 @@ public struct AdditionalPropertiesClass: Codable, Hashable {
|
||||
try container.encodeIfPresent(mapString, forKey: .mapString)
|
||||
try container.encodeIfPresent(mapMapString, forKey: .mapMapString)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Animal: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct Animal: Codable, Hashable {
|
||||
self.className = className
|
||||
self.color = color
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case className
|
||||
case color
|
||||
@@ -29,7 +32,5 @@ public struct Animal: Codable, Hashable {
|
||||
try container.encode(className, forKey: .className)
|
||||
try container.encodeIfPresent(color, forKey: .color)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public typealias AnimalFarm = [Animal]
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct ApiResponse: Codable, Hashable {
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct ApiResponse: Codable, Hashable {
|
||||
self.type = type
|
||||
self.message = message
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case code
|
||||
case type
|
||||
@@ -33,7 +36,5 @@ public struct ApiResponse: Codable, Hashable {
|
||||
try container.encodeIfPresent(type, forKey: .type)
|
||||
try container.encodeIfPresent(message, forKey: .message)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
|
||||
public init(arrayArrayNumber: [[Double]]? = nil) {
|
||||
self.arrayArrayNumber = arrayArrayNumber
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case arrayArrayNumber = "ArrayArrayNumber"
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(arrayArrayNumber, forKey: .arrayArrayNumber)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
|
||||
public init(arrayNumber: [Double]? = nil) {
|
||||
self.arrayNumber = arrayNumber
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case arrayNumber = "ArrayNumber"
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct ArrayOfNumberOnly: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(arrayNumber, forKey: .arrayNumber)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct ArrayTest: Codable, Hashable {
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct ArrayTest: Codable, Hashable {
|
||||
self.arrayArrayOfInteger = arrayArrayOfInteger
|
||||
self.arrayArrayOfModel = arrayArrayOfModel
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case arrayOfString = "array_of_string"
|
||||
case arrayArrayOfInteger = "array_array_of_integer"
|
||||
@@ -33,7 +36,5 @@ public struct ArrayTest: Codable, Hashable {
|
||||
try container.encodeIfPresent(arrayArrayOfInteger, forKey: .arrayArrayOfInteger)
|
||||
try container.encodeIfPresent(arrayArrayOfModel, forKey: .arrayArrayOfModel)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Capitalization: Codable, Hashable {
|
||||
|
||||
@@ -26,6 +28,7 @@ public struct Capitalization: Codable, Hashable {
|
||||
self.sCAETHFlowPoints = sCAETHFlowPoints
|
||||
self.ATT_NAME = ATT_NAME
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case smallCamel
|
||||
case capitalCamel = "CapitalCamel"
|
||||
@@ -46,7 +49,5 @@ public struct Capitalization: Codable, Hashable {
|
||||
try container.encodeIfPresent(sCAETHFlowPoints, forKey: .sCAETHFlowPoints)
|
||||
try container.encodeIfPresent(ATT_NAME, forKey: .ATT_NAME)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Cat: Codable, Hashable {
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct Cat: Codable, Hashable {
|
||||
self.color = color
|
||||
self.declawed = declawed
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case className
|
||||
case color
|
||||
@@ -33,7 +36,5 @@ public struct Cat: Codable, Hashable {
|
||||
try container.encodeIfPresent(color, forKey: .color)
|
||||
try container.encodeIfPresent(declawed, forKey: .declawed)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct CatAllOf: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct CatAllOf: Codable, Hashable {
|
||||
public init(declawed: Bool? = nil) {
|
||||
self.declawed = declawed
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case declawed
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct CatAllOf: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(declawed, forKey: .declawed)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Category: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct Category: Codable, Hashable {
|
||||
self.id = id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case id
|
||||
case name
|
||||
@@ -29,7 +32,5 @@ public struct Category: Codable, Hashable {
|
||||
try container.encodeIfPresent(id, forKey: .id)
|
||||
try container.encode(name, forKey: .name)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing model with \"_class\" property */
|
||||
public struct ClassModel: Codable, Hashable {
|
||||
@@ -16,6 +18,7 @@ public struct ClassModel: Codable, Hashable {
|
||||
public init(_class: String? = nil) {
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case _class
|
||||
}
|
||||
@@ -26,7 +29,5 @@ public struct ClassModel: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(_class, forKey: ._class)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Client: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct Client: Codable, Hashable {
|
||||
public init(client: String? = nil) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case client
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct Client: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(client, forKey: .client)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Dog: Codable, Hashable {
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct Dog: Codable, Hashable {
|
||||
self.color = color
|
||||
self.breed = breed
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case className
|
||||
case color
|
||||
@@ -33,7 +36,5 @@ public struct Dog: Codable, Hashable {
|
||||
try container.encodeIfPresent(color, forKey: .color)
|
||||
try container.encodeIfPresent(breed, forKey: .breed)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct DogAllOf: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct DogAllOf: Codable, Hashable {
|
||||
public init(breed: String? = nil) {
|
||||
self.breed = breed
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case breed
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct DogAllOf: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(breed, forKey: .breed)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct EnumArrays: Codable, Hashable {
|
||||
|
||||
@@ -25,6 +27,7 @@ public struct EnumArrays: Codable, Hashable {
|
||||
self.justSymbol = justSymbol
|
||||
self.arrayEnum = arrayEnum
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case justSymbol = "just_symbol"
|
||||
case arrayEnum = "array_enum"
|
||||
@@ -37,7 +40,5 @@ public struct EnumArrays: Codable, Hashable {
|
||||
try container.encodeIfPresent(justSymbol, forKey: .justSymbol)
|
||||
try container.encodeIfPresent(arrayEnum, forKey: .arrayEnum)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public enum EnumClass: String, Codable, CaseIterable {
|
||||
case abc = "_abc"
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct EnumTest: Codable, Hashable {
|
||||
|
||||
@@ -41,6 +43,7 @@ public struct EnumTest: Codable, Hashable {
|
||||
self.enumNumber = enumNumber
|
||||
self.outerEnum = outerEnum
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case enumString = "enum_string"
|
||||
case enumStringRequired = "enum_string_required"
|
||||
@@ -59,7 +62,5 @@ public struct EnumTest: Codable, Hashable {
|
||||
try container.encodeIfPresent(enumNumber, forKey: .enumNumber)
|
||||
try container.encodeIfPresent(outerEnum, forKey: .outerEnum)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Must be named `File` for test. */
|
||||
public struct File: Codable, Hashable {
|
||||
@@ -17,6 +19,7 @@ public struct File: Codable, Hashable {
|
||||
public init(sourceURI: String? = nil) {
|
||||
self.sourceURI = sourceURI
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case sourceURI
|
||||
}
|
||||
@@ -27,7 +30,5 @@ public struct File: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(sourceURI, forKey: .sourceURI)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct FileSchemaTestClass: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct FileSchemaTestClass: Codable, Hashable {
|
||||
self.file = file
|
||||
self.files = files
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case file
|
||||
case files
|
||||
@@ -29,7 +32,5 @@ public struct FileSchemaTestClass: Codable, Hashable {
|
||||
try container.encodeIfPresent(file, forKey: .file)
|
||||
try container.encodeIfPresent(files, forKey: .files)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct FormatTest: Codable, Hashable {
|
||||
|
||||
@@ -39,6 +41,7 @@ public struct FormatTest: Codable, Hashable {
|
||||
self.uuid = uuid
|
||||
self.password = password
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case integer
|
||||
case int32
|
||||
@@ -73,7 +76,5 @@ public struct FormatTest: Codable, Hashable {
|
||||
try container.encodeIfPresent(uuid, forKey: .uuid)
|
||||
try container.encode(password, forKey: .password)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct HasOnlyReadOnly: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct HasOnlyReadOnly: Codable, Hashable {
|
||||
self.bar = bar
|
||||
self.foo = foo
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case bar
|
||||
case foo
|
||||
@@ -29,7 +32,5 @@ public struct HasOnlyReadOnly: Codable, Hashable {
|
||||
try container.encodeIfPresent(bar, forKey: .bar)
|
||||
try container.encodeIfPresent(foo, forKey: .foo)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct List: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct List: Codable, Hashable {
|
||||
public init(_123list: String? = nil) {
|
||||
self._123list = _123list
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case _123list = "123-list"
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct List: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(_123list, forKey: ._123list)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct MapTest: Codable, Hashable {
|
||||
|
||||
@@ -25,6 +27,7 @@ public struct MapTest: Codable, Hashable {
|
||||
self.directMap = directMap
|
||||
self.indirectMap = indirectMap
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case mapMapOfString = "map_map_of_string"
|
||||
case mapOfEnumString = "map_of_enum_string"
|
||||
@@ -41,7 +44,5 @@ public struct MapTest: Codable, Hashable {
|
||||
try container.encodeIfPresent(directMap, forKey: .directMap)
|
||||
try container.encodeIfPresent(indirectMap, forKey: .indirectMap)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
|
||||
self.dateTime = dateTime
|
||||
self.map = map
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case uuid
|
||||
case dateTime
|
||||
@@ -33,7 +36,5 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
|
||||
try container.encodeIfPresent(dateTime, forKey: .dateTime)
|
||||
try container.encodeIfPresent(map, forKey: .map)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing model name starting with number */
|
||||
public struct Model200Response: Codable, Hashable {
|
||||
@@ -18,6 +20,7 @@ public struct Model200Response: Codable, Hashable {
|
||||
self.name = name
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
case _class = "class"
|
||||
@@ -30,7 +33,5 @@ public struct Model200Response: Codable, Hashable {
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
try container.encodeIfPresent(_class, forKey: ._class)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing model name same as property name */
|
||||
public struct Name: Codable, Hashable {
|
||||
@@ -22,6 +24,7 @@ public struct Name: Codable, Hashable {
|
||||
self.property = property
|
||||
self._123number = _123number
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
case snakeCase = "snake_case"
|
||||
@@ -38,7 +41,5 @@ public struct Name: Codable, Hashable {
|
||||
try container.encodeIfPresent(property, forKey: .property)
|
||||
try container.encodeIfPresent(_123number, forKey: ._123number)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct NumberOnly: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct NumberOnly: Codable, Hashable {
|
||||
public init(justNumber: Double? = nil) {
|
||||
self.justNumber = justNumber
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case justNumber = "JustNumber"
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct NumberOnly: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(justNumber, forKey: .justNumber)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Order: Codable, Hashable {
|
||||
|
||||
@@ -31,6 +33,7 @@ public struct Order: Codable, Hashable {
|
||||
self.status = status
|
||||
self.complete = complete
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case id
|
||||
case petId
|
||||
@@ -51,7 +54,5 @@ public struct Order: Codable, Hashable {
|
||||
try container.encodeIfPresent(status, forKey: .status)
|
||||
try container.encodeIfPresent(complete, forKey: .complete)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct OuterComposite: Codable, Hashable {
|
||||
|
||||
@@ -19,6 +21,7 @@ public struct OuterComposite: Codable, Hashable {
|
||||
self.myString = myString
|
||||
self.myBoolean = myBoolean
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case myNumber = "my_number"
|
||||
case myString = "my_string"
|
||||
@@ -33,7 +36,5 @@ public struct OuterComposite: Codable, Hashable {
|
||||
try container.encodeIfPresent(myString, forKey: .myString)
|
||||
try container.encodeIfPresent(myBoolean, forKey: .myBoolean)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public enum OuterEnum: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
@@ -31,6 +33,7 @@ public struct Pet: Codable, Hashable {
|
||||
self.tags = tags
|
||||
self.status = status
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case id
|
||||
case category
|
||||
@@ -51,7 +54,5 @@ public struct Pet: Codable, Hashable {
|
||||
try container.encodeIfPresent(tags, forKey: .tags)
|
||||
try container.encodeIfPresent(status, forKey: .status)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct ReadOnlyFirst: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct ReadOnlyFirst: Codable, Hashable {
|
||||
self.bar = bar
|
||||
self.baz = baz
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case bar
|
||||
case baz
|
||||
@@ -29,7 +32,5 @@ public struct ReadOnlyFirst: Codable, Hashable {
|
||||
try container.encodeIfPresent(bar, forKey: .bar)
|
||||
try container.encodeIfPresent(baz, forKey: .baz)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing reserved words */
|
||||
public struct Return: Codable, Hashable {
|
||||
@@ -16,6 +18,7 @@ public struct Return: Codable, Hashable {
|
||||
public init(_return: Int? = nil) {
|
||||
self._return = _return
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case _return = "return"
|
||||
}
|
||||
@@ -26,7 +29,5 @@ public struct Return: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(_return, forKey: ._return)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct SpecialModelName: Codable, Hashable {
|
||||
|
||||
@@ -15,6 +17,7 @@ public struct SpecialModelName: Codable, Hashable {
|
||||
public init(specialPropertyName: Int64? = nil) {
|
||||
self.specialPropertyName = specialPropertyName
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case specialPropertyName = "$special[property.name]"
|
||||
}
|
||||
@@ -25,7 +28,5 @@ public struct SpecialModelName: Codable, Hashable {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(specialPropertyName, forKey: .specialPropertyName)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,16 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct StringBooleanMap: Codable, Hashable {
|
||||
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
}
|
||||
|
||||
public private(set) var additionalProperties: [String: Bool] = [:]
|
||||
|
||||
public subscript(key: String) -> Bool? {
|
||||
@@ -38,11 +42,11 @@ public struct StringBooleanMap: Codable, Hashable {
|
||||
// Decodable protocol methods
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: String.self)
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
var nonAdditionalPropertyKeys = Set<String>()
|
||||
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
let additionalPropertiesContainer = try decoder.container(keyedBy: String.self)
|
||||
additionalProperties = try additionalPropertiesContainer.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct Tag: Codable, Hashable {
|
||||
|
||||
@@ -17,6 +19,7 @@ public struct Tag: Codable, Hashable {
|
||||
self.id = id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case id
|
||||
case name
|
||||
@@ -29,7 +32,5 @@ public struct Tag: Codable, Hashable {
|
||||
try container.encodeIfPresent(id, forKey: .id)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct TypeHolderDefault: Codable, Hashable {
|
||||
|
||||
@@ -23,6 +25,7 @@ public struct TypeHolderDefault: Codable, Hashable {
|
||||
self.boolItem = boolItem
|
||||
self.arrayItem = arrayItem
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case stringItem = "string_item"
|
||||
case numberItem = "number_item"
|
||||
@@ -41,7 +44,5 @@ public struct TypeHolderDefault: Codable, Hashable {
|
||||
try container.encode(boolItem, forKey: .boolItem)
|
||||
try container.encode(arrayItem, forKey: .arrayItem)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct TypeHolderExample: Codable, Hashable {
|
||||
|
||||
@@ -23,6 +25,7 @@ public struct TypeHolderExample: Codable, Hashable {
|
||||
self.boolItem = boolItem
|
||||
self.arrayItem = arrayItem
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case stringItem = "string_item"
|
||||
case numberItem = "number_item"
|
||||
@@ -41,7 +44,5 @@ public struct TypeHolderExample: Codable, Hashable {
|
||||
try container.encode(boolItem, forKey: .boolItem)
|
||||
try container.encode(arrayItem, forKey: .arrayItem)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
#if canImport(AnyCodable)
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
public struct User: Codable, Hashable {
|
||||
|
||||
@@ -30,6 +32,7 @@ public struct User: Codable, Hashable {
|
||||
self.phone = phone
|
||||
self.userStatus = userStatus
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case id
|
||||
case username
|
||||
@@ -54,7 +57,5 @@ public struct User: Codable, Hashable {
|
||||
try container.encodeIfPresent(phone, forKey: .phone)
|
||||
try container.encodeIfPresent(userStatus, forKey: .userStatus)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -93,14 +93,14 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
return modifiedRequest
|
||||
}
|
||||
|
||||
override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||
override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClient.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||
let urlSessionId = UUID().uuidString
|
||||
// Create a new manager for each request to customize its request header
|
||||
let urlSession = createURLSession()
|
||||
urlSessionStore[urlSessionId] = urlSession
|
||||
|
||||
guard let xMethod = HTTPMethod(rawValue: method) else {
|
||||
fatalError("Unsuported Http method - \(method)")
|
||||
fatalError("Unsupported Http method - \(method)")
|
||||
}
|
||||
|
||||
let encoding: ParameterEncoding
|
||||
@@ -119,7 +119,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
} else if contentType == "application/x-www-form-urlencoded" {
|
||||
encoding = FormURLEncoding()
|
||||
} else {
|
||||
fatalError("Unsuported Media Type - \(contentType)")
|
||||
fatalError("Unsupported Media Type - \(contentType)")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,16 +205,18 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
}
|
||||
|
||||
let fileManager = FileManager.default
|
||||
let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
|
||||
let cachesDirectory = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0]
|
||||
let requestURL = try getURL(from: urlRequest)
|
||||
|
||||
var requestPath = try getPath(from: requestURL)
|
||||
|
||||
if let headerFileName = getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) {
|
||||
requestPath = requestPath.appending("/\(headerFileName)")
|
||||
} else {
|
||||
requestPath = requestPath.appending("/tmp.PetstoreClient.\(UUID().uuidString)")
|
||||
}
|
||||
|
||||
let filePath = documentsDirectory.appendingPathComponent(requestPath)
|
||||
let filePath = cachesDirectory.appendingPathComponent(requestPath)
|
||||
let directoryPath = filePath.deletingLastPathComponent().path
|
||||
|
||||
try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil)
|
||||
@@ -232,6 +234,10 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: nil)))
|
||||
|
||||
case is Data.Type:
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: data as? T)))
|
||||
|
||||
default:
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: data as? T)))
|
||||
@@ -244,7 +250,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
for (key, value) in headers {
|
||||
httpHeaders[key] = value
|
||||
}
|
||||
for (key, value) in PetstoreClientAPI.customHeaders {
|
||||
for (key, value) in PetstoreClient.customHeaders {
|
||||
httpHeaders[key] = value
|
||||
}
|
||||
return httpHeaders
|
||||
@@ -328,6 +334,43 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
|
||||
completion(.success(Response<T>(response: httpResponse, body: body as? T)))
|
||||
|
||||
case is URL.Type:
|
||||
do {
|
||||
|
||||
guard error == nil else {
|
||||
throw DownloadException.responseFailed
|
||||
}
|
||||
|
||||
guard let data = data else {
|
||||
throw DownloadException.responseDataMissing
|
||||
}
|
||||
|
||||
let fileManager = FileManager.default
|
||||
let cachesDirectory = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0]
|
||||
let requestURL = try getURL(from: urlRequest)
|
||||
|
||||
var requestPath = try getPath(from: requestURL)
|
||||
|
||||
if let headerFileName = getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) {
|
||||
requestPath = requestPath.appending("/\(headerFileName)")
|
||||
} else {
|
||||
requestPath = requestPath.appending("/tmp.PetstoreClient.\(UUID().uuidString)")
|
||||
}
|
||||
|
||||
let filePath = cachesDirectory.appendingPathComponent(requestPath)
|
||||
let directoryPath = filePath.deletingLastPathComponent().path
|
||||
|
||||
try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil)
|
||||
try data.write(to: filePath, options: .atomic)
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: filePath as? T)))
|
||||
|
||||
} catch let requestParserError as DownloadException {
|
||||
completion(.failure(ErrorResponse.error(400, data, response, requestParserError)))
|
||||
} catch {
|
||||
completion(.failure(ErrorResponse.error(400, data, response, error)))
|
||||
}
|
||||
|
||||
case is Void.Type:
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: nil)))
|
||||
|
||||
@@ -379,7 +379,7 @@ import PetstoreClient
|
||||
let number = 987 // Double | None
|
||||
let double = 987 // Double | None
|
||||
let patternWithoutDelimiter = "patternWithoutDelimiter_example" // String | None
|
||||
let byte = 987 // Data | None
|
||||
let byte = Data([9, 8, 7]) // Data | None
|
||||
let integer = 987 // Int | None (optional)
|
||||
let int32 = 987 // Int | None (optional)
|
||||
let int64 = 987 // Int64 | None (optional)
|
||||
|
||||
43
samples/client/petstore/swift5/readonlyProperties/pom.xml
Normal file
43
samples/client/petstore/swift5/readonlyProperties/pom.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>Swift5PetstoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Swift5 Swagger Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>xcodebuild-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>./run_spmbuild.sh</executable>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -11,5 +11,5 @@ targets:
|
||||
settings:
|
||||
APPLICATION_EXTENSION_API_ONLY: true
|
||||
scheme: {}
|
||||
|
||||
dependencies:
|
||||
- carthage: AnyCodable
|
||||
|
||||
3
samples/client/petstore/swift5/readonlyProperties/run_spmbuild.sh
Executable file
3
samples/client/petstore/swift5/readonlyProperties/run_spmbuild.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
swift build && exit ${PIPESTATUS[0]}
|
||||
Reference in New Issue
Block a user