Merge pull request #2651 from wing328/swift_petstore_cleanup

[Swift] update Petstore sample for Swift
This commit is contained in:
wing328 2016-04-20 16:39:33 +08:00
commit 2af29fa831
15 changed files with 144 additions and 933 deletions

View File

@ -63,58 +63,6 @@ public class PetAPI: APIBase {
return requestBuilder.init(method: "POST", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Fake endpoint to test byte array in body parameter for adding a new pet to the store
- parameter body: (body) Pet object in the form of byte array (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func addPetUsingByteArray(body body: String? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetUsingByteArrayWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
}
/**
Fake endpoint to test byte array in body parameter for adding a new pet to the store
- parameter body: (body) Pet object in the form of byte array (optional)
- returns: Promise<Void>
*/
public class func addPetUsingByteArray(body body: String? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
addPetUsingByteArray(body: body) { error in
if let error = error {
deferred.reject(error)
} else {
deferred.fulfill()
}
}
return deferred.promise
}
/**
Fake endpoint to test byte array in body parameter for adding a new pet to the store
- POST /pet?testing_byte_array&#x3D;true
-
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object in the form of byte array (optional)
- returns: RequestBuilder<Void>
*/
public class func addPetUsingByteArrayWithRequestBuilder(body body: String? = nil) -> RequestBuilder<Void> {
let path = "/pet?testing_byte_array&#x3D;true"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Deletes a pet
@ -173,7 +121,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for query (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findPetsByStatus(status status: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
@ -185,7 +133,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for query (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- returns: Promise<[Pet]>
*/
public class func findPetsByStatus(status status: [String]? = nil) -> Promise<[Pet]> {
@ -203,58 +151,19 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- GET /pet/findByStatus
- Multiple status values can be provided with comma separated strings
- Multiple status values can be provided with comma seperated strings
- OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example=[ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"category" : {
"name" : "aeiou",
"id" : 123456789
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
<id>123456</id>
<name>doggie</name>
<photoUrls>
<photoUrls>string</photoUrls>
</photoUrls>
<tags>
</tags>
<status>string</status>
</Pet>}]
- examples: [{contentType=application/json, example=[ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"category" : {
"name" : "aeiou",
"id" : 123456789
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
<id>123456</id>
<name>doggie</name>
<photoUrls>
<photoUrls>string</photoUrls>
</photoUrls>
<tags>
</tags>
<status>string</status>
</Pet>}]
- examples: [{example={
"name" : "Puma",
"type" : "Dog",
"color" : "Black",
"gender" : "Female",
"breed" : "Mixed"
}, contentType=application/json}]
- parameter status: (query) Status values that need to be considered for query (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- returns: RequestBuilder<[Pet]>
*/
@ -309,20 +218,20 @@ public class PetAPI: APIBase {
- OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example=[ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
- examples: [{example=[ {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 123456789,
"name" : "aeiou"
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
} ], contentType=application/json}, {example=<Pet>
<id>123456</id>
<name>doggie</name>
<photoUrls>
@ -331,21 +240,21 @@ public class PetAPI: APIBase {
<tags>
</tags>
<status>string</status>
</Pet>}]
- examples: [{contentType=application/json, example=[ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
</Pet>, contentType=application/xml}]
- examples: [{example=[ {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 123456789,
"name" : "aeiou"
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
} ], contentType=application/json}, {example=<Pet>
<id>123456</id>
<name>doggie</name>
<photoUrls>
@ -354,7 +263,7 @@ public class PetAPI: APIBase {
<tags>
</tags>
<status>string</status>
</Pet>}]
</Pet>, contentType=application/xml}]
- parameter tags: (query) Tags to filter by (optional)
@ -408,26 +317,26 @@ public class PetAPI: APIBase {
Find pet by ID
- GET /pet/{petId}
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- OAuth:
- type: oauth2
- name: petstore_auth
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
- OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{example={
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 123456789,
"name" : "aeiou"
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<Pet>
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
}, contentType=application/json}, {example=<Pet>
<id>123456</id>
<name>doggie</name>
<photoUrls>
@ -436,21 +345,21 @@ public class PetAPI: APIBase {
<tags>
</tags>
<status>string</status>
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
</Pet>, contentType=application/xml}]
- examples: [{example={
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 123456789,
"name" : "aeiou"
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<Pet>
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
}, contentType=application/json}, {example=<Pet>
<id>123456</id>
<name>doggie</name>
<photoUrls>
@ -459,7 +368,7 @@ public class PetAPI: APIBase {
<tags>
</tags>
<status>string</status>
</Pet>}]
</Pet>, contentType=application/xml}]
- parameter petId: (path) ID of pet that needs to be fetched
@ -478,158 +387,6 @@ public class PetAPI: APIBase {
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
- parameter petId: (path) ID of pet that needs to be fetched
- parameter completion: completion handler to receive the data and the error objects
*/
public class func getPetByIdInObject(petId petId: Int64, completion: ((data: InlineResponse200?, error: ErrorType?) -> Void)) {
getPetByIdInObjectWithRequestBuilder(petId: petId).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
- parameter petId: (path) ID of pet that needs to be fetched
- returns: Promise<InlineResponse200>
*/
public class func getPetByIdInObject(petId petId: Int64) -> Promise<InlineResponse200> {
let deferred = Promise<InlineResponse200>.pendingPromise()
getPetByIdInObject(petId: petId) { data, error in
if let error = error {
deferred.reject(error)
} else {
deferred.fulfill(data!)
}
}
return deferred.promise
}
/**
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
- GET /pet/{petId}?response&#x3D;inline_arbitrary_object
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- OAuth:
- type: oauth2
- name: petstore_auth
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"category" : "{}",
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<null>
<photoUrls>string</photoUrls>
<name>doggie</name>
<id>123456</id>
<category>not implemented io.swagger.models.properties.ObjectProperty@37ff6855</category>
<status>string</status>
</null>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"category" : "{}",
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<null>
<photoUrls>string</photoUrls>
<name>doggie</name>
<id>123456</id>
<category>not implemented io.swagger.models.properties.ObjectProperty@37ff6855</category>
<status>string</status>
</null>}]
- parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<InlineResponse200>
*/
public class func getPetByIdInObjectWithRequestBuilder(petId petId: Int64) -> RequestBuilder<InlineResponse200> {
var path = "/pet/{petId}?response&#x3D;inline_arbitrary_object"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters)
let requestBuilder: RequestBuilder<InlineResponse200>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Fake endpoint to test byte array return by 'Find pet by ID'
- parameter petId: (path) ID of pet that needs to be fetched
- parameter completion: completion handler to receive the data and the error objects
*/
public class func petPetIdtestingByteArraytrueGet(petId petId: Int64, completion: ((data: String?, error: ErrorType?) -> Void)) {
petPetIdtestingByteArraytrueGetWithRequestBuilder(petId: petId).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Fake endpoint to test byte array return by 'Find pet by ID'
- parameter petId: (path) ID of pet that needs to be fetched
- returns: Promise<String>
*/
public class func petPetIdtestingByteArraytrueGet(petId petId: Int64) -> Promise<String> {
let deferred = Promise<String>.pendingPromise()
petPetIdtestingByteArraytrueGet(petId: petId) { data, error in
if let error = error {
deferred.reject(error)
} else {
deferred.fulfill(data!)
}
}
return deferred.promise
}
/**
Fake endpoint to test byte array return by 'Find pet by ID'
- GET /pet/{petId}?testing_byte_array&#x3D;true
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- OAuth:
- type: oauth2
- name: petstore_auth
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}]
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}]
- parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<String>
*/
public class func petPetIdtestingByteArraytrueGetWithRequestBuilder(petId petId: Int64) -> RequestBuilder<String> {
var path = "/pet/{petId}?testing_byte_array&#x3D;true"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters)
let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Update an existing pet
@ -751,11 +508,11 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet to update
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- parameter _file: (form) file to upload (optional)
- parameter file: (form) file to upload (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func uploadFile(petId petId: Int64, additionalMetadata: String? = nil, _file: NSURL? = nil, completion: ((error: ErrorType?) -> Void)) {
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, _file: _file).execute { (response, error) -> Void in
public class func uploadFile(petId petId: Int64, additionalMetadata: String? = nil, file: NSURL? = nil, completion: ((error: ErrorType?) -> Void)) {
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -765,12 +522,12 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet to update
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- parameter _file: (form) file to upload (optional)
- parameter file: (form) file to upload (optional)
- returns: Promise<Void>
*/
public class func uploadFile(petId petId: Int64, additionalMetadata: String? = nil, _file: NSURL? = nil) -> Promise<Void> {
public class func uploadFile(petId petId: Int64, additionalMetadata: String? = nil, file: NSURL? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
uploadFile(petId: petId, additionalMetadata: additionalMetadata, _file: _file) { error in
uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { error in
if let error = error {
deferred.reject(error)
} else {
@ -790,18 +547,18 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet to update
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- parameter _file: (form) file to upload (optional)
- parameter file: (form) file to upload (optional)
- returns: RequestBuilder<Void>
*/
public class func uploadFileWithRequestBuilder(petId petId: Int64, additionalMetadata: String? = nil, _file: NSURL? = nil) -> RequestBuilder<Void> {
public class func uploadFileWithRequestBuilder(petId petId: Int64, additionalMetadata: String? = nil, file: NSURL? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}/uploadImage"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [
"additionalMetadata": additionalMetadata,
"file": _file
"file": file
]
let parameters = APIHelper.rejectNil(nillableParameters)

View File

@ -63,95 +63,6 @@ public class StoreAPI: APIBase {
return requestBuilder.init(method: "DELETE", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Finds orders by status
- parameter status: (query) Status value that needs to be considered for query (optional, default to placed)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findOrdersByStatus(status status: String? = nil, completion: ((data: [Order]?, error: ErrorType?) -> Void)) {
findOrdersByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Finds orders by status
- parameter status: (query) Status value that needs to be considered for query (optional, default to placed)
- returns: Promise<[Order]>
*/
public class func findOrdersByStatus(status status: String? = nil) -> Promise<[Order]> {
let deferred = Promise<[Order]>.pendingPromise()
findOrdersByStatus(status: status) { data, error in
if let error = error {
deferred.reject(error)
} else {
deferred.fulfill(data!)
}
}
return deferred.promise
}
/**
Finds orders by status
- GET /store/findByStatus
- A single status value can be provided as a string
- API Key:
- type: apiKey x-test_api_client_id
- name: test_api_client_id
- API Key:
- type: apiKey x-test_api_client_secret
- name: test_api_client_secret
- examples: [{contentType=application/json, example=[ {
"petId" : 123456789,
"quantity" : 123,
"id" : 123456789,
"shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Order>
<id>123456</id>
<petId>123456</petId>
<quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status>
<complete>true</complete>
</Order>}]
- examples: [{contentType=application/json, example=[ {
"petId" : 123456789,
"quantity" : 123,
"id" : 123456789,
"shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Order>
<id>123456</id>
<petId>123456</petId>
<quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status>
<complete>true</complete>
</Order>}]
- parameter status: (query) Status value that needs to be considered for query (optional, default to placed)
- returns: RequestBuilder<[Order]>
*/
public class func findOrdersByStatusWithRequestBuilder(status status: String? = nil) -> RequestBuilder<[Order]> {
let path = "/store/findByStatus"
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [
"status": status
]
let parameters = APIHelper.rejectNil(nillableParameters)
let requestBuilder: RequestBuilder<[Order]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: false)
}
/**
Returns pet inventories by status
@ -187,12 +98,12 @@ public class StoreAPI: APIBase {
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
- examples: [{example={
"key" : 123
}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}]
- examples: [{contentType=application/json, example={
}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}]
- examples: [{example={
"key" : 123
}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}]
}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}]
- returns: RequestBuilder<[String:Int32]>
*/
@ -208,58 +119,6 @@ public class StoreAPI: APIBase {
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Fake endpoint to test arbitrary object return by 'Get inventory'
- parameter completion: completion handler to receive the data and the error objects
*/
public class func getInventoryInObject(completion: ((data: AnyObject?, error: ErrorType?) -> Void)) {
getInventoryInObjectWithRequestBuilder().execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
/**
Fake endpoint to test arbitrary object return by 'Get inventory'
- returns: Promise<AnyObject>
*/
public class func getInventoryInObject() -> Promise<AnyObject> {
let deferred = Promise<AnyObject>.pendingPromise()
getInventoryInObject() { data, error in
if let error = error {
deferred.reject(error)
} else {
deferred.fulfill(data!)
}
}
return deferred.promise
}
/**
Fake endpoint to test arbitrary object return by 'Get inventory'
- GET /store/inventory?response&#x3D;arbitrary_object
- Returns an arbitrary object which is actually a map of status codes to quantities
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example="{}"}, {contentType=application/xml, example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f}]
- examples: [{contentType=application/json, example="{}"}, {contentType=application/xml, example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f}]
- returns: RequestBuilder<AnyObject>
*/
public class func getInventoryInObjectWithRequestBuilder() -> RequestBuilder<AnyObject> {
let path = "/store/inventory?response&#x3D;arbitrary_object"
let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters)
let requestBuilder: RequestBuilder<AnyObject>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true)
}
/**
Find purchase order by ID
@ -294,42 +153,36 @@ public class StoreAPI: APIBase {
Find purchase order by ID
- GET /store/order/{orderId}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- API Key:
- type: apiKey test_api_key_query (QUERY)
- name: test_api_key_query
- API Key:
- type: apiKey test_api_key_header
- name: test_api_key_header
- examples: [{contentType=application/json, example={
"petId" : 123456789,
"quantity" : 123,
- examples: [{example={
"id" : 123456789,
"shipDate" : "2000-01-23T04:56:07.000+0000",
"petId" : 123456789,
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000"
}, contentType=application/json}, {example=<Order>
<id>123456</id>
<petId>123456</petId>
<quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status>
<complete>true</complete>
</Order>}]
- examples: [{contentType=application/json, example={
"petId" : 123456789,
"quantity" : 123,
</Order>, contentType=application/xml}]
- examples: [{example={
"id" : 123456789,
"shipDate" : "2000-01-23T04:56:07.000+0000",
"petId" : 123456789,
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000"
}, contentType=application/json}, {example=<Order>
<id>123456</id>
<petId>123456</petId>
<quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status>
<complete>true</complete>
</Order>}]
</Order>, contentType=application/xml}]
- parameter orderId: (path) ID of pet that needs to be fetched
@ -382,42 +235,36 @@ public class StoreAPI: APIBase {
Place an order for a pet
- POST /store/order
-
- API Key:
- type: apiKey x-test_api_client_id
- name: test_api_client_id
- API Key:
- type: apiKey x-test_api_client_secret
- name: test_api_client_secret
- examples: [{contentType=application/json, example={
"petId" : 123456789,
"quantity" : 123,
- examples: [{example={
"id" : 123456789,
"shipDate" : "2000-01-23T04:56:07.000+0000",
"petId" : 123456789,
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000"
}, contentType=application/json}, {example=<Order>
<id>123456</id>
<petId>123456</petId>
<quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status>
<complete>true</complete>
</Order>}]
- examples: [{contentType=application/json, example={
"petId" : 123456789,
"quantity" : 123,
</Order>, contentType=application/xml}]
- examples: [{example={
"id" : 123456789,
"shipDate" : "2000-01-23T04:56:07.000+0000",
"petId" : 123456789,
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000"
}, contentType=application/json}, {example=<Order>
<id>123456</id>
<petId>123456</petId>
<quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status>
<complete>true</complete>
</Order>}]
</Order>, contentType=application/xml}]
- parameter body: (body) order placed for purchasing the pet (optional)

View File

@ -192,9 +192,6 @@ public class UserAPI: APIBase {
Delete user
- DELETE /user/{username}
- This can only be done by the logged in user.
- BASIC:
- type: basic
- name: test_http_basic
- parameter username: (path) The name that needs to be deleted
@ -247,16 +244,44 @@ public class UserAPI: APIBase {
Get user by user name
- GET /user/{username}
-
- examples: [{contentType=application/json, example={
"id" : 1,
"username" : "johnp",
"firstName" : "John",
"lastName" : "Public",
"email" : "johnp@swagger.io",
"password" : "-secret-",
"phone" : "0123456789",
"userStatus" : 0
}}]
- examples: [{example={
"id" : 123456789,
"lastName" : "aeiou",
"phone" : "aeiou",
"username" : "aeiou",
"email" : "aeiou",
"userStatus" : 123,
"firstName" : "aeiou",
"password" : "aeiou"
}, contentType=application/json}, {example=<User>
<id>123456</id>
<username>string</username>
<firstName>string</firstName>
<lastName>string</lastName>
<email>string</email>
<password>string</password>
<phone>string</phone>
<userStatus>0</userStatus>
</User>, contentType=application/xml}]
- examples: [{example={
"id" : 123456789,
"lastName" : "aeiou",
"phone" : "aeiou",
"username" : "aeiou",
"email" : "aeiou",
"userStatus" : 123,
"firstName" : "aeiou",
"password" : "aeiou"
}, contentType=application/json}, {example=<User>
<id>123456</id>
<username>string</username>
<firstName>string</firstName>
<lastName>string</lastName>
<email>string</email>
<password>string</password>
<phone>string</phone>
<userStatus>0</userStatus>
</User>, contentType=application/xml}]
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
@ -311,8 +336,8 @@ public class UserAPI: APIBase {
Logs user into the system
- GET /user/login
-
- examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}]
- examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}]
- examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}]
- examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}]
- parameter username: (query) The user name for login (optional)
- parameter password: (query) The password for login in clear text (optional)

View File

@ -75,7 +75,7 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
request.authenticate(usingCredential: credential)
}
request.responseJSON(options: .AllowFragments) { response in
request.validate().responseJSON(options: .AllowFragments) { response in
managerStore.removeValueForKey(managerId)
if response.result.isFailure {

View File

@ -130,33 +130,6 @@ class Decoders {
fatalError("formatter failed to parse \(source)")
}
// Decoder for [Animal]
Decoders.addDecoder(clazz: [Animal].self) { (source: AnyObject) -> [Animal] in
return Decoders.decode(clazz: [Animal].self, source: source)
}
// Decoder for Animal
Decoders.addDecoder(clazz: Animal.self) { (source: AnyObject) -> Animal in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Animal()
instance.className = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"])
return instance
}
// Decoder for [Cat]
Decoders.addDecoder(clazz: [Cat].self) { (source: AnyObject) -> [Cat] in
return Decoders.decode(clazz: [Cat].self, source: source)
}
// Decoder for Cat
Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject) -> Cat in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Cat()
instance.className = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"])
instance.declawed = Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["declawed"])
return instance
}
// Decoder for [Category]
Decoders.addDecoder(clazz: [Category].self) { (source: AnyObject) -> [Category] in
return Decoders.decode(clazz: [Category].self, source: source)
@ -171,102 +144,6 @@ class Decoders {
}
// Decoder for [Dog]
Decoders.addDecoder(clazz: [Dog].self) { (source: AnyObject) -> [Dog] in
return Decoders.decode(clazz: [Dog].self, source: source)
}
// Decoder for Dog
Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject) -> Dog in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Dog()
instance.className = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"])
instance.breed = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["breed"])
return instance
}
// Decoder for [FormatTest]
Decoders.addDecoder(clazz: [FormatTest].self) { (source: AnyObject) -> [FormatTest] in
return Decoders.decode(clazz: [FormatTest].self, source: source)
}
// Decoder for FormatTest
Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject) -> FormatTest in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = FormatTest()
instance.integer = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["integer"])
instance._int32 = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["int32"])
instance._int64 = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["int64"])
instance.number = Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["number"])
instance._float = Decoders.decodeOptional(clazz: Float.self, source: sourceDictionary["float"])
instance._double = Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["double"])
instance._string = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["string"])
instance.byte = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["byte"])
instance.binary = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["binary"])
instance.date = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["date"])
instance.dateTime = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["dateTime"])
instance.password = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["password"])
return instance
}
// Decoder for [InlineResponse200]
Decoders.addDecoder(clazz: [InlineResponse200].self) { (source: AnyObject) -> [InlineResponse200] in
return Decoders.decode(clazz: [InlineResponse200].self, source: source)
}
// Decoder for InlineResponse200
Decoders.addDecoder(clazz: InlineResponse200.self) { (source: AnyObject) -> InlineResponse200 in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = InlineResponse200()
instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"])
instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"])
instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"])
instance.category = Decoders.decodeOptional(clazz: AnyObject.self, source: sourceDictionary["category"])
instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"])
instance.status = InlineResponse200.Status(rawValue: (sourceDictionary["status"] as? String) ?? "")
return instance
}
// Decoder for [Model200Response]
Decoders.addDecoder(clazz: [Model200Response].self) { (source: AnyObject) -> [Model200Response] in
return Decoders.decode(clazz: [Model200Response].self, source: source)
}
// Decoder for Model200Response
Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject) -> Model200Response in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Model200Response()
instance.name = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"])
return instance
}
// Decoder for [ModelReturn]
Decoders.addDecoder(clazz: [ModelReturn].self) { (source: AnyObject) -> [ModelReturn] in
return Decoders.decode(clazz: [ModelReturn].self, source: source)
}
// Decoder for ModelReturn
Decoders.addDecoder(clazz: ModelReturn.self) { (source: AnyObject) -> ModelReturn in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = ModelReturn()
instance._return = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["return"])
return instance
}
// Decoder for [Name]
Decoders.addDecoder(clazz: [Name].self) { (source: AnyObject) -> [Name] in
return Decoders.decode(clazz: [Name].self, source: source)
}
// Decoder for Name
Decoders.addDecoder(clazz: Name.self) { (source: AnyObject) -> Name in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Name()
instance.name = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"])
instance.snakeCase = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["snake_case"])
return instance
}
// Decoder for [Order]
Decoders.addDecoder(clazz: [Order].self) { (source: AnyObject) -> [Order] in
return Decoders.decode(clazz: [Order].self, source: source)
@ -303,19 +180,6 @@ class Decoders {
}
// Decoder for [SpecialModelName]
Decoders.addDecoder(clazz: [SpecialModelName].self) { (source: AnyObject) -> [SpecialModelName] in
return Decoders.decode(clazz: [SpecialModelName].self, source: source)
}
// Decoder for SpecialModelName
Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject) -> SpecialModelName in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = SpecialModelName()
instance.specialPropertyName = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["$special[property.name]"])
return instance
}
// Decoder for [Tag]
Decoders.addDecoder(clazz: [Tag].self) { (source: AnyObject) -> [Tag] in
return Decoders.decode(clazz: [Tag].self, source: source)

View File

@ -1,23 +0,0 @@
//
// Animal.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class Animal: JSONEncodable {
public var className: String?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["className"] = self.className
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,25 +0,0 @@
//
// Cat.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class Cat: JSONEncodable {
public var className: String?
public var declawed: Bool?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["className"] = self.className
nillableDictionary["declawed"] = self.declawed
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,25 +0,0 @@
//
// Dog.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class Dog: JSONEncodable {
public var className: String?
public var breed: String?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["className"] = self.className
nillableDictionary["breed"] = self.breed
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,46 +0,0 @@
//
// FormatTest.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class FormatTest: JSONEncodable {
public var integer: Int32?
public var _int32: Int32?
public var _int64: Int64?
public var number: Double?
public var _float: Float?
public var _double: Double?
public var _string: String?
public var byte: String?
public var binary: String?
public var date: NSDate?
public var dateTime: NSDate?
public var password: String?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["integer"] = self.integer?.encodeToJSON()
nillableDictionary["int32"] = self._int32?.encodeToJSON()
nillableDictionary["int64"] = self._int64?.encodeToJSON()
nillableDictionary["int64"] = self._int64?.encodeToJSON()
nillableDictionary["number"] = self.number
nillableDictionary["float"] = self._float
nillableDictionary["double"] = self._double
nillableDictionary["string"] = self._string
nillableDictionary["byte"] = self.byte
nillableDictionary["binary"] = self.binary
nillableDictionary["date"] = self.date?.encodeToJSON()
nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON()
nillableDictionary["password"] = self.password
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,40 +0,0 @@
//
// InlineResponse200.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class InlineResponse200: JSONEncodable {
public enum Status: String {
case Available = "available"
case Pending = "pending"
case Sold = "sold"
}
public var photoUrls: [String]?
public var name: String?
public var id: Int64?
public var category: AnyObject?
public var tags: [Tag]?
/** pet status in the store */
public var status: Status?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON()
nillableDictionary["name"] = self.name
nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["category"] = self.category
nillableDictionary["tags"] = self.tags?.encodeToJSON()
nillableDictionary["status"] = self.status?.rawValue
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,24 +0,0 @@
//
// Model200Response.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** Model for testing model name starting with number */
public class Model200Response: JSONEncodable {
public var name: Int32?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["name"] = self.name?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,24 +0,0 @@
//
// ModelReturn.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** Model for testing reserved words */
public class ModelReturn: JSONEncodable {
public var _return: Int32?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["return"] = self._return?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,26 +0,0 @@
//
// Name.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** Model for testing model name same as property name */
public class Name: JSONEncodable {
public var name: Int32?
public var snakeCase: Int32?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["name"] = self.name?.encodeToJSON()
nillableDictionary["snake_case"] = self.snakeCase?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,25 +0,0 @@
//
// ObjectReturn.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class ObjectReturn: JSONEncodable {
public var _return: Int?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["_return"] = self._return
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}

View File

@ -1,24 +0,0 @@
//
// SpecialModelName.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public class SpecialModelName: JSONEncodable {
public var specialPropertyName: Int64?
public init() {}
// MARK: JSONEncodable
func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]()
nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON()
nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}