Merge pull request #2583 from cjolif/nilasdefault

make sure user is not forced to pass nil for optional parameters
This commit is contained in:
wing328
2016-04-14 19:23:24 +08:00
4 changed files with 45 additions and 45 deletions

View File

@@ -23,7 +23,7 @@ public class {{classname}}: APIBase {
- parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}
- parameter completion: completion handler to receive the data and the error objects
*/
public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: (({{#returnType}}data: {{{returnType}}}?, {{/returnType}}error: ErrorType?) -> Void)) {
public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: (({{#returnType}}data: {{{returnType}}}?, {{/returnType}}error: ErrorType?) -> Void)) {
{{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in
completion({{#returnType}}data: response?.body, {{/returnType}}error: error);
}
@@ -37,7 +37,7 @@ public class {{classname}}: APIBase {
- parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}
- returns: Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>
*/
public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
let deferred = Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.pendingPromise()
{{operationId}}({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#returnType}}data, {{/returnType}}error in
if let error = error {
@@ -69,7 +69,7 @@ public class {{classname}}: APIBase {
- returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}}
*/
public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
{{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{path}}"{{#pathParams}}
path = path.stringByReplacingOccurrencesOfString("{{=<% %>=}}{<%paramName%>}<%={{ }}=%>", withString: "\({{paramName}})", options: .LiteralSearch, range: nil){{/pathParams}}
let URLString = {{projectName}}API.basePath + path

View File

@@ -17,7 +17,7 @@ public class PetAPI: APIBase {
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func addPet(body body: Pet?, completion: ((error: ErrorType?) -> Void)) {
public class func addPet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -29,7 +29,7 @@ public class PetAPI: APIBase {
- parameter body: (body) Pet object that needs to be added to the store (optional)
- returns: Promise<Void>
*/
public class func addPet(body body: Pet?) -> Promise<Void> {
public class func addPet(body body: Pet? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
addPet(body: body) { error in
if let error = error {
@@ -53,7 +53,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func addPetWithRequestBuilder(body body: Pet?) -> RequestBuilder<Void> {
public class func addPetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
@@ -69,7 +69,7 @@ public class PetAPI: APIBase {
- 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?, completion: ((error: ErrorType?) -> Void)) {
public class func addPetUsingByteArray(body body: String? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetUsingByteArrayWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -81,7 +81,7 @@ public class PetAPI: APIBase {
- parameter body: (body) Pet object in the form of byte array (optional)
- returns: Promise<Void>
*/
public class func addPetUsingByteArray(body body: String?) -> 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 {
@@ -105,7 +105,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func addPetUsingByteArrayWithRequestBuilder(body body: String?) -> 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]
@@ -176,7 +176,7 @@ public class PetAPI: APIBase {
- parameter status: (query) Status values that need to be considered for query (optional, default to available)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findPetsByStatus(status status: [String]?, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
public class func findPetsByStatus(status status: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
findPetsByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
@@ -188,7 +188,7 @@ public class PetAPI: APIBase {
- parameter status: (query) Status values that need to be considered for query (optional, default to available)
- returns: Promise<[Pet]>
*/
public class func findPetsByStatus(status status: [String]?) -> Promise<[Pet]> {
public class func findPetsByStatus(status status: [String]? = nil) -> Promise<[Pet]> {
let deferred = Promise<[Pet]>.pendingPromise()
findPetsByStatus(status: status) { data, error in
if let error = error {
@@ -258,7 +258,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<[Pet]>
*/
public class func findPetsByStatusWithRequestBuilder(status status: [String]?) -> RequestBuilder<[Pet]> {
public class func findPetsByStatusWithRequestBuilder(status status: [String]? = nil) -> RequestBuilder<[Pet]> {
let path = "/pet/findByStatus"
let URLString = PetstoreClientAPI.basePath + path
@@ -278,7 +278,7 @@ public class PetAPI: APIBase {
- parameter tags: (query) Tags to filter by (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findPetsByTags(tags tags: [String]?, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
public class func findPetsByTags(tags tags: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
findPetsByTagsWithRequestBuilder(tags: tags).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
@@ -290,7 +290,7 @@ public class PetAPI: APIBase {
- parameter tags: (query) Tags to filter by (optional)
- returns: Promise<[Pet]>
*/
public class func findPetsByTags(tags tags: [String]?) -> Promise<[Pet]> {
public class func findPetsByTags(tags tags: [String]? = nil) -> Promise<[Pet]> {
let deferred = Promise<[Pet]>.pendingPromise()
findPetsByTags(tags: tags) { data, error in
if let error = error {
@@ -360,7 +360,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<[Pet]>
*/
public class func findPetsByTagsWithRequestBuilder(tags tags: [String]?) -> RequestBuilder<[Pet]> {
public class func findPetsByTagsWithRequestBuilder(tags tags: [String]? = nil) -> RequestBuilder<[Pet]> {
let path = "/pet/findByTags"
let URLString = PetstoreClientAPI.basePath + path
@@ -636,7 +636,7 @@ public class PetAPI: APIBase {
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updatePet(body body: Pet?, completion: ((error: ErrorType?) -> Void)) {
public class func updatePet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -648,7 +648,7 @@ public class PetAPI: APIBase {
- parameter body: (body) Pet object that needs to be added to the store (optional)
- returns: Promise<Void>
*/
public class func updatePet(body body: Pet?) -> Promise<Void> {
public class func updatePet(body body: Pet? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
updatePet(body: body) { error in
if let error = error {
@@ -672,7 +672,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func updatePetWithRequestBuilder(body body: Pet?) -> RequestBuilder<Void> {
public class func updatePetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
@@ -690,7 +690,7 @@ public class PetAPI: APIBase {
- parameter status: (form) Updated status of the pet (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updatePetWithForm(petId petId: String, name: String?, status: String?, completion: ((error: ErrorType?) -> Void)) {
public class func updatePetWithForm(petId petId: String, name: String? = nil, status: String? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute { (response, error) -> Void in
completion(error: error);
}
@@ -704,7 +704,7 @@ public class PetAPI: APIBase {
- parameter status: (form) Updated status of the pet (optional)
- returns: Promise<Void>
*/
public class func updatePetWithForm(petId petId: String, name: String?, status: String?) -> Promise<Void> {
public class func updatePetWithForm(petId petId: String, name: String? = nil, status: String? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
updatePetWithForm(petId: petId, name: name, status: status) { error in
if let error = error {
@@ -730,7 +730,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func updatePetWithFormWithRequestBuilder(petId petId: String, name: String?, status: String?) -> RequestBuilder<Void> {
public class func updatePetWithFormWithRequestBuilder(petId petId: String, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -754,7 +754,7 @@ public class PetAPI: APIBase {
- 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?, _file: NSURL?, completion: ((error: ErrorType?) -> Void)) {
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);
}
@@ -768,7 +768,7 @@ public class PetAPI: APIBase {
- parameter _file: (form) file to upload (optional)
- returns: Promise<Void>
*/
public class func uploadFile(petId petId: Int64, additionalMetadata: String?, _file: NSURL?) -> 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
if let error = error {
@@ -794,7 +794,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func uploadFileWithRequestBuilder(petId petId: Int64, additionalMetadata: String?, _file: NSURL?) -> 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

View File

@@ -69,7 +69,7 @@ public class StoreAPI: APIBase {
- 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?, completion: ((data: [Order]?, error: ErrorType?) -> Void)) {
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);
}
@@ -81,7 +81,7 @@ public class StoreAPI: APIBase {
- 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?) -> 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 {
@@ -138,7 +138,7 @@ public class StoreAPI: APIBase {
- returns: RequestBuilder<[Order]>
*/
public class func findOrdersByStatusWithRequestBuilder(status status: String?) -> RequestBuilder<[Order]> {
public class func findOrdersByStatusWithRequestBuilder(status status: String? = nil) -> RequestBuilder<[Order]> {
let path = "/store/findByStatus"
let URLString = PetstoreClientAPI.basePath + path
@@ -354,7 +354,7 @@ public class StoreAPI: APIBase {
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func placeOrder(body body: Order?, completion: ((data: Order?, error: ErrorType?) -> Void)) {
public class func placeOrder(body body: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
@@ -366,7 +366,7 @@ public class StoreAPI: APIBase {
- parameter body: (body) order placed for purchasing the pet (optional)
- returns: Promise<Order>
*/
public class func placeOrder(body body: Order?) -> Promise<Order> {
public class func placeOrder(body body: Order? = nil) -> Promise<Order> {
let deferred = Promise<Order>.pendingPromise()
placeOrder(body: body) { data, error in
if let error = error {
@@ -423,7 +423,7 @@ public class StoreAPI: APIBase {
- returns: RequestBuilder<Order>
*/
public class func placeOrderWithRequestBuilder(body body: Order?) -> RequestBuilder<Order> {
public class func placeOrderWithRequestBuilder(body body: Order? = nil) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]

View File

@@ -17,7 +17,7 @@ public class UserAPI: APIBase {
- parameter body: (body) Created user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUser(body body: User?, completion: ((error: ErrorType?) -> Void)) {
public class func createUser(body body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -29,7 +29,7 @@ public class UserAPI: APIBase {
- parameter body: (body) Created user object (optional)
- returns: Promise<Void>
*/
public class func createUser(body body: User?) -> Promise<Void> {
public class func createUser(body body: User? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
createUser(body: body) { error in
if let error = error {
@@ -50,7 +50,7 @@ public class UserAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func createUserWithRequestBuilder(body body: User?) -> RequestBuilder<Void> {
public class func createUserWithRequestBuilder(body body: User? = nil) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
@@ -66,7 +66,7 @@ public class UserAPI: APIBase {
- parameter body: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithArrayInput(body body: [User]?, completion: ((error: ErrorType?) -> Void)) {
public class func createUsersWithArrayInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -78,7 +78,7 @@ public class UserAPI: APIBase {
- parameter body: (body) List of user object (optional)
- returns: Promise<Void>
*/
public class func createUsersWithArrayInput(body body: [User]?) -> Promise<Void> {
public class func createUsersWithArrayInput(body body: [User]? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
createUsersWithArrayInput(body: body) { error in
if let error = error {
@@ -99,7 +99,7 @@ public class UserAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]?) -> RequestBuilder<Void> {
public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
@@ -115,7 +115,7 @@ public class UserAPI: APIBase {
- parameter body: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithListInput(body body: [User]?, completion: ((error: ErrorType?) -> Void)) {
public class func createUsersWithListInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -127,7 +127,7 @@ public class UserAPI: APIBase {
- parameter body: (body) List of user object (optional)
- returns: Promise<Void>
*/
public class func createUsersWithListInput(body body: [User]?) -> Promise<Void> {
public class func createUsersWithListInput(body body: [User]? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
createUsersWithListInput(body: body) { error in
if let error = error {
@@ -148,7 +148,7 @@ public class UserAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func createUsersWithListInputWithRequestBuilder(body body: [User]?) -> RequestBuilder<Void> {
public class func createUsersWithListInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
@@ -282,7 +282,7 @@ public class UserAPI: APIBase {
- parameter password: (query) The password for login in clear text (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func loginUser(username username: String?, password: String?, completion: ((data: String?, error: ErrorType?) -> Void)) {
public class func loginUser(username username: String? = nil, password: String? = nil, completion: ((data: String?, error: ErrorType?) -> Void)) {
loginUserWithRequestBuilder(username: username, password: password).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
@@ -295,7 +295,7 @@ public class UserAPI: APIBase {
- parameter password: (query) The password for login in clear text (optional)
- returns: Promise<String>
*/
public class func loginUser(username username: String?, password: String?) -> Promise<String> {
public class func loginUser(username username: String? = nil, password: String? = nil) -> Promise<String> {
let deferred = Promise<String>.pendingPromise()
loginUser(username: username, password: password) { data, error in
if let error = error {
@@ -319,7 +319,7 @@ public class UserAPI: APIBase {
- returns: RequestBuilder<String>
*/
public class func loginUserWithRequestBuilder(username username: String?, password: String?) -> RequestBuilder<String> {
public class func loginUserWithRequestBuilder(username username: String? = nil, password: String? = nil) -> RequestBuilder<String> {
let path = "/user/login"
let URLString = PetstoreClientAPI.basePath + path
@@ -388,7 +388,7 @@ public class UserAPI: APIBase {
- parameter body: (body) Updated user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updateUser(username username: String, body: User?, completion: ((error: ErrorType?) -> Void)) {
public class func updateUser(username username: String, body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
completion(error: error);
}
@@ -401,7 +401,7 @@ public class UserAPI: APIBase {
- parameter body: (body) Updated user object (optional)
- returns: Promise<Void>
*/
public class func updateUser(username username: String, body: User?) -> Promise<Void> {
public class func updateUser(username username: String, body: User? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
updateUser(username: username, body: body) { error in
if let error = error {
@@ -423,7 +423,7 @@ public class UserAPI: APIBase {
- returns: RequestBuilder<Void>
*/
public class func updateUserWithRequestBuilder(username username: String, body: User?) -> RequestBuilder<Void> {
public class func updateUserWithRequestBuilder(username username: String, body: User? = nil) -> RequestBuilder<Void> {
var path = "/user/{username}"
path = path.stringByReplacingOccurrencesOfString("{username}", withString: "\(username)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path