Skip to content

Commit 31827f5

Browse files
authored
update swift4 samples, update test scripts (#4009)
1 parent af9eb8d commit 31827f5

551 files changed

Lines changed: 8791 additions & 8861 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Foundation
88

99
public struct APIHelper {
10-
public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? {
10+
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
1111
let destination = source.reduce(into: [String: Any]()) { (result, item) in
1212
if let value = item.value {
1313
result[item.key] = value
@@ -20,17 +20,17 @@ public struct APIHelper {
2020
return destination
2121
}
2222

23-
public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] {
23+
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
2424
return source.reduce(into: [String: String]()) { (result, item) in
2525
if let collection = item.value as? Array<Any?> {
26-
result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",")
26+
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
2727
} else if let value: Any = item.value {
2828
result[item.key] = "\(value)"
2929
}
3030
}
3131
}
3232

33-
public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? {
33+
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
3434
guard let source = source else {
3535
return nil
3636
}
@@ -52,7 +52,7 @@ public struct APIHelper {
5252
return source
5353
}
5454

55-
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
55+
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
5656
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
5757
if let collection = item.value as? Array<Any?> {
5858
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
@@ -68,4 +68,3 @@ public struct APIHelper {
6868
return destination
6969
}
7070
}
71-

samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ import Foundation
99
open class PetstoreClientAPI {
1010
public static var basePath = "http://petstore.swagger.io:80/v2"
1111
public static var credential: URLCredential?
12-
public static var customHeaders: [String:String] = [:]
12+
public static var customHeaders: [String: String] = [:]
1313
public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
1414
}
1515

1616
open class RequestBuilder<T> {
1717
var credential: URLCredential?
18-
var headers: [String:String]
19-
public let parameters: [String:Any]?
18+
var headers: [String: String]
19+
public let parameters: [String: Any]?
2020
public let isBody: Bool
2121
public let method: String
2222
public let URLString: String
2323

2424
/// Optional block to obtain a reference to the request's progress instance when available.
25-
public var onProgressReady: ((Progress) -> ())?
25+
public var onProgressReady: ((Progress) -> Void)?
2626

27-
required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) {
27+
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
2828
self.method = method
2929
self.URLString = URLString
3030
self.parameters = parameters
@@ -34,7 +34,7 @@ open class RequestBuilder<T> {
3434
addHeaders(PetstoreClientAPI.customHeaders)
3535
}
3636

37-
open func addHeaders(_ aHeaders:[String:String]) {
37+
open func addHeaders(_ aHeaders: [String: String]) {
3838
for (header, value) in aHeaders {
3939
headers[header] = value
4040
}
@@ -57,5 +57,5 @@ open class RequestBuilder<T> {
5757

5858
public protocol RequestBuilderFactory {
5959
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
60-
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
60+
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
6161
}

samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
import Foundation
99
import Alamofire
1010

11-
12-
1311
open class AnotherFakeAPI {
1412
/**
1513
To test special tags
1614

1715
- parameter body: (body) client model
1816
- parameter completion: completion handler to receive the data and the error objects
1917
*/
20-
open class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
18+
open class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
2119
call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
2220
completion(response?.body, error)
2321
}

0 commit comments

Comments
 (0)