forked from loafle/openapi-generator-original
Merge pull request #2903 from wing328/master
[ObjC] remove try-catch block from objc sample code
This commit is contained in:
commit
19449c69b4
@ -42,29 +42,21 @@ 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}}// {{{.}}}
|
||||||
{{/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}}
|
{{/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}}
|
{{paramName}}{{/secondaryParam}}:{{paramName}}{{/allParams}}
|
||||||
{{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error) {
|
{{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error) {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
if (output) {
|
if (output) {
|
||||||
NSLog(@"%@", output);
|
NSLog(@"%@", output);
|
||||||
}
|
}
|
||||||
{{/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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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];
|
||||||
|
@ -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]
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,24 +88,16 @@ 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
|
||||||
[apiInstance deletePetWithPetId:petId
|
[apiInstance deletePetWithPetId:petId
|
||||||
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,26 +142,18 @@ 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
|
||||||
[apiInstance findPetsByStatusWithStatus:status
|
[apiInstance findPetsByStatusWithStatus:status
|
||||||
completionHandler: ^(NSArray<SWGPet>* output, NSError* error) {
|
completionHandler: ^(NSArray<SWGPet>* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,26 +197,18 @@ 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
|
||||||
[apiInstance findPetsByTagsWithTags:tags
|
[apiInstance findPetsByTagsWithTags:tags
|
||||||
completionHandler: ^(NSArray<SWGPet>* output, NSError* error) {
|
completionHandler: ^(NSArray<SWGPet>* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,37 +246,29 @@ 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
|
||||||
[apiInstance getPetByIdWithPetId:petId
|
[apiInstance getPetByIdWithPetId:petId
|
||||||
completionHandler: ^(SWGPet* output, NSError* error) {
|
completionHandler: ^(SWGPet* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,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* 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
|
||||||
[apiInstance updatePetWithFormWithPetId:petId
|
[apiInstance updatePetWithFormWithPetId:petId
|
||||||
name:name
|
name:name
|
||||||
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,25 +428,17 @@ 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
|
||||||
[apiInstance uploadFileWithPetId:petId
|
[apiInstance uploadFileWithPetId:petId
|
||||||
additionalMetadata:additionalMetadata
|
additionalMetadata:additionalMetadata
|
||||||
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
|
||||||
|
@ -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,26 +78,18 @@ 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
|
||||||
[apiInstance getInventoryWithCompletionHandler:
|
[apiInstance getInventoryWithCompletionHandler:
|
||||||
^(NSDictionary<NSString*, NSNumber*>* output, NSError* error) {
|
^(NSDictionary<NSString*, NSNumber*>* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,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
|
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
|
||||||
[apiInstance getOrderByIdWithOrderId:orderId
|
[apiInstance getOrderByIdWithOrderId:orderId
|
||||||
completionHandler: ^(SWGOrder* output, NSError* error) {
|
completionHandler: ^(SWGOrder* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,26 +175,18 @@ 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
|
||||||
[apiInstance placeOrderWithBody:body
|
[apiInstance placeOrderWithBody:body
|
||||||
completionHandler: ^(SWGOrder* output, NSError* error) {
|
completionHandler: ^(SWGOrder* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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
|
||||||
|
@ -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,26 +217,18 @@ 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
|
||||||
[apiInstance getUserByNameWithUsername:username
|
[apiInstance getUserByNameWithUsername:username
|
||||||
completionHandler: ^(SWGUser* output, NSError* error) {
|
completionHandler: ^(SWGUser* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,27 +269,19 @@ 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
|
||||||
[apiInstance loginUserWithUsername:username
|
[apiInstance loginUserWithUsername:username
|
||||||
password:password
|
password:password
|
||||||
completionHandler: ^(NSString* output, NSError* error) {
|
completionHandler: ^(NSString* output, NSError* error) {
|
||||||
if (output) {
|
if (output) {
|
||||||
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,24 +366,16 @@ 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
|
||||||
[apiInstance updateUserWithUsername:username
|
[apiInstance updateUserWithUsername:username
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user