forked from loafle/openapi-generator-original
[Swift] Add public initializer for modelObject. (#7652)
* Add public initializer for modelObject. * Update samples. * Use allVars instead of vars. * Fix code format.
This commit is contained in:
parent
b5eb0e7de8
commit
e22faf4cd3
@ -22,6 +22,14 @@ public struct {{classname}}: Codable {
|
||||
{{/isEnum}}
|
||||
{{/allVars}}
|
||||
|
||||
{{#hasVars}}
|
||||
public init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) {
|
||||
{{#allVars}}
|
||||
self.{{name}} = {{name}}
|
||||
{{/allVars}}
|
||||
}
|
||||
{{/hasVars}}
|
||||
|
||||
{{#additionalPropertiesType}}
|
||||
public var additionalProperties: [String:{{{additionalPropertiesType}}}] = [:]
|
||||
|
||||
|
@ -157,7 +157,7 @@ open class UserAPI {
|
||||
/**
|
||||
Get user by user name
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getUserByName(username: String, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) {
|
||||
@ -210,7 +210,7 @@ open class UserAPI {
|
||||
"username" : "username"
|
||||
}}]
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
- returns: RequestBuilder<User>
|
||||
*/
|
||||
|
@ -14,6 +14,11 @@ public struct AdditionalPropertiesClass: Codable {
|
||||
public var mapProperty: [String:String]?
|
||||
public var mapOfMapProperty: [String:[String:String]]?
|
||||
|
||||
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
|
||||
self.mapProperty = mapProperty
|
||||
self.mapOfMapProperty = mapOfMapProperty
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case mapProperty = "map_property"
|
||||
|
@ -14,6 +14,11 @@ public struct Animal: Codable {
|
||||
public var className: String
|
||||
public var color: String?
|
||||
|
||||
public init(className: String, color: String?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,12 @@ public struct ApiResponse: Codable {
|
||||
public var type: String?
|
||||
public var message: String?
|
||||
|
||||
public init(code: Int?, type: String?, message: String?) {
|
||||
self.code = code
|
||||
self.type = type
|
||||
self.message = message
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
public init(arrayArrayNumber: [[Double]]?) {
|
||||
self.arrayArrayNumber = arrayArrayNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayArrayNumber = "ArrayArrayNumber"
|
||||
|
@ -13,6 +13,10 @@ public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
public init(arrayNumber: [Double]?) {
|
||||
self.arrayNumber = arrayNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayNumber = "ArrayNumber"
|
||||
|
@ -15,6 +15,12 @@ public struct ArrayTest: Codable {
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||
|
||||
public init(arrayOfString: [String]?, arrayArrayOfInteger: [[Int64]]?, arrayArrayOfModel: [[ReadOnlyFirst]]?) {
|
||||
self.arrayOfString = arrayOfString
|
||||
self.arrayArrayOfInteger = arrayArrayOfInteger
|
||||
self.arrayArrayOfModel = arrayArrayOfModel
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayOfString = "array_of_string"
|
||||
|
@ -19,6 +19,15 @@ public struct Capitalization: Codable {
|
||||
/** Name of the pet */
|
||||
public var ATT_NAME: String?
|
||||
|
||||
public init(smallCamel: String?, capitalCamel: String?, smallSnake: String?, capitalSnake: String?, sCAETHFlowPoints: String?, ATT_NAME: String?) {
|
||||
self.smallCamel = smallCamel
|
||||
self.capitalCamel = capitalCamel
|
||||
self.smallSnake = smallSnake
|
||||
self.capitalSnake = capitalSnake
|
||||
self.sCAETHFlowPoints = sCAETHFlowPoints
|
||||
self.ATT_NAME = ATT_NAME
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case smallCamel
|
||||
|
@ -15,6 +15,12 @@ public struct Cat: Codable {
|
||||
public var color: String?
|
||||
public var declawed: Bool?
|
||||
|
||||
public init(className: String, color: String?, declawed: Bool?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
self.declawed = declawed
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public struct Category: Codable {
|
||||
public var _id: Int64?
|
||||
public var name: String?
|
||||
|
||||
public init(_id: Int64?, name: String?) {
|
||||
self._id = _id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,6 +14,10 @@ public struct ClassModel: Codable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
public init(_class: String?) {
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct Client: Codable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
public init(client: String?) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,12 @@ public struct Dog: Codable {
|
||||
public var color: String?
|
||||
public var breed: String?
|
||||
|
||||
public init(className: String, color: String?, breed: String?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
self.breed = breed
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ public struct EnumArrays: Codable {
|
||||
public var justSymbol: JustSymbol?
|
||||
public var arrayEnum: [ArrayEnum]?
|
||||
|
||||
public init(justSymbol: JustSymbol?, arrayEnum: [ArrayEnum]?) {
|
||||
self.justSymbol = justSymbol
|
||||
self.arrayEnum = arrayEnum
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case justSymbol = "just_symbol"
|
||||
|
@ -29,6 +29,13 @@ public struct EnumTest: Codable {
|
||||
public var enumNumber: EnumNumber?
|
||||
public var outerEnum: OuterEnum?
|
||||
|
||||
public init(enumString: EnumString?, enumInteger: EnumInteger?, enumNumber: EnumNumber?, outerEnum: OuterEnum?) {
|
||||
self.enumString = enumString
|
||||
self.enumInteger = enumInteger
|
||||
self.enumNumber = enumNumber
|
||||
self.outerEnum = outerEnum
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case enumString = "enum_string"
|
||||
|
@ -25,6 +25,22 @@ public struct FormatTest: Codable {
|
||||
public var uuid: UUID?
|
||||
public var password: String
|
||||
|
||||
public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: Data?, date: Date, dateTime: Date?, uuid: UUID?, password: String) {
|
||||
self.integer = integer
|
||||
self.int32 = int32
|
||||
self.int64 = int64
|
||||
self.number = number
|
||||
self.float = float
|
||||
self.double = double
|
||||
self.string = string
|
||||
self.byte = byte
|
||||
self.binary = binary
|
||||
self.date = date
|
||||
self.dateTime = dateTime
|
||||
self.uuid = uuid
|
||||
self.password = password
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public struct HasOnlyReadOnly: Codable {
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
||||
public init(bar: String?, foo: String?) {
|
||||
self.bar = bar
|
||||
self.foo = foo
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct List: Codable {
|
||||
|
||||
public var _123List: String?
|
||||
|
||||
public init(_123List: String?) {
|
||||
self._123List = _123List
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _123List = "123-list"
|
||||
|
@ -18,6 +18,11 @@ public struct MapTest: Codable {
|
||||
public var mapMapOfString: [String:[String:String]]?
|
||||
public var mapOfEnumString: [String:String]?
|
||||
|
||||
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?) {
|
||||
self.mapMapOfString = mapMapOfString
|
||||
self.mapOfEnumString = mapOfEnumString
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case mapMapOfString = "map_map_of_string"
|
||||
|
@ -15,6 +15,12 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
public var dateTime: Date?
|
||||
public var map: [String:Animal]?
|
||||
|
||||
public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) {
|
||||
self.uuid = uuid
|
||||
self.dateTime = dateTime
|
||||
self.map = map
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,11 @@ public struct Model200Response: Codable {
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
|
||||
public init(name: Int?, _class: String?) {
|
||||
self.name = name
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
|
@ -17,6 +17,13 @@ public struct Name: Codable {
|
||||
public var property: String?
|
||||
public var _123Number: Int?
|
||||
|
||||
public init(name: Int, snakeCase: Int?, property: String?, _123Number: Int?) {
|
||||
self.name = name
|
||||
self.snakeCase = snakeCase
|
||||
self.property = property
|
||||
self._123Number = _123Number
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
|
@ -13,6 +13,10 @@ public struct NumberOnly: Codable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
public init(justNumber: Double?) {
|
||||
self.justNumber = justNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case justNumber = "JustNumber"
|
||||
|
@ -24,6 +24,15 @@ public struct Order: Codable {
|
||||
public var status: Status?
|
||||
public var complete: Bool?
|
||||
|
||||
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
|
||||
self._id = _id
|
||||
self.petId = petId
|
||||
self.quantity = quantity
|
||||
self.shipDate = shipDate
|
||||
self.status = status
|
||||
self.complete = complete
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,5 +14,6 @@ public struct OuterBoolean: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,12 @@ public struct OuterComposite: Codable {
|
||||
public var myString: OuterString?
|
||||
public var myBoolean: OuterBoolean?
|
||||
|
||||
public init(myNumber: OuterNumber?, myString: OuterString?, myBoolean: OuterBoolean?) {
|
||||
self.myNumber = myNumber
|
||||
self.myString = myString
|
||||
self.myBoolean = myBoolean
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case myNumber = "my_number"
|
||||
|
@ -14,5 +14,6 @@ public struct OuterNumber: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,5 +14,6 @@ public struct OuterString: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,15 @@ public struct Pet: Codable {
|
||||
/** pet status in the store */
|
||||
public var status: Status?
|
||||
|
||||
public init(_id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
|
||||
self._id = _id
|
||||
self.category = category
|
||||
self.name = name
|
||||
self.photoUrls = photoUrls
|
||||
self.tags = tags
|
||||
self.status = status
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,6 +14,11 @@ public struct ReadOnlyFirst: Codable {
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
||||
public init(bar: String?, baz: String?) {
|
||||
self.bar = bar
|
||||
self.baz = baz
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,10 @@ public struct Return: Codable {
|
||||
|
||||
public var _return: Int?
|
||||
|
||||
public init(_return: Int?) {
|
||||
self._return = _return
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _return = "return"
|
||||
|
@ -13,6 +13,10 @@ public struct SpecialModelName: Codable {
|
||||
|
||||
public var specialPropertyName: Int64?
|
||||
|
||||
public init(specialPropertyName: Int64?) {
|
||||
self.specialPropertyName = specialPropertyName
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case specialPropertyName = "$special[property.name]"
|
||||
|
@ -14,6 +14,11 @@ public struct Tag: Codable {
|
||||
public var _id: Int64?
|
||||
public var name: String?
|
||||
|
||||
public init(_id: Int64?, name: String?) {
|
||||
self._id = _id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -21,6 +21,17 @@ public struct User: Codable {
|
||||
/** User Status */
|
||||
public var userStatus: Int?
|
||||
|
||||
public init(_id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
|
||||
self._id = _id
|
||||
self.username = username
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.phone = phone
|
||||
self.userStatus = userStatus
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -16,10 +16,10 @@ open class PetstoreClientAPI {
|
||||
open class RequestBuilder<T> {
|
||||
var credential: URLCredential?
|
||||
var headers: [String:String]
|
||||
let parameters: [String:Any]?
|
||||
let isBody: Bool
|
||||
let method: String
|
||||
let URLString: String
|
||||
public let parameters: [String:Any]?
|
||||
public let isBody: Bool
|
||||
public let method: String
|
||||
public let URLString: String
|
||||
|
||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||
public var onProgressReady: ((Progress) -> ())?
|
||||
|
@ -78,7 +78,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
|
||||
var path = "/pet/{petId}"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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
|
||||
|
||||
@ -432,7 +434,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
|
||||
var path = "/pet/{petId}"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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
|
||||
|
||||
@ -513,7 +517,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
|
||||
var path = "/pet/{petId}"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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?] = [
|
||||
"name": name,
|
||||
@ -567,7 +573,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
|
||||
var path = "/pet/{petId}/uploadImage"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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?] = [
|
||||
"additionalMetadata": additionalMetadata,
|
||||
|
@ -35,7 +35,9 @@ open class StoreAPI {
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
var path = "/store/order/{order_id}"
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let orderIdPreEscape = "\(orderId)"
|
||||
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
|
||||
|
||||
@ -139,7 +141,9 @@ open class StoreAPI {
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
var path = "/store/order/{order_id}"
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let orderIdPreEscape = "\(orderId)"
|
||||
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
|
||||
|
||||
|
@ -140,7 +140,9 @@ open class UserAPI {
|
||||
*/
|
||||
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil)
|
||||
let usernamePreEscape = "\(username)"
|
||||
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
|
||||
|
||||
@ -155,7 +157,7 @@ open class UserAPI {
|
||||
/**
|
||||
Get user by user name
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getUserByName(username: String, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) {
|
||||
@ -208,13 +210,15 @@ open class UserAPI {
|
||||
"username" : "username"
|
||||
}}]
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
- returns: RequestBuilder<User>
|
||||
*/
|
||||
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
|
||||
var path = "/user/{username}"
|
||||
path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil)
|
||||
let usernamePreEscape = "\(username)"
|
||||
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
|
||||
|
||||
@ -329,7 +333,9 @@ open class UserAPI {
|
||||
*/
|
||||
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil)
|
||||
let usernamePreEscape = "\(username)"
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
|
@ -14,6 +14,11 @@ public struct AdditionalPropertiesClass: Codable {
|
||||
public var mapProperty: [String:String]?
|
||||
public var mapOfMapProperty: [String:[String:String]]?
|
||||
|
||||
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
|
||||
self.mapProperty = mapProperty
|
||||
self.mapOfMapProperty = mapOfMapProperty
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case mapProperty = "map_property"
|
||||
|
@ -14,6 +14,11 @@ public struct Animal: Codable {
|
||||
public var className: String
|
||||
public var color: String?
|
||||
|
||||
public init(className: String, color: String?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ public struct ApiResponse: Codable {
|
||||
public var type: String?
|
||||
public var message: String?
|
||||
|
||||
public init(code: Int?, type: String?, message: String?) {
|
||||
self.code = code
|
||||
self.type = type
|
||||
self.message = message
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
public init(arrayArrayNumber: [[Double]]?) {
|
||||
self.arrayArrayNumber = arrayArrayNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayArrayNumber = "ArrayArrayNumber"
|
||||
|
@ -13,6 +13,10 @@ public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
public init(arrayNumber: [Double]?) {
|
||||
self.arrayNumber = arrayNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayNumber = "ArrayNumber"
|
||||
|
@ -15,6 +15,12 @@ public struct ArrayTest: Codable {
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||
|
||||
public init(arrayOfString: [String]?, arrayArrayOfInteger: [[Int64]]?, arrayArrayOfModel: [[ReadOnlyFirst]]?) {
|
||||
self.arrayOfString = arrayOfString
|
||||
self.arrayArrayOfInteger = arrayArrayOfInteger
|
||||
self.arrayArrayOfModel = arrayArrayOfModel
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayOfString = "array_of_string"
|
||||
|
@ -19,6 +19,15 @@ public struct Capitalization: Codable {
|
||||
/** Name of the pet */
|
||||
public var ATT_NAME: String?
|
||||
|
||||
public init(smallCamel: String?, capitalCamel: String?, smallSnake: String?, capitalSnake: String?, sCAETHFlowPoints: String?, ATT_NAME: String?) {
|
||||
self.smallCamel = smallCamel
|
||||
self.capitalCamel = capitalCamel
|
||||
self.smallSnake = smallSnake
|
||||
self.capitalSnake = capitalSnake
|
||||
self.sCAETHFlowPoints = sCAETHFlowPoints
|
||||
self.ATT_NAME = ATT_NAME
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case smallCamel
|
||||
|
@ -20,6 +20,12 @@ public struct Cat: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public init(className: String, color: String?, declawed: Bool?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
self.declawed = declawed
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,11 @@ public struct Category: Codable {
|
||||
}
|
||||
public var name: String?
|
||||
|
||||
public init(_id: Int64?, name: String?) {
|
||||
self._id = _id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,6 +14,10 @@ public struct ClassModel: Codable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
public init(_class: String?) {
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct Client: Codable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
public init(client: String?) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,12 @@ public struct Dog: Codable {
|
||||
public var color: String?
|
||||
public var breed: String?
|
||||
|
||||
public init(className: String, color: String?, breed: String?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
self.breed = breed
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ public struct EnumArrays: Codable {
|
||||
public var justSymbol: JustSymbol?
|
||||
public var arrayEnum: [ArrayEnum]?
|
||||
|
||||
public init(justSymbol: JustSymbol?, arrayEnum: [ArrayEnum]?) {
|
||||
self.justSymbol = justSymbol
|
||||
self.arrayEnum = arrayEnum
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case justSymbol = "just_symbol"
|
||||
|
@ -29,6 +29,13 @@ public struct EnumTest: Codable {
|
||||
public var enumNumber: EnumNumber?
|
||||
public var outerEnum: OuterEnum?
|
||||
|
||||
public init(enumString: EnumString?, enumInteger: EnumInteger?, enumNumber: EnumNumber?, outerEnum: OuterEnum?) {
|
||||
self.enumString = enumString
|
||||
self.enumInteger = enumInteger
|
||||
self.enumNumber = enumNumber
|
||||
self.outerEnum = outerEnum
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case enumString = "enum_string"
|
||||
|
@ -50,6 +50,22 @@ public struct FormatTest: Codable {
|
||||
public var uuid: UUID?
|
||||
public var password: String
|
||||
|
||||
public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: Data?, date: Date, dateTime: Date?, uuid: UUID?, password: String) {
|
||||
self.integer = integer
|
||||
self.int32 = int32
|
||||
self.int64 = int64
|
||||
self.number = number
|
||||
self.float = float
|
||||
self.double = double
|
||||
self.string = string
|
||||
self.byte = byte
|
||||
self.binary = binary
|
||||
self.date = date
|
||||
self.dateTime = dateTime
|
||||
self.uuid = uuid
|
||||
self.password = password
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public struct HasOnlyReadOnly: Codable {
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
||||
public init(bar: String?, foo: String?) {
|
||||
self.bar = bar
|
||||
self.foo = foo
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct List: Codable {
|
||||
|
||||
public var _123List: String?
|
||||
|
||||
public init(_123List: String?) {
|
||||
self._123List = _123List
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _123List = "123-list"
|
||||
|
@ -18,6 +18,11 @@ public struct MapTest: Codable {
|
||||
public var mapMapOfString: [String:[String:String]]?
|
||||
public var mapOfEnumString: [String:String]?
|
||||
|
||||
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?) {
|
||||
self.mapMapOfString = mapMapOfString
|
||||
self.mapOfEnumString = mapOfEnumString
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case mapMapOfString = "map_map_of_string"
|
||||
|
@ -15,6 +15,12 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
public var dateTime: Date?
|
||||
public var map: [String:Animal]?
|
||||
|
||||
public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) {
|
||||
self.uuid = uuid
|
||||
self.dateTime = dateTime
|
||||
self.map = map
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ public struct Model200Response: Codable {
|
||||
}
|
||||
public var _class: String?
|
||||
|
||||
public init(name: Int?, _class: String?) {
|
||||
self.name = name
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
|
@ -32,6 +32,13 @@ public struct Name: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public init(name: Int, snakeCase: Int?, property: String?, _123Number: Int?) {
|
||||
self.name = name
|
||||
self.snakeCase = snakeCase
|
||||
self.property = property
|
||||
self._123Number = _123Number
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
|
@ -13,6 +13,10 @@ public struct NumberOnly: Codable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
public init(justNumber: Double?) {
|
||||
self.justNumber = justNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case justNumber = "JustNumber"
|
||||
|
@ -44,6 +44,15 @@ public struct Order: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
|
||||
self._id = _id
|
||||
self.petId = petId
|
||||
self.quantity = quantity
|
||||
self.shipDate = shipDate
|
||||
self.status = status
|
||||
self.complete = complete
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,5 +14,6 @@ public struct OuterBoolean: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,12 @@ public struct OuterComposite: Codable {
|
||||
public var myString: OuterString?
|
||||
public var myBoolean: OuterBoolean?
|
||||
|
||||
public init(myNumber: OuterNumber?, myString: OuterString?, myBoolean: OuterBoolean?) {
|
||||
self.myNumber = myNumber
|
||||
self.myString = myString
|
||||
self.myBoolean = myBoolean
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case myNumber = "my_number"
|
||||
|
@ -14,5 +14,6 @@ public struct OuterNumber: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,5 +14,6 @@ public struct OuterString: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,15 @@ public struct Pet: Codable {
|
||||
/** pet status in the store */
|
||||
public var status: Status?
|
||||
|
||||
public init(_id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
|
||||
self._id = _id
|
||||
self.category = category
|
||||
self.name = name
|
||||
self.photoUrls = photoUrls
|
||||
self.tags = tags
|
||||
self.status = status
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,6 +14,11 @@ public struct ReadOnlyFirst: Codable {
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
||||
public init(bar: String?, baz: String?) {
|
||||
self.bar = bar
|
||||
self.baz = baz
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,10 @@ public struct Return: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public init(_return: Int?) {
|
||||
self._return = _return
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _return = "return"
|
||||
|
@ -18,6 +18,10 @@ public struct SpecialModelName: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public init(specialPropertyName: Int64?) {
|
||||
self.specialPropertyName = specialPropertyName
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case specialPropertyName = "$special[property.name]"
|
||||
|
@ -19,6 +19,11 @@ public struct Tag: Codable {
|
||||
}
|
||||
public var name: String?
|
||||
|
||||
public init(_id: Int64?, name: String?) {
|
||||
self._id = _id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -31,6 +31,17 @@ public struct User: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public init(_id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
|
||||
self._id = _id
|
||||
self.username = username
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.phone = phone
|
||||
self.userStatus = userStatus
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -16,10 +16,10 @@ open class PetstoreClientAPI {
|
||||
open class RequestBuilder<T> {
|
||||
var credential: URLCredential?
|
||||
var headers: [String:String]
|
||||
let parameters: [String:Any]?
|
||||
let isBody: Bool
|
||||
let method: String
|
||||
let URLString: String
|
||||
public let parameters: [String:Any]?
|
||||
public let isBody: Bool
|
||||
public let method: String
|
||||
public let URLString: String
|
||||
|
||||
/// Optional block to obtain a reference to the request's progress instance when available.
|
||||
public var onProgressReady: ((Progress) -> ())?
|
||||
|
@ -114,7 +114,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
|
||||
var path = "/pet/{petId}"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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
|
||||
|
||||
@ -519,7 +521,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
|
||||
var path = "/pet/{petId}"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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
|
||||
|
||||
@ -636,7 +640,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
|
||||
var path = "/pet/{petId}"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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?] = [
|
||||
"name": name,
|
||||
@ -709,7 +715,9 @@ open class PetAPI {
|
||||
*/
|
||||
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
|
||||
var path = "/pet/{petId}/uploadImage"
|
||||
path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil)
|
||||
let petIdPreEscape = "\(petId)"
|
||||
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?] = [
|
||||
"additionalMetadata": additionalMetadata,
|
||||
|
@ -53,7 +53,9 @@ open class StoreAPI {
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
var path = "/store/order/{order_id}"
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let orderIdPreEscape = "\(orderId)"
|
||||
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
|
||||
|
||||
@ -190,7 +192,9 @@ open class StoreAPI {
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
var path = "/store/order/{order_id}"
|
||||
path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil)
|
||||
let orderIdPreEscape = "\(orderId)"
|
||||
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
|
||||
|
||||
|
@ -209,7 +209,9 @@ open class UserAPI {
|
||||
*/
|
||||
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil)
|
||||
let usernamePreEscape = "\(username)"
|
||||
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
|
||||
|
||||
@ -224,7 +226,7 @@ open class UserAPI {
|
||||
/**
|
||||
Get user by user name
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func getUserByName(username: String, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) {
|
||||
@ -236,7 +238,7 @@ open class UserAPI {
|
||||
/**
|
||||
Get user by user name
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- returns: Promise<User>
|
||||
*/
|
||||
open class func getUserByName( username: String) -> Promise<User> {
|
||||
@ -294,13 +296,15 @@ open class UserAPI {
|
||||
"username" : "username"
|
||||
}}]
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
- returns: RequestBuilder<User>
|
||||
*/
|
||||
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
|
||||
var path = "/user/{username}"
|
||||
path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil)
|
||||
let usernamePreEscape = "\(username)"
|
||||
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
|
||||
|
||||
@ -467,7 +471,9 @@ open class UserAPI {
|
||||
*/
|
||||
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil)
|
||||
let usernamePreEscape = "\(username)"
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
|
@ -14,6 +14,11 @@ public struct AdditionalPropertiesClass: Codable {
|
||||
public var mapProperty: [String:String]?
|
||||
public var mapOfMapProperty: [String:[String:String]]?
|
||||
|
||||
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
|
||||
self.mapProperty = mapProperty
|
||||
self.mapOfMapProperty = mapOfMapProperty
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case mapProperty = "map_property"
|
||||
|
@ -14,6 +14,11 @@ public struct Animal: Codable {
|
||||
public var className: String
|
||||
public var color: String?
|
||||
|
||||
public init(className: String, color: String?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,12 @@ public struct ApiResponse: Codable {
|
||||
public var type: String?
|
||||
public var message: String?
|
||||
|
||||
public init(code: Int?, type: String?, message: String?) {
|
||||
self.code = code
|
||||
self.type = type
|
||||
self.message = message
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
public init(arrayArrayNumber: [[Double]]?) {
|
||||
self.arrayArrayNumber = arrayArrayNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayArrayNumber = "ArrayArrayNumber"
|
||||
|
@ -13,6 +13,10 @@ public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
public init(arrayNumber: [Double]?) {
|
||||
self.arrayNumber = arrayNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayNumber = "ArrayNumber"
|
||||
|
@ -15,6 +15,12 @@ public struct ArrayTest: Codable {
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||
|
||||
public init(arrayOfString: [String]?, arrayArrayOfInteger: [[Int64]]?, arrayArrayOfModel: [[ReadOnlyFirst]]?) {
|
||||
self.arrayOfString = arrayOfString
|
||||
self.arrayArrayOfInteger = arrayArrayOfInteger
|
||||
self.arrayArrayOfModel = arrayArrayOfModel
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case arrayOfString = "array_of_string"
|
||||
|
@ -19,6 +19,15 @@ public struct Capitalization: Codable {
|
||||
/** Name of the pet */
|
||||
public var ATT_NAME: String?
|
||||
|
||||
public init(smallCamel: String?, capitalCamel: String?, smallSnake: String?, capitalSnake: String?, sCAETHFlowPoints: String?, ATT_NAME: String?) {
|
||||
self.smallCamel = smallCamel
|
||||
self.capitalCamel = capitalCamel
|
||||
self.smallSnake = smallSnake
|
||||
self.capitalSnake = capitalSnake
|
||||
self.sCAETHFlowPoints = sCAETHFlowPoints
|
||||
self.ATT_NAME = ATT_NAME
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case smallCamel
|
||||
|
@ -15,6 +15,12 @@ public struct Cat: Codable {
|
||||
public var color: String?
|
||||
public var declawed: Bool?
|
||||
|
||||
public init(className: String, color: String?, declawed: Bool?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
self.declawed = declawed
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public struct Category: Codable {
|
||||
public var _id: Int64?
|
||||
public var name: String?
|
||||
|
||||
public init(_id: Int64?, name: String?) {
|
||||
self._id = _id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,6 +14,10 @@ public struct ClassModel: Codable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
public init(_class: String?) {
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct Client: Codable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
public init(client: String?) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,12 @@ public struct Dog: Codable {
|
||||
public var color: String?
|
||||
public var breed: String?
|
||||
|
||||
public init(className: String, color: String?, breed: String?) {
|
||||
self.className = className
|
||||
self.color = color
|
||||
self.breed = breed
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ public struct EnumArrays: Codable {
|
||||
public var justSymbol: JustSymbol?
|
||||
public var arrayEnum: [ArrayEnum]?
|
||||
|
||||
public init(justSymbol: JustSymbol?, arrayEnum: [ArrayEnum]?) {
|
||||
self.justSymbol = justSymbol
|
||||
self.arrayEnum = arrayEnum
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case justSymbol = "just_symbol"
|
||||
|
@ -29,6 +29,13 @@ public struct EnumTest: Codable {
|
||||
public var enumNumber: EnumNumber?
|
||||
public var outerEnum: OuterEnum?
|
||||
|
||||
public init(enumString: EnumString?, enumInteger: EnumInteger?, enumNumber: EnumNumber?, outerEnum: OuterEnum?) {
|
||||
self.enumString = enumString
|
||||
self.enumInteger = enumInteger
|
||||
self.enumNumber = enumNumber
|
||||
self.outerEnum = outerEnum
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case enumString = "enum_string"
|
||||
|
@ -25,6 +25,22 @@ public struct FormatTest: Codable {
|
||||
public var uuid: UUID?
|
||||
public var password: String
|
||||
|
||||
public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: Data?, date: Date, dateTime: Date?, uuid: UUID?, password: String) {
|
||||
self.integer = integer
|
||||
self.int32 = int32
|
||||
self.int64 = int64
|
||||
self.number = number
|
||||
self.float = float
|
||||
self.double = double
|
||||
self.string = string
|
||||
self.byte = byte
|
||||
self.binary = binary
|
||||
self.date = date
|
||||
self.dateTime = dateTime
|
||||
self.uuid = uuid
|
||||
self.password = password
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public struct HasOnlyReadOnly: Codable {
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
||||
public init(bar: String?, foo: String?) {
|
||||
self.bar = bar
|
||||
self.foo = foo
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public struct List: Codable {
|
||||
|
||||
public var _123List: String?
|
||||
|
||||
public init(_123List: String?) {
|
||||
self._123List = _123List
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _123List = "123-list"
|
||||
|
@ -18,6 +18,11 @@ public struct MapTest: Codable {
|
||||
public var mapMapOfString: [String:[String:String]]?
|
||||
public var mapOfEnumString: [String:String]?
|
||||
|
||||
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?) {
|
||||
self.mapMapOfString = mapMapOfString
|
||||
self.mapOfEnumString = mapOfEnumString
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case mapMapOfString = "map_map_of_string"
|
||||
|
@ -15,6 +15,12 @@ public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
public var dateTime: Date?
|
||||
public var map: [String:Animal]?
|
||||
|
||||
public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) {
|
||||
self.uuid = uuid
|
||||
self.dateTime = dateTime
|
||||
self.map = map
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,11 @@ public struct Model200Response: Codable {
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
|
||||
public init(name: Int?, _class: String?) {
|
||||
self.name = name
|
||||
self._class = _class
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
|
@ -17,6 +17,13 @@ public struct Name: Codable {
|
||||
public var property: String?
|
||||
public var _123Number: Int?
|
||||
|
||||
public init(name: Int, snakeCase: Int?, property: String?, _123Number: Int?) {
|
||||
self.name = name
|
||||
self.snakeCase = snakeCase
|
||||
self.property = property
|
||||
self._123Number = _123Number
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
|
@ -13,6 +13,10 @@ public struct NumberOnly: Codable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
public init(justNumber: Double?) {
|
||||
self.justNumber = justNumber
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case justNumber = "JustNumber"
|
||||
|
@ -24,6 +24,15 @@ public struct Order: Codable {
|
||||
public var status: Status?
|
||||
public var complete: Bool?
|
||||
|
||||
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
|
||||
self._id = _id
|
||||
self.petId = petId
|
||||
self.quantity = quantity
|
||||
self.shipDate = shipDate
|
||||
self.status = status
|
||||
self.complete = complete
|
||||
}
|
||||
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _id = "id"
|
||||
|
@ -14,5 +14,6 @@ public struct OuterBoolean: Codable {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
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