[ObjC] minor code style enhancement to ObjC API client (#4437)

* minor code style enhancement to objc api client

* update petstore sample

* remove datatype from docstring (objc)
This commit is contained in:
wing328 2016-12-20 19:13:03 +08:00 committed by GitHub
parent c4ccf49064
commit 204c05442d
16 changed files with 166 additions and 288 deletions

View File

@ -75,11 +75,17 @@ NSInteger k{{classname}}MissingParamErrorCode = 234513;
///
/// {{{summary}}}
/// {{{notes}}}
/// {{#allParams}} @param {{paramName}} {{{description}}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{#allParams}}
/// @param {{paramName}} {{{description}}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
///
/// {{/allParams}} @returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
///
-(NSNumber*) {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
{{/allParams}}
{{#responses}}
/// code:{{{code}}} message:"{{{message}}}"{{#hasMore}},{{/hasMore}}
{{/responses}}
{{#returnType}}
/// @return {{{returnType}}}
{{/returnType}}
-(NSNumber*) {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{operationId}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
{{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}{{/allParams}}
{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error)) handler {
{{#allParams}}
@ -181,6 +187,5 @@ NSInteger k{{classname}}MissingParamErrorCode = 234513;
{{/operation}}
{{newline}}
{{/operations}}
@end

View File

@ -16,18 +16,23 @@ extern NSInteger k{{classname}}MissingParamErrorCode;
{{#operations}}
{{#operation}}
/// {{{summary}}}
/// {{#notes}}{{{notes}}}{{/notes}}
{{#notes}}
/// {{{notes}}}
{{/notes}}
///
/// {{#allParams}}@param {{paramName}} {{description}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
/// {{/allParams}}{{#responses}}
/// code:{{{code}}} message:"{{{message}}}"{{#hasMore}},{{/hasMore}}{{/responses}}
///{{#returnType}}
/// @return {{{returnType}}}{{/returnType}}
-(NSNumber*) {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
{{#allParams}}
/// @param {{paramName}} {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
{{#responses}}
/// code:{{{code}}} message:"{{{message}}}"{{#hasMore}},{{/hasMore}}
{{/responses}}
{{#returnType}}
/// @return {{{returnType}}}
{{/returnType}}
-(NSNumber*) {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{operationId}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
{{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}{{/allParams}}
{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error)) handler;
{{newline}}
{{/operation}}
{{/operations}}

View File

@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
- API version: 1.0.0
- Package version:
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
- Build package: io.swagger.codegen.languages.ObjcClientCodegen
## Requirements

View File

@ -27,113 +27,84 @@ extern NSInteger kSWGPetApiMissingParamErrorCode;
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
///
/// @return
-(NSNumber*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Deletes a pet
///
///
/// @param petId Pet id to delete
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
///
/// @return
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler;
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
///
/// @param status Status values that need to be considered for filter (optional) (default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
///
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
///
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
///
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
/// Update an existing pet
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
///
/// @return
-(NSNumber*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Updates a pet in the store with form data
///
///
/// @param petId ID of pet that needs to be updated
/// @param name Updated name of the pet (optional)
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
///
/// @return
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler;
/// uploads an image
///
///
/// @param petId ID of pet to update
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
///
/// @return
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@ -72,10 +72,9 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Add a new pet to the store
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// @returns void
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@ -131,12 +130,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Deletes a pet
///
/// @param petId Pet id to delete
/// @param petId Pet id to delete
///
/// @param apiKey (optional)
///
/// @returns void
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler {
@ -209,10 +207,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
/// @param status Status values that need to be considered for filter (optional, default to available)
///
/// @returns NSArray<SWGPet>*
/// @param status Status values that need to be considered for filter (optional, default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"];
@ -271,10 +270,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// @param tags Tags to filter by (optional)
///
/// @returns NSArray<SWGPet>*
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"];
@ -333,10 +333,12 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
/// @param petId ID of pet that needs to be fetched
///
/// @returns SWGPet*
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler {
// verify the required parameter 'petId' is set
@ -405,10 +407,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Update an existing pet
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// @returns void
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
-(NSNumber*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@ -464,14 +467,13 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Updates a pet in the store with form data
///
/// @param petId ID of pet that needs to be updated
/// @param petId ID of pet that needs to be updated
///
/// @param name Updated name of the pet (optional)
/// @param name Updated name of the pet (optional)
///
/// @param status Updated status of the pet (optional)
///
/// @returns void
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
@ -548,14 +550,13 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// uploads an image
///
/// @param petId ID of pet to update
/// @param petId ID of pet to update
///
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param additionalMetadata Additional data to pass to server (optional)
///
/// @param file file to upload (optional)
///
/// @returns void
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
@ -628,5 +629,4 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
}
@end

View File

@ -27,52 +27,39 @@ extern NSInteger kSWGStoreApiMissingParamErrorCode;
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
///
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
///
/// @return
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler;
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
///
///
/// code:200 message:"successful operation"
///
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler;
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
///
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
///
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
/// Place an order for a pet
///
///
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
///
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
@end

View File

@ -72,10 +72,10 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Delete purchase order by ID
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// @param orderId ID of the order that needs to be deleted
///
/// @returns void
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'orderId' is set
@ -144,8 +144,8 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
/// @returns NSDictionary<NSString*, NSNumber*>*
///
/// code:200 message:"successful operation"
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"];
@ -200,10 +200,12 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// @param orderId ID of pet that needs to be fetched
///
/// @returns SWGOrder*
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
// verify the required parameter 'orderId' is set
@ -272,10 +274,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Place an order for a pet
///
/// @param body order placed for purchasing the pet (optional)
///
/// @returns SWGOrder*
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"];
@ -329,5 +332,4 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
}
@end

View File

@ -27,105 +27,75 @@ extern NSInteger kSWGUserApiMissingParamErrorCode;
/// This can only be done by the logged in user.
///
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
///
/// @return
-(NSNumber*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
///
/// @return
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
///
/// @return
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Delete user
/// This can only be done by the logged in user.
///
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
///
/// @return
-(NSNumber*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler;
/// Get user by user name
///
///
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
///
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler;
/// Logs user into the system
///
///
/// @param username The user name for login (optional)
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
///
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler;
/// Logs out current logged in user session
///
///
///
/// code:0 message:"successful operation"
///
/// @return
-(NSNumber*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler;
/// Updated user
/// This can only be done by the logged in user.
///
/// @param username name that need to be deleted
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
///
/// @return
-(NSNumber*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@ -72,10 +72,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Create user
/// This can only be done by the logged in user.
/// @param body Created user object (optional)
///
/// @returns void
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"];
@ -131,10 +130,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
///
/// @returns void
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"];
@ -190,10 +188,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
///
/// @returns void
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"];
@ -249,10 +246,10 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Delete user
/// This can only be done by the logged in user.
/// @param username The name that needs to be deleted
///
/// @returns void
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
-(NSNumber*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set
@ -321,10 +318,12 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Get user by user name
///
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// @returns SWGUser*
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler {
// verify the required parameter 'username' is set
@ -393,12 +392,13 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs user into the system
///
/// @param username The user name for login (optional)
/// @param username The user name for login (optional)
///
/// @param password The password for login in clear text (optional)
///
/// @returns NSString*
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler {
@ -460,8 +460,7 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs out current logged in user session
///
/// @returns void
///
/// code:0 message:"successful operation"
-(NSNumber*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"];
@ -516,12 +515,12 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Updated user
/// This can only be done by the logged in user.
/// @param username name that need to be deleted
/// @param username name that need to be deleted
///
/// @param body Updated user object (optional)
///
/// @returns void
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
-(NSNumber*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
@ -590,5 +589,4 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
}
@end

View File

@ -27,108 +27,84 @@ extern NSInteger kSWGPetApiMissingParamErrorCode;
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
///
-(NSNumber*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Deletes a pet
///
///
/// @param petId Pet id to delete
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
///
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler;
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
///
/// @param status Status values that need to be considered for filter (optional) (default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
///
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
///
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
///
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
///
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
/// Update an existing pet
///
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
///
-(NSNumber*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Updates a pet in the store with form data
///
///
/// @param petId ID of pet that needs to be updated
/// @param name Updated name of the pet (optional)
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
///
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler;
/// uploads an image
///
///
/// @param petId ID of pet to update
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
///
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@ -72,10 +72,9 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Add a new pet to the store
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// @returns void
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@ -131,12 +130,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Deletes a pet
///
/// @param petId Pet id to delete
/// @param petId Pet id to delete
///
/// @param apiKey (optional)
///
/// @returns void
/// @param apiKey (optional)
///
/// code:400 message:"Invalid pet value"
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler {
@ -209,10 +207,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by status
/// Multiple status values can be provided with comma separated strings
/// @param status Status values that need to be considered for filter (optional, default to available)
///
/// @returns NSArray<SWGPet>*
/// @param status Status values that need to be considered for filter (optional, default to available)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid status value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"];
@ -271,10 +270,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Finds Pets by tags
/// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// @param tags Tags to filter by (optional)
///
/// @returns NSArray<SWGPet>*
/// @param tags Tags to filter by (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid tag value"
/// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"];
@ -333,10 +333,12 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Find pet by ID
/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
/// @param petId ID of pet that needs to be fetched
///
/// @returns SWGPet*
/// @param petId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found"
/// @return SWGPet*
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler {
// verify the required parameter 'petId' is set
@ -376,7 +378,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
// Authentication setting
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
@ -405,10 +407,11 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Update an existing pet
///
/// @param body Pet object that needs to be added to the store (optional)
///
/// @returns void
/// @param body Pet object that needs to be added to the store (optional)
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Pet not found",
/// code:405 message:"Validation exception"
-(NSNumber*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"];
@ -464,14 +467,13 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// Updates a pet in the store with form data
///
/// @param petId ID of pet that needs to be updated
/// @param petId ID of pet that needs to be updated
///
/// @param name Updated name of the pet (optional)
/// @param name Updated name of the pet (optional)
///
/// @param status Updated status of the pet (optional)
///
/// @returns void
/// @param status Updated status of the pet (optional)
///
/// code:405 message:"Invalid input"
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
@ -548,14 +550,13 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
///
/// uploads an image
///
/// @param petId ID of pet to update
/// @param petId ID of pet to update
///
/// @param additionalMetadata Additional data to pass to server (optional)
/// @param additionalMetadata Additional data to pass to server (optional)
///
/// @param file file to upload (optional)
///
/// @returns void
/// @param file file to upload (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
@ -628,5 +629,4 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
}
@end

View File

@ -27,51 +27,39 @@ extern NSInteger kSWGStoreApiMissingParamErrorCode;
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
///
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
///
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler;
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
///
///
/// code:200 message:"successful operation"
///
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler;
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
///
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
///
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
/// Place an order for a pet
///
///
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
///
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
@end

View File

@ -72,10 +72,10 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Delete purchase order by ID
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// @param orderId ID of the order that needs to be deleted
///
/// @returns void
/// @param orderId ID of the order that needs to be deleted
///
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'orderId' is set
@ -144,8 +144,8 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Returns pet inventories by status
/// Returns a map of status codes to quantities
/// @returns NSDictionary<NSString*, NSNumber*>*
///
/// code:200 message:"successful operation"
/// @return NSDictionary<NSString*, NSNumber*>*
-(NSNumber*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"];
@ -200,10 +200,12 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// @param orderId ID of pet that needs to be fetched
///
/// @returns SWGOrder*
/// @param orderId ID of pet that needs to be fetched
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid ID supplied",
/// code:404 message:"Order not found"
/// @return SWGOrder*
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
// verify the required parameter 'orderId' is set
@ -272,10 +274,11 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
///
/// Place an order for a pet
///
/// @param body order placed for purchasing the pet (optional)
///
/// @returns SWGOrder*
/// @param body order placed for purchasing the pet (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid Order"
/// @return SWGOrder*
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"];
@ -329,5 +332,4 @@ NSInteger kSWGStoreApiMissingParamErrorCode = 234513;
}
@end

View File

@ -27,99 +27,75 @@ extern NSInteger kSWGUserApiMissingParamErrorCode;
/// This can only be done by the logged in user.
///
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
///
-(NSNumber*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
///
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Creates list of users with given input array
///
///
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
///
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
/// Delete user
/// This can only be done by the logged in user.
///
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
///
-(NSNumber*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler;
/// Get user by user name
///
///
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
///
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler;
/// Logs user into the system
///
///
/// @param username The user name for login (optional)
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
///
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler;
/// Logs out current logged in user session
///
///
///
/// code:0 message:"successful operation"
///
-(NSNumber*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler;
/// Updated user
/// This can only be done by the logged in user.
///
/// @param username name that need to be deleted
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
///
-(NSNumber*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
@end

View File

@ -72,10 +72,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Create user
/// This can only be done by the logged in user.
/// @param body Created user object (optional)
///
/// @returns void
/// @param body Created user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"];
@ -131,10 +130,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
///
/// @returns void
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"];
@ -190,10 +188,9 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Creates list of users with given input array
///
/// @param body List of user object (optional)
///
/// @returns void
/// @param body List of user object (optional)
///
/// code:0 message:"successful operation"
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"];
@ -249,10 +246,10 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Delete user
/// This can only be done by the logged in user.
/// @param username The name that needs to be deleted
///
/// @returns void
/// @param username The name that needs to be deleted
///
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
-(NSNumber*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler {
// verify the required parameter 'username' is set
@ -321,10 +318,12 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Get user by user name
///
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// @returns SWGUser*
/// @param username The name that needs to be fetched. Use user1 for testing.
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username supplied",
/// code:404 message:"User not found"
/// @return SWGUser*
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler {
// verify the required parameter 'username' is set
@ -393,12 +392,13 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs user into the system
///
/// @param username The user name for login (optional)
/// @param username The user name for login (optional)
///
/// @param password The password for login in clear text (optional)
///
/// @returns NSString*
/// @param password The password for login in clear text (optional)
///
/// code:200 message:"successful operation",
/// code:400 message:"Invalid username/password supplied"
/// @return NSString*
-(NSNumber*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler {
@ -460,8 +460,7 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Logs out current logged in user session
///
/// @returns void
///
/// code:0 message:"successful operation"
-(NSNumber*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"];
@ -516,12 +515,12 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
///
/// Updated user
/// This can only be done by the logged in user.
/// @param username name that need to be deleted
/// @param username name that need to be deleted
///
/// @param body Updated user object (optional)
///
/// @returns void
/// @param body Updated user object (optional)
///
/// code:400 message:"Invalid user supplied",
/// code:404 message:"User not found"
-(NSNumber*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler {
@ -590,5 +589,4 @@ NSInteger kSWGUserApiMissingParamErrorCode = 234513;
}
@end

View File

@ -246,14 +246,14 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSNumber* petId = @789; // ID of pet that needs to be fetched
@ -283,7 +283,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -447,7 +447,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **NSNumber***| ID of pet to update |
**additionalMetadata** | **NSString***| Additional data to pass to server | [optional]
**file** | **NSURL*****NSURL***| file to upload | [optional]
**file** | **NSURL***| file to upload | [optional]
### Return type