forked from loafle/openapi-generator-original
run swiftlint latest version on swift samples (#6788)
This commit is contained in:
@@ -14,11 +14,11 @@ let package = Package(
|
||||
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
||||
.library(
|
||||
name: "PetstoreClient",
|
||||
targets: ["PetstoreClient"]),
|
||||
targets: ["PetstoreClient"])
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"),
|
||||
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0")
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
@@ -27,6 +27,6 @@ let package = Package(
|
||||
name: "PetstoreClient",
|
||||
dependencies: ["RxSwift"],
|
||||
path: "PetstoreClient/Classes"
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Foundation
|
||||
|
||||
public struct APIHelper {
|
||||
public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? {
|
||||
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
|
||||
let destination = source.reduce(into: [String: Any]()) { (result, item) in
|
||||
if let value = item.value {
|
||||
result[item.key] = value
|
||||
@@ -20,17 +20,17 @@ public struct APIHelper {
|
||||
return destination
|
||||
}
|
||||
|
||||
public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] {
|
||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||
return source.reduce(into: [String: String]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",")
|
||||
if let collection = item.value as? [Any?] {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? {
|
||||
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
|
||||
guard let source = source else {
|
||||
return nil
|
||||
}
|
||||
@@ -46,15 +46,15 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? Array<Any?> {
|
||||
if let collection = source as? [Any?] {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
}
|
||||
|
||||
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
|
||||
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
|
||||
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
if let collection = item.value as? [Any?] {
|
||||
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
}
|
||||
@@ -69,4 +69,3 @@ public struct APIHelper {
|
||||
return destination
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ import Foundation
|
||||
open class PetstoreClientAPI {
|
||||
public static var basePath = "http://petstore.swagger.io:80/v2"
|
||||
public static var credential: URLCredential?
|
||||
public static var customHeaders: [String:String] = [:]
|
||||
public static var customHeaders: [String: String] = [:]
|
||||
public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory()
|
||||
public static var apiResponseQueue: DispatchQueue = .main
|
||||
}
|
||||
|
||||
open class RequestBuilder<T> {
|
||||
var credential: URLCredential?
|
||||
var headers: [String:String]
|
||||
public let parameters: [String:Any]?
|
||||
var headers: [String: String]
|
||||
public let parameters: [String: Any]?
|
||||
public let isBody: Bool
|
||||
public let method: String
|
||||
public let URLString: String
|
||||
@@ -25,9 +25,9 @@ open class RequestBuilder<T> {
|
||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||
/// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0.
|
||||
/// If you need to get the request's progress in older OS versions, please use Alamofire http client.
|
||||
public var onProgressReady: ((Progress) -> ())?
|
||||
public var onProgressReady: ((Progress) -> Void)?
|
||||
|
||||
required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) {
|
||||
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
|
||||
self.method = method
|
||||
self.URLString = URLString
|
||||
self.parameters = parameters
|
||||
@@ -37,7 +37,7 @@ open class RequestBuilder<T> {
|
||||
addHeaders(PetstoreClientAPI.customHeaders)
|
||||
}
|
||||
|
||||
open func addHeaders(_ aHeaders:[String:String]) {
|
||||
open func addHeaders(_ aHeaders: [String: String]) {
|
||||
for (header, value) in aHeaders {
|
||||
headers[header] = value
|
||||
}
|
||||
@@ -60,5 +60,5 @@ open class RequestBuilder<T> {
|
||||
|
||||
public protocol RequestBuilderFactory {
|
||||
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
|
||||
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
|
||||
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
|
||||
|
||||
open class AnotherFakeAPI {
|
||||
/**
|
||||
To test special tags
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
|
||||
|
||||
open class FakeAPI {
|
||||
/**
|
||||
|
||||
@@ -351,7 +349,7 @@ 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: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
let formParams: [String: Any?] = [
|
||||
"integer": integer?.encodeToJSON(),
|
||||
"int32": int32?.encodeToJSON(),
|
||||
"int64": int64?.encodeToJSON(),
|
||||
@@ -370,7 +368,7 @@ open class FakeAPI {
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
@@ -491,19 +489,19 @@ open class FakeAPI {
|
||||
open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
let formParams: [String: Any?] = [
|
||||
"enum_form_string_array": enumFormStringArray?.encodeToJSON(),
|
||||
"enum_form_string": enumFormString?.encodeToJSON()
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
|
||||
|
||||
var url = URLComponents(string: URLString)
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"enum_query_string_array": enumQueryStringArray?.encodeToJSON(),
|
||||
"enum_query_string": enumQueryString?.encodeToJSON(),
|
||||
"enum_query_integer": enumQueryInteger?.encodeToJSON(),
|
||||
"enum_query_string_array": enumQueryStringArray?.encodeToJSON(),
|
||||
"enum_query_string": enumQueryString?.encodeToJSON(),
|
||||
"enum_query_integer": enumQueryInteger?.encodeToJSON(),
|
||||
"enum_query_double": enumQueryDouble?.encodeToJSON()
|
||||
])
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
@@ -559,13 +557,13 @@ open class FakeAPI {
|
||||
open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
var url = URLComponents(string: URLString)
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"required_string_group": requiredStringGroup.encodeToJSON(),
|
||||
"required_int64_group": requiredInt64Group.encodeToJSON(),
|
||||
"string_group": stringGroup?.encodeToJSON(),
|
||||
"required_string_group": requiredStringGroup.encodeToJSON(),
|
||||
"required_int64_group": requiredInt64Group.encodeToJSON(),
|
||||
"string_group": stringGroup?.encodeToJSON(),
|
||||
"int64_group": int64Group?.encodeToJSON()
|
||||
])
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
@@ -586,7 +584,7 @@ open class FakeAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- returns: Observable<Void>
|
||||
*/
|
||||
open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<Void> {
|
||||
open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<Void> {
|
||||
return Observable.create { observer -> Disposable in
|
||||
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
@@ -607,7 +605,7 @@ open class FakeAPI {
|
||||
- parameter param: (body) request body
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
|
||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> {
|
||||
let path = "/fake/inline-additionalProperties"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
||||
@@ -652,14 +650,14 @@ open class FakeAPI {
|
||||
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
||||
let path = "/fake/jsonFormData"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
let formParams: [String: Any?] = [
|
||||
"param": param.encodeToJSON(),
|
||||
"param2": param2.encodeToJSON()
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
|
||||
|
||||
open class FakeClassnameTags123API {
|
||||
/**
|
||||
To test class name in snake case
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
|
||||
|
||||
open class PetAPI {
|
||||
/**
|
||||
Add a new pet to the store
|
||||
@@ -93,8 +91,8 @@ open class PetAPI {
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
"api_key": apiKey?.encodeToJSON()
|
||||
@@ -150,8 +148,8 @@ open class PetAPI {
|
||||
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
||||
let path = "/pet/findByStatus"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
var url = URLComponents(string: URLString)
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"status": status.encodeToJSON()
|
||||
@@ -199,8 +197,8 @@ open class PetAPI {
|
||||
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
||||
let path = "/pet/findByTags"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
var url = URLComponents(string: URLString)
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"tags": tags.encodeToJSON()
|
||||
@@ -249,8 +247,8 @@ open class PetAPI {
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
@@ -342,14 +340,14 @@ open class PetAPI {
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
let formParams: [String: Any?] = [
|
||||
"name": name?.encodeToJSON(),
|
||||
"status": status?.encodeToJSON()
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
@@ -398,14 +396,14 @@ open class PetAPI {
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
let formParams: [String: Any?] = [
|
||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||
"file": file?.encodeToJSON()
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
@@ -454,14 +452,14 @@ open class PetAPI {
|
||||
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
let formParams: [String: Any?] = [
|
||||
"additionalMetadata": additionalMetadata?.encodeToJSON(),
|
||||
"requiredFile": requiredFile.encodeToJSON()
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
let parameters = APIHelper.convertBoolToString(nonNullParameters)
|
||||
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
|
||||
|
||||
open class StoreAPI {
|
||||
/**
|
||||
Delete purchase order by ID
|
||||
@@ -46,8 +44,8 @@ open class StoreAPI {
|
||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
@@ -61,7 +59,7 @@ open class StoreAPI {
|
||||
- parameter apiResponseQueue: The queue on which api response is dispatched.
|
||||
- returns: Observable<[String:Int]>
|
||||
*/
|
||||
open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[String:Int]> {
|
||||
open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[String: Int]> {
|
||||
return Observable.create { observer -> Disposable in
|
||||
getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in
|
||||
switch result {
|
||||
@@ -85,14 +83,14 @@ open class StoreAPI {
|
||||
- name: api_key
|
||||
- returns: RequestBuilder<[String:Int]>
|
||||
*/
|
||||
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> {
|
||||
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> {
|
||||
let path = "/store/inventory"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
||||
}
|
||||
@@ -132,8 +130,8 @@ open class StoreAPI {
|
||||
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
|
||||
|
||||
open class UserAPI {
|
||||
/**
|
||||
Create user
|
||||
@@ -167,8 +165,8 @@ open class UserAPI {
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
@@ -210,8 +208,8 @@ open class UserAPI {
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
@@ -253,11 +251,11 @@ open class UserAPI {
|
||||
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
||||
let path = "/user/login"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
var url = URLComponents(string: URLString)
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"username": username.encodeToJSON(),
|
||||
"username": username.encodeToJSON(),
|
||||
"password": password.encodeToJSON()
|
||||
])
|
||||
|
||||
@@ -295,8 +293,8 @@ open class UserAPI {
|
||||
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
||||
let path = "/user/logout"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters: [String:Any]? = nil
|
||||
|
||||
let parameters: [String: Any]? = nil
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
@@ -45,4 +45,4 @@ open class CodableHelper {
|
||||
open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable {
|
||||
return Swift.Result { try self.jsonEncoder.encode(value) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
import Foundation
|
||||
|
||||
open class Configuration {
|
||||
|
||||
|
||||
// This value is used to configure the date formatter that is used to serialize dates into JSON format.
|
||||
// You must set it prior to encoding any dates, and it will only be read once.
|
||||
@available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.")
|
||||
public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -108,24 +108,24 @@ extension String: CodingKey {
|
||||
|
||||
extension KeyedEncodingContainerProtocol {
|
||||
|
||||
public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable {
|
||||
public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable {
|
||||
var arrayContainer = nestedUnkeyedContainer(forKey: key)
|
||||
try arrayContainer.encode(contentsOf: values)
|
||||
}
|
||||
|
||||
public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable {
|
||||
public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable {
|
||||
if let values = values {
|
||||
try encodeArray(values, forKey: key)
|
||||
}
|
||||
}
|
||||
|
||||
public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable {
|
||||
public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable {
|
||||
for (key, value) in pairs {
|
||||
try encode(value, forKey: key)
|
||||
}
|
||||
}
|
||||
|
||||
public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable {
|
||||
public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable {
|
||||
if let pairs = pairs {
|
||||
try encodeMap(pairs)
|
||||
}
|
||||
@@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol {
|
||||
|
||||
extension KeyedDecodingContainerProtocol {
|
||||
|
||||
public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable {
|
||||
public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable {
|
||||
var tmpArray = [T]()
|
||||
|
||||
var nestedContainer = try nestedUnkeyedContainer(forKey: key)
|
||||
@@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol {
|
||||
return tmpArray
|
||||
}
|
||||
|
||||
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable {
|
||||
var tmpArray: [T]? = nil
|
||||
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable {
|
||||
var tmpArray: [T]?
|
||||
|
||||
if contains(key) {
|
||||
tmpArray = try decodeArray(T.self, forKey: key)
|
||||
@@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol {
|
||||
return tmpArray
|
||||
}
|
||||
|
||||
public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable {
|
||||
var map: [Self.Key : T] = [:]
|
||||
public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable {
|
||||
var map: [Self.Key: T] = [:]
|
||||
|
||||
for key in allKeys {
|
||||
if !excludedKeys.contains(key) {
|
||||
@@ -177,5 +177,3 @@ extension HTTPURLResponse {
|
||||
return Array(200 ..< 300).contains(statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public struct JSONDataEncoding {
|
||||
}
|
||||
|
||||
public static func encodingParameters(jsonData: Data?) -> [String: Any]? {
|
||||
var returnedParams: [String: Any]? = nil
|
||||
var returnedParams: [String: Any]?
|
||||
if let jsonData = jsonData, !jsonData.isEmpty {
|
||||
var params: [String: Any] = [:]
|
||||
params[jsonDataKey] = jsonData
|
||||
|
||||
@@ -9,8 +9,8 @@ import Foundation
|
||||
|
||||
open class JSONEncodingHelper {
|
||||
|
||||
open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
||||
var params: [String: Any]? = nil
|
||||
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
||||
var params: [String: Any]?
|
||||
|
||||
// Encode the Encodable object
|
||||
if let encodableObj = encodableObj {
|
||||
@@ -27,7 +27,7 @@ open class JSONEncodingHelper {
|
||||
}
|
||||
|
||||
open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? {
|
||||
var params: [String: Any]? = nil
|
||||
var params: [String: Any]?
|
||||
|
||||
if let encodableObj = encodableObj {
|
||||
do {
|
||||
@@ -41,5 +41,5 @@ open class JSONEncodingHelper {
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ protocol JSONEncodable {
|
||||
func encodeToJSON() -> Any
|
||||
}
|
||||
|
||||
public enum ErrorResponse : Error {
|
||||
public enum ErrorResponse: Error {
|
||||
case error(Int, Data?, Error)
|
||||
}
|
||||
|
||||
public enum DownloadException : Error {
|
||||
public enum DownloadException: Error {
|
||||
case responseDataMissing
|
||||
case responseFailed
|
||||
case requestMissing
|
||||
@@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error {
|
||||
case generalError(Error)
|
||||
}
|
||||
|
||||
|
||||
open class Response<T> {
|
||||
public let statusCode: Int
|
||||
public let header: [String: String]
|
||||
@@ -44,7 +43,7 @@ open class Response<T> {
|
||||
|
||||
public convenience init(response: HTTPURLResponse, body: T?) {
|
||||
let rawHeader = response.allHeaderFields
|
||||
var header = [String:String]()
|
||||
var header = [String: String]()
|
||||
for (key, value) in rawHeader {
|
||||
if let key = key.base as? String, let value = value as? String {
|
||||
header[key] = value
|
||||
|
||||
@@ -7,19 +7,17 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable {
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable {
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
||||
|
||||
public var mapString: [String:String]?
|
||||
public var mapMapString: [String:[String:String]]?
|
||||
|
||||
public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) {
|
||||
public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) {
|
||||
self.mapString = mapString
|
||||
self.mapMapString = mapMapString
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case mapString = "map_string"
|
||||
case mapMapString = "map_map_string"
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Animal: Codable {
|
||||
|
||||
public struct Animal: Codable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
||||
@@ -7,5 +7,4 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public typealias AnimalFarm = [Animal]
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ApiResponse: Codable {
|
||||
|
||||
public struct ApiResponse: Codable {
|
||||
|
||||
public var code: Int?
|
||||
public var type: String?
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
@@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
self.arrayArrayNumber = arrayArrayNumber
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case arrayArrayNumber = "ArrayArrayNumber"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
@@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable {
|
||||
self.arrayNumber = arrayNumber
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case arrayNumber = "ArrayNumber"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayTest: Codable {
|
||||
|
||||
public struct ArrayTest: Codable {
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
@@ -21,7 +19,7 @@ public struct ArrayTest: Codable {
|
||||
self.arrayArrayOfModel = arrayArrayOfModel
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case arrayOfString = "array_of_string"
|
||||
case arrayArrayOfInteger = "array_array_of_integer"
|
||||
case arrayArrayOfModel = "array_array_of_model"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Capitalization: Codable {
|
||||
|
||||
public struct Capitalization: Codable {
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
@@ -28,7 +26,7 @@ public struct Capitalization: Codable {
|
||||
self.ATT_NAME = ATT_NAME
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case smallCamel
|
||||
case capitalCamel = "CapitalCamel"
|
||||
case smallSnake = "small_Snake"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Cat: Codable {
|
||||
|
||||
public struct Cat: Codable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct CatAllOf: Codable {
|
||||
|
||||
public struct CatAllOf: Codable {
|
||||
|
||||
public var declawed: Bool?
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Category: Codable {
|
||||
|
||||
public struct Category: Codable {
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String = "default-name"
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model with \"_class\" property */
|
||||
public struct ClassModel: Codable {
|
||||
|
||||
public struct ClassModel: Codable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Client: Codable {
|
||||
|
||||
public struct Client: Codable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Dog: Codable {
|
||||
|
||||
public struct Dog: Codable {
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct DogAllOf: Codable {
|
||||
|
||||
public struct DogAllOf: Codable {
|
||||
|
||||
public var breed: String?
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct EnumArrays: Codable {
|
||||
|
||||
public struct EnumArrays: Codable {
|
||||
|
||||
public enum JustSymbol: String, Codable, CaseIterable {
|
||||
case greaterThanOrEqualTo = ">="
|
||||
@@ -27,7 +25,7 @@ public struct EnumArrays: Codable {
|
||||
self.arrayEnum = arrayEnum
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case justSymbol = "just_symbol"
|
||||
case arrayEnum = "array_enum"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public enum EnumClass: String, Codable, CaseIterable {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct EnumTest: Codable {
|
||||
|
||||
public struct EnumTest: Codable {
|
||||
|
||||
public enum EnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
@@ -43,7 +41,7 @@ public struct EnumTest: Codable {
|
||||
self.outerEnum = outerEnum
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case enumString = "enum_string"
|
||||
case enumStringRequired = "enum_string_required"
|
||||
case enumInteger = "enum_integer"
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Must be named `File` for test. */
|
||||
public struct File: Codable {
|
||||
|
||||
public struct File: Codable {
|
||||
|
||||
/** Test capitalization */
|
||||
public var sourceURI: String?
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct FileSchemaTestClass: Codable {
|
||||
|
||||
public struct FileSchemaTestClass: Codable {
|
||||
|
||||
public var file: File?
|
||||
public var files: [File]?
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct FormatTest: Codable {
|
||||
|
||||
public struct FormatTest: Codable {
|
||||
|
||||
public var integer: Int?
|
||||
public var int32: Int?
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct HasOnlyReadOnly: Codable {
|
||||
|
||||
public struct HasOnlyReadOnly: Codable {
|
||||
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct List: Codable {
|
||||
|
||||
public struct List: Codable {
|
||||
|
||||
public var _123list: String?
|
||||
|
||||
@@ -17,7 +15,7 @@ public struct List: Codable {
|
||||
self._123list = _123list
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case _123list = "123-list"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,27 +7,25 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct MapTest: Codable {
|
||||
|
||||
public struct MapTest: Codable {
|
||||
|
||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
}
|
||||
public var mapMapOfString: [String:[String:String]]?
|
||||
public var mapOfEnumString: [String:String]?
|
||||
public var directMap: [String:Bool]?
|
||||
public var mapMapOfString: [String: [String: String]]?
|
||||
public var mapOfEnumString: [String: String]?
|
||||
public var directMap: [String: Bool]?
|
||||
public var indirectMap: StringBooleanMap?
|
||||
|
||||
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) {
|
||||
public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) {
|
||||
self.mapMapOfString = mapMapOfString
|
||||
self.mapOfEnumString = mapOfEnumString
|
||||
self.directMap = directMap
|
||||
self.indirectMap = indirectMap
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case mapMapOfString = "map_map_of_string"
|
||||
case mapOfEnumString = "map_of_enum_string"
|
||||
case directMap = "direct_map"
|
||||
|
||||
@@ -7,15 +7,13 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
|
||||
public var uuid: UUID?
|
||||
public var dateTime: Date?
|
||||
public var map: [String:Animal]?
|
||||
public var map: [String: Animal]?
|
||||
|
||||
public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) {
|
||||
public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) {
|
||||
self.uuid = uuid
|
||||
self.dateTime = dateTime
|
||||
self.map = map
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name starting with number */
|
||||
public struct Model200Response: Codable {
|
||||
|
||||
public struct Model200Response: Codable {
|
||||
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
@@ -19,7 +18,7 @@ public struct Model200Response: Codable {
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
case _class = "class"
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name same as property name */
|
||||
public struct Name: Codable {
|
||||
|
||||
public struct Name: Codable {
|
||||
|
||||
public var name: Int
|
||||
public var snakeCase: Int?
|
||||
@@ -23,7 +22,7 @@ public struct Name: Codable {
|
||||
self._123number = _123number
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case name
|
||||
case snakeCase = "snake_case"
|
||||
case property
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct NumberOnly: Codable {
|
||||
|
||||
public struct NumberOnly: Codable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
@@ -17,7 +15,7 @@ public struct NumberOnly: Codable {
|
||||
self.justNumber = justNumber
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case justNumber = "JustNumber"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Order: Codable {
|
||||
|
||||
public struct Order: Codable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct OuterComposite: Codable {
|
||||
|
||||
public struct OuterComposite: Codable {
|
||||
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
@@ -21,7 +19,7 @@ public struct OuterComposite: Codable {
|
||||
self.myBoolean = myBoolean
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case myNumber = "my_number"
|
||||
case myString = "my_string"
|
||||
case myBoolean = "my_boolean"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public enum OuterEnum: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Pet: Codable {
|
||||
|
||||
public struct Pet: Codable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ReadOnlyFirst: Codable {
|
||||
|
||||
public struct ReadOnlyFirst: Codable {
|
||||
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing reserved words */
|
||||
public struct Return: Codable {
|
||||
|
||||
public struct Return: Codable {
|
||||
|
||||
public var _return: Int?
|
||||
|
||||
@@ -17,7 +16,7 @@ public struct Return: Codable {
|
||||
self._return = _return
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case _return = "return"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct SpecialModelName: Codable {
|
||||
|
||||
public struct SpecialModelName: Codable {
|
||||
|
||||
public var specialPropertyName: Int64?
|
||||
|
||||
@@ -17,7 +15,7 @@ public struct SpecialModelName: Codable {
|
||||
self.specialPropertyName = specialPropertyName
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case specialPropertyName = "$special[property.name]"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct StringBooleanMap: Codable {
|
||||
|
||||
public struct StringBooleanMap: Codable {
|
||||
|
||||
|
||||
|
||||
public var additionalProperties: [String:Bool] = [:]
|
||||
public var additionalProperties: [String: Bool] = [:]
|
||||
|
||||
public subscript(key: String) -> Bool? {
|
||||
get {
|
||||
@@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable {
|
||||
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Tag: Codable {
|
||||
|
||||
public struct Tag: Codable {
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String?
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct TypeHolderDefault: Codable {
|
||||
|
||||
public struct TypeHolderDefault: Codable {
|
||||
|
||||
public var stringItem: String = "what"
|
||||
public var numberItem: Double
|
||||
@@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable {
|
||||
self.arrayItem = arrayItem
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case stringItem = "string_item"
|
||||
case numberItem = "number_item"
|
||||
case integerItem = "integer_item"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct TypeHolderExample: Codable {
|
||||
|
||||
public struct TypeHolderExample: Codable {
|
||||
|
||||
public var stringItem: String
|
||||
public var numberItem: Double
|
||||
@@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable {
|
||||
self.arrayItem = arrayItem
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
public enum CodingKeys: String, CodingKey, CaseIterable {
|
||||
case stringItem = "string_item"
|
||||
case numberItem = "number_item"
|
||||
case integerItem = "integer_item"
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct User: Codable {
|
||||
|
||||
public struct User: Codable {
|
||||
|
||||
public var id: Int64?
|
||||
public var username: String?
|
||||
|
||||
@@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory {
|
||||
return URLSessionRequestBuilder<T>.self
|
||||
}
|
||||
|
||||
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type {
|
||||
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type {
|
||||
return URLSessionDecodableRequestBuilder<T>.self
|
||||
}
|
||||
}
|
||||
@@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory {
|
||||
private var urlSessionStore = SynchronizedDictionary<String, URLSession>()
|
||||
|
||||
open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
|
||||
private var observation: NSKeyValueObservation?
|
||||
|
||||
|
||||
deinit {
|
||||
observation?.invalidate()
|
||||
}
|
||||
|
||||
|
||||
// swiftlint:disable:next weak_delegate
|
||||
fileprivate let sessionDelegate = SessionDelegate()
|
||||
|
||||
|
||||
/**
|
||||
May be assigned if you want to control the authentication challenges.
|
||||
*/
|
||||
@@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
- retry the request.
|
||||
*/
|
||||
public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
|
||||
|
||||
required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) {
|
||||
|
||||
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
|
||||
super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
May be overridden by a subclass if you want to control the URLSession
|
||||
configuration.
|
||||
@@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
May be overridden by a subclass if you want to control the URLRequest
|
||||
configuration (e.g. to override the cache policy).
|
||||
*/
|
||||
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest {
|
||||
|
||||
open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest {
|
||||
|
||||
guard let url = URL(string: URLString) else {
|
||||
throw DownloadException.requestMissingURL
|
||||
}
|
||||
|
||||
|
||||
var originalRequest = URLRequest(url: url)
|
||||
|
||||
|
||||
originalRequest.httpMethod = method.rawValue
|
||||
|
||||
|
||||
buildHeaders().forEach { key, value in
|
||||
originalRequest.setValue(value, forHTTPHeaderField: key)
|
||||
}
|
||||
|
||||
|
||||
headers.forEach { key, value in
|
||||
originalRequest.setValue(value, forHTTPHeaderField: key)
|
||||
}
|
||||
|
||||
|
||||
let modifiedRequest = try encoding.encode(originalRequest, with: parameters)
|
||||
|
||||
|
||||
return modifiedRequest
|
||||
}
|
||||
|
||||
override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||
let urlSessionId:String = UUID().uuidString
|
||||
let urlSessionId: String = UUID().uuidString
|
||||
// Create a new manager for each request to customize its request header
|
||||
let urlSession = createURLSession()
|
||||
urlSessionStore[urlSessionId] = urlSession
|
||||
|
||||
|
||||
let parameters: [String: Any] = self.parameters ?? [:]
|
||||
|
||||
|
||||
let fileKeys = parameters.filter { $1 is URL }
|
||||
.map { $0.0 }
|
||||
|
||||
|
||||
let encoding: ParameterEncoding
|
||||
if fileKeys.count > 0 {
|
||||
encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:))
|
||||
@@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
} else {
|
||||
encoding = URLEncoding()
|
||||
}
|
||||
|
||||
|
||||
guard let xMethod = HTTPMethod(rawValue: method) else {
|
||||
fatalError("Unsuported Http method - \(method)")
|
||||
}
|
||||
|
||||
|
||||
let cleanupRequest = {
|
||||
urlSessionStore[urlSessionId] = nil
|
||||
self.observation?.invalidate()
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers)
|
||||
|
||||
|
||||
let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in
|
||||
|
||||
|
||||
guard let self = self else { return }
|
||||
|
||||
|
||||
if let taskCompletionShouldRetry = self.taskCompletionShouldRetry {
|
||||
|
||||
|
||||
taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in
|
||||
|
||||
|
||||
guard let self = self else { return }
|
||||
|
||||
|
||||
if shouldRetry {
|
||||
cleanupRequest()
|
||||
self.execute(apiResponseQueue, completion)
|
||||
@@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) {
|
||||
onProgressReady?(dataTask.progress)
|
||||
}
|
||||
|
||||
|
||||
dataTask.resume()
|
||||
|
||||
|
||||
} catch {
|
||||
apiResponseQueue.async {
|
||||
cleanupRequest()
|
||||
@@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||
|
||||
if let error = error {
|
||||
@@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
switch T.self {
|
||||
case is String.Type:
|
||||
|
||||
|
||||
let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? ""
|
||||
|
||||
|
||||
completion(.success(Response<T>(response: httpResponse, body: body as? T)))
|
||||
|
||||
|
||||
case is URL.Type:
|
||||
do {
|
||||
|
||||
|
||||
guard error == nil else {
|
||||
throw DownloadException.responseFailed
|
||||
}
|
||||
|
||||
|
||||
guard let data = data else {
|
||||
throw DownloadException.responseDataMissing
|
||||
}
|
||||
|
||||
|
||||
let fileManager = FileManager.default
|
||||
let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
|
||||
let requestURL = try self.getURL(from: urlRequest)
|
||||
|
||||
|
||||
var requestPath = try self.getPath(from: requestURL)
|
||||
|
||||
|
||||
if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) {
|
||||
requestPath = requestPath.appending("/\(headerFileName)")
|
||||
}
|
||||
|
||||
|
||||
let filePath = documentsDirectory.appendingPathComponent(requestPath)
|
||||
let directoryPath = filePath.deletingLastPathComponent().path
|
||||
|
||||
|
||||
try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil)
|
||||
try data.write(to: filePath, options: .atomic)
|
||||
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: filePath as? T)))
|
||||
|
||||
|
||||
} catch let requestParserError as DownloadException {
|
||||
completion(.failure(ErrorResponse.error(400, data, requestParserError)))
|
||||
} catch let error {
|
||||
completion(.failure(ErrorResponse.error(400, data, error)))
|
||||
}
|
||||
|
||||
|
||||
case is Void.Type:
|
||||
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: nil)))
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: data as? T)))
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
return httpHeaders
|
||||
}
|
||||
|
||||
fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? {
|
||||
fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? {
|
||||
|
||||
guard let contentDisposition = contentDisposition else {
|
||||
return nil
|
||||
@@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
filename = contentItem
|
||||
return filename?
|
||||
.replacingCharacters(in: range, with:"")
|
||||
.replacingCharacters(in: range, with: "")
|
||||
.replacingOccurrences(of: "\"", with: "")
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
@@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
}
|
||||
|
||||
fileprivate func getPath(from url : URL) throws -> String {
|
||||
fileprivate func getPath(from url: URL) throws -> String {
|
||||
|
||||
guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else {
|
||||
throw DownloadException.requestMissingPath
|
||||
@@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
}
|
||||
|
||||
fileprivate func getURL(from urlRequest : URLRequest) throws -> URL {
|
||||
fileprivate func getURL(from urlRequest: URLRequest) throws -> URL {
|
||||
|
||||
guard let url = urlRequest.url else {
|
||||
throw DownloadException.requestMissingURL
|
||||
@@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
|
||||
}
|
||||
|
||||
open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> {
|
||||
open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> {
|
||||
override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) {
|
||||
|
||||
if let error = error {
|
||||
@@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil
|
||||
|
||||
switch T.self {
|
||||
case is String.Type:
|
||||
|
||||
|
||||
let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? ""
|
||||
|
||||
|
||||
completion(.success(Response<T>(response: httpResponse, body: body as? T)))
|
||||
|
||||
|
||||
case is Void.Type:
|
||||
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: nil)))
|
||||
|
||||
|
||||
case is Data.Type:
|
||||
|
||||
|
||||
completion(.success(Response(response: httpResponse, body: data as? T)))
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
guard let data = data, !data.isEmpty else {
|
||||
completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse)))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
let decodeResult = CodableHelper.decode(T.self, from: data)
|
||||
|
||||
|
||||
switch decodeResult {
|
||||
case let .success(decodableObj):
|
||||
completion(.success(Response(response: httpResponse, body: decodableObj)))
|
||||
@@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate {
|
||||
|
||||
private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate {
|
||||
|
||||
var credential: URLCredential?
|
||||
|
||||
|
||||
var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))?
|
||||
|
||||
func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
|
||||
@@ -402,13 +402,13 @@ public protocol ParameterEncoding {
|
||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest
|
||||
}
|
||||
|
||||
fileprivate class URLEncoding: ParameterEncoding {
|
||||
func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest {
|
||||
|
||||
private class URLEncoding: ParameterEncoding {
|
||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest {
|
||||
|
||||
var urlRequest = urlRequest
|
||||
|
||||
|
||||
guard let parameters = parameters else { return urlRequest }
|
||||
|
||||
|
||||
guard let url = urlRequest.url else {
|
||||
throw DownloadException.requestMissingURL
|
||||
}
|
||||
@@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding {
|
||||
urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters)
|
||||
urlRequest.url = urlComponents.url
|
||||
}
|
||||
|
||||
|
||||
return urlRequest
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate class FileUploadEncoding: ParameterEncoding {
|
||||
private class FileUploadEncoding: ParameterEncoding {
|
||||
|
||||
let contentTypeForFormPart: (_ fileURL: URL) -> String?
|
||||
|
||||
@@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding {
|
||||
func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest {
|
||||
|
||||
var urlRequest = urlRequest
|
||||
|
||||
|
||||
guard let parameters = parameters, !parameters.isEmpty else {
|
||||
return urlRequest
|
||||
}
|
||||
|
||||
|
||||
let boundary = "Boundary-\(UUID().uuidString)"
|
||||
|
||||
|
||||
urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
|
||||
|
||||
for (key, value) in parameters {
|
||||
@@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding {
|
||||
fatalError("Unprocessable value \(value) with key \(key)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var body = urlRequest.httpBody.orEmpty
|
||||
|
||||
body.append("\r\n--\(boundary)--\r\n")
|
||||
@@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding {
|
||||
var urlRequest = urlRequest
|
||||
|
||||
var body = urlRequest.httpBody.orEmpty
|
||||
|
||||
|
||||
let fileData = try Data(contentsOf: fileURL)
|
||||
|
||||
let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL)
|
||||
@@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding {
|
||||
let fileName = fileURL.lastPathComponent
|
||||
|
||||
// If we already added something then we need an additional newline.
|
||||
if (body.count > 0) {
|
||||
if body.count > 0 {
|
||||
body.append("\r\n")
|
||||
}
|
||||
|
||||
@@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding {
|
||||
|
||||
// The value data.
|
||||
body.append(fileData)
|
||||
|
||||
|
||||
urlRequest.httpBody = body
|
||||
|
||||
return urlRequest
|
||||
}
|
||||
|
||||
|
||||
private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest {
|
||||
|
||||
var urlRequest = urlRequest
|
||||
|
||||
|
||||
var body = urlRequest.httpBody.orEmpty
|
||||
|
||||
// If we already added something then we need an additional newline.
|
||||
if (body.count > 0) {
|
||||
if body.count > 0 {
|
||||
body.append("\r\n")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user