#1907 JsonModel deserialization errors

This commit is contained in:
Mateusz Mackowiak 2016-04-25 19:04:00 +02:00
parent 0792ddc9b4
commit 18783e3fc7
26 changed files with 1544 additions and 587 deletions

View File

@ -2,6 +2,10 @@
NSString *const {{classPrefix}}ResponseObjectErrorKey = @"{{classPrefix}}ResponseObject"; NSString *const {{classPrefix}}ResponseObjectErrorKey = @"{{classPrefix}}ResponseObject";
NSString *const {{classPrefix}}DeserializationErrorDomainKey = @"{{classPrefix}}DeserializationErrorDomainKey";
NSInteger const {{classPrefix}}TypeMismatchErrorCode = 143553;
static long requestId = 0; static long requestId = 0;
static bool offlineState = false; static bool offlineState = false;
static NSMutableSet * queuedRequests = nil; static NSMutableSet * queuedRequests = nil;
@ -288,13 +292,7 @@ static void (^reachabilityChangeBlock)(int);
#pragma mark - Deserialize methods #pragma mark - Deserialize methods
- (id) deserialize:(id) data class:(NSString *) class { - (id) deserialize:(id) data class:(NSString *) class error:(NSError **) error {
NSRegularExpression *regexp = nil;
NSTextCheckingResult *match = nil;
NSMutableArray *resultArray = nil;
NSMutableDictionary *resultDict = nil;
NSString *innerType = nil;
// return nil if data is nil or class is nil // return nil if data is nil or class is nil
if (!data || !class) { if (!data || !class) {
return nil; return nil;
@ -310,6 +308,12 @@ static void (^reachabilityChangeBlock)(int);
return data; return data;
} }
NSRegularExpression *regexp = nil;
NSTextCheckingResult *match = nil;
NSMutableArray *resultArray = nil;
NSMutableDictionary *resultDict = nil;
NSString *innerType = nil;
// list of models // list of models
NSString *arrayOfModelsPat = @"NSArray<(.+)>"; NSString *arrayOfModelsPat = @"NSArray<(.+)>";
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
@ -321,14 +325,25 @@ static void (^reachabilityChangeBlock)(int);
range:NSMakeRange(0, [class length])]; range:NSMakeRange(0, [class length])];
if (match) { if (match) {
if(![data isKindOfClass: [NSArray class]]) {
if(error) {
NSDictionary * userInfo = @{NSLocalizedDescriptionKey : NSLocalizedString(@"Received response is not an array", nil)};
*error = [NSError errorWithDomain:{{classPrefix}}DeserializationErrorDomainKey code:{{classPrefix}}TypeMismatchErrorCode userInfo:userInfo];
}
return nil;
}
NSArray *dataArray = data; NSArray *dataArray = data;
innerType = [class substringWithRange:[match rangeAtIndex:1]]; innerType = [class substringWithRange:[match rangeAtIndex:1]];
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:innerType]]; id arrObj = [self deserialize:obj class:innerType error:error];
if(arrObj) {
[resultArray addObject:arrObj];
} else {
* stop = YES;
} }
]; }];
return resultArray; return resultArray;
} }
@ -348,7 +363,12 @@ static void (^reachabilityChangeBlock)(int);
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:innerType]]; id arrObj = [self deserialize:obj class:innerType error:error];
if(arrObj) {
[resultArray addObject:arrObj];
} else {
* stop = YES;
}
}]; }];
return resultArray; return resultArray;
@ -369,7 +389,12 @@ static void (^reachabilityChangeBlock)(int);
resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]]; resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]];
[data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { [data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[resultDict setValue:[self deserialize:obj class:valueType] forKey:key]; id dicObj = [self deserialize:obj class:valueType error:error];
if(dicObj) {
[resultDict setValue:dicObj forKey:key];
} else {
* stop = YES;
}
}]; }];
return resultDict; return resultDict;
@ -407,7 +432,7 @@ static void (^reachabilityChangeBlock)(int);
// model // model
Class ModelClass = NSClassFromString(class); Class ModelClass = NSClassFromString(class);
if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) {
return [[ModelClass alloc] initWithDictionary:data error:nil]; return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error];
} }
return nil; return nil;
@ -635,7 +660,12 @@ static void (^reachabilityChangeBlock)(int);
} }
else { else {
[self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) {
completionBlock([self deserialize:data class:responseType], error); NSError * serializationError;
id response = [self deserialize:data class:responseType error:&serializationError];
if(!response && !error){
error = serializationError;
}
completionBlock(response, error);
}]; }];
} }
return requestId; return requestId;

View File

@ -25,6 +25,16 @@
*/ */
extern NSString *const {{classPrefix}}ResponseObjectErrorKey; extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
/**
* A key for deserialization ErrorDomain
*/
extern NSString *const {{classPrefix}}DeserializationErrorDomainKey;
/**
* Code for deserialization type mismatch error
*/
extern NSInteger const {{classPrefix}}TypeMismatchErrorCode;
/** /**
* Log debug message macro * Log debug message macro
*/ */
@ -171,8 +181,9 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
* *
* @param data The data will be deserialized. * @param data The data will be deserialized.
* @param class The type of objective-c object. * @param class The type of objective-c object.
* @param error The error
*/ */
- (id) deserialize:(id) data class:(NSString *) class; - (id) deserialize:(id) data class:(NSString *) class error:(NSError**)error;
/** /**
* Logs request and response * Logs request and response

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-04-12T15:30:12.334+08:00 - Build date: 2016-04-25T18:52:19.055+02:00
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen - Build package: class io.swagger.codegen.languages.ObjcClientCodegen
## Requirements ## Requirements
@ -41,18 +41,9 @@ Import the following:
#import <SwaggerClient/SWGApiClient.h> #import <SwaggerClient/SWGApiClient.h>
#import <SwaggerClient/SWGConfiguration.h> #import <SwaggerClient/SWGConfiguration.h>
// load models // load models
#import <SwaggerClient/SWG200Response.h>
#import <SwaggerClient/SWGAnimal.h>
#import <SwaggerClient/SWGCat.h>
#import <SwaggerClient/SWGCategory.h> #import <SwaggerClient/SWGCategory.h>
#import <SwaggerClient/SWGDog.h>
#import <SwaggerClient/SWGFormatTest.h>
#import <SwaggerClient/SWGInlineResponse200.h>
#import <SwaggerClient/SWGName.h>
#import <SwaggerClient/SWGOrder.h> #import <SwaggerClient/SWGOrder.h>
#import <SwaggerClient/SWGPet.h> #import <SwaggerClient/SWGPet.h>
#import <SwaggerClient/SWGReturn.h>
#import <SwaggerClient/SWGSpecialModelName_.h>
#import <SwaggerClient/SWGTag.h> #import <SwaggerClient/SWGTag.h>
#import <SwaggerClient/SWGUser.h> #import <SwaggerClient/SWGUser.h>
// load API classes for accessing endpoints // load API classes for accessing endpoints
@ -107,20 +98,15 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*SWGPetApi* | [**addPet**](docs/SWGPetApi.md#addpet) | **POST** /pet | Add a new pet to the store *SWGPetApi* | [**addPet**](docs/SWGPetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*SWGPetApi* | [**addPetUsingByteArray**](docs/SWGPetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array&#x3D;true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
*SWGPetApi* | [**deletePet**](docs/SWGPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *SWGPetApi* | [**deletePet**](docs/SWGPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*SWGPetApi* | [**findPetsByStatus**](docs/SWGPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *SWGPetApi* | [**findPetsByStatus**](docs/SWGPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*SWGPetApi* | [**findPetsByTags**](docs/SWGPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *SWGPetApi* | [**findPetsByTags**](docs/SWGPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*SWGPetApi* | [**getPetById**](docs/SWGPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID *SWGPetApi* | [**getPetById**](docs/SWGPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*SWGPetApi* | [**getPetByIdInObject**](docs/SWGPetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response&#x3D;inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
*SWGPetApi* | [**petPetIdtestingByteArraytrueGet**](docs/SWGPetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array&#x3D;true | Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
*SWGPetApi* | [**updatePet**](docs/SWGPetApi.md#updatepet) | **PUT** /pet | Update an existing pet *SWGPetApi* | [**updatePet**](docs/SWGPetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*SWGPetApi* | [**updatePetWithForm**](docs/SWGPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *SWGPetApi* | [**updatePetWithForm**](docs/SWGPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*SWGPetApi* | [**uploadFile**](docs/SWGPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *SWGPetApi* | [**uploadFile**](docs/SWGPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*SWGStoreApi* | [**deleteOrder**](docs/SWGStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID *SWGStoreApi* | [**deleteOrder**](docs/SWGStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*SWGStoreApi* | [**findOrdersByStatus**](docs/SWGStoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status
*SWGStoreApi* | [**getInventory**](docs/SWGStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status *SWGStoreApi* | [**getInventory**](docs/SWGStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*SWGStoreApi* | [**getInventoryInObject**](docs/SWGStoreApi.md#getinventoryinobject) | **GET** /store/inventory?response&#x3D;arbitrary_object | Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
*SWGStoreApi* | [**getOrderById**](docs/SWGStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *SWGStoreApi* | [**getOrderById**](docs/SWGStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*SWGStoreApi* | [**placeOrder**](docs/SWGStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *SWGStoreApi* | [**placeOrder**](docs/SWGStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*SWGUserApi* | [**createUser**](docs/SWGUserApi.md#createuser) | **POST** /user | Create user *SWGUserApi* | [**createUser**](docs/SWGUserApi.md#createuser) | **POST** /user | Create user
@ -135,18 +121,9 @@ Class | Method | HTTP request | Description
## Documentation For Models ## Documentation For Models
- [SWG200Response](docs/SWG200Response.md)
- [SWGAnimal](docs/SWGAnimal.md)
- [SWGCat](docs/SWGCat.md)
- [SWGCategory](docs/SWGCategory.md) - [SWGCategory](docs/SWGCategory.md)
- [SWGDog](docs/SWGDog.md)
- [SWGFormatTest](docs/SWGFormatTest.md)
- [SWGInlineResponse200](docs/SWGInlineResponse200.md)
- [SWGName](docs/SWGName.md)
- [SWGOrder](docs/SWGOrder.md) - [SWGOrder](docs/SWGOrder.md)
- [SWGPet](docs/SWGPet.md) - [SWGPet](docs/SWGPet.md)
- [SWGReturn](docs/SWGReturn.md)
- [SWGSpecialModelName_](docs/SWGSpecialModelName_.md)
- [SWGTag](docs/SWGTag.md) - [SWGTag](docs/SWGTag.md)
- [SWGUser](docs/SWGUser.md) - [SWGUser](docs/SWGUser.md)
@ -154,11 +131,14 @@ Class | Method | HTTP request | Description
## Documentation For Authorization ## Documentation For Authorization
## test_api_key_header ## petstore_auth
- **Type**: API key - **Type**: OAuth
- **API key parameter name**: test_api_key_header - **Flow**: implicit
- **Location**: HTTP header - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## api_key ## api_key
@ -166,40 +146,9 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key - **API key parameter name**: api_key
- **Location**: HTTP header - **Location**: HTTP header
## test_http_basic
- **Type**: HTTP basic authentication
## test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **Location**: HTTP header
## test_api_client_id
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
## test_api_key_query
- **Type**: API key
- **API key parameter name**: test_api_key_query
- **Location**: URL query string
## petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## Author ## Author
apiteam@swagger.io apiteam@wordnik.com

View File

@ -12,18 +12,9 @@
* Do not edit the class manually. * Do not edit the class manually.
*/ */
#import "SWG200Response.h"
#import "SWGAnimal.h"
#import "SWGCat.h"
#import "SWGCategory.h" #import "SWGCategory.h"
#import "SWGDog.h"
#import "SWGFormatTest.h"
#import "SWGInlineResponse200.h"
#import "SWGName.h"
#import "SWGOrder.h" #import "SWGOrder.h"
#import "SWGPet.h" #import "SWGPet.h"
#import "SWGReturn.h"
#import "SWGSpecialModelName_.h"
#import "SWGTag.h" #import "SWGTag.h"
#import "SWGUser.h" #import "SWGUser.h"
@ -38,6 +29,16 @@
*/ */
extern NSString *const SWGResponseObjectErrorKey; extern NSString *const SWGResponseObjectErrorKey;
/**
* A key for deserialization ErrorDomain
*/
extern NSString *const SWGDeserializationErrorDomainKey;
/**
* Code for deserialization type mismatch error
*/
extern NSInteger const SWGTypeMismatchErrorCode;
/** /**
* Log debug message macro * Log debug message macro
*/ */
@ -184,8 +185,9 @@ extern NSString *const SWGResponseObjectErrorKey;
* *
* @param data The data will be deserialized. * @param data The data will be deserialized.
* @param class The type of objective-c object. * @param class The type of objective-c object.
* @param error The error
*/ */
- (id) deserialize:(id) data class:(NSString *) class; - (id) deserialize:(id) data class:(NSString *) class error:(NSError**)error;
/** /**
* Logs request and response * Logs request and response

View File

@ -2,6 +2,10 @@
NSString *const SWGResponseObjectErrorKey = @"SWGResponseObject"; NSString *const SWGResponseObjectErrorKey = @"SWGResponseObject";
NSString *const SWGDeserializationErrorDomainKey = @"SWGDeserializationErrorDomainKey";
NSInteger const SWGTypeMismatchErrorCode = 143553;
static long requestId = 0; static long requestId = 0;
static bool offlineState = false; static bool offlineState = false;
static NSMutableSet * queuedRequests = nil; static NSMutableSet * queuedRequests = nil;
@ -288,13 +292,7 @@ static void (^reachabilityChangeBlock)(int);
#pragma mark - Deserialize methods #pragma mark - Deserialize methods
- (id) deserialize:(id) data class:(NSString *) class { - (id) deserialize:(id) data class:(NSString *) class error:(NSError **) error {
NSRegularExpression *regexp = nil;
NSTextCheckingResult *match = nil;
NSMutableArray *resultArray = nil;
NSMutableDictionary *resultDict = nil;
NSString *innerType = nil;
// return nil if data is nil or class is nil // return nil if data is nil or class is nil
if (!data || !class) { if (!data || !class) {
return nil; return nil;
@ -310,6 +308,12 @@ static void (^reachabilityChangeBlock)(int);
return data; return data;
} }
NSRegularExpression *regexp = nil;
NSTextCheckingResult *match = nil;
NSMutableArray *resultArray = nil;
NSMutableDictionary *resultDict = nil;
NSString *innerType = nil;
// list of models // list of models
NSString *arrayOfModelsPat = @"NSArray<(.+)>"; NSString *arrayOfModelsPat = @"NSArray<(.+)>";
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
@ -321,14 +325,25 @@ static void (^reachabilityChangeBlock)(int);
range:NSMakeRange(0, [class length])]; range:NSMakeRange(0, [class length])];
if (match) { if (match) {
if(![data isKindOfClass: [NSArray class]]) {
if(error) {
NSDictionary * userInfo = @{NSLocalizedDescriptionKey : NSLocalizedString(@"Received response is not an array", nil)};
*error = [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGTypeMismatchErrorCode userInfo:userInfo];
}
return nil;
}
NSArray *dataArray = data; NSArray *dataArray = data;
innerType = [class substringWithRange:[match rangeAtIndex:1]]; innerType = [class substringWithRange:[match rangeAtIndex:1]];
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:innerType]]; id arrObj = [self deserialize:obj class:innerType error:error];
if(arrObj) {
[resultArray addObject:arrObj];
} else {
* stop = YES;
} }
]; }];
return resultArray; return resultArray;
} }
@ -348,7 +363,12 @@ static void (^reachabilityChangeBlock)(int);
resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]]; resultArray = [NSMutableArray arrayWithCapacity:[dataArray count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:innerType]]; id arrObj = [self deserialize:obj class:innerType error:error];
if(arrObj) {
[resultArray addObject:arrObj];
} else {
* stop = YES;
}
}]; }];
return resultArray; return resultArray;
@ -369,7 +389,12 @@ static void (^reachabilityChangeBlock)(int);
resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]]; resultDict = [NSMutableDictionary dictionaryWithCapacity:[dataDict count]];
[data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { [data enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[resultDict setValue:[self deserialize:obj class:valueType] forKey:key]; id dicObj = [self deserialize:obj class:valueType error:error];
if(dicObj) {
[resultDict setValue:dicObj forKey:key];
} else {
* stop = YES;
}
}]; }];
return resultDict; return resultDict;
@ -407,7 +432,7 @@ static void (^reachabilityChangeBlock)(int);
// model // model
Class ModelClass = NSClassFromString(class); Class ModelClass = NSClassFromString(class);
if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) {
return [[ModelClass alloc] initWithDictionary:data error:nil]; return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error];
} }
return nil; return nil;
@ -635,7 +660,12 @@ static void (^reachabilityChangeBlock)(int);
} }
else { else {
[self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) {
completionBlock([self deserialize:data class:responseType], error); NSError * serializationError;
id response = [self deserialize:data class:responseType error:&serializationError];
if(!response && !error){
error = serializationError;
}
completionBlock(response, error);
}]; }];
} }
return requestId; return requestId;

View File

@ -122,12 +122,12 @@
- (NSDictionary *) authSettings { - (NSDictionary *) authSettings {
return @{ return @{
@"test_api_key_header": @"petstore_auth":
@{ @{
@"type": @"api_key", @"type": @"oauth",
@"in": @"header", @"in": @"header",
@"key": @"test_api_key_header", @"key": @"Authorization",
@"value": [self getApiKeyWithPrefix:@"test_api_key_header"] @"value": [self getAccessToken]
}, },
@"api_key": @"api_key":
@{ @{
@ -136,41 +136,6 @@
@"key": @"api_key", @"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"] @"value": [self getApiKeyWithPrefix:@"api_key"]
}, },
@"test_http_basic":
@{
@"type": @"basic",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getBasicAuthToken]
},
@"test_api_client_secret":
@{
@"type": @"api_key",
@"in": @"header",
@"key": @"x-test_api_client_secret",
@"value": [self getApiKeyWithPrefix:@"x-test_api_client_secret"]
},
@"test_api_client_id":
@{
@"type": @"api_key",
@"in": @"header",
@"key": @"x-test_api_client_id",
@"value": [self getApiKeyWithPrefix:@"x-test_api_client_id"]
},
@"test_api_key_query":
@{
@"type": @"api_key",
@"in": @"query",
@"key": @"test_api_key_query",
@"value": [self getApiKeyWithPrefix:@"test_api_key_query"]
},
@"petstore_auth":
@{
@"type": @"oauth",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getAccessToken]
},
}; };
} }

View File

@ -16,17 +16,17 @@
@interface SWGInlineResponse200 : SWGObject @interface SWGInlineResponse200 : SWGObject
@property(nonatomic) NSArray<SWGTag>* tags; @property(nonatomic) NSArray* /* NSString */ photoUrls;
@property(nonatomic) NSString* name;
@property(nonatomic) NSNumber* _id; @property(nonatomic) NSNumber* _id;
@property(nonatomic) NSObject* category; @property(nonatomic) NSObject* category;
@property(nonatomic) NSArray<SWGTag>* tags;
/* pet status in the store [optional] /* pet status in the store [optional]
*/ */
@property(nonatomic) NSString* status; @property(nonatomic) NSString* status;
@property(nonatomic) NSString* name;
@property(nonatomic) NSArray* /* NSString */ photoUrls;
@end @end

View File

@ -20,7 +20,7 @@
*/ */
+ (JSONKeyMapper *)keyMapper + (JSONKeyMapper *)keyMapper
{ {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"tags": @"tags", @"id": @"_id", @"category": @"category", @"status": @"status", @"name": @"name", @"photoUrls": @"photoUrls" }]; return [[JSONKeyMapper alloc] initWithDictionary:@{ @"photoUrls": @"photoUrls", @"name": @"name", @"id": @"_id", @"category": @"category", @"tags": @"tags", @"status": @"status" }];
} }
/** /**
@ -30,7 +30,7 @@
*/ */
+ (BOOL)propertyIsOptional:(NSString *)propertyName + (BOOL)propertyIsOptional:(NSString *)propertyName
{ {
NSArray *optionalProperties = @[@"tags", @"category", @"status", @"name", @"photoUrls"]; NSArray *optionalProperties = @[@"photoUrls", @"name", @"category", @"tags", @"status"];
if ([optionalProperties containsObject:propertyName]) { if ([optionalProperties containsObject:propertyName]) {
return YES; return YES;

View File

@ -1,6 +1,5 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SWGPet.h" #import "SWGPet.h"
#import "SWGInlineResponse200.h"
#import "SWGObject.h" #import "SWGObject.h"
#import "SWGApiClient.h" #import "SWGApiClient.h"
@ -33,19 +32,6 @@
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
///
///
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
///
///
/// @param body Pet object in the form of byte array (optional)
///
///
/// @return
-(NSNumber*) addPetUsingByteArrayWithBody: (NSString*) body
completionHandler: (void (^)(NSError* error)) handler;
/// ///
/// ///
/// Deletes a pet /// Deletes a pet
@ -64,9 +50,9 @@
/// ///
/// ///
/// Finds Pets by status /// Finds Pets by status
/// Multiple status values can be provided with comma separated strings /// Multiple status values can be provided with comma seperated strings
/// ///
/// @param status Status values that need to be considered for query (optional) (default to available) /// @param status Status values that need to be considered for filter (optional) (default to available)
/// ///
/// ///
/// @return NSArray<SWGPet>* /// @return NSArray<SWGPet>*
@ -100,32 +86,6 @@
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler; completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
///
///
/// Fake endpoint to test inline arbitrary object return by '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
///
///
/// @return SWGInlineResponse200*
-(NSNumber*) getPetByIdInObjectWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGInlineResponse200* output, NSError* error)) handler;
///
///
/// Fake endpoint to test byte array return by '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
///
///
/// @return NSString*
-(NSNumber*) petPetIdtestingByteArraytrueGetWithPetId: (NSNumber*) petId
completionHandler: (void (^)(NSString* output, NSError* error)) handler;
/// ///
/// ///
/// Update an existing pet /// Update an existing pet

View File

@ -1,7 +1,6 @@
#import "SWGPetApi.h" #import "SWGPetApi.h"
#import "SWGQueryParamCollection.h" #import "SWGQueryParamCollection.h"
#import "SWGPet.h" #import "SWGPet.h"
#import "SWGInlineResponse200.h"
@interface SWGPetApi () @interface SWGPetApi ()
@ -132,70 +131,6 @@ static SWGPetApi* singletonAPI = nil;
]; ];
} }
///
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
///
/// @param body Pet object in the form of byte array (optional)
///
/// @returns void
///
-(NSNumber*) addPetUsingByteArrayWithBody: (NSString*) body
completionHandler: (void (^)(NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet?testing_byte_array&#x3D;true"];
// remove format in URL if needed
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
}
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders];
// HTTP header `Accept`
headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]];
if ([headerParams[@"Accept"] length] == 0) {
[headerParams removeObjectForKey:@"Accept"];
}
// response content type
NSString *responseContentType;
if ([headerParams objectForKey:@"Accept"]) {
responseContentType = [headerParams[@"Accept"] componentsSeparatedByString:@", "][0];
}
else {
responseContentType = @"";
}
// request content type
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[@"application/json", @"application/xml"]];
// Authentication setting
NSArray *authSettings = @[@"petstore_auth"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init];
bodyParam = body;
return [self.apiClient requestWithPath: resourcePath
method: @"POST"
pathParams: pathParams
queryParams: queryParams
formParams: formParams
files: localVarFiles
body: bodyParam
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
responseType: nil
completionBlock: ^(id data, NSError *error) {
handler(error);
}
];
}
/// ///
/// Deletes a pet /// Deletes a pet
/// ///
@ -277,8 +212,8 @@ static SWGPetApi* singletonAPI = nil;
/// ///
/// Finds Pets by status /// Finds Pets by status
/// Multiple status values can be provided with comma separated strings /// Multiple status values can be provided with comma seperated strings
/// @param status Status values that need to be considered for query (optional, default to available) /// @param status Status values that need to be considered for filter (optional, default to available)
/// ///
/// @returns NSArray<SWGPet>* /// @returns NSArray<SWGPet>*
/// ///
@ -456,7 +391,7 @@ static SWGPetApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"api_key", @"petstore_auth"]; NSArray *authSettings = @[@"petstore_auth", @"api_key"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
@ -480,148 +415,6 @@ static SWGPetApi* singletonAPI = nil;
]; ];
} }
///
/// Fake endpoint to test inline arbitrary object return by '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 SWGInlineResponse200*
///
-(NSNumber*) getPetByIdInObjectWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGInlineResponse200* output, NSError* error)) handler {
// verify the required parameter 'petId' is set
if (petId == nil) {
[NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `getPetByIdInObject`"];
}
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}?response&#x3D;inline_arbitrary_object"];
// remove format in URL if needed
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
}
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (petId != nil) {
pathParams[@"petId"] = petId;
}
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders];
// HTTP header `Accept`
headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]];
if ([headerParams[@"Accept"] length] == 0) {
[headerParams removeObjectForKey:@"Accept"];
}
// response content type
NSString *responseContentType;
if ([headerParams objectForKey:@"Accept"]) {
responseContentType = [headerParams[@"Accept"] componentsSeparatedByString:@", "][0];
}
else {
responseContentType = @"";
}
// request content type
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init];
return [self.apiClient requestWithPath: resourcePath
method: @"GET"
pathParams: pathParams
queryParams: queryParams
formParams: formParams
files: localVarFiles
body: bodyParam
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
responseType: @"SWGInlineResponse200*"
completionBlock: ^(id data, NSError *error) {
handler((SWGInlineResponse200*)data, error);
}
];
}
///
/// Fake endpoint to test byte array return by '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 NSString*
///
-(NSNumber*) petPetIdtestingByteArraytrueGetWithPetId: (NSNumber*) petId
completionHandler: (void (^)(NSString* output, NSError* error)) handler {
// verify the required parameter 'petId' is set
if (petId == nil) {
[NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `petPetIdtestingByteArraytrueGet`"];
}
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}?testing_byte_array&#x3D;true"];
// remove format in URL if needed
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
}
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
if (petId != nil) {
pathParams[@"petId"] = petId;
}
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders];
// HTTP header `Accept`
headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]];
if ([headerParams[@"Accept"] length] == 0) {
[headerParams removeObjectForKey:@"Accept"];
}
// response content type
NSString *responseContentType;
if ([headerParams objectForKey:@"Accept"]) {
responseContentType = [headerParams[@"Accept"] componentsSeparatedByString:@", "][0];
}
else {
responseContentType = @"";
}
// request content type
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init];
return [self.apiClient requestWithPath: resourcePath
method: @"GET"
pathParams: pathParams
queryParams: queryParams
formParams: formParams
files: localVarFiles
body: bodyParam
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
responseType: @"NSString*"
completionBlock: ^(id data, NSError *error) {
handler((NSString*)data, error);
}
];
}
/// ///
/// Update an existing pet /// Update an existing pet
/// ///

View File

@ -32,19 +32,6 @@
completionHandler: (void (^)(NSError* error)) handler; completionHandler: (void (^)(NSError* error)) handler;
///
///
/// Finds orders by status
/// A single status value can be provided as a string
///
/// @param status Status value that needs to be considered for query (optional) (default to placed)
///
///
/// @return NSArray<SWGOrder>*
-(NSNumber*) findOrdersByStatusWithStatus: (NSString*) status
completionHandler: (void (^)(NSArray<SWGOrder>* output, NSError* error)) handler;
/// ///
/// ///
/// Returns pet inventories by status /// Returns pet inventories by status
@ -57,18 +44,6 @@
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler; (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler;
///
///
/// Fake endpoint to test arbitrary object return by 'Get inventory'
/// Returns an arbitrary object which is actually a map of status codes to quantities
///
///
///
/// @return NSObject*
-(NSNumber*) getInventoryInObjectWithCompletionHandler:
(void (^)(NSObject* output, NSError* error)) handler;
/// ///
/// ///
/// Find purchase order by ID /// Find purchase order by ID

View File

@ -138,72 +138,6 @@ static SWGStoreApi* singletonAPI = nil;
]; ];
} }
///
/// Finds orders by status
/// A single status value can be provided as a string
/// @param status Status value that needs to be considered for query (optional, default to placed)
///
/// @returns NSArray<SWGOrder>*
///
-(NSNumber*) findOrdersByStatusWithStatus: (NSString*) status
completionHandler: (void (^)(NSArray<SWGOrder>* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/findByStatus"];
// remove format in URL if needed
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
}
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
if (status != nil) {
queryParams[@"status"] = status;
}
NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders];
// HTTP header `Accept`
headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]];
if ([headerParams[@"Accept"] length] == 0) {
[headerParams removeObjectForKey:@"Accept"];
}
// response content type
NSString *responseContentType;
if ([headerParams objectForKey:@"Accept"]) {
responseContentType = [headerParams[@"Accept"] componentsSeparatedByString:@", "][0];
}
else {
responseContentType = @"";
}
// request content type
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting
NSArray *authSettings = @[@"test_api_client_id", @"test_api_client_secret"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init];
return [self.apiClient requestWithPath: resourcePath
method: @"GET"
pathParams: pathParams
queryParams: queryParams
formParams: formParams
files: localVarFiles
body: bodyParam
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
responseType: @"NSArray<SWGOrder>*"
completionBlock: ^(id data, NSError *error) {
handler((NSArray<SWGOrder>*)data, error);
}
];
}
/// ///
/// Returns pet inventories by status /// Returns pet inventories by status
/// Returns a map of status codes to quantities /// Returns a map of status codes to quantities
@ -265,67 +199,6 @@ static SWGStoreApi* singletonAPI = nil;
]; ];
} }
///
/// Fake endpoint to test arbitrary object return by 'Get inventory'
/// Returns an arbitrary object which is actually a map of status codes to quantities
/// @returns NSObject*
///
-(NSNumber*) getInventoryInObjectWithCompletionHandler:
(void (^)(NSObject* output, NSError* error)) handler {
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory?response&#x3D;arbitrary_object"];
// remove format in URL if needed
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
}
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders];
// HTTP header `Accept`
headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]];
if ([headerParams[@"Accept"] length] == 0) {
[headerParams removeObjectForKey:@"Accept"];
}
// response content type
NSString *responseContentType;
if ([headerParams objectForKey:@"Accept"]) {
responseContentType = [headerParams[@"Accept"] componentsSeparatedByString:@", "][0];
}
else {
responseContentType = @"";
}
// request content type
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting
NSArray *authSettings = @[@"api_key"];
id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init];
return [self.apiClient requestWithPath: resourcePath
method: @"GET"
pathParams: pathParams
queryParams: queryParams
formParams: formParams
files: localVarFiles
body: bodyParam
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
responseType: @"NSObject*"
completionBlock: ^(id data, NSError *error) {
handler((NSObject*)data, error);
}
];
}
/// ///
/// Find purchase order by ID /// Find purchase order by ID
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -373,7 +246,7 @@ static SWGStoreApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"test_api_key_header", @"test_api_key_query"]; NSArray *authSettings = @[];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
@ -436,7 +309,7 @@ static SWGStoreApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"test_api_client_id", @"test_api_client_secret"]; NSArray *authSettings = @[];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@ -306,7 +306,7 @@ static SWGUserApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"test_http_basic"]; NSArray *authSettings = @[];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@ -1,10 +1,10 @@
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
target 'SwaggerClient_Example', :exclusive => true do target 'SwaggerClient_Example' do
pod "SwaggerClient", :path => "../" pod "SwaggerClient", :path => "../"
end end
target 'SwaggerClient_Tests', :exclusive => true do target 'SwaggerClient_Tests' do
pod "SwaggerClient", :path => "../" pod "SwaggerClient", :path => "../"
pod 'Specta' pod 'Specta'

View File

@ -15,14 +15,15 @@
6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; };
6003F59E195388D20070C39A /* SWGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* SWGAppDelegate.m */; }; 6003F59E195388D20070C39A /* SWGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* SWGAppDelegate.m */; };
6003F5A7195388D20070C39A /* SWGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* SWGViewController.m */; }; 6003F5A7195388D20070C39A /* SWGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* SWGViewController.m */; };
6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */; }; 94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */; };
B2ADC17C287DCABF329BA8AC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC7027D4B025ABCA7999F /* Main.storyboard */; };
B2ADC2D632658A5F73C6CE66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC65E342ADA697322D68C /* Images.xcassets */; };
B2ADC56977372855A63F4E4D /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */; };
CF0ADB481B5F95D6008A2729 /* PetTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0ADB471B5F95D6008A2729 /* PetTest.m */; }; CF0ADB481B5F95D6008A2729 /* PetTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0ADB471B5F95D6008A2729 /* PetTest.m */; };
CF8F71391B5F73AC00162980 /* DeserializationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF8F71381B5F73AC00162980 /* DeserializationTest.m */; }; CF8F71391B5F73AC00162980 /* DeserializationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF8F71381B5F73AC00162980 /* DeserializationTest.m */; };
CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */; }; CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */; };
@ -56,7 +57,6 @@
6003F59D195388D20070C39A /* SWGAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGAppDelegate.m; sourceTree = "<group>"; }; 6003F59D195388D20070C39A /* SWGAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGAppDelegate.m; sourceTree = "<group>"; };
6003F5A5195388D20070C39A /* SWGViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWGViewController.h; sourceTree = "<group>"; }; 6003F5A5195388D20070C39A /* SWGViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWGViewController.h; sourceTree = "<group>"; };
6003F5A6195388D20070C39A /* SWGViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGViewController.m; sourceTree = "<group>"; }; 6003F5A6195388D20070C39A /* SWGViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGViewController.m; sourceTree = "<group>"; };
6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClient_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClient_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; }; 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
@ -64,8 +64,10 @@
6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; }; 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; }; 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.debug.xcconfig"; sourceTree = "<group>"; }; 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.debug.xcconfig"; sourceTree = "<group>"; };
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = "Launch Screen.storyboard"; path = "SwaggerClient/Launch Screen.storyboard"; sourceTree = "<group>"; };
B2ADC65E342ADA697322D68C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SwaggerClient/Images.xcassets; sourceTree = "<group>"; };
B2ADC7027D4B025ABCA7999F /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Main.storyboard; path = SwaggerClient/Main.storyboard; sourceTree = "<group>"; };
BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = "<group>"; }; BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = "<group>"; };
CF0ADB471B5F95D6008A2729 /* PetTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetTest.m; sourceTree = "<group>"; }; CF0ADB471B5F95D6008A2729 /* PetTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetTest.m; sourceTree = "<group>"; };
CF8F71381B5F73AC00162980 /* DeserializationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeserializationTest.m; sourceTree = "<group>"; }; CF8F71381B5F73AC00162980 /* DeserializationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeserializationTest.m; sourceTree = "<group>"; };
@ -121,6 +123,7 @@
children = ( children = (
6003F58A195388D20070C39A /* SwaggerClient_Example.app */, 6003F58A195388D20070C39A /* SwaggerClient_Example.app */,
6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */, 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */,
B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -143,10 +146,8 @@
children = ( children = (
6003F59C195388D20070C39A /* SWGAppDelegate.h */, 6003F59C195388D20070C39A /* SWGAppDelegate.h */,
6003F59D195388D20070C39A /* SWGAppDelegate.m */, 6003F59D195388D20070C39A /* SWGAppDelegate.m */,
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
6003F5A5195388D20070C39A /* SWGViewController.h */, 6003F5A5195388D20070C39A /* SWGViewController.h */,
6003F5A6195388D20070C39A /* SWGViewController.m */, 6003F5A6195388D20070C39A /* SWGViewController.m */,
6003F5A8195388D20070C39A /* Images.xcassets */,
6003F594195388D20070C39A /* Supporting Files */, 6003F594195388D20070C39A /* Supporting Files */,
); );
name = "Example for SwaggerClient"; name = "Example for SwaggerClient";
@ -194,6 +195,8 @@
children = ( children = (
E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */, E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */,
4CCE21315897B7D544C83242 /* README.md */, 4CCE21315897B7D544C83242 /* README.md */,
B2ADC7027D4B025ABCA7999F /* Main.storyboard */,
B2ADC65E342ADA697322D68C /* Images.xcassets */,
); );
name = "Podspec Metadata"; name = "Podspec Metadata";
sourceTree = "<group>"; sourceTree = "<group>";
@ -287,9 +290,10 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
6003F598195388D20070C39A /* InfoPlist.strings in Resources */, 6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
B2ADC17C287DCABF329BA8AC /* Main.storyboard in Resources */,
B2ADC2D632658A5F73C6CE66 /* Images.xcassets in Resources */,
B2ADC56977372855A63F4E4D /* Launch Screen.storyboard in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2016 geekerzp. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="20" y="559" width="560" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SwaggerClient" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="20" y="180" width="560" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@ -2,11 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
@ -29,6 +24,13 @@
<string>1.0</string> <string>1.0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UILaunchStoryboardName</key>
<string>Launch Screen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>

View File

@ -26,9 +26,9 @@
[formatter setTimeZone:timezone]; [formatter setTimeZone:timezone];
[formatter setDateFormat:@"yyyy-MM-dd"]; [formatter setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [formatter dateFromString:dateStr]; NSDate *date = [formatter dateFromString:dateStr];
NSError* error;
NSDate *deserializedDate = [apiClient deserialize:dateStr class:@"NSDate*"]; NSDate *deserializedDate = [apiClient deserialize:dateStr class:@"NSDate*" error:&error];
XCTAssertNil(error);
XCTAssertEqualWithAccuracy([date timeIntervalSinceReferenceDate], [deserializedDate timeIntervalSinceReferenceDate], 0.001); XCTAssertEqualWithAccuracy([date timeIntervalSinceReferenceDate], [deserializedDate timeIntervalSinceReferenceDate], 0.001);
} }
@ -38,30 +38,33 @@
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSDate *dateTime = [formatter dateFromString:dateTimeStr]; NSDate *dateTime = [formatter dateFromString:dateTimeStr];
NSError* error;
NSDate *deserializedDateTime = [apiClient deserialize:dateTimeStr class:@"NSDate*"]; NSDate *deserializedDateTime = [apiClient deserialize:dateTimeStr class:@"NSDate*" error:&error];
XCTAssertNil(error);
XCTAssertEqualWithAccuracy([dateTime timeIntervalSinceReferenceDate], [deserializedDateTime timeIntervalSinceReferenceDate], 0.001); XCTAssertEqualWithAccuracy([dateTime timeIntervalSinceReferenceDate], [deserializedDateTime timeIntervalSinceReferenceDate], 0.001);
} }
- (void)testDeserializeObject { - (void)testDeserializeObject {
NSNumber *data = @1; NSNumber *data = @1;
NSNumber *result = [apiClient deserialize:data class:@"NSObject*"]; NSError* error;
NSNumber *result = [apiClient deserialize:data class:@"NSObject*" error:&error];
XCTAssertNil(error);
XCTAssertEqualObjects(data, result); XCTAssertEqualObjects(data, result);
} }
- (void)testDeserializeString { - (void)testDeserializeString {
NSString *data = @"test string"; NSString *data = @"test string";
NSString *result = [apiClient deserialize:data class:@"NSString*"]; NSError* error;
NSString *result = [apiClient deserialize:data class:@"NSString*" error:&error];
XCTAssertNil(error);
XCTAssertTrue([result isEqualToString:data]); XCTAssertTrue([result isEqualToString:data]);
} }
- (void)testDeserializeListOfString { - (void)testDeserializeListOfString {
NSArray *data = @[@"test string"]; NSArray *data = @[@"test string"];
NSArray *result = [apiClient deserialize:data class:@"NSArray* /* NSString */"]; NSError* error;
NSArray *result = [apiClient deserialize:data class:@"NSArray* /* NSString */" error:&error];
XCTAssertNil(error);
XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([result isKindOfClass:[NSArray class]]);
XCTAssertTrue([result[0] isKindOfClass:[NSString class]]); XCTAssertTrue([result[0] isKindOfClass:[NSString class]]);
} }
@ -88,8 +91,8 @@
@"status": @"available" @"status": @"available"
}]; }];
NSError* error;
NSArray *result = [apiClient deserialize:data class:@"NSArray<SWGPet>*"]; NSArray *result = [apiClient deserialize:data class:@"NSArray<SWGPet>*" error:&error];
XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([result isKindOfClass:[NSArray class]]);
XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]); XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]);
@ -119,8 +122,8 @@
} }
}; };
NSError* error;
NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */"]; NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */" error:&error];
XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result isKindOfClass:[NSDictionary class]]);
XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]); XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]);
@ -134,8 +137,8 @@
@"bar": @1 @"bar": @1
} }
}; };
NSError* error;
NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, NSDictionary* /* NSString, NSNumber */ */"]; NSDictionary *result = [apiClient deserialize:data class:@"NSDictionary* /* NSString, NSDictionary* /* NSString, NSNumber */ */" error:&error];
XCTAssertTrue([result isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result isKindOfClass:[NSDictionary class]]);
XCTAssertTrue([result[@"foo"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"foo"] isKindOfClass:[NSDictionary class]]);
@ -144,8 +147,8 @@
- (void)testDeserializeNestedList { - (void)testDeserializeNestedList {
NSArray *data = @[@[@"foo"]]; NSArray *data = @[@[@"foo"]];
NSError* error;
NSArray *result = [apiClient deserialize:data class:@"NSArray* /* NSArray* /* NSString */ */"]; NSArray *result = [apiClient deserialize:data class:@"NSArray* /* NSArray* /* NSString */ */" error:&error];
XCTAssertTrue([result isKindOfClass:[NSArray class]]); XCTAssertTrue([result isKindOfClass:[NSArray class]]);
XCTAssertTrue([result[0] isKindOfClass:[NSArray class]]); XCTAssertTrue([result[0] isKindOfClass:[NSArray class]]);
@ -157,11 +160,12 @@
NSNumber *result; NSNumber *result;
data = @"true"; data = @"true";
result = [apiClient deserialize:data class:@"NSNumber*"]; NSError* error;
result = [apiClient deserialize:data class:@"NSNumber*" error:&error];
XCTAssertTrue([result isEqual:@YES]); XCTAssertTrue([result isEqual:@YES]);
data = @"false"; data = @"false";
result = [apiClient deserialize:data class:@"NSNumber*"]; result = [apiClient deserialize:data class:@"NSNumber*" error:&error];
XCTAssertTrue([result isEqual:@NO]); XCTAssertTrue([result isEqual:@NO]);
} }

View File

@ -0,0 +1,11 @@
# SWGCategory
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_id** | **NSNumber*** | | [optional]
**name** | **NSString*** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,15 @@
# SWGOrder
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_id** | **NSNumber*** | | [optional]
**petId** | **NSNumber*** | | [optional]
**quantity** | **NSNumber*** | | [optional]
**shipDate** | **NSDate*** | | [optional]
**status** | **NSString*** | Order Status | [optional]
**complete** | **NSNumber*** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,15 @@
# SWGPet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_id** | **NSNumber*** | | [optional]
**category** | [**SWGCategory***](SWGCategory.md) | | [optional]
**name** | **NSString*** | |
**photoUrls** | **NSArray* /* NSString */** | |
**tags** | [**NSArray&lt;SWGTag&gt;***](SWGTag.md) | | [optional]
**status** | **NSString*** | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,530 @@
# SWGPetApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**addPet**](SWGPetApi.md#addpet) | **POST** /pet | Add a new pet to the store
[**deletePet**](SWGPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
[**findPetsByStatus**](SWGPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
[**findPetsByTags**](SWGPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
[**getPetById**](SWGPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
[**updatePet**](SWGPetApi.md#updatepet) | **PUT** /pet | Update an existing pet
[**updatePetWithForm**](SWGPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**uploadFile**](SWGPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
# **addPet**
```objc
-(NSNumber*) addPetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
```
Add a new pet to the store
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
SWGPet* body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**SWGPet***](SWGPet*.md)| Pet object that needs to be added to the store | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **deletePet**
```objc
-(NSNumber*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler;
```
Deletes a pet
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSNumber* petId = @789; // Pet id to delete
NSString* apiKey = @"apiKey_example"; // (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **NSNumber***| Pet id to delete |
**apiKey** | **NSString***| | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **findPetsByStatus**
```objc
-(NSNumber*) findPetsByStatusWithStatus: (NSArray* /* NSString */) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
```
Finds Pets by status
Multiple status values can be provided with comma seperated strings
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSArray* /* NSString */ status = @[@"available"]; // Status values that need to be considered for filter (optional) (default to available)
@try
{
SWGPetApi *apiInstance = [[SWGPetApi alloc] init];
// Finds Pets by status
[apiInstance findPetsByStatusWithStatus:status
completionHandler: ^(NSArray<SWGPet>* 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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**NSArray* /* NSString */**](NSString*.md)| Status values that need to be considered for filter | [optional] [default to available]
### Return type
[**NSArray<SWGPet>***](SWGPet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **findPetsByTags**
```objc
-(NSNumber*) findPetsByTagsWithTags: (NSArray* /* NSString */) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
```
Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSArray* /* NSString */ tags = @[@"tags_example"]; // Tags to filter by (optional)
@try
{
SWGPetApi *apiInstance = [[SWGPetApi alloc] init];
// Finds Pets by tags
[apiInstance findPetsByTagsWithTags:tags
completionHandler: ^(NSArray<SWGPet>* 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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**NSArray* /* NSString */**](NSString*.md)| Tags to filter by | [optional]
### Return type
[**NSArray<SWGPet>***](SWGPet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getPetById**
```objc
-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
```
Find pet by ID
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example
```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"];
NSNumber* petId = @789; // ID of pet that needs to be fetched
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **NSNumber***| ID of pet that needs to be fetched |
### Return type
[**SWGPet***](SWGPet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **updatePet**
```objc
-(NSNumber*) updatePetWithBody: (SWGPet*) body
completionHandler: (void (^)(NSError* error)) handler;
```
Update an existing pet
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
SWGPet* body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**SWGPet***](SWGPet*.md)| Pet object that needs to be added to the store | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **updatePetWithForm**
```objc
-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler;
```
Updates a pet in the store with form data
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
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];
// 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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **NSString***| ID of pet that needs to be updated |
**name** | **NSString***| Updated name of the pet | [optional]
**status** | **NSString***| Updated status of the pet | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **uploadFile**
```objc
-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler;
```
uploads an image
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
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];
// 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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **NSNumber***| ID of pet to update |
**additionalMetadata** | **NSString***| Additional data to pass to server | [optional]
**file** | **NSURL***| file to upload | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,244 @@
# SWGStoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**deleteOrder**](SWGStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
[**getInventory**](SWGStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
[**getOrderById**](SWGStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
[**placeOrder**](SWGStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
# **deleteOrder**
```objc
-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
completionHandler: (void (^)(NSError* error)) handler;
```
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```objc
NSString* orderId = @"orderId_example"; // ID of the order that needs to be deleted
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **NSString***| ID of the order that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getInventory**
```objc
-(NSNumber*) getInventoryWithCompletionHandler:
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler;
```
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```objc
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// 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"];
@try
{
SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init];
// Returns pet inventories by status
[apiInstance getInventoryWithCompletionHandler:
^(NSDictionary* /* NSString, NSNumber */ 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);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**NSDictionary* /* NSString, NSNumber */**](NSDictionary.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getOrderById**
```objc
-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* 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
### Example
```objc
NSString* orderId = @"orderId_example"; // ID of pet that needs to be fetched
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **NSString***| ID of pet that needs to be fetched |
### Return type
[**SWGOrder***](SWGOrder.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **placeOrder**
```objc
-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;
```
Place an order for a pet
### Example
```objc
SWGOrder* body = [[SWGOrder alloc] init]; // order placed for purchasing the pet (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**SWGOrder***](SWGOrder*.md)| order placed for purchasing the pet | [optional]
### Return type
[**SWGOrder***](SWGOrder.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# SWGTag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_id** | **NSNumber*** | | [optional]
**name** | **NSString*** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,17 @@
# SWGUser
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_id** | **NSNumber*** | | [optional]
**username** | **NSString*** | | [optional]
**firstName** | **NSString*** | | [optional]
**lastName** | **NSString*** | | [optional]
**email** | **NSString*** | | [optional]
**password** | **NSString*** | | [optional]
**phone** | **NSString*** | | [optional]
**userStatus** | **NSNumber*** | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,466 @@
# SWGUserApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**createUser**](SWGUserApi.md#createuser) | **POST** /user | Create user
[**createUsersWithArrayInput**](SWGUserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
[**createUsersWithListInput**](SWGUserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
[**deleteUser**](SWGUserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
[**getUserByName**](SWGUserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
[**loginUser**](SWGUserApi.md#loginuser) | **GET** /user/login | Logs user into the system
[**logoutUser**](SWGUserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
[**updateUser**](SWGUserApi.md#updateuser) | **PUT** /user/{username} | Updated user
# **createUser**
```objc
-(NSNumber*) createUserWithBody: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
```
Create user
This can only be done by the logged in user.
### Example
```objc
SWGUser* body = [[SWGUser alloc] init]; // Created user object (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**SWGUser***](SWGUser*.md)| Created user object | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createUsersWithArrayInput**
```objc
-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
```
Creates list of users with given input array
### Example
```objc
NSArray<SWGUser>* body = @[[[SWGUser alloc] init]]; // List of user object (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**NSArray&lt;SWGUser&gt;***](SWGUser.md)| List of user object | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createUsersWithListInput**
```objc
-(NSNumber*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error)) handler;
```
Creates list of users with given input array
### Example
```objc
NSArray<SWGUser>* body = @[[[SWGUser alloc] init]]; // List of user object (optional)
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**NSArray&lt;SWGUser&gt;***](SWGUser.md)| List of user object | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **deleteUser**
```objc
-(NSNumber*) deleteUserWithUsername: (NSString*) username
completionHandler: (void (^)(NSError* error)) handler;
```
Delete user
This can only be done by the logged in user.
### Example
```objc
NSString* username = @"username_example"; // The name that needs to be deleted
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **NSString***| The name that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getUserByName**
```objc
-(NSNumber*) getUserByNameWithUsername: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error)) handler;
```
Get user by user name
### Example
```objc
NSString* username = @"username_example"; // The name that needs to be fetched. Use user1 for testing.
@try
{
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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **NSString***| The name that needs to be fetched. Use user1 for testing. |
### Return type
[**SWGUser***](SWGUser.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **loginUser**
```objc
-(NSNumber*) loginUserWithUsername: (NSString*) username
password: (NSString*) password
completionHandler: (void (^)(NSString* output, NSError* error)) handler;
```
Logs user into the system
### Example
```objc
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];
// 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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **NSString***| The user name for login | [optional]
**password** | **NSString***| The password for login in clear text | [optional]
### Return type
**NSString***
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **logoutUser**
```objc
-(NSNumber*) logoutUserWithCompletionHandler:
(void (^)(NSError* error)) handler;
```
Logs out current logged in user session
### Example
```objc
@try
{
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);
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **updateUser**
```objc
-(NSNumber*) updateUserWithUsername: (NSString*) username
body: (SWGUser*) body
completionHandler: (void (^)(NSError* error)) handler;
```
Updated user
This can only be done by the logged in user.
### Example
```objc
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];
// 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);
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **NSString***| name that need to be deleted |
**body** | [**SWGUser***](SWGUser*.md)| Updated user object | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)