Merge pull request #2903 from wing328/master

[ObjC] remove try-catch block from objc sample code
This commit is contained in:
wing328 2016-05-19 00:13:53 +08:00
commit 19449c69b4
7 changed files with 222 additions and 390 deletions

View File

@ -42,8 +42,6 @@ Method | HTTP request | Description
{{#allParams}}{{{dataType}}} {{paramName}} = {{{example}}}; // {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} {{#allParams}}{{{dataType}}} {{paramName}} = {{{example}}}; // {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}} {{/allParams}}
@try
{
{{classname}}*apiInstance = [[{{classname}} alloc] init]; {{classname}}*apiInstance = [[{{classname}} alloc] init];
{{#summary}}// {{{.}}} {{#summary}}// {{{.}}}
@ -56,15 +54,9 @@ Method | HTTP request | Description
} }
{{/returnType}} {{/returnType}}
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling {{classname}}->{{operationId}}: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling {{classname}}->{{operationId}}: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters

View File

@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
- API version: 1.0.0 - API version: 1.0.0
- Package version: - 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 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen
## Requirements ## Requirements
@ -124,6 +124,12 @@ Class | Method | HTTP request | Description
## Documentation For Authorization ## Documentation For Authorization
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## petstore_auth ## petstore_auth
- **Type**: OAuth - **Type**: OAuth
@ -133,12 +139,6 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account - **write:pets**: modify pets in your account
- **read:pets**: read your pets - **read:pets**: read your pets
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Author ## Author

View File

@ -376,7 +376,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513;
NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"petstore_auth", @"api_key"]; NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@ -109,13 +109,6 @@
- (NSDictionary *) authSettings { - (NSDictionary *) authSettings {
return @{ return @{
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
@"api_key": @"api_key":
@{ @{
@"type": @"api_key", @"type": @"api_key",
@ -123,6 +116,13 @@
@"key": @"api_key", @"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"] @"value": [self getApiKeyWithPrefix:@"api_key"]
}, },
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
}; };
} }

View File

@ -34,23 +34,15 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
SWGPet* body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) 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 // Add a new pet to the store
[apiInstance addPetWithBody:body [apiInstance addPetWithBody:body
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->addPet: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->addPet: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -96,8 +88,6 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
NSNumber* petId = @789; // Pet id to delete NSNumber* petId = @789; // Pet id to delete
NSString* apiKey = @"apiKey_example"; // (optional) NSString* apiKey = @"apiKey_example"; // (optional)
@try
{
SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Deletes a pet // Deletes a pet
@ -105,15 +95,9 @@ NSString* apiKey = @"apiKey_example"; // (optional)
apiKey:apiKey apiKey:apiKey
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->deletePet: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->deletePet: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -158,8 +142,6 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
NSArray<NSString*>* status = @[@"available"]; // Status values that need to be considered for filter (optional) (default to available) NSArray<NSString*>* 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 // Finds Pets by status
@ -169,15 +151,9 @@ NSArray<NSString*>* status = @[@"available"]; // Status values that need to be c
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->findPetsByStatus: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->findPetsByStatus: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -221,8 +197,6 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
NSArray<NSString*>* tags = @[@"tags_example"]; // Tags to filter by (optional) NSArray<NSString*>* tags = @[@"tags_example"]; // Tags to filter by (optional)
@try
{
SWGPetApi*apiInstance = [[SWGPetApi alloc] init]; SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Finds Pets by tags // Finds Pets by tags
@ -232,15 +206,9 @@ NSArray<NSString*>* tags = @[@"tags_example"]; // Tags to filter by (optional)
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->findPetsByTags: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->findPetsByTags: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -278,19 +246,17 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
```objc ```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; 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) // Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"]; [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"]; //[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 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 // Find pet by ID
@ -300,15 +266,9 @@ NSNumber* petId = @789; // ID of pet that needs to be fetched
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->getPetById: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->getPetById: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -323,7 +283,7 @@ Name | Type | Description | Notes
### Authorization ### 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 ### 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) 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 // Update an existing pet
[apiInstance updatePetWithBody:body [apiInstance updatePetWithBody:body
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->updatePet: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->updatePet: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -416,8 +368,6 @@ NSString* petId = @"petId_example"; // ID of pet that needs to be updated
NSString* name = @"name_example"; // Updated name of the pet (optional) NSString* name = @"name_example"; // Updated name of the pet (optional)
NSString* status = @"status_example"; // Updated status 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 // Updates a pet in the store with form data
@ -426,15 +376,9 @@ NSString* status = @"status_example"; // Updated status of the pet (optional)
status:status status:status
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->updatePetWithForm: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->updatePetWithForm: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -484,8 +428,6 @@ NSNumber* petId = @789; // ID of pet to update
NSString* additionalMetadata = @"additionalMetadata_example"; // Additional data to pass to server (optional) NSString* additionalMetadata = @"additionalMetadata_example"; // Additional data to pass to server (optional)
NSURL* file = [NSURL fileURLWithPath:@"/path/to/file.txt"]; // file to upload (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 // uploads an image
@ -494,15 +436,9 @@ NSURL* file = [NSURL fileURLWithPath:@"/path/to/file.txt"]; // file to upload (o
file:file file:file
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGPetApi->uploadFile: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->uploadFile: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters

View File

@ -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 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 // Delete purchase order by ID
[apiInstance deleteOrderWithOrderId:orderId [apiInstance deleteOrderWithOrderId:orderId
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGStoreApi->deleteOrder: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGStoreApi->deleteOrder: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -86,8 +78,6 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
@try
{
SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init]; SWGStoreApi*apiInstance = [[SWGStoreApi alloc] init];
// Returns pet inventories by status // Returns pet inventories by status
@ -97,15 +87,9 @@ SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGStoreApi->getInventory: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGStoreApi->getInventory: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -141,8 +125,6 @@ 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 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 // Find purchase order by ID
@ -152,15 +134,9 @@ NSString* orderId = @"orderId_example"; // ID of pet that needs to be fetched
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGStoreApi->getOrderById: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGStoreApi->getOrderById: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -199,8 +175,6 @@ Place an order for a pet
SWGOrder* body = [[SWGOrder alloc] init]; // order placed for purchasing the pet (optional) 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 // Place an order for a pet
@ -210,15 +184,9 @@ SWGOrder* body = [[SWGOrder alloc] init]; // order placed for purchasing the pet
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGStoreApi->placeOrder: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGStoreApi->placeOrder: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters

View File

@ -29,23 +29,15 @@ This can only be done by the logged in user.
SWGUser* body = [[SWGUser alloc] init]; // Created user object (optional) SWGUser* body = [[SWGUser alloc] init]; // Created user object (optional)
@try
{
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
// Create user // Create user
[apiInstance createUserWithBody:body [apiInstance createUserWithBody:body
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->createUser: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->createUser: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -84,23 +76,15 @@ Creates list of users with given input array
NSArray<SWGUser>* body = @[[[SWGUser alloc] init]]; // List of user object (optional) NSArray<SWGUser>* 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 // Creates list of users with given input array
[apiInstance createUsersWithArrayInputWithBody:body [apiInstance createUsersWithArrayInputWithBody:body
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->createUsersWithArrayInput: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->createUsersWithArrayInput: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -139,23 +123,15 @@ Creates list of users with given input array
NSArray<SWGUser>* body = @[[[SWGUser alloc] init]]; // List of user object (optional) NSArray<SWGUser>* 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 // Creates list of users with given input array
[apiInstance createUsersWithListInputWithBody:body [apiInstance createUsersWithListInputWithBody:body
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->createUsersWithListInput: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->createUsersWithListInput: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### 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 NSString* username = @"username_example"; // The name that needs to be deleted
@try
{
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
// Delete user // Delete user
[apiInstance deleteUserWithUsername:username [apiInstance deleteUserWithUsername:username
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->deleteUser: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->deleteUser: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -249,8 +217,6 @@ Get user by user name
NSString* username = @"username_example"; // The name that needs to be fetched. Use user1 for testing. 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 // Get user by user name
@ -260,15 +226,9 @@ NSString* username = @"username_example"; // The name that needs to be fetched.
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->getUserByName: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->getUserByName: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -309,8 +269,6 @@ Logs user into the system
NSString* username = @"username_example"; // The user name for login (optional) NSString* username = @"username_example"; // The user name for login (optional)
NSString* password = @"password_example"; // The password for login in clear text (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 // Logs user into the system
@ -321,15 +279,9 @@ NSString* password = @"password_example"; // The password for login in clear tex
NSLog(@"%@", output); NSLog(@"%@", output);
} }
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->loginUser: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->loginUser: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -368,23 +320,15 @@ Logs out current logged in user session
```objc ```objc
@try
{
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
// Logs out current logged in user session // Logs out current logged in user session
[apiInstance logoutUserWithCompletionHandler: [apiInstance logoutUserWithCompletionHandler:
^(NSError* error) { ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->logoutUser: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->logoutUser: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters
@ -422,8 +366,6 @@ This can only be done by the logged in user.
NSString* username = @"username_example"; // name that need to be deleted NSString* username = @"username_example"; // name that need to be deleted
SWGUser* body = [[SWGUser alloc] init]; // Updated user object (optional) SWGUser* body = [[SWGUser alloc] init]; // Updated user object (optional)
@try
{
SWGUserApi*apiInstance = [[SWGUserApi alloc] init]; SWGUserApi*apiInstance = [[SWGUserApi alloc] init];
// Updated user // Updated user
@ -431,15 +373,9 @@ SWGUser* body = [[SWGUser alloc] init]; // Updated user object (optional)
body:body body:body
completionHandler: ^(NSError* error) { completionHandler: ^(NSError* error) {
if (error) { if (error) {
NSLog(@"Error: %@", error); NSLog(@"Error calling SWGUserApi->updateUser: %@", error);
} }
}]; }];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGUserApi->updateUser: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
``` ```
### Parameters ### Parameters