diff --git a/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache b/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache index c27f6425388..7acaada7e32 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache @@ -42,29 +42,21 @@ Method | HTTP request | Description {{#allParams}}{{{dataType}}} {{paramName}} = {{{example}}}; // {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} {{/allParams}} -@try -{ - {{classname}} *apiInstance = [[{{classname}} alloc] init]; +{{classname}}*apiInstance = [[{{classname}} alloc] init]; -{{#summary}} // {{{.}}} -{{/summary}} [apiInstance {{#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}} - {{paramName}}{{/secondaryParam}}:{{paramName}}{{/allParams}} - {{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error) { +{{#summary}}// {{{.}}} +{{/summary}}[apiInstance {{#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}} + {{paramName}}{{/secondaryParam}}:{{paramName}}{{/allParams}} + {{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error) { {{#returnType}} - if (output) { - NSLog(@"%@", output); - } + if (output) { + NSLog(@"%@", output); + } {{/returnType}} - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling {{classname}}->{{operationId}}: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} + if (error) { + NSLog(@"Error calling {{classname}}->{{operationId}}: %@", error); + } + }]; ``` ### Parameters diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index 17dda837f12..32999a5e80b 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-05-16T09:18:48.757+02:00 +- Build date: 2016-05-18T23:48:57.670+08:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements @@ -124,6 +124,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## petstore_auth - **Type**: OAuth @@ -133,12 +139,6 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## Author diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.m b/samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.m index 409f5b86655..e35421fc520 100644 --- a/samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.m +++ b/samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.m @@ -376,7 +376,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]; diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m b/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m index cd8d6e7aeef..630c751ce74 100644 --- a/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m +++ b/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m @@ -109,13 +109,6 @@ - (NSDictionary *) authSettings { return @{ - @"petstore_auth": - @{ - @"type": @"oauth", - @"in": @"header", - @"key": @"Authorization", - @"value": [self getAccessToken] - }, @"api_key": @{ @"type": @"api_key", @@ -123,6 +116,13 @@ @"key": @"api_key", @"value": [self getApiKeyWithPrefix:@"api_key"] }, + @"petstore_auth": + @{ + @"type": @"oauth", + @"in": @"header", + @"key": @"Authorization", + @"value": [self getAccessToken] + }, }; } diff --git a/samples/client/petstore/objc/docs/SWGPetApi.md b/samples/client/petstore/objc/docs/SWGPetApi.md index a07f0cf067c..92fb2c4de81 100644 --- a/samples/client/petstore/objc/docs/SWGPetApi.md +++ b/samples/client/petstore/objc/docs/SWGPetApi.md @@ -34,23 +34,15 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; SWGPet* body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Add a new pet to the store - [apiInstance addPetWithBody:body - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->addPet: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Add a new pet to the store +[apiInstance addPetWithBody:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGPetApi->addPet: %@", error); + } + }]; ``` ### Parameters @@ -96,24 +88,16 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; NSNumber* petId = @789; // Pet id to delete NSString* apiKey = @"apiKey_example"; // (optional) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Deletes a pet - [apiInstance deletePetWithPetId:petId - apiKey:apiKey - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->deletePet: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Deletes a pet +[apiInstance deletePetWithPetId:petId + apiKey:apiKey + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGPetApi->deletePet: %@", error); + } + }]; ``` ### Parameters @@ -158,26 +142,18 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; NSArray* status = @[@"available"]; // Status values that need to be considered for filter (optional) (default to available) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Finds Pets by status - [apiInstance findPetsByStatusWithStatus:status - completionHandler: ^(NSArray* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->findPetsByStatus: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Finds Pets by status +[apiInstance findPetsByStatusWithStatus:status + completionHandler: ^(NSArray* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGPetApi->findPetsByStatus: %@", error); + } + }]; ``` ### Parameters @@ -221,26 +197,18 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; NSArray* tags = @[@"tags_example"]; // Tags to filter by (optional) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Finds Pets by tags - [apiInstance findPetsByTagsWithTags:tags - completionHandler: ^(NSArray* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->findPetsByTags: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Finds Pets by tags +[apiInstance findPetsByTagsWithTags:tags + completionHandler: ^(NSArray* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGPetApi->findPetsByTags: %@", error); + } + }]; ``` ### Parameters @@ -278,37 +246,29 @@ 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 -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Find pet by ID - [apiInstance getPetByIdWithPetId:petId - completionHandler: ^(SWGPet* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->getPetById: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Find pet by ID +[apiInstance getPetByIdWithPetId:petId + completionHandler: ^(SWGPet* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGPetApi->getPetById: %@", error); + } + }]; ``` ### Parameters @@ -323,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 @@ -352,23 +312,15 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; SWGPet* body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Update an existing pet - [apiInstance updatePetWithBody:body - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->updatePet: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Update an existing pet +[apiInstance updatePetWithBody:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGPetApi->updatePet: %@", error); + } + }]; ``` ### Parameters @@ -416,25 +368,17 @@ NSString* petId = @"petId_example"; // ID of pet that needs to be updated NSString* name = @"name_example"; // Updated name of the pet (optional) NSString* status = @"status_example"; // Updated status of the pet (optional) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // Updates a pet in the store with form data - [apiInstance updatePetWithFormWithPetId:petId - name:name - status:status - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->updatePetWithForm: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Updates a pet in the store with form data +[apiInstance updatePetWithFormWithPetId:petId + name:name + status:status + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGPetApi->updatePetWithForm: %@", error); + } + }]; ``` ### Parameters @@ -484,25 +428,17 @@ NSNumber* petId = @789; // ID of pet to update NSString* additionalMetadata = @"additionalMetadata_example"; // Additional data to pass to server (optional) NSURL* file = [NSURL fileURLWithPath:@"/path/to/file.txt"]; // file to upload (optional) -@try -{ - SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; +SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; - // uploads an image - [apiInstance uploadFileWithPetId:petId - additionalMetadata:additionalMetadata - file:file - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGPetApi->uploadFile: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// uploads an image +[apiInstance uploadFileWithPetId:petId + additionalMetadata:additionalMetadata + file:file + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGPetApi->uploadFile: %@", error); + } + }]; ``` ### Parameters diff --git a/samples/client/petstore/objc/docs/SWGStoreApi.md b/samples/client/petstore/objc/docs/SWGStoreApi.md index 29dfde60aa7..12bcef79a40 100644 --- a/samples/client/petstore/objc/docs/SWGStoreApi.md +++ b/samples/client/petstore/objc/docs/SWGStoreApi.md @@ -25,23 +25,15 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non NSString* orderId = @"orderId_example"; // ID of the order that needs to be deleted -@try -{ - SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init]; +SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; - // Delete purchase order by ID - [apiInstance deleteOrderWithOrderId:orderId - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGStoreApi->deleteOrder: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Delete purchase order by ID +[apiInstance deleteOrderWithOrderId:orderId + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGStoreApi->deleteOrder: %@", error); + } + }]; ``` ### Parameters @@ -86,26 +78,18 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; -@try -{ - SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init]; +SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; - // Returns pet inventories by status - [apiInstance getInventoryWithCompletionHandler: - ^(NSDictionary* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGStoreApi->getInventory: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Returns pet inventories by status +[apiInstance getInventoryWithCompletionHandler: + ^(NSDictionary* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGStoreApi->getInventory: %@", error); + } + }]; ``` ### Parameters @@ -141,26 +125,18 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge NSString* orderId = @"orderId_example"; // ID of pet that needs to be fetched -@try -{ - SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init]; +SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; - // Find purchase order by ID - [apiInstance getOrderByIdWithOrderId:orderId - completionHandler: ^(SWGOrder* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGStoreApi->getOrderById: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Find purchase order by ID +[apiInstance getOrderByIdWithOrderId:orderId + completionHandler: ^(SWGOrder* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGStoreApi->getOrderById: %@", error); + } + }]; ``` ### Parameters @@ -199,26 +175,18 @@ Place an order for a pet SWGOrder* body = [[SWGOrder alloc] init]; // order placed for purchasing the pet (optional) -@try -{ - SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init]; +SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; - // Place an order for a pet - [apiInstance placeOrderWithBody:body - completionHandler: ^(SWGOrder* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGStoreApi->placeOrder: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Place an order for a pet +[apiInstance placeOrderWithBody:body + completionHandler: ^(SWGOrder* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGStoreApi->placeOrder: %@", error); + } + }]; ``` ### Parameters diff --git a/samples/client/petstore/objc/docs/SWGUserApi.md b/samples/client/petstore/objc/docs/SWGUserApi.md index 4fe7a25bccf..c7a62f3b3c4 100644 --- a/samples/client/petstore/objc/docs/SWGUserApi.md +++ b/samples/client/petstore/objc/docs/SWGUserApi.md @@ -29,23 +29,15 @@ This can only be done by the logged in user. SWGUser* body = [[SWGUser alloc] init]; // Created user object (optional) -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Create user - [apiInstance createUserWithBody:body - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->createUser: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Create user +[apiInstance createUserWithBody:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGUserApi->createUser: %@", error); + } + }]; ``` ### Parameters @@ -84,23 +76,15 @@ Creates list of users with given input array NSArray* body = @[[[SWGUser alloc] init]]; // List of user object (optional) -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Creates list of users with given input array - [apiInstance createUsersWithArrayInputWithBody:body - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->createUsersWithArrayInput: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Creates list of users with given input array +[apiInstance createUsersWithArrayInputWithBody:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGUserApi->createUsersWithArrayInput: %@", error); + } + }]; ``` ### Parameters @@ -139,23 +123,15 @@ Creates list of users with given input array NSArray* body = @[[[SWGUser alloc] init]]; // List of user object (optional) -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Creates list of users with given input array - [apiInstance createUsersWithListInputWithBody:body - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->createUsersWithListInput: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Creates list of users with given input array +[apiInstance createUsersWithListInputWithBody:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGUserApi->createUsersWithListInput: %@", error); + } + }]; ``` ### Parameters @@ -194,23 +170,15 @@ This can only be done by the logged in user. NSString* username = @"username_example"; // The name that needs to be deleted -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Delete user - [apiInstance deleteUserWithUsername:username - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->deleteUser: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Delete user +[apiInstance deleteUserWithUsername:username + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGUserApi->deleteUser: %@", error); + } + }]; ``` ### Parameters @@ -249,26 +217,18 @@ Get user by user name NSString* username = @"username_example"; // The name that needs to be fetched. Use user1 for testing. -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Get user by user name - [apiInstance getUserByNameWithUsername:username - completionHandler: ^(SWGUser* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->getUserByName: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Get user by user name +[apiInstance getUserByNameWithUsername:username + completionHandler: ^(SWGUser* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGUserApi->getUserByName: %@", error); + } + }]; ``` ### Parameters @@ -309,27 +269,19 @@ Logs user into the system NSString* username = @"username_example"; // The user name for login (optional) NSString* password = @"password_example"; // The password for login in clear text (optional) -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Logs user into the system - [apiInstance loginUserWithUsername:username - password:password - completionHandler: ^(NSString* output, NSError* error) { - if (output) { - NSLog(@"%@", output); - } - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->loginUser: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Logs user into the system +[apiInstance loginUserWithUsername:username + password:password + completionHandler: ^(NSString* output, NSError* error) { + if (output) { + NSLog(@"%@", output); + } + if (error) { + NSLog(@"Error calling SWGUserApi->loginUser: %@", error); + } + }]; ``` ### Parameters @@ -368,23 +320,15 @@ Logs out current logged in user session ```objc -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Logs out current logged in user session - [apiInstance logoutUserWithCompletionHandler: - ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->logoutUser: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Logs out current logged in user session +[apiInstance logoutUserWithCompletionHandler: + ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGUserApi->logoutUser: %@", error); + } + }]; ``` ### Parameters @@ -422,24 +366,16 @@ This can only be done by the logged in user. NSString* username = @"username_example"; // name that need to be deleted SWGUser* body = [[SWGUser alloc] init]; // Updated user object (optional) -@try -{ - SWGUserApi *apiInstance = [[SWGUserApi alloc] init]; +SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; - // Updated user - [apiInstance updateUserWithUsername:username - body:body - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error: %@", error); - } - }]; -} -@catch (NSException *exception) -{ - NSLog(@"Exception when calling SWGUserApi->updateUser: %@ ", exception.name); - NSLog(@"Reason: %@ ", exception.reason); -} +// Updated user +[apiInstance updateUserWithUsername:username + body:body + completionHandler: ^(NSError* error) { + if (error) { + NSLog(@"Error calling SWGUserApi->updateUser: %@", error); + } + }]; ``` ### Parameters