forked from loafle/openapi-generator-original
[Swift][client] update samples (#12923)
This commit is contained in:
parent
8fded5c47e
commit
1a5b5924ed
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ internal class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionReques
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui
|
||||
default:
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
if T.self is ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: Optional<T>.none as! T)))
|
||||
if let E = T.self as? ExpressibleByNilLiteral.Type {
|
||||
completion(.success(Response(response: httpResponse, body: E.init(nilLiteral: ()) as! T)))
|
||||
} else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user