[Swift 5] deprecate retry hook since its no longer needed (#8303)

* [Swift 5] deprecated retry hook since its no longer needed

* [Swift 5] deprecated retry hook since its no longer needed

* [swift] fix generator code formatting
This commit is contained in:
Bruno Coelho 2021-01-04 11:34:28 +00:00 committed by GitHub
parent caf52641f0
commit d2aa40a935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 85 additions and 76 deletions

View File

@ -7,7 +7,7 @@
import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNil(_ source: [String:Any?]) -> [String:Any]? {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
let destination = source.reduce(into: [String: Any]()) { (result, item) in
if let value = item.value {
result[item.key] = value
@ -20,17 +20,17 @@ import Foundation
return destination
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
if let collection = item.value as? Array<Any?> {
result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",")
if let collection = item.value as? [Any?] {
result[item.key] = collection.filter { $0 != nil }.map { "\($0!)" }.joined(separator: ",")
} else if let value: Any = item.value {
result[item.key] = "\(value)"
}
}
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
guard let source = source else {
return nil
}
@ -46,16 +46,16 @@ import Foundation
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func mapValueToPathItem(_ source: Any) -> Any {
if let collection = source as? Array<Any?> {
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
if let collection = source as? [Any?] {
return collection.filter { $0 != nil }.map {"\($0!)"}.joined(separator: ",")
}
return source
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
if let collection = item.value as? Array<Any?> {
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
if let collection = item.value as? [Any?] {
collection.filter { $0 != nil }.map {"\($0!)"}.forEach { value in
result.append(URLQueryItem(name: item.key, value: value))
}
} else if let value = item.value {
@ -69,4 +69,3 @@ import Foundation
return destination
}
}

View File

@ -9,7 +9,7 @@ import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{projectName}}API {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var basePath = "{{{basePath}}}"
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var credential: URLCredential?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var customHeaders: [String:String] = [:]{{#useAlamofire}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var customHeaders: [String: String] = [:]{{#useAlamofire}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory(){{/useAlamofire}}{{#useURLSession}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory(){{/useURLSession}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var apiResponseQueue: DispatchQueue = .main
@ -17,8 +17,8 @@ import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder<T> {
var credential: URLCredential?
var headers: [String:String]
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String:Any]?
var headers: [String: String]
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: Any]?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let isBody: Bool
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let method: String
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String
@ -26,9 +26,9 @@ import Foundation
/// Optional block to obtain a reference to the request's progress instance when available.{{#useURLSession}}
/// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0.
/// If you need to get the request's progress in older OS versions, please use Alamofire http client.{{/useURLSession}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var onProgressReady: ((Progress) -> ())?
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var onProgressReady: ((Progress) -> Void)?
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) {
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
self.method = method
self.URLString = URLString
self.parameters = parameters
@ -38,7 +38,7 @@ import Foundation
addHeaders({{projectName}}API.customHeaders)
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addHeaders(_ aHeaders:[String:String]) {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func addHeaders(_ aHeaders: [String: String]) {
for (header, value) in aHeaders {
headers[header] = value
}
@ -61,5 +61,5 @@ import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol RequestBuilderFactory {
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
}

View File

@ -45,4 +45,4 @@ import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable {
return Swift.Result { try self.jsonEncoder.encode(value) }
}
}
}

View File

@ -7,10 +7,10 @@
import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class Configuration {
// This value is used to configure the date formatter that is used to serialize dates into JSON format.
// You must set it prior to encoding any dates, and it will only be read once.
@available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.")
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
}
}

View File

@ -109,24 +109,24 @@ extension String: CodingKey {
extension KeyedEncodingContainerProtocol {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable {
var arrayContainer = nestedUnkeyedContainer(forKey: key)
try arrayContainer.encode(contentsOf: values)
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable {
if let values = values {
try encodeArray(values, forKey: key)
}
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable {
for (key, value) in pairs {
try encode(value, forKey: key)
}
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable {
if let pairs = pairs {
try encodeMap(pairs)
}
@ -136,7 +136,7 @@ extension KeyedEncodingContainerProtocol {
extension KeyedDecodingContainerProtocol {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable {
var tmpArray = [T]()
var nestedContainer = try nestedUnkeyedContainer(forKey: key)
@ -148,8 +148,8 @@ extension KeyedDecodingContainerProtocol {
return tmpArray
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable {
var tmpArray: [T]? = nil
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable {
var tmpArray: [T]?
if contains(key) {
tmpArray = try decodeArray(T.self, forKey: key)
@ -158,8 +158,8 @@ extension KeyedDecodingContainerProtocol {
return tmpArray
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable {
var map: [Self.Key : T] = [:]
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable {
var map: [Self.Key: T] = [:]
for key in allKeys {
if !excludedKeys.contains(key) {
@ -177,10 +177,10 @@ extension HTTPURLResponse {
var isStatusCodeSuccessful: Bool {
return Array(200 ..< 300).contains(statusCode)
}
}
}{{#usePromiseKit}}
{{#usePromiseKit}}extension RequestBuilder {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func execute() -> Promise<Response<T>> {
extension RequestBuilder {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func execute() -> Promise<Response<T>> {
let deferred = Promise<Response<T>>.pending()
self.execute { result in
switch result {

View File

@ -41,7 +41,7 @@ import Foundation
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func encodingParameters(jsonData: Data?) -> [String: Any]? {
var returnedParams: [String: Any]? = nil
var returnedParams: [String: Any]?
if let jsonData = jsonData, !jsonData.isEmpty {
var params: [String: Any] = [:]
params[jsonDataKey] = jsonData

View File

@ -9,8 +9,8 @@ import Foundation
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class JSONEncodingHelper {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
var params: [String: Any]? = nil
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
var params: [String: Any]?
// Encode the Encodable object
if let encodableObj = encodableObj {
@ -27,7 +27,7 @@ import Foundation
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
var params: [String: Any]? = nil
var params: [String: Any]?
if let encodableObj = encodableObj {
do {
@ -41,5 +41,5 @@ import Foundation
return params
}
}

View File

@ -10,11 +10,11 @@ protocol JSONEncodable {
func encodeToJSON() -> Any
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse : Error {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse: Error {
case error(Int, Data?, URLResponse?, Error)
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DownloadException : Error {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum DownloadException: Error {
case responseDataMissing
case responseFailed
case requestMissing
@ -30,7 +30,6 @@ protocol JSONEncodable {
case generalError(Error)
}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class Response<T> {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let statusCode: Int
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let header: [String: String]
@ -44,7 +43,7 @@ protocol JSONEncodable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} convenience init(response: HTTPURLResponse, body: T?) {
let rawHeader = response.allHeaderFields
var header = [String:String]()
var header = [String: String]()
for (key, value) in rawHeader {
if let key = key.base as? String, let value = value as? String {
header[key] = value

View File

@ -44,6 +44,7 @@ private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ internal struct APIHelper {
internal static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ internal struct APIHelper {
internal static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ internal struct APIHelper {
internal static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
internal var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required internal init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {

View File

@ -23,7 +23,7 @@ public struct APIHelper {
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
return source.reduce(into: [String: String]()) { (result, item) in
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 {
result[item.key] = "\(value)"
}
@ -47,7 +47,7 @@ public struct APIHelper {
public static func mapValueToPathItem(_ source: Any) -> 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
}
@ -55,7 +55,7 @@ public struct APIHelper {
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
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))
}
} else if let value = item.value {

View File

@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
- intercept and handle errors like authorization
- retry the request.
*/
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {