forked from loafle/openapi-generator-original
run swiftlint latest version on swift samples (#6788)
This commit is contained in:
parent
5cce9dc7d3
commit
720ab3d39b
@ -14,19 +14,19 @@ let package = Package(
|
|||||||
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
||||||
.library(
|
.library(
|
||||||
name: "PetstoreClient",
|
name: "PetstoreClient",
|
||||||
targets: ["PetstoreClient"]),
|
targets: ["PetstoreClient"])
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1"),
|
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1")
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
|
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
|
||||||
.target(
|
.target(
|
||||||
name: "PetstoreClient",
|
name: "PetstoreClient",
|
||||||
dependencies: ["Alamofire", ],
|
dependencies: ["Alamofire" ],
|
||||||
path: "PetstoreClient/Classes"
|
path: "PetstoreClient/Classes"
|
||||||
),
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct APIHelper {
|
public struct APIHelper {
|
||||||
public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? {
|
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
|
||||||
let destination = source.reduce(into: [String: Any]()) { (result, item) in
|
let destination = source.reduce(into: [String: Any]()) { (result, item) in
|
||||||
if let value = item.value {
|
if let value = item.value {
|
||||||
result[item.key] = value
|
result[item.key] = value
|
||||||
@ -20,17 +20,17 @@ public struct APIHelper {
|
|||||||
return destination
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] {
|
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||||
return source.reduce(into: [String: String]()) { (result, item) in
|
return source.reduce(into: [String: String]()) { (result, item) in
|
||||||
if let collection = item.value as? Array<Any?> {
|
if let collection = item.value as? [Any?] {
|
||||||
result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",")
|
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||||
} else if let value: Any = item.value {
|
} else if let value: Any = item.value {
|
||||||
result[item.key] = "\(value)"
|
result[item.key] = "\(value)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? {
|
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
|
||||||
guard let source = source else {
|
guard let source = source else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -46,15 +46,15 @@ public struct APIHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||||
if let collection = source as? Array<Any?> {
|
if let collection = source as? [Any?] {
|
||||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||||
}
|
}
|
||||||
return source
|
return source
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
|
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||||
if let collection = item.value as? Array<Any?> {
|
if let collection = item.value as? [Any?] {
|
||||||
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
|
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
|
||||||
result.append(URLQueryItem(name: item.key, value: value))
|
result.append(URLQueryItem(name: item.key, value: value))
|
||||||
}
|
}
|
||||||
@ -69,4 +69,3 @@ public struct APIHelper {
|
|||||||
return destination
|
return destination
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,23 +9,23 @@ import Foundation
|
|||||||
open class PetstoreClientAPI {
|
open class PetstoreClientAPI {
|
||||||
public static var basePath = "http://petstore.swagger.io:80/v2"
|
public static var basePath = "http://petstore.swagger.io:80/v2"
|
||||||
public static var credential: URLCredential?
|
public static var credential: URLCredential?
|
||||||
public static var customHeaders: [String:String] = [:]
|
public static var customHeaders: [String: String] = [:]
|
||||||
public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
|
public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
|
||||||
public static var apiResponseQueue: DispatchQueue = .main
|
public static var apiResponseQueue: DispatchQueue = .main
|
||||||
}
|
}
|
||||||
|
|
||||||
open class RequestBuilder<T> {
|
open class RequestBuilder<T> {
|
||||||
var credential: URLCredential?
|
var credential: URLCredential?
|
||||||
var headers: [String:String]
|
var headers: [String: String]
|
||||||
public let parameters: [String:Any]?
|
public let parameters: [String: Any]?
|
||||||
public let isBody: Bool
|
public let isBody: Bool
|
||||||
public let method: String
|
public let method: String
|
||||||
public let URLString: String
|
public let URLString: String
|
||||||
|
|
||||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||||
public var onProgressReady: ((Progress) -> ())?
|
public var onProgressReady: ((Progress) -> Void)?
|
||||||
|
|
||||||
required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) {
|
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
|
||||||
self.method = method
|
self.method = method
|
||||||
self.URLString = URLString
|
self.URLString = URLString
|
||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
@ -35,7 +35,7 @@ open class RequestBuilder<T> {
|
|||||||
addHeaders(PetstoreClientAPI.customHeaders)
|
addHeaders(PetstoreClientAPI.customHeaders)
|
||||||
}
|
}
|
||||||
|
|
||||||
open func addHeaders(_ aHeaders:[String:String]) {
|
open func addHeaders(_ aHeaders: [String: String]) {
|
||||||
for (header, value) in aHeaders {
|
for (header, value) in aHeaders {
|
||||||
headers[header] = value
|
headers[header] = value
|
||||||
}
|
}
|
||||||
@ -58,5 +58,5 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
public protocol RequestBuilderFactory {
|
public protocol RequestBuilderFactory {
|
||||||
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
|
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
|
||||||
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
|
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class AnotherFakeAPI {
|
open class AnotherFakeAPI {
|
||||||
/**
|
/**
|
||||||
To test special tags
|
To test special tags
|
||||||
@ -17,7 +15,7 @@ open class AnotherFakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||||
call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class FakeAPI {
|
open class FakeAPI {
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -16,7 +14,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) {
|
||||||
fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -51,7 +49,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) {
|
||||||
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -86,7 +84,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) {
|
||||||
fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -121,7 +119,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) {
|
||||||
fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -156,7 +154,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -192,7 +190,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in
|
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -231,7 +229,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||||
testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -281,7 +279,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.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
|
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 {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -318,7 +316,7 @@ open class FakeAPI {
|
|||||||
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> {
|
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 path = "/fake"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"integer": integer?.encodeToJSON(),
|
"integer": integer?.encodeToJSON(),
|
||||||
"int32": int32?.encodeToJSON(),
|
"int32": int32?.encodeToJSON(),
|
||||||
"int64": int64?.encodeToJSON(),
|
"int64": int64?.encodeToJSON(),
|
||||||
@ -426,7 +424,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.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
|
testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -454,7 +452,7 @@ open class FakeAPI {
|
|||||||
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> {
|
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 path = "/fake"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"enum_form_string_array": enumFormStringArray?.encodeToJSON(),
|
"enum_form_string_array": enumFormStringArray?.encodeToJSON(),
|
||||||
"enum_form_string": enumFormString?.encodeToJSON()
|
"enum_form_string": enumFormString?.encodeToJSON()
|
||||||
]
|
]
|
||||||
@ -492,7 +490,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.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
|
testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -518,7 +516,7 @@ open class FakeAPI {
|
|||||||
open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> 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 path = "/fake"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -545,7 +543,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in
|
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -562,7 +560,7 @@ open class FakeAPI {
|
|||||||
- parameter param: (body) request body
|
- parameter param: (body) request body
|
||||||
- returns: RequestBuilder<Void>
|
- returns: RequestBuilder<Void>
|
||||||
*/
|
*/
|
||||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
|
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> {
|
||||||
let path = "/fake/inline-additionalProperties"
|
let path = "/fake/inline-additionalProperties"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
||||||
@ -582,7 +580,7 @@ open class FakeAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in
|
testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -603,7 +601,7 @@ open class FakeAPI {
|
|||||||
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
||||||
let path = "/fake/jsonFormData"
|
let path = "/fake/jsonFormData"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"param": param.encodeToJSON(),
|
"param": param.encodeToJSON(),
|
||||||
"param2": param2.encodeToJSON()
|
"param2": param2.encodeToJSON()
|
||||||
]
|
]
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class FakeClassnameTags123API {
|
open class FakeClassnameTags123API {
|
||||||
/**
|
/**
|
||||||
To test class name in snake case
|
To test class name in snake case
|
||||||
@ -17,7 +15,7 @@ open class FakeClassnameTags123API {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
|
||||||
testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class PetAPI {
|
open class PetAPI {
|
||||||
/**
|
/**
|
||||||
Add a new pet to the store
|
Add a new pet to the store
|
||||||
@ -17,7 +15,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -57,7 +55,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in
|
deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -84,7 +82,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
let nillableHeaders: [String: Any?] = [
|
let nillableHeaders: [String: Any?] = [
|
||||||
@ -113,7 +111,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) {
|
||||||
findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in
|
findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -137,7 +135,7 @@ open class PetAPI {
|
|||||||
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
||||||
let path = "/pet/findByStatus"
|
let path = "/pet/findByStatus"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -157,7 +155,7 @@ open class PetAPI {
|
|||||||
- parameter completion: completion handler to receive the data and the error objects
|
- parameter completion: completion handler to receive the data and the error objects
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated, message: "This operation is deprecated.")
|
@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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) {
|
||||||
findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in
|
findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -182,7 +180,7 @@ open class PetAPI {
|
|||||||
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
||||||
let path = "/pet/findByTags"
|
let path = "/pet/findByTags"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -201,7 +199,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) {
|
||||||
getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in
|
getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -228,7 +226,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -244,7 +242,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -285,7 +283,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in
|
updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -313,7 +311,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"name": name?.encodeToJSON(),
|
"name": name?.encodeToJSON(),
|
||||||
"status": status?.encodeToJSON()
|
"status": status?.encodeToJSON()
|
||||||
]
|
]
|
||||||
@ -337,7 +335,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) {
|
||||||
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in
|
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -365,7 +363,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||||
"file": file?.encodeToJSON()
|
"file": file?.encodeToJSON()
|
||||||
]
|
]
|
||||||
@ -389,7 +387,7 @@ open class PetAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) {
|
||||||
uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in
|
uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -417,7 +415,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||||
"requiredFile": requiredFile.encodeToJSON()
|
"requiredFile": requiredFile.encodeToJSON()
|
||||||
]
|
]
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class StoreAPI {
|
open class StoreAPI {
|
||||||
/**
|
/**
|
||||||
Delete purchase order by ID
|
Delete purchase order by ID
|
||||||
@ -17,7 +15,7 @@ open class StoreAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in
|
deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -41,7 +39,7 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ open class StoreAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) {
|
||||||
getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -76,14 +74,14 @@ open class StoreAPI {
|
|||||||
- name: api_key
|
- name: api_key
|
||||||
- returns: RequestBuilder<[String:Int]>
|
- returns: RequestBuilder<[String:Int]>
|
||||||
*/
|
*/
|
||||||
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> {
|
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> {
|
||||||
let path = "/store/inventory"
|
let path = "/store/inventory"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||||
|
|
||||||
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
||||||
}
|
}
|
||||||
@ -95,7 +93,7 @@ open class StoreAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) {
|
||||||
getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in
|
getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -119,7 +117,7 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -135,7 +133,7 @@ open class StoreAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) {
|
||||||
placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class UserAPI {
|
open class UserAPI {
|
||||||
/**
|
/**
|
||||||
Create user
|
Create user
|
||||||
@ -17,7 +15,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -54,7 +52,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -90,7 +88,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -126,7 +124,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in
|
deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -150,7 +148,7 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -166,7 +164,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) {
|
||||||
getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in
|
getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -189,7 +187,7 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -206,7 +204,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) {
|
||||||
loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in
|
loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -228,7 +226,7 @@ open class UserAPI {
|
|||||||
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
||||||
let path = "/user/login"
|
let path = "/user/login"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -247,7 +245,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
@ -266,7 +264,7 @@ open class UserAPI {
|
|||||||
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
||||||
let path = "/user/logout"
|
let path = "/user/logout"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -283,7 +281,7 @@ open class UserAPI {
|
|||||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||||
- parameter completion: completion handler to receive the data and the error objects
|
- 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 = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) {
|
||||||
updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in
|
updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success:
|
case .success:
|
||||||
|
@ -12,7 +12,7 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory {
|
|||||||
return AlamofireRequestBuilder<T>.self
|
return AlamofireRequestBuilder<T>.self
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type {
|
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
|
||||||
return AlamofireDecodableRequestBuilder<T>.self
|
return AlamofireDecodableRequestBuilder<T>.self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory {
|
|||||||
private var managerStore = SynchronizedDictionary<String, Alamofire.SessionManager>()
|
private var managerStore = SynchronizedDictionary<String, Alamofire.SessionManager>()
|
||||||
|
|
||||||
open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
||||||
required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) {
|
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
|
||||||
super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers)
|
super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,17 +59,17 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
May be overridden by a subclass if you want to control the request
|
May be overridden by a subclass if you want to control the request
|
||||||
configuration (e.g. to override the cache policy).
|
configuration (e.g. to override the cache policy).
|
||||||
*/
|
*/
|
||||||
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest {
|
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest {
|
||||||
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers)
|
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||||
let managerId:String = UUID().uuidString
|
let managerId: String = UUID().uuidString
|
||||||
// Create a new manager for each request to customize its request header
|
// Create a new manager for each request to customize its request header
|
||||||
let manager = createSessionManager()
|
let manager = createSessionManager()
|
||||||
managerStore[managerId] = manager
|
managerStore[managerId] = manager
|
||||||
|
|
||||||
let encoding:ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding()
|
let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding()
|
||||||
|
|
||||||
let xMethod = Alamofire.HTTPMethod(rawValue: method)
|
let xMethod = Alamofire.HTTPMethod(rawValue: method)
|
||||||
let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL }
|
let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL }
|
||||||
@ -82,8 +82,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
case let fileURL as URL:
|
case let fileURL as URL:
|
||||||
if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) {
|
if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) {
|
||||||
mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType)
|
mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mpForm.append(fileURL, withName: k)
|
mpForm.append(fileURL, withName: k)
|
||||||
}
|
}
|
||||||
case let string as String:
|
case let string as String:
|
||||||
@ -102,7 +101,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
}
|
}
|
||||||
self.processRequest(request: upload, managerId, apiResponseQueue, completion)
|
self.processRequest(request: upload, managerId, apiResponseQueue, completion)
|
||||||
case .failure(let encodingError):
|
case .failure(let encodingError):
|
||||||
apiResponseQueue.async{
|
apiResponseQueue.async {
|
||||||
completion(.failure(ErrorResponse.error(415, nil, encodingError)))
|
completion(.failure(ErrorResponse.error(415, nil, encodingError)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +219,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
return httpHeaders
|
return httpHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? {
|
fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? {
|
||||||
|
|
||||||
guard let contentDisposition = contentDisposition else {
|
guard let contentDisposition = contentDisposition else {
|
||||||
return nil
|
return nil
|
||||||
@ -228,7 +227,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
|
|
||||||
let items = contentDisposition.components(separatedBy: ";")
|
let items = contentDisposition.components(separatedBy: ";")
|
||||||
|
|
||||||
var filename : String? = nil
|
var filename: String?
|
||||||
|
|
||||||
for contentItem in items {
|
for contentItem in items {
|
||||||
|
|
||||||
@ -239,7 +238,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
|
|
||||||
filename = contentItem
|
filename = contentItem
|
||||||
return filename?
|
return filename?
|
||||||
.replacingCharacters(in: range, with:"")
|
.replacingCharacters(in: range, with: "")
|
||||||
.replacingOccurrences(of: "\"", with: "")
|
.replacingOccurrences(of: "\"", with: "")
|
||||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
}
|
}
|
||||||
@ -248,7 +247,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func getPath(from url : URL) throws -> String {
|
fileprivate func getPath(from url: URL) throws -> String {
|
||||||
|
|
||||||
guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else {
|
guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else {
|
||||||
throw DownloadException.requestMissingPath
|
throw DownloadException.requestMissingPath
|
||||||
@ -262,7 +261,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func getURL(from urlRequest : URLRequest) throws -> URL {
|
fileprivate func getURL(from urlRequest: URLRequest) throws -> URL {
|
||||||
|
|
||||||
guard let url = urlRequest.url else {
|
guard let url = urlRequest.url else {
|
||||||
throw DownloadException.requestMissingURL
|
throw DownloadException.requestMissingURL
|
||||||
@ -273,7 +272,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilder<T> {
|
open class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T> {
|
||||||
|
|
||||||
override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ apiResponseQueue: DispatchQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ apiResponseQueue: DispatchQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
|
@ -108,24 +108,24 @@ extension String: CodingKey {
|
|||||||
|
|
||||||
extension KeyedEncodingContainerProtocol {
|
extension KeyedEncodingContainerProtocol {
|
||||||
|
|
||||||
public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable {
|
public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable {
|
||||||
var arrayContainer = nestedUnkeyedContainer(forKey: key)
|
var arrayContainer = nestedUnkeyedContainer(forKey: key)
|
||||||
try arrayContainer.encode(contentsOf: values)
|
try arrayContainer.encode(contentsOf: values)
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable {
|
public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable {
|
||||||
if let values = values {
|
if let values = values {
|
||||||
try encodeArray(values, forKey: key)
|
try encodeArray(values, forKey: key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable {
|
public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable {
|
||||||
for (key, value) in pairs {
|
for (key, value) in pairs {
|
||||||
try encode(value, forKey: key)
|
try encode(value, forKey: key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable {
|
public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable {
|
||||||
if let pairs = pairs {
|
if let pairs = pairs {
|
||||||
try encodeMap(pairs)
|
try encodeMap(pairs)
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol {
|
|||||||
|
|
||||||
extension KeyedDecodingContainerProtocol {
|
extension KeyedDecodingContainerProtocol {
|
||||||
|
|
||||||
public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable {
|
public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable {
|
||||||
var tmpArray = [T]()
|
var tmpArray = [T]()
|
||||||
|
|
||||||
var nestedContainer = try nestedUnkeyedContainer(forKey: key)
|
var nestedContainer = try nestedUnkeyedContainer(forKey: key)
|
||||||
@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol {
|
|||||||
return tmpArray
|
return tmpArray
|
||||||
}
|
}
|
||||||
|
|
||||||
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable {
|
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable {
|
||||||
var tmpArray: [T]? = nil
|
var tmpArray: [T]?
|
||||||
|
|
||||||
if contains(key) {
|
if contains(key) {
|
||||||
tmpArray = try decodeArray(T.self, forKey: key)
|
tmpArray = try decodeArray(T.self, forKey: key)
|
||||||
@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol {
|
|||||||
return tmpArray
|
return tmpArray
|
||||||
}
|
}
|
||||||
|
|
||||||
public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable {
|
public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable {
|
||||||
var map: [Self.Key : T] = [:]
|
var map: [Self.Key: T] = [:]
|
||||||
|
|
||||||
for key in allKeys {
|
for key in allKeys {
|
||||||
if !excludedKeys.contains(key) {
|
if !excludedKeys.contains(key) {
|
||||||
@ -177,5 +177,3 @@ extension HTTPURLResponse {
|
|||||||
return Array(200 ..< 300).contains(statusCode)
|
return Array(200 ..< 300).contains(statusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public struct JSONDataEncoding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
||||||
var returnedParams: [String: Any]? = nil
|
var returnedParams: [String: Any]?
|
||||||
if let jsonData = jsonData, !jsonData.isEmpty {
|
if let jsonData = jsonData, !jsonData.isEmpty {
|
||||||
var params: [String: Any] = [:]
|
var params: [String: Any] = [:]
|
||||||
params[jsonDataKey] = jsonData
|
params[jsonDataKey] = jsonData
|
||||||
|
@ -9,8 +9,8 @@ import Foundation
|
|||||||
|
|
||||||
open class JSONEncodingHelper {
|
open class JSONEncodingHelper {
|
||||||
|
|
||||||
open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
||||||
var params: [String: Any]? = nil
|
var params: [String: Any]?
|
||||||
|
|
||||||
// Encode the Encodable object
|
// Encode the Encodable object
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
@ -27,7 +27,7 @@ open class JSONEncodingHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
|
open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
|
||||||
var params: [String: Any]? = nil
|
var params: [String: Any]?
|
||||||
|
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
do {
|
do {
|
||||||
|
@ -10,11 +10,11 @@ protocol JSONEncodable {
|
|||||||
func encodeToJSON() -> Any
|
func encodeToJSON() -> Any
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ErrorResponse : Error {
|
public enum ErrorResponse: Error {
|
||||||
case error(Int, Data?, Error)
|
case error(Int, Data?, Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DownloadException : Error {
|
public enum DownloadException: Error {
|
||||||
case responseDataMissing
|
case responseDataMissing
|
||||||
case responseFailed
|
case responseFailed
|
||||||
case requestMissing
|
case requestMissing
|
||||||
@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error {
|
|||||||
case generalError(Error)
|
case generalError(Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
open class Response<T> {
|
open class Response<T> {
|
||||||
public let statusCode: Int
|
public let statusCode: Int
|
||||||
public let header: [String: String]
|
public let header: [String: String]
|
||||||
@ -44,7 +43,7 @@ open class Response<T> {
|
|||||||
|
|
||||||
public convenience init(response: HTTPURLResponse, body: T?) {
|
public convenience init(response: HTTPURLResponse, body: T?) {
|
||||||
let rawHeader = response.allHeaderFields
|
let rawHeader = response.allHeaderFields
|
||||||
var header = [String:String]()
|
var header = [String: String]()
|
||||||
for (key, value) in rawHeader {
|
for (key, value) in rawHeader {
|
||||||
if let key = key.base as? String, let value = value as? String {
|
if let key = key.base as? String, let value = value as? String {
|
||||||
header[key] = value
|
header[key] = value
|
||||||
|
@ -7,14 +7,12 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct AdditionalPropertiesClass: Codable {
|
public struct AdditionalPropertiesClass: Codable {
|
||||||
|
|
||||||
|
public var mapString: [String: String]?
|
||||||
|
public var mapMapString: [String: [String: String]]?
|
||||||
|
|
||||||
public var mapString: [String:String]?
|
public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) {
|
||||||
public var mapMapString: [String:[String:String]]?
|
|
||||||
|
|
||||||
public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) {
|
|
||||||
self.mapString = mapString
|
self.mapString = mapString
|
||||||
self.mapMapString = mapMapString
|
self.mapMapString = mapMapString
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Animal: Codable {
|
public struct Animal: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
|
||||||
|
@ -7,5 +7,4 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias AnimalFarm = [Animal]
|
public typealias AnimalFarm = [Animal]
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ApiResponse: Codable {
|
public struct ApiResponse: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var code: Int?
|
public var code: Int?
|
||||||
public var type: String?
|
public var type: String?
|
||||||
public var message: String?
|
public var message: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ArrayOfArrayOfNumberOnly: Codable {
|
public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var arrayArrayNumber: [[Double]]?
|
public var arrayArrayNumber: [[Double]]?
|
||||||
|
|
||||||
public init(arrayArrayNumber: [[Double]]?) {
|
public init(arrayArrayNumber: [[Double]]?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ArrayOfNumberOnly: Codable {
|
public struct ArrayOfNumberOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var arrayNumber: [Double]?
|
public var arrayNumber: [Double]?
|
||||||
|
|
||||||
public init(arrayNumber: [Double]?) {
|
public init(arrayNumber: [Double]?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ArrayTest: Codable {
|
public struct ArrayTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var arrayOfString: [String]?
|
public var arrayOfString: [String]?
|
||||||
public var arrayArrayOfInteger: [[Int64]]?
|
public var arrayArrayOfInteger: [[Int64]]?
|
||||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Capitalization: Codable {
|
public struct Capitalization: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var smallCamel: String?
|
public var smallCamel: String?
|
||||||
public var capitalCamel: String?
|
public var capitalCamel: String?
|
||||||
public var smallSnake: String?
|
public var smallSnake: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Cat: Codable {
|
public struct Cat: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
public var declawed: Bool?
|
public var declawed: Bool?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct CatAllOf: Codable {
|
public struct CatAllOf: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var declawed: Bool?
|
public var declawed: Bool?
|
||||||
|
|
||||||
public init(declawed: Bool?) {
|
public init(declawed: Bool?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Category: Codable {
|
public struct Category: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var name: String = "default-name"
|
public var name: String = "default-name"
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing model with \"_class\" property */
|
/** Model for testing model with \"_class\" property */
|
||||||
public struct ClassModel: Codable {
|
public struct ClassModel: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
|
||||||
public init(_class: String?) {
|
public init(_class: String?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Client: Codable {
|
public struct Client: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var client: String?
|
public var client: String?
|
||||||
|
|
||||||
public init(client: String?) {
|
public init(client: String?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Dog: Codable {
|
public struct Dog: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
public var breed: String?
|
public var breed: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct DogAllOf: Codable {
|
public struct DogAllOf: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var breed: String?
|
public var breed: String?
|
||||||
|
|
||||||
public init(breed: String?) {
|
public init(breed: String?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct EnumArrays: Codable {
|
public struct EnumArrays: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum JustSymbol: String, Codable, CaseIterable {
|
public enum JustSymbol: String, Codable, CaseIterable {
|
||||||
case greaterThanOrEqualTo = ">="
|
case greaterThanOrEqualTo = ">="
|
||||||
case dollar = "$"
|
case dollar = "$"
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public enum EnumClass: String, Codable, CaseIterable {
|
public enum EnumClass: String, Codable, CaseIterable {
|
||||||
case abc = "_abc"
|
case abc = "_abc"
|
||||||
case efg = "-efg"
|
case efg = "-efg"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct EnumTest: Codable {
|
public struct EnumTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum EnumString: String, Codable, CaseIterable {
|
public enum EnumString: String, Codable, CaseIterable {
|
||||||
case upper = "UPPER"
|
case upper = "UPPER"
|
||||||
case lower = "lower"
|
case lower = "lower"
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Must be named `File` for test. */
|
/** Must be named `File` for test. */
|
||||||
public struct File: Codable {
|
public struct File: Codable {
|
||||||
|
|
||||||
|
|
||||||
/** Test capitalization */
|
/** Test capitalization */
|
||||||
public var sourceURI: String?
|
public var sourceURI: String?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct FileSchemaTestClass: Codable {
|
public struct FileSchemaTestClass: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var file: File?
|
public var file: File?
|
||||||
public var files: [File]?
|
public var files: [File]?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct FormatTest: Codable {
|
public struct FormatTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var integer: Int?
|
public var integer: Int?
|
||||||
public var int32: Int?
|
public var int32: Int?
|
||||||
public var int64: Int64?
|
public var int64: Int64?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct HasOnlyReadOnly: Codable {
|
public struct HasOnlyReadOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var bar: String?
|
public var bar: String?
|
||||||
public var foo: String?
|
public var foo: String?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct List: Codable {
|
public struct List: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var _123list: String?
|
public var _123list: String?
|
||||||
|
|
||||||
public init(_123list: String?) {
|
public init(_123list: String?) {
|
||||||
|
@ -7,20 +7,18 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct MapTest: Codable {
|
public struct MapTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||||
case upper = "UPPER"
|
case upper = "UPPER"
|
||||||
case lower = "lower"
|
case lower = "lower"
|
||||||
}
|
}
|
||||||
public var mapMapOfString: [String:[String:String]]?
|
public var mapMapOfString: [String: [String: String]]?
|
||||||
public var mapOfEnumString: [String:String]?
|
public var mapOfEnumString: [String: String]?
|
||||||
public var directMap: [String:Bool]?
|
public var directMap: [String: Bool]?
|
||||||
public var indirectMap: StringBooleanMap?
|
public var indirectMap: StringBooleanMap?
|
||||||
|
|
||||||
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) {
|
public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) {
|
||||||
self.mapMapOfString = mapMapOfString
|
self.mapMapOfString = mapMapOfString
|
||||||
self.mapOfEnumString = mapOfEnumString
|
self.mapOfEnumString = mapOfEnumString
|
||||||
self.directMap = directMap
|
self.directMap = directMap
|
||||||
|
@ -7,15 +7,13 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var uuid: UUID?
|
public var uuid: UUID?
|
||||||
public var dateTime: Date?
|
public var dateTime: Date?
|
||||||
public var map: [String:Animal]?
|
public var map: [String: Animal]?
|
||||||
|
|
||||||
public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) {
|
public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) {
|
||||||
self.uuid = uuid
|
self.uuid = uuid
|
||||||
self.dateTime = dateTime
|
self.dateTime = dateTime
|
||||||
self.map = map
|
self.map = map
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing model name starting with number */
|
/** Model for testing model name starting with number */
|
||||||
public struct Model200Response: Codable {
|
public struct Model200Response: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var name: Int?
|
public var name: Int?
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing model name same as property name */
|
/** Model for testing model name same as property name */
|
||||||
public struct Name: Codable {
|
public struct Name: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var name: Int
|
public var name: Int
|
||||||
public var snakeCase: Int?
|
public var snakeCase: Int?
|
||||||
public var property: String?
|
public var property: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct NumberOnly: Codable {
|
public struct NumberOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var justNumber: Double?
|
public var justNumber: Double?
|
||||||
|
|
||||||
public init(justNumber: Double?) {
|
public init(justNumber: Double?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Order: Codable {
|
public struct Order: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum Status: String, Codable, CaseIterable {
|
public enum Status: String, Codable, CaseIterable {
|
||||||
case placed = "placed"
|
case placed = "placed"
|
||||||
case approved = "approved"
|
case approved = "approved"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct OuterComposite: Codable {
|
public struct OuterComposite: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var myNumber: Double?
|
public var myNumber: Double?
|
||||||
public var myString: String?
|
public var myString: String?
|
||||||
public var myBoolean: Bool?
|
public var myBoolean: Bool?
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public enum OuterEnum: String, Codable, CaseIterable {
|
public enum OuterEnum: String, Codable, CaseIterable {
|
||||||
case placed = "placed"
|
case placed = "placed"
|
||||||
case approved = "approved"
|
case approved = "approved"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Pet: Codable {
|
public struct Pet: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum Status: String, Codable, CaseIterable {
|
public enum Status: String, Codable, CaseIterable {
|
||||||
case available = "available"
|
case available = "available"
|
||||||
case pending = "pending"
|
case pending = "pending"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ReadOnlyFirst: Codable {
|
public struct ReadOnlyFirst: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var bar: String?
|
public var bar: String?
|
||||||
public var baz: String?
|
public var baz: String?
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing reserved words */
|
/** Model for testing reserved words */
|
||||||
public struct Return: Codable {
|
public struct Return: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var _return: Int?
|
public var _return: Int?
|
||||||
|
|
||||||
public init(_return: Int?) {
|
public init(_return: Int?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct SpecialModelName: Codable {
|
public struct SpecialModelName: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var specialPropertyName: Int64?
|
public var specialPropertyName: Int64?
|
||||||
|
|
||||||
public init(specialPropertyName: Int64?) {
|
public init(specialPropertyName: Int64?) {
|
||||||
|
@ -7,12 +7,9 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct StringBooleanMap: Codable {
|
public struct StringBooleanMap: Codable {
|
||||||
|
|
||||||
|
public var additionalProperties: [String: Bool] = [:]
|
||||||
|
|
||||||
public var additionalProperties: [String:Bool] = [:]
|
|
||||||
|
|
||||||
public subscript(key: String) -> Bool? {
|
public subscript(key: String) -> Bool? {
|
||||||
get {
|
get {
|
||||||
@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable {
|
|||||||
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Tag: Codable {
|
public struct Tag: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var name: String?
|
public var name: String?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct TypeHolderDefault: Codable {
|
public struct TypeHolderDefault: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var stringItem: String = "what"
|
public var stringItem: String = "what"
|
||||||
public var numberItem: Double
|
public var numberItem: Double
|
||||||
public var integerItem: Int
|
public var integerItem: Int
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct TypeHolderExample: Codable {
|
public struct TypeHolderExample: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var stringItem: String
|
public var stringItem: String
|
||||||
public var numberItem: Double
|
public var numberItem: Double
|
||||||
public var integerItem: Int
|
public var integerItem: Int
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct User: Codable {
|
public struct User: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var username: String?
|
public var username: String?
|
||||||
public var firstName: String?
|
public var firstName: String?
|
||||||
|
@ -14,7 +14,7 @@ let package = Package(
|
|||||||
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
||||||
.library(
|
.library(
|
||||||
name: "PetstoreClient",
|
name: "PetstoreClient",
|
||||||
targets: ["PetstoreClient"]),
|
targets: ["PetstoreClient"])
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
@ -26,6 +26,6 @@ let package = Package(
|
|||||||
name: "PetstoreClient",
|
name: "PetstoreClient",
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
path: "PetstoreClient/Classes"
|
path: "PetstoreClient/Classes"
|
||||||
),
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct APIHelper {
|
public struct APIHelper {
|
||||||
public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? {
|
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
|
||||||
let destination = source.reduce(into: [String: Any]()) { (result, item) in
|
let destination = source.reduce(into: [String: Any]()) { (result, item) in
|
||||||
if let value = item.value {
|
if let value = item.value {
|
||||||
result[item.key] = value
|
result[item.key] = value
|
||||||
@ -20,17 +20,17 @@ public struct APIHelper {
|
|||||||
return destination
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] {
|
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||||
return source.reduce(into: [String: String]()) { (result, item) in
|
return source.reduce(into: [String: String]()) { (result, item) in
|
||||||
if let collection = item.value as? Array<Any?> {
|
if let collection = item.value as? [Any?] {
|
||||||
result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",")
|
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||||
} else if let value: Any = item.value {
|
} else if let value: Any = item.value {
|
||||||
result[item.key] = "\(value)"
|
result[item.key] = "\(value)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? {
|
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
|
||||||
guard let source = source else {
|
guard let source = source else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -46,15 +46,15 @@ public struct APIHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||||
if let collection = source as? Array<Any?> {
|
if let collection = source as? [Any?] {
|
||||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||||
}
|
}
|
||||||
return source
|
return source
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
|
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||||
if let collection = item.value as? Array<Any?> {
|
if let collection = item.value as? [Any?] {
|
||||||
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
|
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
|
||||||
result.append(URLQueryItem(name: item.key, value: value))
|
result.append(URLQueryItem(name: item.key, value: value))
|
||||||
}
|
}
|
||||||
@ -69,4 +69,3 @@ public struct APIHelper {
|
|||||||
return destination
|
return destination
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,15 +9,15 @@ import Foundation
|
|||||||
open class PetstoreClientAPI {
|
open class PetstoreClientAPI {
|
||||||
public static var basePath = "http://petstore.swagger.io:80/v2"
|
public static var basePath = "http://petstore.swagger.io:80/v2"
|
||||||
public static var credential: URLCredential?
|
public static var credential: URLCredential?
|
||||||
public static var customHeaders: [String:String] = [:]
|
public static var customHeaders: [String: String] = [:]
|
||||||
public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory()
|
public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory()
|
||||||
public static var apiResponseQueue: DispatchQueue = .main
|
public static var apiResponseQueue: DispatchQueue = .main
|
||||||
}
|
}
|
||||||
|
|
||||||
open class RequestBuilder<T> {
|
open class RequestBuilder<T> {
|
||||||
var credential: URLCredential?
|
var credential: URLCredential?
|
||||||
var headers: [String:String]
|
var headers: [String: String]
|
||||||
public let parameters: [String:Any]?
|
public let parameters: [String: Any]?
|
||||||
public let isBody: Bool
|
public let isBody: Bool
|
||||||
public let method: String
|
public let method: String
|
||||||
public let URLString: String
|
public let URLString: String
|
||||||
@ -25,9 +25,9 @@ open class RequestBuilder<T> {
|
|||||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||||
/// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0.
|
/// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0.
|
||||||
/// If you need to get the request's progress in older OS versions, please use Alamofire http client.
|
/// If you need to get the request's progress in older OS versions, please use Alamofire http client.
|
||||||
public var onProgressReady: ((Progress) -> ())?
|
public var onProgressReady: ((Progress) -> Void)?
|
||||||
|
|
||||||
required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) {
|
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
|
||||||
self.method = method
|
self.method = method
|
||||||
self.URLString = URLString
|
self.URLString = URLString
|
||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
@ -37,7 +37,7 @@ open class RequestBuilder<T> {
|
|||||||
addHeaders(PetstoreClientAPI.customHeaders)
|
addHeaders(PetstoreClientAPI.customHeaders)
|
||||||
}
|
}
|
||||||
|
|
||||||
open func addHeaders(_ aHeaders:[String:String]) {
|
open func addHeaders(_ aHeaders: [String: String]) {
|
||||||
for (header, value) in aHeaders {
|
for (header, value) in aHeaders {
|
||||||
headers[header] = value
|
headers[header] = value
|
||||||
}
|
}
|
||||||
@ -60,5 +60,5 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
public protocol RequestBuilderFactory {
|
public protocol RequestBuilderFactory {
|
||||||
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
|
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
|
||||||
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
|
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class AnotherFakeAPI {
|
open class AnotherFakeAPI {
|
||||||
/**
|
/**
|
||||||
To test special tags
|
To test special tags
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class FakeAPI {
|
open class FakeAPI {
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -343,7 +341,7 @@ open class FakeAPI {
|
|||||||
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> {
|
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 path = "/fake"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"integer": integer?.encodeToJSON(),
|
"integer": integer?.encodeToJSON(),
|
||||||
"int32": int32?.encodeToJSON(),
|
"int32": int32?.encodeToJSON(),
|
||||||
"int64": int64?.encodeToJSON(),
|
"int64": int64?.encodeToJSON(),
|
||||||
@ -482,7 +480,7 @@ open class FakeAPI {
|
|||||||
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> {
|
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 path = "/fake"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"enum_form_string_array": enumFormStringArray?.encodeToJSON(),
|
"enum_form_string_array": enumFormStringArray?.encodeToJSON(),
|
||||||
"enum_form_string": enumFormString?.encodeToJSON()
|
"enum_form_string": enumFormString?.encodeToJSON()
|
||||||
]
|
]
|
||||||
@ -549,7 +547,7 @@ open class FakeAPI {
|
|||||||
open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> 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 path = "/fake"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -577,7 +575,7 @@ open class FakeAPI {
|
|||||||
- returns: AnyPublisher<Void, Error>
|
- returns: AnyPublisher<Void, Error>
|
||||||
*/
|
*/
|
||||||
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||||||
open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
|
open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
|
||||||
return Future<Void, Error>.init { promisse in
|
return Future<Void, Error>.init { promisse in
|
||||||
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in
|
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
@ -596,7 +594,7 @@ open class FakeAPI {
|
|||||||
- parameter param: (body) request body
|
- parameter param: (body) request body
|
||||||
- returns: RequestBuilder<Void>
|
- returns: RequestBuilder<Void>
|
||||||
*/
|
*/
|
||||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
|
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> {
|
||||||
let path = "/fake/inline-additionalProperties"
|
let path = "/fake/inline-additionalProperties"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
||||||
@ -640,7 +638,7 @@ open class FakeAPI {
|
|||||||
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
||||||
let path = "/fake/jsonFormData"
|
let path = "/fake/jsonFormData"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"param": param.encodeToJSON(),
|
"param": param.encodeToJSON(),
|
||||||
"param2": param2.encodeToJSON()
|
"param2": param2.encodeToJSON()
|
||||||
]
|
]
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class FakeClassnameTags123API {
|
open class FakeClassnameTags123API {
|
||||||
/**
|
/**
|
||||||
To test class name in snake case
|
To test class name in snake case
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class PetAPI {
|
open class PetAPI {
|
||||||
/**
|
/**
|
||||||
Add a new pet to the store
|
Add a new pet to the store
|
||||||
@ -91,7 +89,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
let nillableHeaders: [String: Any?] = [
|
let nillableHeaders: [String: Any?] = [
|
||||||
@ -147,7 +145,7 @@ open class PetAPI {
|
|||||||
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
||||||
let path = "/pet/findByStatus"
|
let path = "/pet/findByStatus"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -195,7 +193,7 @@ open class PetAPI {
|
|||||||
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
||||||
let path = "/pet/findByTags"
|
let path = "/pet/findByTags"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -244,7 +242,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -335,7 +333,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"name": name?.encodeToJSON(),
|
"name": name?.encodeToJSON(),
|
||||||
"status": status?.encodeToJSON()
|
"status": status?.encodeToJSON()
|
||||||
]
|
]
|
||||||
@ -390,7 +388,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||||
"file": file?.encodeToJSON()
|
"file": file?.encodeToJSON()
|
||||||
]
|
]
|
||||||
@ -445,7 +443,7 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let formParams: [String:Any?] = [
|
let formParams: [String: Any?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||||
"requiredFile": requiredFile.encodeToJSON()
|
"requiredFile": requiredFile.encodeToJSON()
|
||||||
]
|
]
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class StoreAPI {
|
open class StoreAPI {
|
||||||
/**
|
/**
|
||||||
Delete purchase order by ID
|
Delete purchase order by ID
|
||||||
@ -45,7 +43,7 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -61,8 +59,8 @@ open class StoreAPI {
|
|||||||
- returns: AnyPublisher<[String:Int], Error>
|
- returns: AnyPublisher<[String:Int], Error>
|
||||||
*/
|
*/
|
||||||
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
||||||
open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[String:Int], Error> {
|
open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[String: Int], Error> {
|
||||||
return Future<[String:Int], Error>.init { promisse in
|
return Future<[String: Int], Error>.init { promisse in
|
||||||
getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case let .success(response):
|
case let .success(response):
|
||||||
@ -83,14 +81,14 @@ open class StoreAPI {
|
|||||||
- name: api_key
|
- name: api_key
|
||||||
- returns: RequestBuilder<[String:Int]>
|
- returns: RequestBuilder<[String:Int]>
|
||||||
*/
|
*/
|
||||||
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> {
|
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> {
|
||||||
let path = "/store/inventory"
|
let path = "/store/inventory"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||||
|
|
||||||
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
||||||
}
|
}
|
||||||
@ -129,7 +127,7 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
open class UserAPI {
|
open class UserAPI {
|
||||||
/**
|
/**
|
||||||
Create user
|
Create user
|
||||||
@ -163,7 +161,7 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -205,7 +203,7 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
@ -247,7 +245,7 @@ open class UserAPI {
|
|||||||
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
||||||
let path = "/user/login"
|
let path = "/user/login"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
var url = URLComponents(string: URLString)
|
var url = URLComponents(string: URLString)
|
||||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
@ -288,7 +286,7 @@ open class UserAPI {
|
|||||||
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
||||||
let path = "/user/logout"
|
let path = "/user/logout"
|
||||||
let URLString = PetstoreClientAPI.basePath + path
|
let URLString = PetstoreClientAPI.basePath + path
|
||||||
let parameters: [String:Any]? = nil
|
let parameters: [String: Any]? = nil
|
||||||
|
|
||||||
let url = URLComponents(string: URLString)
|
let url = URLComponents(string: URLString)
|
||||||
|
|
||||||
|
@ -108,24 +108,24 @@ extension String: CodingKey {
|
|||||||
|
|
||||||
extension KeyedEncodingContainerProtocol {
|
extension KeyedEncodingContainerProtocol {
|
||||||
|
|
||||||
public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable {
|
public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable {
|
||||||
var arrayContainer = nestedUnkeyedContainer(forKey: key)
|
var arrayContainer = nestedUnkeyedContainer(forKey: key)
|
||||||
try arrayContainer.encode(contentsOf: values)
|
try arrayContainer.encode(contentsOf: values)
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable {
|
public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable {
|
||||||
if let values = values {
|
if let values = values {
|
||||||
try encodeArray(values, forKey: key)
|
try encodeArray(values, forKey: key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable {
|
public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable {
|
||||||
for (key, value) in pairs {
|
for (key, value) in pairs {
|
||||||
try encode(value, forKey: key)
|
try encode(value, forKey: key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable {
|
public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable {
|
||||||
if let pairs = pairs {
|
if let pairs = pairs {
|
||||||
try encodeMap(pairs)
|
try encodeMap(pairs)
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol {
|
|||||||
|
|
||||||
extension KeyedDecodingContainerProtocol {
|
extension KeyedDecodingContainerProtocol {
|
||||||
|
|
||||||
public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable {
|
public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable {
|
||||||
var tmpArray = [T]()
|
var tmpArray = [T]()
|
||||||
|
|
||||||
var nestedContainer = try nestedUnkeyedContainer(forKey: key)
|
var nestedContainer = try nestedUnkeyedContainer(forKey: key)
|
||||||
@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol {
|
|||||||
return tmpArray
|
return tmpArray
|
||||||
}
|
}
|
||||||
|
|
||||||
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable {
|
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable {
|
||||||
var tmpArray: [T]? = nil
|
var tmpArray: [T]?
|
||||||
|
|
||||||
if contains(key) {
|
if contains(key) {
|
||||||
tmpArray = try decodeArray(T.self, forKey: key)
|
tmpArray = try decodeArray(T.self, forKey: key)
|
||||||
@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol {
|
|||||||
return tmpArray
|
return tmpArray
|
||||||
}
|
}
|
||||||
|
|
||||||
public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable {
|
public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable {
|
||||||
var map: [Self.Key : T] = [:]
|
var map: [Self.Key: T] = [:]
|
||||||
|
|
||||||
for key in allKeys {
|
for key in allKeys {
|
||||||
if !excludedKeys.contains(key) {
|
if !excludedKeys.contains(key) {
|
||||||
@ -177,5 +177,3 @@ extension HTTPURLResponse {
|
|||||||
return Array(200 ..< 300).contains(statusCode)
|
return Array(200 ..< 300).contains(statusCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public struct JSONDataEncoding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
||||||
var returnedParams: [String: Any]? = nil
|
var returnedParams: [String: Any]?
|
||||||
if let jsonData = jsonData, !jsonData.isEmpty {
|
if let jsonData = jsonData, !jsonData.isEmpty {
|
||||||
var params: [String: Any] = [:]
|
var params: [String: Any] = [:]
|
||||||
params[jsonDataKey] = jsonData
|
params[jsonDataKey] = jsonData
|
||||||
|
@ -9,8 +9,8 @@ import Foundation
|
|||||||
|
|
||||||
open class JSONEncodingHelper {
|
open class JSONEncodingHelper {
|
||||||
|
|
||||||
open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
||||||
var params: [String: Any]? = nil
|
var params: [String: Any]?
|
||||||
|
|
||||||
// Encode the Encodable object
|
// Encode the Encodable object
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
@ -27,7 +27,7 @@ open class JSONEncodingHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
|
open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
|
||||||
var params: [String: Any]? = nil
|
var params: [String: Any]?
|
||||||
|
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
do {
|
do {
|
||||||
|
@ -10,11 +10,11 @@ protocol JSONEncodable {
|
|||||||
func encodeToJSON() -> Any
|
func encodeToJSON() -> Any
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ErrorResponse : Error {
|
public enum ErrorResponse: Error {
|
||||||
case error(Int, Data?, Error)
|
case error(Int, Data?, Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DownloadException : Error {
|
public enum DownloadException: Error {
|
||||||
case responseDataMissing
|
case responseDataMissing
|
||||||
case responseFailed
|
case responseFailed
|
||||||
case requestMissing
|
case requestMissing
|
||||||
@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error {
|
|||||||
case generalError(Error)
|
case generalError(Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
open class Response<T> {
|
open class Response<T> {
|
||||||
public let statusCode: Int
|
public let statusCode: Int
|
||||||
public let header: [String: String]
|
public let header: [String: String]
|
||||||
@ -44,7 +43,7 @@ open class Response<T> {
|
|||||||
|
|
||||||
public convenience init(response: HTTPURLResponse, body: T?) {
|
public convenience init(response: HTTPURLResponse, body: T?) {
|
||||||
let rawHeader = response.allHeaderFields
|
let rawHeader = response.allHeaderFields
|
||||||
var header = [String:String]()
|
var header = [String: String]()
|
||||||
for (key, value) in rawHeader {
|
for (key, value) in rawHeader {
|
||||||
if let key = key.base as? String, let value = value as? String {
|
if let key = key.base as? String, let value = value as? String {
|
||||||
header[key] = value
|
header[key] = value
|
||||||
|
@ -7,14 +7,12 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct AdditionalPropertiesClass: Codable {
|
public struct AdditionalPropertiesClass: Codable {
|
||||||
|
|
||||||
|
public var mapString: [String: String]?
|
||||||
|
public var mapMapString: [String: [String: String]]?
|
||||||
|
|
||||||
public var mapString: [String:String]?
|
public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) {
|
||||||
public var mapMapString: [String:[String:String]]?
|
|
||||||
|
|
||||||
public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) {
|
|
||||||
self.mapString = mapString
|
self.mapString = mapString
|
||||||
self.mapMapString = mapMapString
|
self.mapMapString = mapMapString
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Animal: Codable {
|
public struct Animal: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
|
||||||
|
@ -7,5 +7,4 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias AnimalFarm = [Animal]
|
public typealias AnimalFarm = [Animal]
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ApiResponse: Codable {
|
public struct ApiResponse: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var code: Int?
|
public var code: Int?
|
||||||
public var type: String?
|
public var type: String?
|
||||||
public var message: String?
|
public var message: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ArrayOfArrayOfNumberOnly: Codable {
|
public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var arrayArrayNumber: [[Double]]?
|
public var arrayArrayNumber: [[Double]]?
|
||||||
|
|
||||||
public init(arrayArrayNumber: [[Double]]?) {
|
public init(arrayArrayNumber: [[Double]]?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ArrayOfNumberOnly: Codable {
|
public struct ArrayOfNumberOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var arrayNumber: [Double]?
|
public var arrayNumber: [Double]?
|
||||||
|
|
||||||
public init(arrayNumber: [Double]?) {
|
public init(arrayNumber: [Double]?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ArrayTest: Codable {
|
public struct ArrayTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var arrayOfString: [String]?
|
public var arrayOfString: [String]?
|
||||||
public var arrayArrayOfInteger: [[Int64]]?
|
public var arrayArrayOfInteger: [[Int64]]?
|
||||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Capitalization: Codable {
|
public struct Capitalization: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var smallCamel: String?
|
public var smallCamel: String?
|
||||||
public var capitalCamel: String?
|
public var capitalCamel: String?
|
||||||
public var smallSnake: String?
|
public var smallSnake: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Cat: Codable {
|
public struct Cat: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
public var declawed: Bool?
|
public var declawed: Bool?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct CatAllOf: Codable {
|
public struct CatAllOf: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var declawed: Bool?
|
public var declawed: Bool?
|
||||||
|
|
||||||
public init(declawed: Bool?) {
|
public init(declawed: Bool?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Category: Codable {
|
public struct Category: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var name: String = "default-name"
|
public var name: String = "default-name"
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing model with \"_class\" property */
|
/** Model for testing model with \"_class\" property */
|
||||||
public struct ClassModel: Codable {
|
public struct ClassModel: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
|
||||||
public init(_class: String?) {
|
public init(_class: String?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Client: Codable {
|
public struct Client: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var client: String?
|
public var client: String?
|
||||||
|
|
||||||
public init(client: String?) {
|
public init(client: String?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Dog: Codable {
|
public struct Dog: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
public var breed: String?
|
public var breed: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct DogAllOf: Codable {
|
public struct DogAllOf: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var breed: String?
|
public var breed: String?
|
||||||
|
|
||||||
public init(breed: String?) {
|
public init(breed: String?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct EnumArrays: Codable {
|
public struct EnumArrays: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum JustSymbol: String, Codable, CaseIterable {
|
public enum JustSymbol: String, Codable, CaseIterable {
|
||||||
case greaterThanOrEqualTo = ">="
|
case greaterThanOrEqualTo = ">="
|
||||||
case dollar = "$"
|
case dollar = "$"
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public enum EnumClass: String, Codable, CaseIterable {
|
public enum EnumClass: String, Codable, CaseIterable {
|
||||||
case abc = "_abc"
|
case abc = "_abc"
|
||||||
case efg = "-efg"
|
case efg = "-efg"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct EnumTest: Codable {
|
public struct EnumTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum EnumString: String, Codable, CaseIterable {
|
public enum EnumString: String, Codable, CaseIterable {
|
||||||
case upper = "UPPER"
|
case upper = "UPPER"
|
||||||
case lower = "lower"
|
case lower = "lower"
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Must be named `File` for test. */
|
/** Must be named `File` for test. */
|
||||||
public struct File: Codable {
|
public struct File: Codable {
|
||||||
|
|
||||||
|
|
||||||
/** Test capitalization */
|
/** Test capitalization */
|
||||||
public var sourceURI: String?
|
public var sourceURI: String?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct FileSchemaTestClass: Codable {
|
public struct FileSchemaTestClass: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var file: File?
|
public var file: File?
|
||||||
public var files: [File]?
|
public var files: [File]?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct FormatTest: Codable {
|
public struct FormatTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var integer: Int?
|
public var integer: Int?
|
||||||
public var int32: Int?
|
public var int32: Int?
|
||||||
public var int64: Int64?
|
public var int64: Int64?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct HasOnlyReadOnly: Codable {
|
public struct HasOnlyReadOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var bar: String?
|
public var bar: String?
|
||||||
public var foo: String?
|
public var foo: String?
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct List: Codable {
|
public struct List: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var _123list: String?
|
public var _123list: String?
|
||||||
|
|
||||||
public init(_123list: String?) {
|
public init(_123list: String?) {
|
||||||
|
@ -7,20 +7,18 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct MapTest: Codable {
|
public struct MapTest: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||||
case upper = "UPPER"
|
case upper = "UPPER"
|
||||||
case lower = "lower"
|
case lower = "lower"
|
||||||
}
|
}
|
||||||
public var mapMapOfString: [String:[String:String]]?
|
public var mapMapOfString: [String: [String: String]]?
|
||||||
public var mapOfEnumString: [String:String]?
|
public var mapOfEnumString: [String: String]?
|
||||||
public var directMap: [String:Bool]?
|
public var directMap: [String: Bool]?
|
||||||
public var indirectMap: StringBooleanMap?
|
public var indirectMap: StringBooleanMap?
|
||||||
|
|
||||||
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) {
|
public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) {
|
||||||
self.mapMapOfString = mapMapOfString
|
self.mapMapOfString = mapMapOfString
|
||||||
self.mapOfEnumString = mapOfEnumString
|
self.mapOfEnumString = mapOfEnumString
|
||||||
self.directMap = directMap
|
self.directMap = directMap
|
||||||
|
@ -7,15 +7,13 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var uuid: UUID?
|
public var uuid: UUID?
|
||||||
public var dateTime: Date?
|
public var dateTime: Date?
|
||||||
public var map: [String:Animal]?
|
public var map: [String: Animal]?
|
||||||
|
|
||||||
public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) {
|
public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) {
|
||||||
self.uuid = uuid
|
self.uuid = uuid
|
||||||
self.dateTime = dateTime
|
self.dateTime = dateTime
|
||||||
self.map = map
|
self.map = map
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing model name starting with number */
|
/** Model for testing model name starting with number */
|
||||||
public struct Model200Response: Codable {
|
public struct Model200Response: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var name: Int?
|
public var name: Int?
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import Foundation
|
|||||||
/** Model for testing model name same as property name */
|
/** Model for testing model name same as property name */
|
||||||
public struct Name: Codable {
|
public struct Name: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var name: Int
|
public var name: Int
|
||||||
public var snakeCase: Int?
|
public var snakeCase: Int?
|
||||||
public var property: String?
|
public var property: String?
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct NumberOnly: Codable {
|
public struct NumberOnly: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var justNumber: Double?
|
public var justNumber: Double?
|
||||||
|
|
||||||
public init(justNumber: Double?) {
|
public init(justNumber: Double?) {
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Order: Codable {
|
public struct Order: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum Status: String, Codable, CaseIterable {
|
public enum Status: String, Codable, CaseIterable {
|
||||||
case placed = "placed"
|
case placed = "placed"
|
||||||
case approved = "approved"
|
case approved = "approved"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct OuterComposite: Codable {
|
public struct OuterComposite: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var myNumber: Double?
|
public var myNumber: Double?
|
||||||
public var myString: String?
|
public var myString: String?
|
||||||
public var myBoolean: Bool?
|
public var myBoolean: Bool?
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public enum OuterEnum: String, Codable, CaseIterable {
|
public enum OuterEnum: String, Codable, CaseIterable {
|
||||||
case placed = "placed"
|
case placed = "placed"
|
||||||
case approved = "approved"
|
case approved = "approved"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct Pet: Codable {
|
public struct Pet: Codable {
|
||||||
|
|
||||||
|
|
||||||
public enum Status: String, Codable, CaseIterable {
|
public enum Status: String, Codable, CaseIterable {
|
||||||
case available = "available"
|
case available = "available"
|
||||||
case pending = "pending"
|
case pending = "pending"
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public struct ReadOnlyFirst: Codable {
|
public struct ReadOnlyFirst: Codable {
|
||||||
|
|
||||||
|
|
||||||
public var bar: String?
|
public var bar: String?
|
||||||
public var baz: String?
|
public var baz: String?
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user