[swift5] Fix target SDKs for Combine option (#8476)

* Update min sdks when Combine is used

* Update samples

* Revert "Update min sdks when Combine is used"

This reverts commit e88b8abaa7.

* Wrap import combine with canImport directive

* Update samples

* Wrap functions using Combine with canImport because of compiler error on archive

* Update samples

* Remove unnecessary newline and update samles
This commit is contained in:
Frank Lehmann
2021-01-23 03:35:37 +01:00
committed by GitHub
parent ac59ab9201
commit eecd30c2da
30 changed files with 309 additions and 223 deletions

View File

@@ -8,7 +8,9 @@
import Foundation{{#usePromiseKit}}
import PromiseKit{{/usePromiseKit}}{{#useRxSwift}}
import RxSwift{{/useRxSwift}}{{#useCombine}}
import Combine{{/useCombine}}{{#swiftUseApiNamespace}}
#if canImport(Combine)
import Combine
#endif{{/useCombine}}{{#swiftUseApiNamespace}}
extension {{projectName}}API {
{{/swiftUseApiNamespace}}
@@ -143,6 +145,7 @@ extension {{projectName}}API {
{{#isDeprecated}}
@available(*, deprecated, message: "This operation is deprecated.")
{{/isDeprecated}}
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> {
return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promise in
@@ -162,6 +165,7 @@ extension {{projectName}}API {
}
}.eraseToAnyPublisher()
}
#endif
{{/useCombine}}
{{#useResult}}
/**

View File

@@ -9,11 +9,11 @@ import Alamofire
class AlamofireRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
AlamofireRequestBuilder<T>.self
return AlamofireRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
AlamofireDecodableRequestBuilder<T>.self
return AlamofireDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**
@@ -73,7 +73,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
configuration (e.g. to override the cache policy).
*/
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest {
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) {

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -6,7 +6,9 @@
//
import Foundation
#if canImport(Combine)
import Combine
#endif
open class AnotherFakeAPI {
/**
@@ -16,6 +18,7 @@ open class AnotherFakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Client, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Client, Error> {
return Future<Client, Error>.init { promise in
@@ -29,6 +32,7 @@ open class AnotherFakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
To test special tags

View File

@@ -6,7 +6,9 @@
//
import Foundation
#if canImport(Combine)
import Combine
#endif
open class FakeAPI {
/**
@@ -15,6 +17,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Bool, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Bool, Error> {
return Future<Bool, Error>.init { promise in
@@ -28,6 +31,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
- POST /fake/outer/boolean
@@ -59,6 +63,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<OuterComposite, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<OuterComposite, Error> {
return Future<OuterComposite, Error>.init { promise in
@@ -72,6 +77,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
- POST /fake/outer/composite
@@ -103,6 +109,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Double, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Double, Error> {
return Future<Double, Error>.init { promise in
@@ -116,6 +123,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
- POST /fake/outer/number
@@ -147,6 +155,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<String, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<String, Error> {
return Future<String, Error>.init { promise in
@@ -160,6 +169,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
- POST /fake/outer/string
@@ -191,6 +201,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -204,6 +215,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
- PUT /fake/body-with-file-schema
@@ -236,6 +248,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -249,6 +262,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
- PUT /fake/body-with-query-params
@@ -284,6 +298,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Client, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Client, Error> {
return Future<Client, Error>.init { promise in
@@ -297,6 +312,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
To test \"client\" model
@@ -343,6 +359,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -356,6 +373,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Fake endpoint for testing various parameters
@@ -497,6 +515,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
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) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -510,6 +529,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
To test enum parameters
@@ -569,6 +589,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -582,6 +603,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Fake endpoint to test group parameters (optional)
@@ -627,6 +649,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@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> {
return Future<Void, Error>.init { promise in
@@ -640,6 +663,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
test inline additionalProperties
@@ -673,6 +697,7 @@ open class FakeAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -686,6 +711,7 @@ open class FakeAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
test json serialization of form data

View File

@@ -6,7 +6,9 @@
//
import Foundation
#if canImport(Combine)
import Combine
#endif
open class FakeClassnameTags123API {
/**
@@ -16,6 +18,7 @@ open class FakeClassnameTags123API {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Client, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Client, Error> {
return Future<Client, Error>.init { promise in
@@ -29,6 +32,7 @@ open class FakeClassnameTags123API {
}
}.eraseToAnyPublisher()
}
#endif
/**
To test class name in snake case

View File

@@ -6,7 +6,9 @@
//
import Foundation
#if canImport(Combine)
import Combine
#endif
open class PetAPI {
/**
@@ -16,6 +18,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -29,6 +32,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Add a new pet to the store
@@ -65,6 +69,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -78,6 +83,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Deletes a pet
@@ -126,6 +132,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<[Pet], Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> {
return Future<[Pet], Error>.init { promise in
@@ -139,6 +146,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Finds Pets by status
@@ -179,6 +187,7 @@ open class PetAPI {
- returns: AnyPublisher<[Pet], Error>
*/
@available(*, deprecated, message: "This operation is deprecated.")
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> {
return Future<[Pet], Error>.init { promise in
@@ -192,6 +201,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Finds Pets by tags
@@ -232,6 +242,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Pet, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Pet, Error> {
return Future<Pet, Error>.init { promise in
@@ -245,6 +256,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Find pet by ID
@@ -284,6 +296,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -297,6 +310,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Update an existing pet
@@ -334,6 +348,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -347,6 +362,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Updates a pet in the store with form data
@@ -395,6 +411,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<ApiResponse, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<ApiResponse, Error> {
return Future<ApiResponse, Error>.init { promise in
@@ -408,6 +425,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
uploads an image
@@ -456,6 +474,7 @@ open class PetAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<ApiResponse, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<ApiResponse, Error> {
return Future<ApiResponse, Error>.init { promise in
@@ -469,6 +488,7 @@ open class PetAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
uploads an image (required)

View File

@@ -6,7 +6,9 @@
//
import Foundation
#if canImport(Combine)
import Combine
#endif
open class StoreAPI {
/**
@@ -16,6 +18,7 @@ open class StoreAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -29,6 +32,7 @@ open class StoreAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Delete purchase order by ID
@@ -64,6 +68,7 @@ open class StoreAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<[String: Int], Error>
*/
#if canImport(Combine)
@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> {
return Future<[String: Int], Error>.init { promise in
@@ -77,6 +82,7 @@ open class StoreAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Returns pet inventories by status
@@ -112,6 +118,7 @@ open class StoreAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Order, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Order, Error> {
return Future<Order, Error>.init { promise in
@@ -125,6 +132,7 @@ open class StoreAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Find purchase order by ID
@@ -161,6 +169,7 @@ open class StoreAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Order, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Order, Error> {
return Future<Order, Error>.init { promise in
@@ -174,6 +183,7 @@ open class StoreAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Place an order for a pet

View File

@@ -6,7 +6,9 @@
//
import Foundation
#if canImport(Combine)
import Combine
#endif
open class UserAPI {
/**
@@ -16,6 +18,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -29,6 +32,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Create user
@@ -62,6 +66,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -75,6 +80,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Creates list of users with given input array
@@ -107,6 +113,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -120,6 +127,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Creates list of users with given input array
@@ -152,6 +160,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -165,6 +174,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Delete user
@@ -201,6 +211,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<User, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<User, Error> {
return Future<User, Error>.init { promise in
@@ -214,6 +225,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Get user by user name
@@ -250,6 +262,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<String, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<String, Error> {
return Future<String, Error>.init { promise in
@@ -263,6 +276,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Logs user into the system
@@ -300,6 +314,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -313,6 +328,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Logs out current logged in user session
@@ -345,6 +361,7 @@ open class UserAPI {
- parameter apiResponseQueue: The queue on which api response is dispatched.
- returns: AnyPublisher<Void, Error>
*/
#if canImport(Combine)
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> {
return Future<Void, Error>.init { promise in
@@ -358,6 +375,7 @@ open class UserAPI {
}
}.eraseToAnyPublisher()
}
#endif
/**
Updated user

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -13,4 +13,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 509bec696cc1d8641751b52e4fe4bef04ac4542c
COCOAPODS: 1.9.0
COCOAPODS: 1.10.0

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
internal func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -8,35 +8,35 @@ import Foundation
import PromiseKit
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -49,7 +49,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -65,32 +65,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -98,11 +98,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -175,7 +175,7 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**

View File

@@ -7,35 +7,35 @@
import Foundation
extension Bool: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Float: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension Int32: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int32) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int32) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> Any { NSNumber(value: self as Int64) }
func encodeToJSON() -> Any { return NSNumber(value: self as Int64) }
}
extension Double: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension String: JSONEncodable {
func encodeToJSON() -> Any { self as Any }
func encodeToJSON() -> Any { return self as Any }
}
extension RawRepresentable where RawValue: JSONEncodable {
func encodeToJSON() -> Any { self.rawValue as Any }
func encodeToJSON() -> Any { return self.rawValue as Any }
}
private func encodeIfPossible<T>(_ object: T) -> Any {
@@ -48,7 +48,7 @@ private func encodeIfPossible<T>(_ object: T) -> Any {
extension Array: JSONEncodable {
func encodeToJSON() -> Any {
self.map(encodeIfPossible)
return self.map(encodeIfPossible)
}
}
@@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable {
extension Data: JSONEncodable {
func encodeToJSON() -> Any {
self.base64EncodedString(options: Data.Base64EncodingOptions())
return self.base64EncodedString(options: Data.Base64EncodingOptions())
}
}
extension Date: JSONEncodable {
func encodeToJSON() -> Any {
CodableHelper.dateFormatter.string(from: self) as Any
return CodableHelper.dateFormatter.string(from: self) as Any
}
}
extension URL: JSONEncodable {
func encodeToJSON() -> Any {
self
return self
}
}
extension UUID: JSONEncodable {
func encodeToJSON() -> Any {
uuidString
return self.uuidString
}
}
extension String: CodingKey {
public var stringValue: String {
self
return self
}
public init?(stringValue: String) {
@@ -97,11 +97,11 @@ extension String: CodingKey {
}
public var intValue: Int? {
nil
return nil
}
public init?(intValue: Int) {
nil
return nil
}
}
@@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol {
extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
Array(200 ..< 300).contains(statusCode)
return Array(200 ..< 300).contains(statusCode)
}
}

View File

@@ -11,11 +11,11 @@ import MobileCoreServices
class URLSessionRequestBuilderFactory: RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
URLSessionRequestBuilder<T>.self
return URLSessionRequestBuilder<T>.self
}
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
URLSessionDecodableRequestBuilder<T>.self
return URLSessionDecodableRequestBuilder<T>.self
}
}
@@ -65,7 +65,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
the file extension). Return the desired Content-Type otherwise.
*/
open func contentTypeForFormPart(fileURL: URL) -> String? {
nil
return nil
}
/**