Support map response for objc client.

completed.
This commit is contained in:
geekerzp 2015-06-13 09:32:53 +08:00
parent 0da3e58fff
commit c50c8b724d
18 changed files with 477 additions and 483 deletions

View File

@ -351,6 +351,7 @@ static bool loggingEnabled = true;
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
}
#pragma mark - Deserialize methods
- (id) deserialize:(id) data class:(NSString *) class {
NSRegularExpression *regexp = nil;
@ -358,6 +359,11 @@ static bool loggingEnabled = true;
NSMutableArray *resultArray = nil;
NSMutableDictionary *resultDict = nil;
// remove "*" from class, if ends with "*"
if ([class hasSuffix:@"*"]) {
class = [class substringToIndex:[class length] - 1];
}
// list of models
NSString *arrayOfModelsPat = @"NSArray<(.+)>";
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
@ -371,7 +377,7 @@ static bool loggingEnabled = true;
if (match) {
NSString *innerType = [class substringWithRange:[match rangeAtIndex:1]];
resultArray = [NSMutableArray arrayWithCapacity:[data length]];
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:innerType]];
}
@ -390,7 +396,7 @@ static bool loggingEnabled = true;
range:NSMakeRange(0, [class length])];
if (match) {
resultArray = [NSMutableArray arrayWithCapacity:[data length]];
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]];
}];
@ -399,7 +405,7 @@ static bool loggingEnabled = true;
}
// map
NSString *dictPat = @"NSDictionary /\\* (.+), (.+) \\*/";
NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/";
regexp = [NSRegularExpression regularExpressionWithPattern:dictPat
options:NSRegularExpressionCaseInsensitive
error:nil];
@ -435,7 +441,16 @@ static bool loggingEnabled = true;
return [NSNumber numberWithBool:[data boolValue]];
}
else if ([class isEqualToString:@"NSNumber"]) {
return [data numberFromString:data];
// NSNumber from NSNumber
if ([data isKindOfClass:[NSNumber class]]) {
return data;
}
// NSNumber from NSString
else {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterDecimalStyle;
return [formatter numberFromString:data];
}
}
}

View File

@ -74,12 +74,12 @@ static NSString * basePath = @"{{basePath}}";
{{#operation}}
/*!
* {{{summary}}}
* {{{notes}}}
{{#allParams}} * \param {{paramName}} {{{description}}}
{{/allParams}} * \returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
*/
//
// {{{summary}}}
// {{{notes}}}
// {{#allParams}} @param {{paramName}} {{{description}}}
// {{/allParams}} @returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
//
-(NSNumber*) {{nickname}}WithCompletionBlock{{^allParams}}: {{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}
{{/allParams}}
{{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock{{/returnBaseType}}

View File

@ -17,16 +17,15 @@
+(void) setBasePath:(NSString*)basePath;
+(NSString*) getBasePath;
{{#operation}}
/**
{{{summary}}}
{{#notes}}{{{notes}}}{{/notes}}
{{#allParams}}@param {{paramName}} {{description}}
{{/allParams}}
return type: {{{returnType}}}
*/
//
//
// {{{summary}}}
// {{#notes}}{{{notes}}}{{/notes}}
//
// {{#allParams}}@param {{paramName}} {{description}}
// {{/allParams}}
//
// @return {{{returnType}}}
-(NSNumber*) {{nickname}}WithCompletionBlock {{^allParams}}:{{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}:({{{dataType}}}) {{paramName}} {{#hasMore}}
{{/hasMore}}{{/allParams}}
{{#returnBaseType}}{{#hasParams}}

View File

@ -1,45 +0,0 @@
// {{returnContainer}} container response type
return [self.apiClient dictionary: requestUrl
method: @"{{httpMethod}}"
queryParams: queryParams
body: bodyDictionary
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
completionBlock: ^(NSDictionary *data, NSError *error) {
if (error) {
{{#returnBaseType}}completionBlock(nil, error);{{/returnBaseType}}{{^returnBaseType}}completionBlock(error);{{/returnBaseType}}
return;
}
{{#isMapContainer}}
NSDictionary *result = nil;
if (data) {
result = [[NSDictionary alloc]initWithDictionary: data];
}
completionBlock(data, nil);
{{/isMapContainer}}{{#isListContainer}}
{{#returnBaseType}}if([data isKindOfClass:[NSArray class]]){
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]];
for (NSDictionary* dict in (NSArray*)data) {
{{#returnTypeIsPrimitive}}
{{returnBaseType}}* d = [[{{{returnBaseType}}} alloc]initWithString: dict];
{{/returnTypeIsPrimitive}}
{{^returnTypeIsPrimitive}}
{{{returnBaseType}}}* d = [[{{{returnBaseType}}} alloc] initWithDictionary:dict error:nil];
{{/returnTypeIsPrimitive}}
[objs addObject:d];
}
completionBlock(({{{returnType}}})objs, nil);
}
{{/returnBaseType}}
{{/isListContainer}}
}];

View File

@ -1,24 +0,0 @@
{{^returnTypeIsPrimitive}}
// comples response type
return [self.apiClient dictionary: requestUrl
method: @"{{httpMethod}}"
queryParams: queryParams
body: bodyDictionary
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
completionBlock: ^(NSDictionary *data, NSError *error) {
if (error) {
{{#returnBaseType}}completionBlock(nil, error);{{/returnBaseType}}
{{^returnBaseType}}completionBlock(error);{{/returnBaseType}}
return;
}
{{#returnType}}{{returnType}} result = nil;
if (data) {
result = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{returnBaseType}}} {{/instantiationType}} alloc] {{#returnContainer}}{{#isMapContainer}}initWithDictionary{{/isMapContainer}}{{#isListContainer}} initWithDictionary{{/isListContainer}}{{/returnContainer}}{{^returnContainer}} initWithDictionary{{/returnContainer}}:data error:nil];
}
{{#returnType}}completionBlock(result , nil);{{/returnType}}
{{/returnType}}
}];
{{/returnTypeIsPrimitive}}

View File

@ -1,36 +0,0 @@
// primitive response type
{{#returnBaseType}}return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"{{httpMethod}}"
queryParams: queryParams
body: bodyDictionary
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
completionBlock: ^(NSString *data, NSError *error) {
if (error) {
completionBlock(nil, error);
return;
}
{{returnBaseType}} *result = data ? [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{returnBaseType}}} {{/instantiationType}} alloc]initWithString: data] : nil;
completionBlock(result, nil);
}];
{{/returnBaseType}}
{{^returnBaseType}}
// no return base type
return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"{{httpMethod}}"
queryParams: queryParams
body: bodyDictionary
headerParams: headerParams
requestContentType: requestContentType
responseContentType: responseContentType
completionBlock: ^(NSString *data, NSError *error) {
if (error) {
completionBlock(error);
return;
}
completionBlock(nil);
}];
{{/returnBaseType}}

View File

@ -1,15 +0,0 @@
return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"{{httpMethod}}"
queryParams: queryParams
body: bodyDictionary
headerParams: headerParams
authSettings: authSettings
requestContentType: requestContentType
responseContentType: responseContentType
completionBlock: ^(NSString *data, NSError *error) {
if (error) {
completionBlock(error);
return;
}
completionBlock(nil);
}];

View File

@ -0,0 +1,47 @@
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "SWGStoreApi.h"
@interface StoreApiTest : XCTestCase
@property (nonatomic) SWGStoreApi *api;
@end
@implementation StoreApiTest
- (void)setUp {
[super setUp];
self.api = [[SWGStoreApi alloc] init];
}
- (void)tearDown {
[super tearDown];
}
- (void)testGetInventory {
XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetByStatus"];
[self.api getInventoryWithCompletionBlock:^(NSDictionary *output, NSError *error) {
if (error) {
XCTFail(@"got error %@", error);
}
if (!output) {
XCTFail(@"failed to fetch inventory");
}
NSSet *expectKeys = [NSSet setWithArray:@[@"confused", @"string", @"pending", @"available", @"sold"]];
NSSet *keys = [NSSet setWithArray:[output allKeys]];
XCTAssertEqualObjects(expectKeys, keys);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:10.0 handler:nil];
}
@end

View File

@ -10,6 +10,7 @@
BA525648922D4C0E9F44D4F1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 73DA4F1067C343C3962F1542 /* libPods.a */; };
CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */; };
CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF31D0981B105E4B00509935 /* SWGApiClientTest.m */; };
CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */; };
CFD1B6701B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; };
CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; };
EA66999A1811D2FA00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; };
@ -60,6 +61,7 @@
CF0560E91B1855CF00C0D4EC /* SWGConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGConfiguration.h; sourceTree = "<group>"; };
CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGConfiguration.m; sourceTree = "<group>"; };
CF31D0981B105E4B00509935 /* SWGApiClientTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClientTest.m; sourceTree = "<group>"; };
CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.m; sourceTree = "<group>"; };
CFD1B66E1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSONValueTransformer+ISO8601.h"; sourceTree = "<group>"; };
CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSONValueTransformer+ISO8601.m"; sourceTree = "<group>"; };
E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "../Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
@ -212,6 +214,7 @@
isa = PBXGroup;
children = (
EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */,
CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */,
CF31D0981B105E4B00509935 /* SWGApiClientTest.m */,
EA6699C71811D2FB00A70D03 /* PetApiTest.m */,
EA6699C21811D2FB00A70D03 /* Supporting Files */,
@ -426,6 +429,7 @@
EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */,
CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */,
EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */,
CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */,
CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -8,6 +8,7 @@
#import "ViewController.h"
#import "SWGPetApi.h"
#import "SWGStoreApi.h"
#import "SWGConfiguration.h"
@interface ViewController ()
@ -54,14 +55,6 @@
// }
];
*/
SWGConfiguration *config = [SWGConfiguration sharedConfig];
config.username = @"foo";
config.password = @"bar";
SWGPetApi *api = [[SWGPetApi alloc] init];
[api addPetWithCompletionBlock:nil
completionHandler:^(NSError *error) {
}];
}
- (void)didReceiveMemoryWarning

View File

@ -98,4 +98,66 @@
XCTAssertEqualObjects(basicAuthCredentials, [config getBasicAuthToken]);
}
- (void)testDeserialize {
id data;
id result;
// list of models
data =
@[
@{
@"id": @119,
@"category": @{
@"id": @0,
@"name": @"string"
},
@"name": @"doggie",
@"photoUrls": @[
@"string"
],
@"tags": @[
@{
@"id": @0,
@"name": @"string"
}
],
@"status": @"available"
}];
result = [self.apiClient deserialize:data class:@"NSArray<SWGPet>*"];
XCTAssertTrue([result isKindOfClass:[NSArray class]]);
XCTAssertTrue([[result firstObject] isKindOfClass:[SWGPet class]]);
XCTAssertEqualObjects([[result firstObject] _id], @119);
// map of models
data =
@{
@"pet": @{
@"id": @119,
@"category": @{
@"id": @0,
@"name": @"string"
},
@"name": @"doggie",
@"photoUrls": @[
@"string"
],
@"tags": @[
@{
@"id": @0,
@"name": @"string"
}
],
@"status": @"available"
}
};
result = [self.apiClient deserialize:data class:@"NSDictionary* /* NSString, SWGPet */"];
XCTAssertTrue([result isKindOfClass:[NSDictionary class]]);
XCTAssertTrue([result[@"pet"] isKindOfClass:[SWGPet class]]);
XCTAssertEqualObjects([result[@"pet"] _id], @119);
}
@end

View File

@ -351,6 +351,7 @@ static bool loggingEnabled = true;
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
}
#pragma mark - Deserialize methods
- (id) deserialize:(id) data class:(NSString *) class {
NSRegularExpression *regexp = nil;
@ -358,6 +359,11 @@ static bool loggingEnabled = true;
NSMutableArray *resultArray = nil;
NSMutableDictionary *resultDict = nil;
// remove "*" from class, if ends with "*"
if ([class hasSuffix:@"*"]) {
class = [class substringToIndex:[class length] - 1];
}
// list of models
NSString *arrayOfModelsPat = @"NSArray<(.+)>";
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
@ -371,7 +377,7 @@ static bool loggingEnabled = true;
if (match) {
NSString *innerType = [class substringWithRange:[match rangeAtIndex:1]];
resultArray = [NSMutableArray arrayWithCapacity:[data length]];
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:innerType]];
}
@ -390,7 +396,7 @@ static bool loggingEnabled = true;
range:NSMakeRange(0, [class length])];
if (match) {
resultArray = [NSMutableArray arrayWithCapacity:[data length]];
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]];
}];
@ -399,7 +405,7 @@ static bool loggingEnabled = true;
}
// map
NSString *dictPat = @"NSDictionary /\\* (.+), (.+) \\*/";
NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/";
regexp = [NSRegularExpression regularExpressionWithPattern:dictPat
options:NSRegularExpressionCaseInsensitive
error:nil];
@ -435,7 +441,16 @@ static bool loggingEnabled = true;
return [NSNumber numberWithBool:[data boolValue]];
}
else if ([class isEqualToString:@"NSNumber"]) {
return [data numberFromString:data];
// NSNumber from NSNumber
if ([data isKindOfClass:[NSNumber class]]) {
return data;
}
// NSNumber from NSString
else {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterDecimalStyle;
return [formatter numberFromString:data];
}
}
}

View File

@ -15,98 +15,92 @@
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
+(void) setBasePath:(NSString*)basePath;
+(NSString*) getBasePath;
/**
Update an existing pet
@param body Pet object that needs to be added to the store
return type:
*/
//
//
// Update an existing pet
//
//
// @param body Pet object that needs to be added to the store
//
//
// @return
-(NSNumber*) updatePetWithCompletionBlock :(SWGPet*) body
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Add a new pet to the store
@param body Pet object that needs to be added to the store
return type:
*/
//
//
// Add a new pet to the store
//
//
// @param body Pet object that needs to be added to the store
//
//
// @return
-(NSNumber*) addPetWithCompletionBlock :(SWGPet*) body
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Finds Pets by status
Multiple status values can be provided with comma seperated strings
@param status Status values that need to be considered for filter
return type: NSArray<SWGPet>*
*/
//
//
// Finds Pets by status
// Multiple status values can be provided with comma seperated strings
//
// @param status Status values that need to be considered for filter
//
//
// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByStatusWithCompletionBlock :(NSArray*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
/**
Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
@param tags Tags to filter by
return type: NSArray<SWGPet>*
*/
//
//
// Finds Pets by tags
// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
//
// @param tags Tags to filter by
//
//
// @return NSArray<SWGPet>*
-(NSNumber*) findPetsByTagsWithCompletionBlock :(NSArray*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
/**
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 type: SWGPet*
*/
//
//
// 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 SWGPet*
-(NSNumber*) getPetByIdWithCompletionBlock :(NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock;
/**
Updates a pet in the store with form data
@param petId ID of pet that needs to be updated
@param name Updated name of the pet
@param status Updated status of the pet
return type:
*/
//
//
// Updates a pet in the store with form data
//
//
// @param petId ID of pet that needs to be updated
// @param name Updated name of the pet
// @param status Updated status of the pet
//
//
// @return
-(NSNumber*) updatePetWithFormWithCompletionBlock :(NSString*) petId
name:(NSString*) name
status:(NSString*) status
@ -115,17 +109,16 @@
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Deletes a pet
@param apiKey
@param petId Pet id to delete
return type:
*/
//
//
// Deletes a pet
//
//
// @param apiKey
// @param petId Pet id to delete
//
//
// @return
-(NSNumber*) deletePetWithCompletionBlock :(NSString*) apiKey
petId:(NSNumber*) petId
@ -133,18 +126,17 @@
completionHandler: (void (^)(NSError* error))completionBlock;
/**
uploads an image
@param petId ID of pet to update
@param additionalMetadata Additional data to pass to server
@param file file to upload
return type:
*/
//
//
// uploads an image
//
//
// @param petId ID of pet to update
// @param additionalMetadata Additional data to pass to server
// @param file file to upload
//
//
// @return
-(NSNumber*) uploadFileWithCompletionBlock :(NSNumber*) petId
additionalMetadata:(NSString*) additionalMetadata
file:(SWGFile*) file

View File

@ -72,12 +72,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
}
/*!
* Update an existing pet
*
* \param body Pet object that needs to be added to the store
* \returns void
*/
//
// Update an existing pet
//
// @param body Pet object that needs to be added to the store
// @returns void
//
-(NSNumber*) updatePetWithCompletionBlock: (SWGPet*) body
@ -168,12 +168,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Add a new pet to the store
*
* \param body Pet object that needs to be added to the store
* \returns void
*/
//
// Add a new pet to the store
//
// @param body Pet object that needs to be added to the store
// @returns void
//
-(NSNumber*) addPetWithCompletionBlock: (SWGPet*) body
@ -264,12 +264,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Finds Pets by status
* Multiple status values can be provided with comma seperated strings
* \param status Status values that need to be considered for filter
* \returns NSArray<SWGPet>*
*/
//
// Finds Pets by status
// Multiple status values can be provided with comma seperated strings
// @param status Status values that need to be considered for filter
// @returns NSArray<SWGPet>*
//
-(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
@ -343,12 +343,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* \param tags Tags to filter by
* \returns NSArray<SWGPet>*
*/
//
// Finds Pets by tags
// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
// @param tags Tags to filter by
// @returns NSArray<SWGPet>*
//
-(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
@ -422,12 +422,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Find pet by ID
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
* \param petId ID of pet that needs to be fetched
* \returns SWGPet*
*/
//
// Find pet by ID
// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
// @param petId ID of pet that needs to be fetched
// @returns SWGPet*
//
-(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock
@ -499,14 +499,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Updates a pet in the store with form data
*
* \param petId ID of pet that needs to be updated
* \param name Updated name of the pet
* \param status Updated status of the pet
* \returns void
*/
//
// Updates a pet in the store with form data
//
// @param petId ID of pet that needs to be updated
// @param name Updated name of the pet
// @param status Updated status of the pet
// @returns void
//
-(NSNumber*) updatePetWithFormWithCompletionBlock: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
@ -596,13 +596,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Deletes a pet
*
* \param apiKey
* \param petId Pet id to delete
* \returns void
*/
//
// Deletes a pet
//
// @param apiKey
// @param petId Pet id to delete
// @returns void
//
-(NSNumber*) deletePetWithCompletionBlock: (NSString*) apiKey
petId: (NSNumber*) petId
@ -677,14 +677,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* uploads an image
*
* \param petId ID of pet to update
* \param additionalMetadata Additional data to pass to server
* \param file file to upload
* \returns void
*/
//
// uploads an image
//
// @param petId ID of pet to update
// @param additionalMetadata Additional data to pass to server
// @param file file to upload
// @returns void
//
-(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (SWGFile*) file

View File

@ -14,62 +14,58 @@
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
+(void) setBasePath:(NSString*)basePath;
+(NSString*) getBasePath;
/**
Returns pet inventories by status
Returns a map of status codes to quantities
return type: NSDictionary* /* NSString, NSNumber */
*/
//
//
// Returns pet inventories by status
// Returns a map of status codes to quantities
//
//
//
// @return NSDictionary* /* NSString, NSNumber */
-(NSNumber*) getInventoryWithCompletionBlock :
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock;
/**
Place an order for a pet
@param body order placed for purchasing the pet
return type: SWGOrder*
*/
//
//
// Place an order for a pet
//
//
// @param body order placed for purchasing the pet
//
//
// @return SWGOrder*
-(NSNumber*) placeOrderWithCompletionBlock :(SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
/**
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@param orderId ID of pet that needs to be fetched
return type: SWGOrder*
*/
//
//
// Find purchase order by ID
// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
//
// @param orderId ID of pet that needs to be fetched
//
//
// @return SWGOrder*
-(NSNumber*) getOrderByIdWithCompletionBlock :(NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
/**
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@param orderId ID of the order that needs to be deleted
return type:
*/
//
//
// Delete purchase order by ID
// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
//
// @param orderId ID of the order that needs to be deleted
//
//
// @return
-(NSNumber*) deleteOrderWithCompletionBlock :(NSString*) orderId

View File

@ -71,17 +71,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
}
/*!
* Returns pet inventories by status
* Returns a map of status codes to quantities
* \returns NSDictionary* /* NSString, NSNumber */
*/
//
// Returns pet inventories by status
// Returns a map of status codes to quantities
// @returns NSDictionary* /* NSString, NSNumber */
//
-(NSNumber*) getInventoryWithCompletionBlock:
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock
{
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/inventory", basePath];
// remove format in URL if needed
@ -142,12 +141,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Place an order for a pet
*
* \param body order placed for purchasing the pet
* \returns SWGOrder*
*/
//
// Place an order for a pet
//
// @param body order placed for purchasing the pet
// @returns SWGOrder*
//
-(NSNumber*) placeOrderWithCompletionBlock: (SWGOrder*) body
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
@ -238,12 +237,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Find purchase order by ID
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* \param orderId ID of pet that needs to be fetched
* \returns SWGOrder*
*/
//
// Find purchase order by ID
// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
// @param orderId ID of pet that needs to be fetched
// @returns SWGOrder*
//
-(NSNumber*) getOrderByIdWithCompletionBlock: (NSString*) orderId
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
@ -315,12 +314,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Delete purchase order by ID
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* \param orderId ID of the order that needs to be deleted
* \returns void
*/
//
// Delete purchase order by ID
// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
// @param orderId ID of the order that needs to be deleted
// @returns void
//
-(NSNumber*) deleteOrderWithCompletionBlock: (NSString*) orderId

View File

@ -14,65 +14,61 @@
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
+(void) setBasePath:(NSString*)basePath;
+(NSString*) getBasePath;
/**
Create user
This can only be done by the logged in user.
@param body Created user object
return type:
*/
//
//
// Create user
// This can only be done by the logged in user.
//
// @param body Created user object
//
//
// @return
-(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Creates list of users with given input array
@param body List of user object
return type:
*/
//
//
// Creates list of users with given input array
//
//
// @param body List of user object
//
//
// @return
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Creates list of users with given input array
@param body List of user object
return type:
*/
//
//
// Creates list of users with given input array
//
//
// @param body List of user object
//
//
// @return
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray<SWGUser>*) body
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Logs user into the system
@param username The user name for login
@param password The password for login in clear text
return type: NSString*
*/
//
//
// Logs user into the system
//
//
// @param username The user name for login
// @param password The password for login in clear text
//
//
// @return NSString*
-(NSNumber*) loginUserWithCompletionBlock :(NSString*) username
password:(NSString*) password
@ -80,47 +76,44 @@
/**
Logs out current logged in user session
return type:
*/
//
//
// Logs out current logged in user session
//
//
//
//
// @return
-(NSNumber*) logoutUserWithCompletionBlock :
(void (^)(NSError* error))completionBlock;
/**
Get user by user name
@param username The name that needs to be fetched. Use user1 for testing.
return type: SWGUser*
*/
//
//
// Get user by user name
//
//
// @param username The name that needs to be fetched. Use user1 for testing.
//
//
// @return SWGUser*
-(NSNumber*) getUserByNameWithCompletionBlock :(NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock;
/**
Updated user
This can only be done by the logged in user.
@param username name that need to be deleted
@param body Updated user object
return type:
*/
//
//
// Updated user
// This can only be done by the logged in user.
//
// @param username name that need to be deleted
// @param body Updated user object
//
//
// @return
-(NSNumber*) updateUserWithCompletionBlock :(NSString*) username
body:(SWGUser*) body
@ -128,16 +121,15 @@
completionHandler: (void (^)(NSError* error))completionBlock;
/**
Delete user
This can only be done by the logged in user.
@param username The name that needs to be deleted
return type:
*/
//
//
// Delete user
// This can only be done by the logged in user.
//
// @param username The name that needs to be deleted
//
//
// @return
-(NSNumber*) deleteUserWithCompletionBlock :(NSString*) username

View File

@ -71,12 +71,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
}
/*!
* Create user
* This can only be done by the logged in user.
* \param body Created user object
* \returns void
*/
//
// Create user
// This can only be done by the logged in user.
// @param body Created user object
// @returns void
//
-(NSNumber*) createUserWithCompletionBlock: (SWGUser*) body
@ -167,12 +167,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Creates list of users with given input array
*
* \param body List of user object
* \returns void
*/
//
// Creates list of users with given input array
//
// @param body List of user object
// @returns void
//
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock: (NSArray<SWGUser>*) body
@ -263,12 +263,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Creates list of users with given input array
*
* \param body List of user object
* \returns void
*/
//
// Creates list of users with given input array
//
// @param body List of user object
// @returns void
//
-(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray<SWGUser>*) body
@ -359,13 +359,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Logs user into the system
*
* \param username The user name for login
* \param password The password for login in clear text
* \returns NSString*
*/
//
// Logs user into the system
//
// @param username The user name for login
// @param password The password for login in clear text
// @returns NSString*
//
-(NSNumber*) loginUserWithCompletionBlock: (NSString*) username
password: (NSString*) password
@ -442,11 +442,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Logs out current logged in user session
*
* \returns void
*/
//
// Logs out current logged in user session
//
// @returns void
//
-(NSNumber*) logoutUserWithCompletionBlock:
(void (^)(NSError* error))completionBlock {
@ -513,12 +513,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Get user by user name
*
* \param username The name that needs to be fetched. Use user1 for testing.
* \returns SWGUser*
*/
//
// Get user by user name
//
// @param username The name that needs to be fetched. Use user1 for testing.
// @returns SWGUser*
//
-(NSNumber*) getUserByNameWithCompletionBlock: (NSString*) username
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock
@ -590,13 +590,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Updated user
* This can only be done by the logged in user.
* \param username name that need to be deleted
* \param body Updated user object
* \returns void
*/
//
// Updated user
// This can only be done by the logged in user.
// @param username name that need to be deleted
// @param body Updated user object
// @returns void
//
-(NSNumber*) updateUserWithCompletionBlock: (NSString*) username
body: (SWGUser*) body
@ -692,12 +692,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
];
}
/*!
* Delete user
* This can only be done by the logged in user.
* \param username The name that needs to be deleted
* \returns void
*/
//
// Delete user
// This can only be done by the logged in user.
// @param username The name that needs to be deleted
// @returns void
//
-(NSNumber*) deleteUserWithCompletionBlock: (NSString*) username