forked from loafle/openapi-generator-original
[swift6] Change JSONEncodable protocol to always return String (#20906)
* [swift6] Change JSONEncodable protocol to always return String * [swift6] Upgrade Alamofire * Add missing @Sendable attributes * Fix APIHelperTests * Fix URLSessionImplementations
This commit is contained in:
parent
1eb8c58446
commit
31c1a86736
@ -8,8 +8,8 @@ import Foundation{{#useVapor}}
|
|||||||
import Vapor{{/useVapor}}
|
import Vapor{{/useVapor}}
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct APIHelper {
|
{{#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 Sendable)?]) -> [String: any Sendable]? {
|
||||||
let destination = source.reduce(into: [String: Any]()) { result, item in
|
let destination = source.reduce(into: [String: any Sendable]()) { result, item in
|
||||||
if let value = item.value {
|
if let value = item.value {
|
||||||
result[item.key] = value
|
result[item.key] = value
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ import Vapor{{/useVapor}}
|
|||||||
return destination
|
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 Sendable)?]) -> [String: String] {
|
||||||
return source.reduce(into: [String: String]()) { result, item in
|
return source.reduce(into: [String: String]()) { result, item in
|
||||||
if let collection = item.value as? [Any?] {
|
if let collection = item.value as? [Any?] {
|
||||||
result[item.key] = collection
|
result[item.key] = collection
|
||||||
@ -33,12 +33,12 @@ import Vapor{{/useVapor}}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#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 Sendable]?) -> [String: any Sendable]? {
|
||||||
guard let source = source else {
|
guard let source = source else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return source.reduce(into: [String: Any]()) { result, item in
|
return source.reduce(into: [String: any Sendable]()) { result, item in
|
||||||
switch item.value {
|
switch item.value {
|
||||||
case let x as Bool:
|
case let x as Bool:
|
||||||
result[item.key] = x.description
|
result[item.key] = x.description
|
||||||
@ -100,7 +100,7 @@ import Vapor{{/useVapor}}
|
|||||||
/// maps all values from source to query parameters
|
/// maps all values from source to query parameters
|
||||||
///
|
///
|
||||||
/// collection values are always exploded
|
/// collection values are always exploded
|
||||||
{{#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 Sendable)?]) -> [URLQueryItem]? {
|
||||||
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
|
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
|
||||||
if let collection = item.value as? [Any?] {
|
if let collection = item.value as? [Any?] {
|
||||||
collection
|
collection
|
||||||
|
@ -85,7 +85,7 @@ import Alamofire{{/useAlamofire}}
|
|||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder<T>: @unchecked Sendable {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class RequestBuilder<T>: @unchecked Sendable {
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var credential: URLCredential?
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var credential: URLCredential?
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var headers: [String: String]
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var headers: [String: String]
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: Any]?
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let parameters: [String: any Sendable]?
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let method: String
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let method: String
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let URLString: String
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requestTask: RequestTask = RequestTask()
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let requestTask: RequestTask = RequestTask()
|
||||||
@ -95,7 +95,7 @@ import Alamofire{{/useAlamofire}}
|
|||||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var onProgressReady: ((Progress) -> Void)?
|
{{#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]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
|
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
|
||||||
self.method = method
|
self.method = method
|
||||||
self.URLString = URLString
|
self.URLString = URLString
|
||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{{#useAlamofire}}
|
{{#useAlamofire}}
|
||||||
# TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
github "Alamofire/Alamofire" = 5.10.2{{/useAlamofire}}{{#usePromiseKit}}
|
||||||
github "Alamofire/Alamofire" = 5.9.1{{/useAlamofire}}{{#usePromiseKit}}
|
|
||||||
github "mxcl/PromiseKit" ~> 8.1{{/usePromiseKit}}{{#useRxSwift}}
|
github "mxcl/PromiseKit" ~> 8.1{{/usePromiseKit}}{{#useRxSwift}}
|
||||||
github "ReactiveX/RxSwift" ~> 6.8{{/useRxSwift}}
|
github "ReactiveX/RxSwift" ~> 6.8{{/useRxSwift}}
|
||||||
|
@ -11,73 +11,49 @@ import FoundationNetworking
|
|||||||
@preconcurrency import PromiseKit{{/usePromiseKit}}{{#useVapor}}
|
@preconcurrency import PromiseKit{{/usePromiseKit}}{{#useVapor}}
|
||||||
import Vapor{{/useVapor}}{{^useVapor}}
|
import Vapor{{/useVapor}}{{^useVapor}}
|
||||||
|
|
||||||
extension Bool: JSONEncodable {
|
extension Bool: QueryStringEncodable {}
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
extension Float: QueryStringEncodable {}
|
||||||
|
extension Int: QueryStringEncodable {}
|
||||||
|
extension Int32: QueryStringEncodable {}
|
||||||
|
extension Int64: QueryStringEncodable {}
|
||||||
|
extension Double: QueryStringEncodable {}
|
||||||
|
extension Decimal: QueryStringEncodable {}
|
||||||
|
extension String: QueryStringEncodable {}
|
||||||
|
extension URL: QueryStringEncodable {}
|
||||||
|
extension UUID: QueryStringEncodable {}
|
||||||
|
|
||||||
|
extension QueryStringEncodable {
|
||||||
|
@_disfavoredOverload
|
||||||
|
func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Float: JSONEncodable {
|
extension RawRepresentable where RawValue: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Int: JSONEncodable {
|
private func encodeIfPossible<T>(_ object: T, codableHelper: CodableHelper) -> String {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
if let encodableObject = object as? QueryStringEncodable {
|
||||||
}
|
return encodableObject.encodeToQueryString(codableHelper: codableHelper)
|
||||||
|
|
||||||
extension Int32: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Int64: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Double: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Decimal: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension String: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension URL: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UUID: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension RawRepresentable where RawValue: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { return self.rawValue }
|
|
||||||
}
|
|
||||||
|
|
||||||
private func encodeIfPossible<T>(_ object: T, codableHelper: CodableHelper) -> Any {
|
|
||||||
if let encodableObject = object as? JSONEncodable {
|
|
||||||
return encodableObject.encodeToJSON(codableHelper: codableHelper)
|
|
||||||
} else {
|
} else {
|
||||||
return object
|
return String(describing: object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Array: JSONEncodable {
|
extension Array {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [String] {
|
||||||
return self.map { encodeIfPossible($0, codableHelper: codableHelper) }
|
return self.map { encodeIfPossible($0, codableHelper: codableHelper) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Set: JSONEncodable {
|
extension Set {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [String] {
|
||||||
return Array(self).encodeToJSON(codableHelper: codableHelper)
|
return Array(self).encodeToQueryString(codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Dictionary: JSONEncodable {
|
extension Dictionary {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] {
|
||||||
var dictionary = [AnyHashable: Any]()
|
var dictionary = [Key: String]()
|
||||||
for (key, value) in self {
|
for (key, value) in self {
|
||||||
dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper)
|
dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
@ -85,24 +61,24 @@ extension Dictionary: JSONEncodable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Data: JSONEncodable {
|
extension Data: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return self.base64EncodedString(options: Data.Base64EncodingOptions())
|
return self.base64EncodedString(options: Data.Base64EncodingOptions())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Date: JSONEncodable {
|
extension Date: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return codableHelper.dateFormatter.string(from: self)
|
return codableHelper.dateFormatter.string(from: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONEncodable where Self: Encodable {
|
extension QueryStringEncodable where Self: Encodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
guard let data = try? codableHelper.jsonEncoder.encode(self) else {
|
guard let data = try? codableHelper.jsonEncoder.encode(self) else {
|
||||||
fatalError("Could not encode to json: \(self)")
|
fatalError("Could not encode to json: \(self)")
|
||||||
}
|
}
|
||||||
return data.encodeToJSON(codableHelper: codableHelper)
|
return data.encodeToQueryString(codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
}{{/useVapor}}{{#generateModelAdditionalProperties}}
|
}{{/useVapor}}{{#generateModelAdditionalProperties}}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import Foundation
|
|||||||
import FoundationNetworking
|
import FoundationNetworking
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct JSONDataEncoding {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct JSONDataEncoding: Sendable {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ import FoundationNetworking
|
|||||||
/// - throws: An `Error` if the encoding process encounters an error.
|
/// - throws: An `Error` if the encoding process encounters an error.
|
||||||
///
|
///
|
||||||
/// - returns: The encoded request.
|
/// - returns: The encoded request.
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(request: URLRequest, with parameters: [String: any Sendable]?) -> URLRequest {
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else {
|
guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else {
|
||||||
return urlRequest
|
return urlRequest
|
||||||
@ -43,10 +43,10 @@ import FoundationNetworking
|
|||||||
return urlRequest
|
return urlRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func encodingParameters(jsonData: Data?) -> [String: any Sendable]? {
|
||||||
var returnedParams: [String: Any]?
|
var returnedParams: [String: any Sendable]?
|
||||||
if let jsonData = jsonData, !jsonData.isEmpty {
|
if let jsonData = jsonData, !jsonData.isEmpty {
|
||||||
var params: [String: Any] = [:]
|
var params: [String: any Sendable] = [:]
|
||||||
params[jsonDataKey] = jsonData
|
params[jsonDataKey] = jsonData
|
||||||
returnedParams = params
|
returnedParams = params
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import Foundation
|
|||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class JSONEncodingHelper {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class JSONEncodingHelper {
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?, codableHelper: CodableHelper) -> [String: Any]? {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?, codableHelper: CodableHelper) -> [String: any Sendable]? {
|
||||||
var params: [String: Any]?
|
var params: [String: any Sendable]?
|
||||||
|
|
||||||
// Encode the Encodable object
|
// Encode the Encodable object
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
@ -26,8 +26,8 @@ import Foundation
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: Any]? {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? {
|
||||||
var params: [String: Any]?
|
var params: [String: any Sendable]?
|
||||||
|
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
do {
|
do {
|
||||||
|
@ -10,8 +10,8 @@ import FoundationNetworking
|
|||||||
#endif{{#useAlamofire}}
|
#endif{{#useAlamofire}}
|
||||||
import Alamofire{{/useAlamofire}}
|
import Alamofire{{/useAlamofire}}
|
||||||
|
|
||||||
protocol JSONEncodable {
|
protocol QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any
|
func encodeToQueryString(codableHelper: CodableHelper) -> String
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum where the last case value can be used as a default catch-all.
|
/// An enum where the last case value can be used as a default catch-all.
|
||||||
@ -119,9 +119,9 @@ extension Response : Sendable where T : Sendable {}{{#useAlamofire}}
|
|||||||
/// Type-erased ResponseSerializer
|
/// Type-erased ResponseSerializer
|
||||||
///
|
///
|
||||||
/// This is needed in order to use `ResponseSerializer` as a Type in `Configuration`. Obsolete with `any` keyword in Swift >= 5.7
|
/// This is needed in order to use `ResponseSerializer` as a Type in `Configuration`. Obsolete with `any` keyword in Swift >= 5.7
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct AnyResponseSerializer<T>: ResponseSerializer {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct AnyResponseSerializer<T: Sendable>: ResponseSerializer {
|
||||||
|
|
||||||
let _serialize: (URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> T
|
let _serialize: @Sendable (URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> T
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init<V: ResponseSerializer>(_ delegatee: V) where V.SerializedObject == T {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init<V: ResponseSerializer>(_ delegatee: V) where V.SerializedObject == T {
|
||||||
_serialize = delegatee.serialize
|
_serialize = delegatee.serialize
|
||||||
|
@ -76,8 +76,8 @@ import Foundation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
extension OpenAPIDateWithoutTime: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ let package = Package(
|
|||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
{{#useAlamofire}}
|
{{#useAlamofire}}
|
||||||
// TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
.package(url: "https://github.com/Alamofire/Alamofire", exact: "5.10.2"),
|
||||||
.package(url: "https://github.com/Alamofire/Alamofire", exact: "5.9.1"),
|
|
||||||
{{/useAlamofire}}
|
{{/useAlamofire}}
|
||||||
{{#usePromiseKit}}
|
{{#usePromiseKit}}
|
||||||
.package(url: "https://github.com/mxcl/PromiseKit", .upToNextMajor(from: "8.1.2")),
|
.package(url: "https://github.com/mxcl/PromiseKit", .upToNextMajor(from: "8.1.2")),
|
||||||
|
@ -27,8 +27,7 @@ Pod::Spec.new do |s|
|
|||||||
{{/podDocumentationURL}}
|
{{/podDocumentationURL}}
|
||||||
s.source_files = '{{swiftPackagePath}}{{^swiftPackagePath}}{{#useSPMFileStructure}}Sources/{{projectName}}{{/useSPMFileStructure}}{{^useSPMFileStructure}}{{projectName}}/Classes{{/useSPMFileStructure}}{{/swiftPackagePath}}/**/*.swift'
|
s.source_files = '{{swiftPackagePath}}{{^swiftPackagePath}}{{#useSPMFileStructure}}Sources/{{projectName}}{{/useSPMFileStructure}}{{^useSPMFileStructure}}{{projectName}}/Classes{{/useSPMFileStructure}}{{/swiftPackagePath}}/**/*.swift'
|
||||||
{{#useAlamofire}}
|
{{#useAlamofire}}
|
||||||
# TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
s.dependency 'Alamofire', '5.10.2'
|
||||||
s.dependency 'Alamofire', '5.9.1'
|
|
||||||
{{/useAlamofire}}
|
{{/useAlamofire}}
|
||||||
{{#usePromiseKit}}
|
{{#usePromiseKit}}
|
||||||
s.dependency 'PromiseKit/CorePromise', '~> 8.1'
|
s.dependency 'PromiseKit/CorePromise', '~> 8.1'
|
||||||
|
@ -1 +1 @@
|
|||||||
"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToJSON(codableHelper: apiConfiguration.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}}
|
"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToQueryString(codableHelper: apiConfiguration.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}}
|
@ -295,7 +295,7 @@ extension {{projectName}}API {
|
|||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
{{^bodyParam}}
|
{{^bodyParam}}
|
||||||
{{#hasFormParams}}
|
{{#hasFormParams}}
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
{{> _param}},
|
{{> _param}},
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
@ -305,7 +305,7 @@ extension {{projectName}}API {
|
|||||||
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{^hasFormParams}}
|
{{^hasFormParams}}
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{/bodyParam}}{{#hasQueryParams}}
|
{{/bodyParam}}{{#hasQueryParams}}
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
@ -316,7 +316,7 @@ extension {{projectName}}API {
|
|||||||
]){{/hasQueryParams}}{{^hasQueryParams}}
|
]){{/hasQueryParams}}{{^hasQueryParams}}
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString){{/hasQueryParams}}
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString){{/hasQueryParams}}
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [{{^headerParams}}{{^hasFormParams}}{{^hasConsumes}}
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [{{^headerParams}}{{^hasFormParams}}{{^hasConsumes}}
|
||||||
:{{/hasConsumes}}{{/hasFormParams}}{{/headerParams}}{{#hasFormParams}}
|
:{{/hasConsumes}}{{/hasFormParams}}{{/headerParams}}{{#hasFormParams}}
|
||||||
"Content-Type": {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}},{{/hasFormParams}}{{^hasFormParams}}{{#hasConsumes}}
|
"Content-Type": {{^consumes}}"multipart/form-data"{{/consumes}}{{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}},{{/hasFormParams}}{{^hasFormParams}}{{#hasConsumes}}
|
||||||
"Content-Type": {{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}},{{/hasConsumes}}{{/hasFormParams}}{{#headerParams}}
|
"Content-Type": {{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}},{{/hasConsumes}}{{/hasFormParams}}{{#headerParams}}
|
||||||
|
@ -28,7 +28,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||||
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
|
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
|
||||||
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
override {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute(completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||||
let managerId = UUID().uuidString
|
let managerId = UUID().uuidString
|
||||||
// Create a new manager for each request to customize its request header
|
// Create a new manager for each request to customize its request header
|
||||||
let manager = createAlamofireSession()
|
let manager = createAlamofireSession()
|
||||||
@ -163,12 +163,12 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
return requestTask
|
return requestTask
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func processRequest(request: DataRequest, managerId: String, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
request.authenticate(with: credential)
|
request.authenticate(with: credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanupRequest = {
|
let cleanupRequest = { @Sendable in
|
||||||
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,12 +257,12 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T>, @unchecked Sendable {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T>, @unchecked Sendable {
|
||||||
|
|
||||||
override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
request.authenticate(with: credential)
|
request.authenticate(with: credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanupRequest = {
|
let cleanupRequest = { @Sendable in
|
||||||
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +415,6 @@ extension JSONDataEncoding: ParameterEncoding {
|
|||||||
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
|
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
|
||||||
let urlRequest = try urlRequest.asURLRequest()
|
let urlRequest = try urlRequest.asURLRequest()
|
||||||
|
|
||||||
return encode(urlRequest, with: parameters)
|
return encode(request: urlRequest, with: parameters)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class URLSessionRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||||
|
|
||||||
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
|
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: {{projectName}}APIConfiguration = {{projectName}}APIConfiguration.shared) {
|
||||||
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
originalRequest.setValue(value, forHTTPHeaderField: key)
|
originalRequest.setValue(value, forHTTPHeaderField: key)
|
||||||
}
|
}
|
||||||
|
|
||||||
let modifiedRequest = try encoding.encode(originalRequest, with: parameters)
|
let modifiedRequest = try encoding.encode(request: originalRequest, with: parameters)
|
||||||
|
|
||||||
return modifiedRequest
|
return modifiedRequest
|
||||||
}
|
}
|
||||||
@ -431,13 +431,13 @@ fileprivate final class SessionDelegate: NSObject, URLSessionTaskDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol ParameterEncoding {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} protocol ParameterEncoding {
|
||||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest
|
func encode(request: URLRequest, with parameters: [String: any Sendable]?) throws -> URLRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
private class URLEncoding: ParameterEncoding {
|
private class URLEncoding: ParameterEncoding {
|
||||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest {
|
func encode(request: URLRequest, with parameters: [String: any Sendable]?) throws -> URLRequest {
|
||||||
|
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
guard let parameters = parameters else { return urlRequest }
|
guard let parameters = parameters else { return urlRequest }
|
||||||
|
|
||||||
@ -462,9 +462,9 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
self.contentTypeForFormPart = contentTypeForFormPart
|
self.contentTypeForFormPart = contentTypeForFormPart
|
||||||
}
|
}
|
||||||
|
|
||||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest {
|
func encode(request: URLRequest, with parameters: [String: any Sendable]?) throws -> URLRequest {
|
||||||
|
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
guard let parameters = parameters, !parameters.isEmpty else {
|
guard let parameters = parameters, !parameters.isEmpty else {
|
||||||
return urlRequest
|
return urlRequest
|
||||||
@ -631,9 +631,9 @@ private class FormDataEncoding: ParameterEncoding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class FormURLEncoding: ParameterEncoding {
|
private class FormURLEncoding: ParameterEncoding {
|
||||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest {
|
func encode(request: URLRequest, with parameters: [String: any Sendable]?) throws -> URLRequest {
|
||||||
|
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
var requestBodyComponents = URLComponents()
|
var requestBodyComponents = URLComponents()
|
||||||
let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:])
|
let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:])
|
||||||
@ -661,9 +661,9 @@ private class FormURLEncoding: ParameterEncoding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class OctetStreamEncoding: ParameterEncoding {
|
private class OctetStreamEncoding: ParameterEncoding {
|
||||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest {
|
func encode(request: URLRequest, with parameters: [String: any Sendable]?) throws -> URLRequest {
|
||||||
|
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
guard let body = parameters?["body"] else { return urlRequest }
|
guard let body = parameters?["body"] else { return urlRequest }
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, JSONEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, QueryStringEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} {
|
||||||
{{#allowableValues}}
|
{{#allowableValues}}
|
||||||
{{#enumVars}}
|
{{#enumVars}}
|
||||||
case {{{name}}} = {{{value}}}
|
case {{{name}}} = {{{value}}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, JSONEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}, QueryStringEncodable{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} {
|
||||||
{{#allowableValues}}
|
{{#allowableValues}}
|
||||||
{{#enumVars}}
|
{{#enumVars}}
|
||||||
case {{{name}}} = {{{value}}}
|
case {{{name}}} = {{{value}}}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
||||||
{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}} {
|
{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}} {
|
||||||
{{/objcCompatible}}
|
{{/objcCompatible}}
|
||||||
|
|
||||||
{{#allVars}}
|
{{#allVars}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable, JSONEncodable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable, QueryStringEncodable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} {
|
||||||
{{#oneOf}}
|
{{#oneOf}}
|
||||||
case type{{#transformArrayType}}{{.}}{{/transformArrayType}}({{.}})
|
case type{{#transformArrayType}}{{.}}{{/transformArrayType}}({{.}})
|
||||||
{{/oneOf}}
|
{{/oneOf}}
|
||||||
|
@ -1,2 +1 @@
|
|||||||
# TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
github "Alamofire/Alamofire" = 5.10.2
|
||||||
github "Alamofire/Alamofire" = 5.9.1
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "82fa799fdb0b54d09f6eef7da70838721a3b0d69ea8499c89924e55e07e47110",
|
"originHash" : "d2e45fa99287c9c1d71d047aa90c9675d5c0aee0e8ba334a9517cdbbfc12f90f",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "alamofire",
|
"identity" : "alamofire",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/Alamofire/Alamofire",
|
"location" : "https://github.com/Alamofire/Alamofire",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a",
|
"revision" : "513364f870f6bfc468f9d2ff0a95caccc10044c5",
|
||||||
"version" : "5.9.1"
|
"version" : "5.10.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -19,8 +19,7 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
// TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
.package(url: "https://github.com/Alamofire/Alamofire", exact: "5.10.2"),
|
||||||
.package(url: "https://github.com/Alamofire/Alamofire", exact: "5.9.1"),
|
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
|
@ -11,6 +11,5 @@ Pod::Spec.new do |s|
|
|||||||
s.homepage = 'https://github.com/openapitools/openapi-generator'
|
s.homepage = 'https://github.com/openapitools/openapi-generator'
|
||||||
s.summary = 'PetstoreClient'
|
s.summary = 'PetstoreClient'
|
||||||
s.source_files = 'Sources/PetstoreClient/**/*.swift'
|
s.source_files = 'Sources/PetstoreClient/**/*.swift'
|
||||||
# TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
s.dependency 'Alamofire', '5.10.2'
|
||||||
s.dependency 'Alamofire', '5.9.1'
|
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,7 @@ open class AnotherFakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -257,10 +257,10 @@ open class FakeAPI {
|
|||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -375,21 +375,21 @@ open class FakeAPI {
|
|||||||
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: OpenAPIDateWithoutTime? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: OpenAPIDateWithoutTime? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake"
|
let localVariablePath = "/fake"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -397,7 +397,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -519,9 +519,9 @@ open class FakeAPI {
|
|||||||
open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake"
|
let localVariablePath = "/fake"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -529,16 +529,16 @@ open class FakeAPI {
|
|||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
"enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||||
@ -588,19 +588,19 @@ open class FakeAPI {
|
|||||||
open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake"
|
let localVariablePath = "/fake"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||||
@ -643,7 +643,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -685,9 +685,9 @@ open class FakeAPI {
|
|||||||
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake/jsonFormData"
|
let localVariablePath = "/fake/jsonFormData"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -695,7 +695,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ open class FakeClassnameTags123API {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -96,12 +96,12 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||||
@ -153,14 +153,14 @@ open class PetAPI {
|
|||||||
open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> {
|
open class func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> {
|
||||||
let localVariablePath = "/pet/findByStatus"
|
let localVariablePath = "/pet/findByStatus"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -206,14 +206,14 @@ open class PetAPI {
|
|||||||
open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> {
|
open class func findPetsByTagsWithRequestBuilder(tags: [String], apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[Pet]> {
|
||||||
let localVariablePath = "/pet/findByTags"
|
let localVariablePath = "/pet/findByTags"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -260,11 +260,11 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -361,9 +361,9 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -371,7 +371,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -421,9 +421,9 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -431,7 +431,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -481,9 +481,9 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -491,7 +491,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ open class StoreAPI {
|
|||||||
open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> {
|
open class func getInventoryWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<[String: Int]> {
|
||||||
let localVariablePath = "/store/inventory"
|
let localVariablePath = "/store/inventory"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -136,11 +136,11 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ open class StoreAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -175,11 +175,11 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -222,11 +222,11 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -269,15 +269,15 @@ open class UserAPI {
|
|||||||
open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<String> {
|
open class func loginUserWithRequestBuilder(username: String, password: String, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<String> {
|
||||||
let localVariablePath = "/user/login"
|
let localVariablePath = "/user/login"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -315,11 +315,11 @@ open class UserAPI {
|
|||||||
open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
open class func logoutUserWithRequestBuilder(apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/user/logout"
|
let localVariablePath = "/user/logout"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct APIHelper {
|
public struct APIHelper {
|
||||||
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
|
public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? {
|
||||||
let destination = source.reduce(into: [String: Any]()) { result, item in
|
let destination = source.reduce(into: [String: any Sendable]()) { result, item in
|
||||||
if let value = item.value {
|
if let value = item.value {
|
||||||
result[item.key] = value
|
result[item.key] = value
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ public struct APIHelper {
|
|||||||
return destination
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
public static func rejectNilHeaders(_ source: [String: (any Sendable)?]) -> [String: String] {
|
||||||
return source.reduce(into: [String: String]()) { result, item in
|
return source.reduce(into: [String: String]()) { result, item in
|
||||||
if let collection = item.value as? [Any?] {
|
if let collection = item.value as? [Any?] {
|
||||||
result[item.key] = collection
|
result[item.key] = collection
|
||||||
@ -32,12 +32,12 @@ public struct APIHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
|
public static func convertBoolToString(_ source: [String: any Sendable]?) -> [String: any Sendable]? {
|
||||||
guard let source = source else {
|
guard let source = source else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return source.reduce(into: [String: Any]()) { result, item in
|
return source.reduce(into: [String: any Sendable]()) { result, item in
|
||||||
switch item.value {
|
switch item.value {
|
||||||
case let x as Bool:
|
case let x as Bool:
|
||||||
result[item.key] = x.description
|
result[item.key] = x.description
|
||||||
@ -99,7 +99,7 @@ public struct APIHelper {
|
|||||||
/// maps all values from source to query parameters
|
/// maps all values from source to query parameters
|
||||||
///
|
///
|
||||||
/// collection values are always exploded
|
/// collection values are always exploded
|
||||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
public static func mapValuesToQueryItems(_ source: [String: (any Sendable)?]) -> [URLQueryItem]? {
|
||||||
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
|
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
|
||||||
if let collection = item.value as? [Any?] {
|
if let collection = item.value as? [Any?] {
|
||||||
collection
|
collection
|
||||||
|
@ -64,7 +64,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable {
|
|||||||
open class RequestBuilder<T>: @unchecked Sendable {
|
open class RequestBuilder<T>: @unchecked Sendable {
|
||||||
public var credential: URLCredential?
|
public var credential: URLCredential?
|
||||||
public var headers: [String: String]
|
public var headers: [String: String]
|
||||||
public let parameters: [String: Any]?
|
public let parameters: [String: any Sendable]?
|
||||||
public let method: String
|
public let method: String
|
||||||
public let URLString: String
|
public let URLString: String
|
||||||
public let requestTask: RequestTask = RequestTask()
|
public let requestTask: RequestTask = RequestTask()
|
||||||
@ -74,7 +74,7 @@ open class RequestBuilder<T>: @unchecked Sendable {
|
|||||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||||
public var onProgressReady: ((Progress) -> Void)?
|
public var onProgressReady: ((Progress) -> Void)?
|
||||||
|
|
||||||
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
||||||
self.method = method
|
self.method = method
|
||||||
self.URLString = URLString
|
self.URLString = URLString
|
||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
|
@ -28,7 +28,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||||
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
||||||
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
override open func execute(completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
override open func execute(completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||||
let managerId = UUID().uuidString
|
let managerId = UUID().uuidString
|
||||||
// Create a new manager for each request to customize its request header
|
// Create a new manager for each request to customize its request header
|
||||||
let manager = createAlamofireSession()
|
let manager = createAlamofireSession()
|
||||||
@ -163,12 +163,12 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
|||||||
return requestTask
|
return requestTask
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func processRequest(request: DataRequest, managerId: String, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
request.authenticate(with: credential)
|
request.authenticate(with: credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanupRequest = {
|
let cleanupRequest = { @Sendable in
|
||||||
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,12 +257,12 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
|||||||
|
|
||||||
open class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T>, @unchecked Sendable {
|
open class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T>, @unchecked Sendable {
|
||||||
|
|
||||||
override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
request.authenticate(with: credential)
|
request.authenticate(with: credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanupRequest = {
|
let cleanupRequest = { @Sendable in
|
||||||
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +415,6 @@ extension JSONDataEncoding: ParameterEncoding {
|
|||||||
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
|
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
|
||||||
let urlRequest = try urlRequest.asURLRequest()
|
let urlRequest = try urlRequest.asURLRequest()
|
||||||
|
|
||||||
return encode(urlRequest, with: parameters)
|
return encode(request: urlRequest, with: parameters)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,73 +9,49 @@ import Foundation
|
|||||||
import FoundationNetworking
|
import FoundationNetworking
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extension Bool: JSONEncodable {
|
extension Bool: QueryStringEncodable {}
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
extension Float: QueryStringEncodable {}
|
||||||
|
extension Int: QueryStringEncodable {}
|
||||||
|
extension Int32: QueryStringEncodable {}
|
||||||
|
extension Int64: QueryStringEncodable {}
|
||||||
|
extension Double: QueryStringEncodable {}
|
||||||
|
extension Decimal: QueryStringEncodable {}
|
||||||
|
extension String: QueryStringEncodable {}
|
||||||
|
extension URL: QueryStringEncodable {}
|
||||||
|
extension UUID: QueryStringEncodable {}
|
||||||
|
|
||||||
|
extension QueryStringEncodable {
|
||||||
|
@_disfavoredOverload
|
||||||
|
func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Float: JSONEncodable {
|
extension RawRepresentable where RawValue: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Int: JSONEncodable {
|
private func encodeIfPossible<T>(_ object: T, codableHelper: CodableHelper) -> String {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
if let encodableObject = object as? QueryStringEncodable {
|
||||||
}
|
return encodableObject.encodeToQueryString(codableHelper: codableHelper)
|
||||||
|
|
||||||
extension Int32: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Int64: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Double: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Decimal: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension String: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension URL: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UUID: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension RawRepresentable where RawValue: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { return self.rawValue }
|
|
||||||
}
|
|
||||||
|
|
||||||
private func encodeIfPossible<T>(_ object: T, codableHelper: CodableHelper) -> Any {
|
|
||||||
if let encodableObject = object as? JSONEncodable {
|
|
||||||
return encodableObject.encodeToJSON(codableHelper: codableHelper)
|
|
||||||
} else {
|
} else {
|
||||||
return object
|
return String(describing: object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Array: JSONEncodable {
|
extension Array {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [String] {
|
||||||
return self.map { encodeIfPossible($0, codableHelper: codableHelper) }
|
return self.map { encodeIfPossible($0, codableHelper: codableHelper) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Set: JSONEncodable {
|
extension Set {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [String] {
|
||||||
return Array(self).encodeToJSON(codableHelper: codableHelper)
|
return Array(self).encodeToQueryString(codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Dictionary: JSONEncodable {
|
extension Dictionary {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] {
|
||||||
var dictionary = [AnyHashable: Any]()
|
var dictionary = [Key: String]()
|
||||||
for (key, value) in self {
|
for (key, value) in self {
|
||||||
dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper)
|
dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
@ -83,24 +59,24 @@ extension Dictionary: JSONEncodable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Data: JSONEncodable {
|
extension Data: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return self.base64EncodedString(options: Data.Base64EncodingOptions())
|
return self.base64EncodedString(options: Data.Base64EncodingOptions())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Date: JSONEncodable {
|
extension Date: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return codableHelper.dateFormatter.string(from: self)
|
return codableHelper.dateFormatter.string(from: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONEncodable where Self: Encodable {
|
extension QueryStringEncodable where Self: Encodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
guard let data = try? codableHelper.jsonEncoder.encode(self) else {
|
guard let data = try? codableHelper.jsonEncoder.encode(self) else {
|
||||||
fatalError("Could not encode to json: \(self)")
|
fatalError("Could not encode to json: \(self)")
|
||||||
}
|
}
|
||||||
return data.encodeToJSON(codableHelper: codableHelper)
|
return data.encodeToQueryString(codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import Foundation
|
|||||||
import FoundationNetworking
|
import FoundationNetworking
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public struct JSONDataEncoding {
|
public struct JSONDataEncoding: Sendable {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ public struct JSONDataEncoding {
|
|||||||
/// - throws: An `Error` if the encoding process encounters an error.
|
/// - throws: An `Error` if the encoding process encounters an error.
|
||||||
///
|
///
|
||||||
/// - returns: The encoded request.
|
/// - returns: The encoded request.
|
||||||
public func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest {
|
public func encode(request: URLRequest, with parameters: [String: any Sendable]?) -> URLRequest {
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else {
|
guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else {
|
||||||
return urlRequest
|
return urlRequest
|
||||||
@ -43,10 +43,10 @@ public struct JSONDataEncoding {
|
|||||||
return urlRequest
|
return urlRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
public static func encodingParameters(jsonData: Data?) -> [String: any Sendable]? {
|
||||||
var returnedParams: [String: Any]?
|
var returnedParams: [String: any Sendable]?
|
||||||
if let jsonData = jsonData, !jsonData.isEmpty {
|
if let jsonData = jsonData, !jsonData.isEmpty {
|
||||||
var params: [String: Any] = [:]
|
var params: [String: any Sendable] = [:]
|
||||||
params[jsonDataKey] = jsonData
|
params[jsonDataKey] = jsonData
|
||||||
returnedParams = params
|
returnedParams = params
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import Foundation
|
|||||||
|
|
||||||
open class JSONEncodingHelper {
|
open class JSONEncodingHelper {
|
||||||
|
|
||||||
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?, codableHelper: CodableHelper) -> [String: Any]? {
|
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?, codableHelper: CodableHelper) -> [String: any Sendable]? {
|
||||||
var params: [String: Any]?
|
var params: [String: any Sendable]?
|
||||||
|
|
||||||
// Encode the Encodable object
|
// Encode the Encodable object
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
@ -26,8 +26,8 @@ open class JSONEncodingHelper {
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: Any]? {
|
open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? {
|
||||||
var params: [String: Any]?
|
var params: [String: any Sendable]?
|
||||||
|
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
do {
|
do {
|
||||||
|
@ -10,8 +10,8 @@ import FoundationNetworking
|
|||||||
#endif
|
#endif
|
||||||
import Alamofire
|
import Alamofire
|
||||||
|
|
||||||
protocol JSONEncodable {
|
protocol QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any
|
func encodeToQueryString(codableHelper: CodableHelper) -> String
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum where the last case value can be used as a default catch-all.
|
/// An enum where the last case value can be used as a default catch-all.
|
||||||
@ -119,9 +119,9 @@ extension Response : Sendable where T : Sendable {}
|
|||||||
/// Type-erased ResponseSerializer
|
/// Type-erased ResponseSerializer
|
||||||
///
|
///
|
||||||
/// This is needed in order to use `ResponseSerializer` as a Type in `Configuration`. Obsolete with `any` keyword in Swift >= 5.7
|
/// This is needed in order to use `ResponseSerializer` as a Type in `Configuration`. Obsolete with `any` keyword in Swift >= 5.7
|
||||||
public struct AnyResponseSerializer<T>: ResponseSerializer {
|
public struct AnyResponseSerializer<T: Sendable>: ResponseSerializer {
|
||||||
|
|
||||||
let _serialize: (URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> T
|
let _serialize: @Sendable (URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> T
|
||||||
|
|
||||||
public init<V: ResponseSerializer>(_ delegatee: V) where V.SerializedObject == T {
|
public init<V: ResponseSerializer>(_ delegatee: V) where V.SerializedObject == T {
|
||||||
_serialize = delegatee.serialize
|
_serialize = delegatee.serialize
|
||||||
|
@ -76,8 +76,8 @@ public struct OpenAPIDateWithoutTime: Sendable, Codable, Hashable, Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension OpenAPIDateWithoutTime: JSONEncodable {
|
extension OpenAPIDateWithoutTime: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct AdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var mapString: [String: String]?
|
public var mapString: [String: String]?
|
||||||
public var mapMapString: [String: [String: String]]?
|
public var mapMapString: [String: [String: String]]?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Animal: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ApiResponse: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var code: Int?
|
public var code: Int?
|
||||||
public var type: String?
|
public var type: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var arrayArrayNumber: [[Double]]?
|
public var arrayArrayNumber: [[Double]]?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var arrayNumber: [Double]?
|
public var arrayNumber: [Double]?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArrayTest: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var arrayOfString: [String]?
|
public var arrayOfString: [String]?
|
||||||
public var arrayArrayOfInteger: [[Int64]]?
|
public var arrayArrayOfInteger: [[Int64]]?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Capitalization: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var smallCamel: String?
|
public var smallCamel: String?
|
||||||
public var capitalCamel: String?
|
public var capitalCamel: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Cat: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Category: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Category: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var name: String? = "default-name"
|
public var name: String? = "default-name"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/** Model for testing model with \"_class\" property */
|
/** Model for testing model with \"_class\" property */
|
||||||
public struct ClassModel: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Client: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Client: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var client: String?
|
public var client: String?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Dog: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct EnumArrays: Sendable, Codable, JSONEncodable, Hashable {
|
public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public enum JustSymbol: String, Sendable, Codable, CaseIterable {
|
public enum JustSymbol: String, Sendable, Codable, CaseIterable {
|
||||||
case greaterThanOrEqualTo = ">="
|
case greaterThanOrEqualTo = ">="
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct EnumTest: Sendable, Codable, JSONEncodable, Hashable {
|
public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public enum EnumString: String, Sendable, Codable, CaseIterable {
|
public enum EnumString: String, Sendable, Codable, CaseIterable {
|
||||||
case upper = "UPPER"
|
case upper = "UPPER"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/** Must be named `File` for test. */
|
/** Must be named `File` for test. */
|
||||||
public struct File: Sendable, Codable, JSONEncodable, Hashable {
|
public struct File: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
/** Test capitalization */
|
/** Test capitalization */
|
||||||
public var sourceURI: String?
|
public var sourceURI: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct FileSchemaTestClass: Sendable, Codable, JSONEncodable, Hashable {
|
public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var file: File?
|
public var file: File?
|
||||||
public var files: [File]?
|
public var files: [File]?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable {
|
public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public static let integerRule = NumericRule<Int>(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil)
|
public static let integerRule = NumericRule<Int>(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil)
|
||||||
public static let int32Rule = NumericRule<Int>(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil)
|
public static let int32Rule = NumericRule<Int>(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct HasOnlyReadOnly: Sendable, Codable, JSONEncodable, Hashable {
|
public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var bar: String?
|
public var bar: String?
|
||||||
public var foo: String?
|
public var foo: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct List: Sendable, Codable, JSONEncodable, Hashable {
|
public struct List: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var _123list: String?
|
public var _123list: String?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct MapTest: Sendable, Codable, JSONEncodable, Hashable {
|
public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public enum MapOfEnumString: String, Sendable, Codable, CaseIterable {
|
public enum MapOfEnumString: String, Sendable, Codable, CaseIterable {
|
||||||
case upper = "UPPER"
|
case upper = "UPPER"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var uuid: UUID?
|
public var uuid: UUID?
|
||||||
public var dateTime: Date?
|
public var dateTime: Date?
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/** Model for testing model name starting with number */
|
/** Model for testing model name starting with number */
|
||||||
public struct Model200Response: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var name: Int?
|
public var name: Int?
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/** Model for testing model name same as property name */
|
/** Model for testing model name same as property name */
|
||||||
public struct Name: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Name: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var name: Int
|
public var name: Int
|
||||||
public var snakeCase: NullEncodable<Int> = .encodeValue(11033)
|
public var snakeCase: NullEncodable<Int> = .encodeValue(11033)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct NumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var justNumber: Double?
|
public var justNumber: Double?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Order: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Order: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public enum Status: String, Sendable, Codable, CaseIterable {
|
public enum Status: String, Sendable, Codable, CaseIterable {
|
||||||
case placed = "placed"
|
case placed = "placed"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct OuterComposite: Sendable, Codable, JSONEncodable, Hashable {
|
public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var myNumber: Double?
|
public var myNumber: Double?
|
||||||
public var myString: String?
|
public var myString: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Pet: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public enum Status: String, Sendable, Codable, CaseIterable {
|
public enum Status: String, Sendable, Codable, CaseIterable {
|
||||||
case available = "available"
|
case available = "available"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ReadOnlyFirst: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var bar: String?
|
public var bar: String?
|
||||||
public var baz: String?
|
public var baz: String?
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/** Model for testing reserved words */
|
/** Model for testing reserved words */
|
||||||
public struct Return: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Return: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var _return: Int?
|
public var _return: Int?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct SpecialModelName: Sendable, Codable, JSONEncodable, Hashable {
|
public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var specialPropertyName: Int64?
|
public var specialPropertyName: Int64?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct StringBooleanMap: Sendable, Codable, JSONEncodable, Hashable {
|
public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
|
|
||||||
public enum CodingKeys: CodingKey, CaseIterable {
|
public enum CodingKeys: CodingKey, CaseIterable {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Tag: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var name: String?
|
public var name: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct TypeHolderDefault: Sendable, Codable, JSONEncodable, Hashable {
|
public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var stringItem: String = "what"
|
public var stringItem: String = "what"
|
||||||
public var numberItem: Double
|
public var numberItem: Double
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct TypeHolderExample: Sendable, Codable, JSONEncodable, Hashable {
|
public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var stringItem: String
|
public var stringItem: String
|
||||||
public var numberItem: Double
|
public var numberItem: Double
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct User: Sendable, Codable, JSONEncodable, Hashable {
|
public struct User: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var username: String?
|
public var username: String?
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "6fb5b6bfc406365339fcc9d8236adab4f0b7ee38fc666a0f00b4b3b75beb7900",
|
"originHash" : "d2e45fa99287c9c1d71d047aa90c9675d5c0aee0e8ba334a9517cdbbfc12f90f",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "alamofire",
|
"identity" : "alamofire",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/Alamofire/Alamofire",
|
"location" : "https://github.com/Alamofire/Alamofire",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a",
|
"revision" : "513364f870f6bfc468f9d2ff0a95caccc10044c5",
|
||||||
"version" : "5.9.1"
|
"version" : "5.10.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -27,7 +27,7 @@ class DateFormatTests: XCTestCase {
|
|||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEncodeToJSONAlwaysResultsInUTCEncodedDate() {
|
func testencodeToQueryStringAlwaysResultsInUTCEncodedDate() {
|
||||||
var dateComponents = DateComponents()
|
var dateComponents = DateComponents()
|
||||||
dateComponents.calendar = Calendar(identifier: .gregorian)
|
dateComponents.calendar = Calendar(identifier: .gregorian)
|
||||||
dateComponents.year = 2018
|
dateComponents.year = 2018
|
||||||
@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var encodedDate = utcDate.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String
|
var encodedDate = utcDate.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String
|
||||||
XCTAssert(encodedDate.hasSuffix("Z"))
|
XCTAssert(encodedDate.hasSuffix("Z"))
|
||||||
|
|
||||||
// test with a positive timzone offset from UTC
|
// test with a positive timzone offset from UTC
|
||||||
@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
encodedDate = nonUTCDate1.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String
|
encodedDate = nonUTCDate1.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String
|
||||||
XCTAssert(encodedDate.hasSuffix("Z"))
|
XCTAssert(encodedDate.hasSuffix("Z"))
|
||||||
|
|
||||||
// test with a negative timzone offset from UTC
|
// test with a negative timzone offset from UTC
|
||||||
@ -71,7 +71,7 @@ class DateFormatTests: XCTestCase {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
encodedDate = nonUTCDate2.encodeToJSON(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String
|
encodedDate = nonUTCDate2.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String
|
||||||
XCTAssert(encodedDate.hasSuffix("Z"))
|
XCTAssert(encodedDate.hasSuffix("Z"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
github "Alamofire/Alamofire" = 5.10.2
|
||||||
github "Alamofire/Alamofire" = 5.9.1
|
|
||||||
github "mxcl/PromiseKit" ~> 8.1
|
github "mxcl/PromiseKit" ~> 8.1
|
||||||
github "ReactiveX/RxSwift" ~> 6.8
|
github "ReactiveX/RxSwift" ~> 6.8
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "766b7b8894983c692454ee57aad3d618580bf90078cad51008d129ddf41ff945",
|
"originHash" : "271b0c60e4f6d7e4e95b242fe75853812e17a2a3c7fd43e160c0d750e9489a83",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "alamofire",
|
"identity" : "alamofire",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/Alamofire/Alamofire",
|
"location" : "https://github.com/Alamofire/Alamofire",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a",
|
"revision" : "513364f870f6bfc468f9d2ff0a95caccc10044c5",
|
||||||
"version" : "5.9.1"
|
"version" : "5.10.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -19,8 +19,7 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// Dependencies declare other packages that this package depends on.
|
// Dependencies declare other packages that this package depends on.
|
||||||
// TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
.package(url: "https://github.com/Alamofire/Alamofire", exact: "5.10.2"),
|
||||||
.package(url: "https://github.com/Alamofire/Alamofire", exact: "5.9.1"),
|
|
||||||
.package(url: "https://github.com/mxcl/PromiseKit", .upToNextMajor(from: "8.1.2")),
|
.package(url: "https://github.com/mxcl/PromiseKit", .upToNextMajor(from: "8.1.2")),
|
||||||
.package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMajor(from: "6.8.0")),
|
.package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMajor(from: "6.8.0")),
|
||||||
],
|
],
|
||||||
|
@ -11,8 +11,7 @@ Pod::Spec.new do |s|
|
|||||||
s.homepage = 'https://github.com/openapitools/openapi-generator'
|
s.homepage = 'https://github.com/openapitools/openapi-generator'
|
||||||
s.summary = 'PetstoreClient'
|
s.summary = 'PetstoreClient'
|
||||||
s.source_files = 'Sources/PetstoreClient/**/*.swift'
|
s.source_files = 'Sources/PetstoreClient/**/*.swift'
|
||||||
# TODO: Alamofire versions 5.10.0 and above are not currently supported. If you need a newer version, please consider submitting a Pull Request with the required changes.
|
s.dependency 'Alamofire', '5.10.2'
|
||||||
s.dependency 'Alamofire', '5.9.1'
|
|
||||||
s.dependency 'PromiseKit/CorePromise', '~> 8.1'
|
s.dependency 'PromiseKit/CorePromise', '~> 8.1'
|
||||||
s.dependency 'RxSwift', '~> 6.8'
|
s.dependency 'RxSwift', '~> 6.8'
|
||||||
end
|
end
|
||||||
|
@ -153,7 +153,7 @@ open class AnotherFakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -563,7 +563,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -847,10 +847,10 @@ open class FakeAPI {
|
|||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"query": (wrappedValue: query.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -996,7 +996,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1232,21 +1232,21 @@ open class FakeAPI {
|
|||||||
open func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
|
open func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake"
|
let localVariablePath = "/fake"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"integer": integer?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"int32": int32?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"int64": int64?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"number": number.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"float": float?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"double": double.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"string": string?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"byte": byte.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"binary": binary?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"date": date?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"dateTime": dateTime?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"password": password?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"callback": callback?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -1254,7 +1254,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1512,9 +1512,9 @@ open class FakeAPI {
|
|||||||
open func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder<Void> {
|
open func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake"
|
let localVariablePath = "/fake"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"enum_form_string_array": enumFormStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"enum_form_string": enumFormString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -1522,16 +1522,16 @@ open class FakeAPI {
|
|||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"enum_query_string": (wrappedValue: enumQueryString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"enum_query_double": (wrappedValue: enumQueryDouble?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
"enum_header_string_array": enumHeaderStringArray?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"enum_header_string": enumHeaderString?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||||
@ -1707,19 +1707,19 @@ open class FakeAPI {
|
|||||||
open func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> {
|
open func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake"
|
let localVariablePath = "/fake"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"required_string_group": (wrappedValue: requiredStringGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"required_int64_group": (wrappedValue: requiredInt64Group.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"string_group": (wrappedValue: stringGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"int64_group": (wrappedValue: int64Group?.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"required_boolean_group": requiredBooleanGroup.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"boolean_group": booleanGroup?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||||
@ -1863,7 +1863,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2011,9 +2011,9 @@ open class FakeAPI {
|
|||||||
open func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
open func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/fake/jsonFormData"
|
let localVariablePath = "/fake/jsonFormData"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"param": param.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"param2": param2.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -2021,7 +2021,7 @@ open class FakeAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ open class FakeClassnameTags123API {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -312,12 +312,12 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"api_key": apiKey?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
|
||||||
@ -470,14 +470,14 @@ open class PetAPI {
|
|||||||
open func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus]) -> RequestBuilder<[Pet]> {
|
open func findPetsByStatusWithRequestBuilder(status: [Status_findPetsByStatus]) -> RequestBuilder<[Pet]> {
|
||||||
let localVariablePath = "/pet/findByStatus"
|
let localVariablePath = "/pet/findByStatus"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"status": (wrappedValue: status.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -629,14 +629,14 @@ open class PetAPI {
|
|||||||
open func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
open func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
||||||
let localVariablePath = "/pet/findByTags"
|
let localVariablePath = "/pet/findByTags"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"tags": (wrappedValue: tags.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -784,11 +784,11 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -936,7 +936,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1097,9 +1097,9 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"name": name?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"status": status?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -1107,7 +1107,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1268,9 +1268,9 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"file": file?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -1278,7 +1278,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1439,9 +1439,9 @@ open class PetAPI {
|
|||||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableFormParams: [String: Any?] = [
|
let localVariableFormParams: [String: (any Sendable)?] = [
|
||||||
"additionalMetadata": additionalMetadata?.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
"requiredFile": requiredFile.encodeToJSON(codableHelper: apiConfiguration.codableHelper),
|
"requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper),
|
||||||
]
|
]
|
||||||
|
|
||||||
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
|
||||||
@ -1449,7 +1449,7 @@ open class PetAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -152,11 +152,11 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -294,11 +294,11 @@ open class StoreAPI {
|
|||||||
open func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> {
|
open func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> {
|
||||||
let localVariablePath = "/store/inventory"
|
let localVariablePath = "/store/inventory"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -443,11 +443,11 @@ open class StoreAPI {
|
|||||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ open class StoreAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -588,11 +588,11 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -736,11 +736,11 @@ open class UserAPI {
|
|||||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||||
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
localVariablePath = localVariablePath.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -889,15 +889,15 @@ open class UserAPI {
|
|||||||
open func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
open func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
||||||
let localVariablePath = "/user/login"
|
let localVariablePath = "/user/login"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||||
"username": (wrappedValue: username.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
"password": (wrappedValue: password.encodeToJSON(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
"password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false),
|
||||||
])
|
])
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1031,11 +1031,11 @@ open class UserAPI {
|
|||||||
open func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
open func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
||||||
let localVariablePath = "/user/logout"
|
let localVariablePath = "/user/logout"
|
||||||
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
let localVariableURLString = apiConfiguration.basePath + localVariablePath
|
||||||
let localVariableParameters: [String: Any]? = nil
|
let localVariableParameters: [String: any Sendable]? = nil
|
||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1191,7 +1191,7 @@ open class UserAPI {
|
|||||||
|
|
||||||
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
|
||||||
|
|
||||||
let localVariableNillableHeaders: [String: Any?] = [
|
let localVariableNillableHeaders: [String: (any Sendable)?] = [
|
||||||
:
|
:
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct APIHelper {
|
public struct APIHelper {
|
||||||
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
|
public static func rejectNil(_ source: [String: (any Sendable)?]) -> [String: any Sendable]? {
|
||||||
let destination = source.reduce(into: [String: Any]()) { result, item in
|
let destination = source.reduce(into: [String: any Sendable]()) { result, item in
|
||||||
if let value = item.value {
|
if let value = item.value {
|
||||||
result[item.key] = value
|
result[item.key] = value
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ public struct APIHelper {
|
|||||||
return destination
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
public static func rejectNilHeaders(_ source: [String: (any Sendable)?]) -> [String: String] {
|
||||||
return source.reduce(into: [String: String]()) { result, item in
|
return source.reduce(into: [String: String]()) { result, item in
|
||||||
if let collection = item.value as? [Any?] {
|
if let collection = item.value as? [Any?] {
|
||||||
result[item.key] = collection
|
result[item.key] = collection
|
||||||
@ -32,12 +32,12 @@ public struct APIHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
|
public static func convertBoolToString(_ source: [String: any Sendable]?) -> [String: any Sendable]? {
|
||||||
guard let source = source else {
|
guard let source = source else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return source.reduce(into: [String: Any]()) { result, item in
|
return source.reduce(into: [String: any Sendable]()) { result, item in
|
||||||
switch item.value {
|
switch item.value {
|
||||||
case let x as Bool:
|
case let x as Bool:
|
||||||
result[item.key] = x.description
|
result[item.key] = x.description
|
||||||
@ -99,7 +99,7 @@ public struct APIHelper {
|
|||||||
/// maps all values from source to query parameters
|
/// maps all values from source to query parameters
|
||||||
///
|
///
|
||||||
/// collection values are always exploded
|
/// collection values are always exploded
|
||||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
public static func mapValuesToQueryItems(_ source: [String: (any Sendable)?]) -> [URLQueryItem]? {
|
||||||
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
|
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
|
||||||
if let collection = item.value as? [Any?] {
|
if let collection = item.value as? [Any?] {
|
||||||
collection
|
collection
|
||||||
|
@ -64,7 +64,7 @@ open class PetstoreClientAPIConfiguration: @unchecked Sendable {
|
|||||||
open class RequestBuilder<T>: @unchecked Sendable {
|
open class RequestBuilder<T>: @unchecked Sendable {
|
||||||
public var credential: URLCredential?
|
public var credential: URLCredential?
|
||||||
public var headers: [String: String]
|
public var headers: [String: String]
|
||||||
public let parameters: [String: Any]?
|
public let parameters: [String: any Sendable]?
|
||||||
public let method: String
|
public let method: String
|
||||||
public let URLString: String
|
public let URLString: String
|
||||||
public let requestTask: RequestTask = RequestTask()
|
public let requestTask: RequestTask = RequestTask()
|
||||||
@ -74,7 +74,7 @@ open class RequestBuilder<T>: @unchecked Sendable {
|
|||||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||||
public var onProgressReady: ((Progress) -> Void)?
|
public var onProgressReady: ((Progress) -> Void)?
|
||||||
|
|
||||||
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
||||||
self.method = method
|
self.method = method
|
||||||
self.URLString = URLString
|
self.URLString = URLString
|
||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
|
@ -28,7 +28,7 @@ fileprivate class AlamofireRequestBuilderConfiguration: @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
||||||
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
required public init(method: String, URLString: String, parameters: [String: any Sendable]?, headers: [String: String] = [:], requiresAuthentication: Bool, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) {
|
||||||
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication, apiConfiguration: apiConfiguration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
override open func execute(completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
override open func execute(completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) -> RequestTask {
|
||||||
let managerId = UUID().uuidString
|
let managerId = UUID().uuidString
|
||||||
// Create a new manager for each request to customize its request header
|
// Create a new manager for each request to customize its request header
|
||||||
let manager = createAlamofireSession()
|
let manager = createAlamofireSession()
|
||||||
@ -163,12 +163,12 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
|||||||
return requestTask
|
return requestTask
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func processRequest(request: DataRequest, managerId: String, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
request.authenticate(with: credential)
|
request.authenticate(with: credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanupRequest = {
|
let cleanupRequest = { @Sendable in
|
||||||
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,12 +257,12 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T>, @unchecked Sendable {
|
|||||||
|
|
||||||
open class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T>, @unchecked Sendable {
|
open class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T>, @unchecked Sendable {
|
||||||
|
|
||||||
override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
override fileprivate func processRequest(request: DataRequest, managerId: String, completion: @Sendable @escaping (_ result: Swift.Result<Response<T>, ErrorResponse>) -> Void) {
|
||||||
if let credential = self.credential {
|
if let credential = self.credential {
|
||||||
request.authenticate(with: credential)
|
request.authenticate(with: credential)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cleanupRequest = {
|
let cleanupRequest = { @Sendable in
|
||||||
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
AlamofireRequestBuilderConfiguration.shared.managerStore[managerId] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +415,6 @@ extension JSONDataEncoding: ParameterEncoding {
|
|||||||
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
|
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
|
||||||
let urlRequest = try urlRequest.asURLRequest()
|
let urlRequest = try urlRequest.asURLRequest()
|
||||||
|
|
||||||
return encode(urlRequest, with: parameters)
|
return encode(request: urlRequest, with: parameters)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,73 +10,49 @@ import FoundationNetworking
|
|||||||
#endif
|
#endif
|
||||||
@preconcurrency import PromiseKit
|
@preconcurrency import PromiseKit
|
||||||
|
|
||||||
extension Bool: JSONEncodable {
|
extension Bool: QueryStringEncodable {}
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
extension Float: QueryStringEncodable {}
|
||||||
|
extension Int: QueryStringEncodable {}
|
||||||
|
extension Int32: QueryStringEncodable {}
|
||||||
|
extension Int64: QueryStringEncodable {}
|
||||||
|
extension Double: QueryStringEncodable {}
|
||||||
|
extension Decimal: QueryStringEncodable {}
|
||||||
|
extension String: QueryStringEncodable {}
|
||||||
|
extension URL: QueryStringEncodable {}
|
||||||
|
extension UUID: QueryStringEncodable {}
|
||||||
|
|
||||||
|
extension QueryStringEncodable {
|
||||||
|
@_disfavoredOverload
|
||||||
|
func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Float: JSONEncodable {
|
extension RawRepresentable where RawValue: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Int: JSONEncodable {
|
private func encodeIfPossible<T>(_ object: T, codableHelper: CodableHelper) -> String {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
if let encodableObject = object as? QueryStringEncodable {
|
||||||
}
|
return encodableObject.encodeToQueryString(codableHelper: codableHelper)
|
||||||
|
|
||||||
extension Int32: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Int64: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Double: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Decimal: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension String: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension URL: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UUID: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { self }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension RawRepresentable where RawValue: JSONEncodable {
|
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any { return self.rawValue }
|
|
||||||
}
|
|
||||||
|
|
||||||
private func encodeIfPossible<T>(_ object: T, codableHelper: CodableHelper) -> Any {
|
|
||||||
if let encodableObject = object as? JSONEncodable {
|
|
||||||
return encodableObject.encodeToJSON(codableHelper: codableHelper)
|
|
||||||
} else {
|
} else {
|
||||||
return object
|
return String(describing: object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Array: JSONEncodable {
|
extension Array {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [String] {
|
||||||
return self.map { encodeIfPossible($0, codableHelper: codableHelper) }
|
return self.map { encodeIfPossible($0, codableHelper: codableHelper) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Set: JSONEncodable {
|
extension Set {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [String] {
|
||||||
return Array(self).encodeToJSON(codableHelper: codableHelper)
|
return Array(self).encodeToQueryString(codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Dictionary: JSONEncodable {
|
extension Dictionary {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] {
|
||||||
var dictionary = [AnyHashable: Any]()
|
var dictionary = [Key: String]()
|
||||||
for (key, value) in self {
|
for (key, value) in self {
|
||||||
dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper)
|
dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
@ -84,24 +60,24 @@ extension Dictionary: JSONEncodable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Data: JSONEncodable {
|
extension Data: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return self.base64EncodedString(options: Data.Base64EncodingOptions())
|
return self.base64EncodedString(options: Data.Base64EncodingOptions())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Date: JSONEncodable {
|
extension Date: QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
return codableHelper.dateFormatter.string(from: self)
|
return codableHelper.dateFormatter.string(from: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONEncodable where Self: Encodable {
|
extension QueryStringEncodable where Self: Encodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any {
|
func encodeToQueryString(codableHelper: CodableHelper) -> String {
|
||||||
guard let data = try? codableHelper.jsonEncoder.encode(self) else {
|
guard let data = try? codableHelper.jsonEncoder.encode(self) else {
|
||||||
fatalError("Could not encode to json: \(self)")
|
fatalError("Could not encode to json: \(self)")
|
||||||
}
|
}
|
||||||
return data.encodeToJSON(codableHelper: codableHelper)
|
return data.encodeToQueryString(codableHelper: codableHelper)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import Foundation
|
|||||||
import FoundationNetworking
|
import FoundationNetworking
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public struct JSONDataEncoding {
|
public struct JSONDataEncoding: Sendable {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ public struct JSONDataEncoding {
|
|||||||
/// - throws: An `Error` if the encoding process encounters an error.
|
/// - throws: An `Error` if the encoding process encounters an error.
|
||||||
///
|
///
|
||||||
/// - returns: The encoded request.
|
/// - returns: The encoded request.
|
||||||
public func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest {
|
public func encode(request: URLRequest, with parameters: [String: any Sendable]?) -> URLRequest {
|
||||||
var urlRequest = urlRequest
|
var urlRequest = request
|
||||||
|
|
||||||
guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else {
|
guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else {
|
||||||
return urlRequest
|
return urlRequest
|
||||||
@ -43,10 +43,10 @@ public struct JSONDataEncoding {
|
|||||||
return urlRequest
|
return urlRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
public static func encodingParameters(jsonData: Data?) -> [String: any Sendable]? {
|
||||||
var returnedParams: [String: Any]?
|
var returnedParams: [String: any Sendable]?
|
||||||
if let jsonData = jsonData, !jsonData.isEmpty {
|
if let jsonData = jsonData, !jsonData.isEmpty {
|
||||||
var params: [String: Any] = [:]
|
var params: [String: any Sendable] = [:]
|
||||||
params[jsonDataKey] = jsonData
|
params[jsonDataKey] = jsonData
|
||||||
returnedParams = params
|
returnedParams = params
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import Foundation
|
|||||||
|
|
||||||
open class JSONEncodingHelper {
|
open class JSONEncodingHelper {
|
||||||
|
|
||||||
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?, codableHelper: CodableHelper) -> [String: Any]? {
|
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?, codableHelper: CodableHelper) -> [String: any Sendable]? {
|
||||||
var params: [String: Any]?
|
var params: [String: any Sendable]?
|
||||||
|
|
||||||
// Encode the Encodable object
|
// Encode the Encodable object
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
@ -26,8 +26,8 @@ open class JSONEncodingHelper {
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: Any]? {
|
open class func encodingParameters(forEncodableObject encodableObj: Any?, codableHelper: CodableHelper) -> [String: any Sendable]? {
|
||||||
var params: [String: Any]?
|
var params: [String: any Sendable]?
|
||||||
|
|
||||||
if let encodableObj = encodableObj {
|
if let encodableObj = encodableObj {
|
||||||
do {
|
do {
|
||||||
|
@ -10,8 +10,8 @@ import FoundationNetworking
|
|||||||
#endif
|
#endif
|
||||||
import Alamofire
|
import Alamofire
|
||||||
|
|
||||||
protocol JSONEncodable {
|
protocol QueryStringEncodable {
|
||||||
func encodeToJSON(codableHelper: CodableHelper) -> Any
|
func encodeToQueryString(codableHelper: CodableHelper) -> String
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum where the last case value can be used as a default catch-all.
|
/// An enum where the last case value can be used as a default catch-all.
|
||||||
@ -119,9 +119,9 @@ extension Response : Sendable where T : Sendable {}
|
|||||||
/// Type-erased ResponseSerializer
|
/// Type-erased ResponseSerializer
|
||||||
///
|
///
|
||||||
/// This is needed in order to use `ResponseSerializer` as a Type in `Configuration`. Obsolete with `any` keyword in Swift >= 5.7
|
/// This is needed in order to use `ResponseSerializer` as a Type in `Configuration`. Obsolete with `any` keyword in Swift >= 5.7
|
||||||
public struct AnyResponseSerializer<T>: ResponseSerializer {
|
public struct AnyResponseSerializer<T: Sendable>: ResponseSerializer {
|
||||||
|
|
||||||
let _serialize: (URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> T
|
let _serialize: @Sendable (URLRequest?, HTTPURLResponse?, Data?, Error?) throws -> T
|
||||||
|
|
||||||
public init<V: ResponseSerializer>(_ delegatee: V) where V.SerializedObject == T {
|
public init<V: ResponseSerializer>(_ delegatee: V) where V.SerializedObject == T {
|
||||||
_serialize = delegatee.serialize
|
_serialize = delegatee.serialize
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct AdditionalPropertiesClass: Sendable, Codable, JSONEncodable, Hashable {
|
public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var mapString: [String: String]?
|
public var mapString: [String: String]?
|
||||||
public var mapMapString: [String: [String: String]]?
|
public var mapMapString: [String: [String: String]]?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Animal: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ApiResponse: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var code: Int?
|
public var code: Int?
|
||||||
public var type: String?
|
public var type: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var arrayArrayNumber: [[Double]]?
|
public var arrayArrayNumber: [[Double]]?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArrayOfNumberOnly: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var arrayNumber: [Double]?
|
public var arrayNumber: [Double]?
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArrayTest: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var arrayOfString: [String]?
|
public var arrayOfString: [String]?
|
||||||
public var arrayArrayOfInteger: [[Int64]]?
|
public var arrayArrayOfInteger: [[Int64]]?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Capitalization: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var smallCamel: String?
|
public var smallCamel: String?
|
||||||
public var capitalCamel: String?
|
public var capitalCamel: String?
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Cat: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var className: String
|
public var className: String
|
||||||
public var color: String? = "red"
|
public var color: String? = "red"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct Category: Sendable, Codable, JSONEncodable, Hashable {
|
public struct Category: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var id: Int64?
|
public var id: Int64?
|
||||||
public var name: String? = "default-name"
|
public var name: String? = "default-name"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/** Model for testing model with \"_class\" property */
|
/** Model for testing model with \"_class\" property */
|
||||||
public struct ClassModel: Sendable, Codable, JSONEncodable, Hashable {
|
public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable {
|
||||||
|
|
||||||
public var _class: String?
|
public var _class: String?
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user