forked from loafle/openapi-generator-original
Support map response for objc client.
completed.
This commit is contained in:
parent
0da3e58fff
commit
c50c8b724d
@ -351,6 +351,7 @@ static bool loggingEnabled = true;
|
|||||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Deserialize methods
|
||||||
|
|
||||||
- (id) deserialize:(id) data class:(NSString *) class {
|
- (id) deserialize:(id) data class:(NSString *) class {
|
||||||
NSRegularExpression *regexp = nil;
|
NSRegularExpression *regexp = nil;
|
||||||
@ -358,6 +359,11 @@ static bool loggingEnabled = true;
|
|||||||
NSMutableArray *resultArray = nil;
|
NSMutableArray *resultArray = nil;
|
||||||
NSMutableDictionary *resultDict = nil;
|
NSMutableDictionary *resultDict = nil;
|
||||||
|
|
||||||
|
// remove "*" from class, if ends with "*"
|
||||||
|
if ([class hasSuffix:@"*"]) {
|
||||||
|
class = [class substringToIndex:[class length] - 1];
|
||||||
|
}
|
||||||
|
|
||||||
// list of models
|
// list of models
|
||||||
NSString *arrayOfModelsPat = @"NSArray<(.+)>";
|
NSString *arrayOfModelsPat = @"NSArray<(.+)>";
|
||||||
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
|
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
|
||||||
@ -371,7 +377,7 @@ static bool loggingEnabled = true;
|
|||||||
if (match) {
|
if (match) {
|
||||||
NSString *innerType = [class substringWithRange:[match rangeAtIndex:1]];
|
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) {
|
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
[resultArray addObject:[self deserialize:obj class:innerType]];
|
[resultArray addObject:[self deserialize:obj class:innerType]];
|
||||||
}
|
}
|
||||||
@ -390,7 +396,7 @@ static bool loggingEnabled = true;
|
|||||||
range:NSMakeRange(0, [class length])];
|
range:NSMakeRange(0, [class length])];
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
resultArray = [NSMutableArray arrayWithCapacity:[data length]];
|
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
|
||||||
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
[resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]];
|
[resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]];
|
||||||
}];
|
}];
|
||||||
@ -399,7 +405,7 @@ static bool loggingEnabled = true;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// map
|
// map
|
||||||
NSString *dictPat = @"NSDictionary /\\* (.+), (.+) \\*/";
|
NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/";
|
||||||
regexp = [NSRegularExpression regularExpressionWithPattern:dictPat
|
regexp = [NSRegularExpression regularExpressionWithPattern:dictPat
|
||||||
options:NSRegularExpressionCaseInsensitive
|
options:NSRegularExpressionCaseInsensitive
|
||||||
error:nil];
|
error:nil];
|
||||||
@ -435,7 +441,16 @@ static bool loggingEnabled = true;
|
|||||||
return [NSNumber numberWithBool:[data boolValue]];
|
return [NSNumber numberWithBool:[data boolValue]];
|
||||||
}
|
}
|
||||||
else if ([class isEqualToString:@"NSNumber"]) {
|
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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,12 +74,12 @@ static NSString * basePath = @"{{basePath}}";
|
|||||||
|
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
/*!
|
//
|
||||||
* {{{summary}}}
|
// {{{summary}}}
|
||||||
* {{{notes}}}
|
// {{{notes}}}
|
||||||
{{#allParams}} * \param {{paramName}} {{{description}}}
|
// {{#allParams}} @param {{paramName}} {{{description}}}
|
||||||
{{/allParams}} * \returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
// {{/allParams}} @returns {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
*/
|
//
|
||||||
-(NSNumber*) {{nickname}}WithCompletionBlock{{^allParams}}: {{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}
|
-(NSNumber*) {{nickname}}WithCompletionBlock{{^allParams}}: {{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
{{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock{{/returnBaseType}}
|
{{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock{{/returnBaseType}}
|
||||||
|
@ -17,16 +17,15 @@
|
|||||||
+(void) setBasePath:(NSString*)basePath;
|
+(void) setBasePath:(NSString*)basePath;
|
||||||
+(NSString*) getBasePath;
|
+(NSString*) getBasePath;
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
{{{summary}}}
|
// {{{summary}}}
|
||||||
{{#notes}}{{{notes}}}{{/notes}}
|
// {{#notes}}{{{notes}}}{{/notes}}
|
||||||
|
//
|
||||||
{{#allParams}}@param {{paramName}} {{description}}
|
// {{#allParams}}@param {{paramName}} {{description}}
|
||||||
{{/allParams}}
|
// {{/allParams}}
|
||||||
|
//
|
||||||
return type: {{{returnType}}}
|
// @return {{{returnType}}}
|
||||||
*/
|
|
||||||
-(NSNumber*) {{nickname}}WithCompletionBlock {{^allParams}}:{{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}:({{{dataType}}}) {{paramName}} {{#hasMore}}
|
-(NSNumber*) {{nickname}}WithCompletionBlock {{^allParams}}:{{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}:({{{dataType}}}) {{paramName}} {{#hasMore}}
|
||||||
{{/hasMore}}{{/allParams}}
|
{{/hasMore}}{{/allParams}}
|
||||||
{{#returnBaseType}}{{#hasParams}}
|
{{#returnBaseType}}{{#hasParams}}
|
||||||
|
@ -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}}
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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}}
|
|
@ -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}}
|
|
||||||
|
|
@ -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);
|
|
||||||
}];
|
|
@ -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
|
@ -10,6 +10,7 @@
|
|||||||
BA525648922D4C0E9F44D4F1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 73DA4F1067C343C3962F1542 /* libPods.a */; };
|
BA525648922D4C0E9F44D4F1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 73DA4F1067C343C3962F1542 /* libPods.a */; };
|
||||||
CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */; };
|
CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */; };
|
||||||
CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF31D0981B105E4B00509935 /* SWGApiClientTest.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 */; };
|
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 */; };
|
CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; };
|
||||||
EA66999A1811D2FA00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */,
|
EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */,
|
||||||
|
CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */,
|
||||||
CF31D0981B105E4B00509935 /* SWGApiClientTest.m */,
|
CF31D0981B105E4B00509935 /* SWGApiClientTest.m */,
|
||||||
EA6699C71811D2FB00A70D03 /* PetApiTest.m */,
|
EA6699C71811D2FB00A70D03 /* PetApiTest.m */,
|
||||||
EA6699C21811D2FB00A70D03 /* Supporting Files */,
|
EA6699C21811D2FB00A70D03 /* Supporting Files */,
|
||||||
@ -426,6 +429,7 @@
|
|||||||
EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */,
|
EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */,
|
||||||
CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */,
|
CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */,
|
||||||
EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */,
|
EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */,
|
||||||
|
CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */,
|
||||||
CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */,
|
CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#import "ViewController.h"
|
#import "ViewController.h"
|
||||||
#import "SWGPetApi.h"
|
#import "SWGPetApi.h"
|
||||||
|
#import "SWGStoreApi.h"
|
||||||
#import "SWGConfiguration.h"
|
#import "SWGConfiguration.h"
|
||||||
|
|
||||||
@interface ViewController ()
|
@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
|
- (void)didReceiveMemoryWarning
|
||||||
|
@ -98,4 +98,66 @@
|
|||||||
XCTAssertEqualObjects(basicAuthCredentials, [config getBasicAuthToken]);
|
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
|
@end
|
||||||
|
@ -351,6 +351,7 @@ static bool loggingEnabled = true;
|
|||||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Deserialize methods
|
||||||
|
|
||||||
- (id) deserialize:(id) data class:(NSString *) class {
|
- (id) deserialize:(id) data class:(NSString *) class {
|
||||||
NSRegularExpression *regexp = nil;
|
NSRegularExpression *regexp = nil;
|
||||||
@ -358,6 +359,11 @@ static bool loggingEnabled = true;
|
|||||||
NSMutableArray *resultArray = nil;
|
NSMutableArray *resultArray = nil;
|
||||||
NSMutableDictionary *resultDict = nil;
|
NSMutableDictionary *resultDict = nil;
|
||||||
|
|
||||||
|
// remove "*" from class, if ends with "*"
|
||||||
|
if ([class hasSuffix:@"*"]) {
|
||||||
|
class = [class substringToIndex:[class length] - 1];
|
||||||
|
}
|
||||||
|
|
||||||
// list of models
|
// list of models
|
||||||
NSString *arrayOfModelsPat = @"NSArray<(.+)>";
|
NSString *arrayOfModelsPat = @"NSArray<(.+)>";
|
||||||
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
|
regexp = [NSRegularExpression regularExpressionWithPattern:arrayOfModelsPat
|
||||||
@ -371,7 +377,7 @@ static bool loggingEnabled = true;
|
|||||||
if (match) {
|
if (match) {
|
||||||
NSString *innerType = [class substringWithRange:[match rangeAtIndex:1]];
|
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) {
|
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
[resultArray addObject:[self deserialize:obj class:innerType]];
|
[resultArray addObject:[self deserialize:obj class:innerType]];
|
||||||
}
|
}
|
||||||
@ -390,7 +396,7 @@ static bool loggingEnabled = true;
|
|||||||
range:NSMakeRange(0, [class length])];
|
range:NSMakeRange(0, [class length])];
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
resultArray = [NSMutableArray arrayWithCapacity:[data length]];
|
resultArray = [NSMutableArray arrayWithCapacity:[data count]];
|
||||||
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
[data enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
[resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]];
|
[resultArray addObject:[self deserialize:obj class:NSStringFromClass([obj class])]];
|
||||||
}];
|
}];
|
||||||
@ -399,7 +405,7 @@ static bool loggingEnabled = true;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// map
|
// map
|
||||||
NSString *dictPat = @"NSDictionary /\\* (.+), (.+) \\*/";
|
NSString *dictPat = @"NSDictionary\\* /\\* (.+), (.+) \\*/";
|
||||||
regexp = [NSRegularExpression regularExpressionWithPattern:dictPat
|
regexp = [NSRegularExpression regularExpressionWithPattern:dictPat
|
||||||
options:NSRegularExpressionCaseInsensitive
|
options:NSRegularExpressionCaseInsensitive
|
||||||
error:nil];
|
error:nil];
|
||||||
@ -435,7 +441,16 @@ static bool loggingEnabled = true;
|
|||||||
return [NSNumber numberWithBool:[data boolValue]];
|
return [NSNumber numberWithBool:[data boolValue]];
|
||||||
}
|
}
|
||||||
else if ([class isEqualToString:@"NSNumber"]) {
|
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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,98 +15,92 @@
|
|||||||
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
+(void) setBasePath:(NSString*)basePath;
|
+(void) setBasePath:(NSString*)basePath;
|
||||||
+(NSString*) getBasePath;
|
+(NSString*) getBasePath;
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Update an existing pet
|
// Update an existing pet
|
||||||
|
//
|
||||||
|
//
|
||||||
@param body Pet object that needs to be added to the store
|
// @param body Pet object that needs to be added to the store
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) updatePetWithCompletionBlock :(SWGPet*) body
|
-(NSNumber*) updatePetWithCompletionBlock :(SWGPet*) body
|
||||||
|
|
||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Add a new pet to the store
|
// Add a new pet to the store
|
||||||
|
//
|
||||||
|
//
|
||||||
@param body Pet object that needs to be added to the store
|
// @param body Pet object that needs to be added to the store
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) addPetWithCompletionBlock :(SWGPet*) body
|
-(NSNumber*) addPetWithCompletionBlock :(SWGPet*) body
|
||||||
|
|
||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Finds Pets by status
|
// Finds Pets by status
|
||||||
Multiple status values can be provided with comma seperated strings
|
// Multiple status values can be provided with comma seperated strings
|
||||||
|
//
|
||||||
@param status Status values that need to be considered for filter
|
// @param status Status values that need to be considered for filter
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: NSArray<SWGPet>*
|
// @return NSArray<SWGPet>*
|
||||||
*/
|
|
||||||
-(NSNumber*) findPetsByStatusWithCompletionBlock :(NSArray*) status
|
-(NSNumber*) findPetsByStatusWithCompletionBlock :(NSArray*) status
|
||||||
|
|
||||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
|
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Finds Pets by tags
|
// Finds Pets by tags
|
||||||
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
//
|
||||||
@param tags Tags to filter by
|
// @param tags Tags to filter by
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: NSArray<SWGPet>*
|
// @return NSArray<SWGPet>*
|
||||||
*/
|
|
||||||
-(NSNumber*) findPetsByTagsWithCompletionBlock :(NSArray*) tags
|
-(NSNumber*) findPetsByTagsWithCompletionBlock :(NSArray*) tags
|
||||||
|
|
||||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
|
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Find pet by ID
|
// Find pet by ID
|
||||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
// 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
|
// @param petId ID of pet that needs to be fetched
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: SWGPet*
|
// @return SWGPet*
|
||||||
*/
|
|
||||||
-(NSNumber*) getPetByIdWithCompletionBlock :(NSNumber*) petId
|
-(NSNumber*) getPetByIdWithCompletionBlock :(NSNumber*) petId
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock;
|
completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Updates a pet in the store with form data
|
// Updates a pet in the store with form data
|
||||||
|
//
|
||||||
|
//
|
||||||
@param petId ID of pet that needs to be updated
|
// @param petId ID of pet that needs to be updated
|
||||||
@param name Updated name of the pet
|
// @param name Updated name of the pet
|
||||||
@param status Updated status of the pet
|
// @param status Updated status of the pet
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) updatePetWithFormWithCompletionBlock :(NSString*) petId
|
-(NSNumber*) updatePetWithFormWithCompletionBlock :(NSString*) petId
|
||||||
name:(NSString*) name
|
name:(NSString*) name
|
||||||
status:(NSString*) status
|
status:(NSString*) status
|
||||||
@ -115,17 +109,16 @@
|
|||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Deletes a pet
|
// Deletes a pet
|
||||||
|
//
|
||||||
|
//
|
||||||
@param apiKey
|
// @param apiKey
|
||||||
@param petId Pet id to delete
|
// @param petId Pet id to delete
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) deletePetWithCompletionBlock :(NSString*) apiKey
|
-(NSNumber*) deletePetWithCompletionBlock :(NSString*) apiKey
|
||||||
petId:(NSNumber*) petId
|
petId:(NSNumber*) petId
|
||||||
|
|
||||||
@ -133,18 +126,17 @@
|
|||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
uploads an image
|
// uploads an image
|
||||||
|
//
|
||||||
|
//
|
||||||
@param petId ID of pet to update
|
// @param petId ID of pet to update
|
||||||
@param additionalMetadata Additional data to pass to server
|
// @param additionalMetadata Additional data to pass to server
|
||||||
@param file file to upload
|
// @param file file to upload
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) uploadFileWithCompletionBlock :(NSNumber*) petId
|
-(NSNumber*) uploadFileWithCompletionBlock :(NSNumber*) petId
|
||||||
additionalMetadata:(NSString*) additionalMetadata
|
additionalMetadata:(NSString*) additionalMetadata
|
||||||
file:(SWGFile*) file
|
file:(SWGFile*) file
|
||||||
|
@ -72,12 +72,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Update an existing pet
|
// Update an existing pet
|
||||||
*
|
//
|
||||||
* \param body Pet object that needs to be added to the store
|
// @param body Pet object that needs to be added to the store
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) updatePetWithCompletionBlock: (SWGPet*) body
|
-(NSNumber*) updatePetWithCompletionBlock: (SWGPet*) body
|
||||||
|
|
||||||
|
|
||||||
@ -168,12 +168,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Add a new pet to the store
|
// Add a new pet to the store
|
||||||
*
|
//
|
||||||
* \param body Pet object that needs to be added to the store
|
// @param body Pet object that needs to be added to the store
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) addPetWithCompletionBlock: (SWGPet*) body
|
-(NSNumber*) addPetWithCompletionBlock: (SWGPet*) body
|
||||||
|
|
||||||
|
|
||||||
@ -264,12 +264,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Finds Pets by status
|
// Finds Pets by status
|
||||||
* Multiple status values can be provided with comma seperated strings
|
// Multiple status values can be provided with comma seperated strings
|
||||||
* \param status Status values that need to be considered for filter
|
// @param status Status values that need to be considered for filter
|
||||||
* \returns NSArray<SWGPet>*
|
// @returns NSArray<SWGPet>*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status
|
-(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status
|
||||||
|
|
||||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
|
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
|
||||||
@ -343,12 +343,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Finds Pets by tags
|
// Finds Pets by tags
|
||||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
* \param tags Tags to filter by
|
// @param tags Tags to filter by
|
||||||
* \returns NSArray<SWGPet>*
|
// @returns NSArray<SWGPet>*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags
|
-(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags
|
||||||
|
|
||||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
|
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
|
||||||
@ -422,12 +422,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Find pet by ID
|
// Find pet by ID
|
||||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
// 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
|
// @param petId ID of pet that needs to be fetched
|
||||||
* \returns SWGPet*
|
// @returns SWGPet*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId
|
-(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock
|
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
|
// Updates a pet in the store with form data
|
||||||
*
|
//
|
||||||
* \param petId ID of pet that needs to be updated
|
// @param petId ID of pet that needs to be updated
|
||||||
* \param name Updated name of the pet
|
// @param name Updated name of the pet
|
||||||
* \param status Updated status of the pet
|
// @param status Updated status of the pet
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) updatePetWithFormWithCompletionBlock: (NSString*) petId
|
-(NSNumber*) updatePetWithFormWithCompletionBlock: (NSString*) petId
|
||||||
name: (NSString*) name
|
name: (NSString*) name
|
||||||
status: (NSString*) status
|
status: (NSString*) status
|
||||||
@ -596,13 +596,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Deletes a pet
|
// Deletes a pet
|
||||||
*
|
//
|
||||||
* \param apiKey
|
// @param apiKey
|
||||||
* \param petId Pet id to delete
|
// @param petId Pet id to delete
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) deletePetWithCompletionBlock: (NSString*) apiKey
|
-(NSNumber*) deletePetWithCompletionBlock: (NSString*) apiKey
|
||||||
petId: (NSNumber*) petId
|
petId: (NSNumber*) petId
|
||||||
|
|
||||||
@ -677,14 +677,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* uploads an image
|
// uploads an image
|
||||||
*
|
//
|
||||||
* \param petId ID of pet to update
|
// @param petId ID of pet to update
|
||||||
* \param additionalMetadata Additional data to pass to server
|
// @param additionalMetadata Additional data to pass to server
|
||||||
* \param file file to upload
|
// @param file file to upload
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId
|
-(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId
|
||||||
additionalMetadata: (NSString*) additionalMetadata
|
additionalMetadata: (NSString*) additionalMetadata
|
||||||
file: (SWGFile*) file
|
file: (SWGFile*) file
|
||||||
|
@ -14,62 +14,58 @@
|
|||||||
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
+(void) setBasePath:(NSString*)basePath;
|
+(void) setBasePath:(NSString*)basePath;
|
||||||
+(NSString*) getBasePath;
|
+(NSString*) getBasePath;
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
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
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: NSDictionary* /* NSString, NSNumber */
|
// @return NSDictionary* /* NSString, NSNumber */
|
||||||
*/
|
|
||||||
-(NSNumber*) getInventoryWithCompletionBlock :
|
-(NSNumber*) getInventoryWithCompletionBlock :
|
||||||
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock;
|
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Place an order for a pet
|
// Place an order for a pet
|
||||||
|
//
|
||||||
|
//
|
||||||
@param body order placed for purchasing the pet
|
// @param body order placed for purchasing the pet
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: SWGOrder*
|
// @return SWGOrder*
|
||||||
*/
|
|
||||||
-(NSNumber*) placeOrderWithCompletionBlock :(SWGOrder*) body
|
-(NSNumber*) placeOrderWithCompletionBlock :(SWGOrder*) body
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
|
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
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
|
||||||
|
//
|
||||||
@param orderId ID of pet that needs to be fetched
|
// @param orderId ID of pet that needs to be fetched
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: SWGOrder*
|
// @return SWGOrder*
|
||||||
*/
|
|
||||||
-(NSNumber*) getOrderByIdWithCompletionBlock :(NSString*) orderId
|
-(NSNumber*) getOrderByIdWithCompletionBlock :(NSString*) orderId
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
|
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Delete purchase order by ID
|
// Delete purchase order by ID
|
||||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
// 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
|
// @param orderId ID of the order that needs to be deleted
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) deleteOrderWithCompletionBlock :(NSString*) orderId
|
-(NSNumber*) deleteOrderWithCompletionBlock :(NSString*) orderId
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,17 +71,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* 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
|
||||||
* \returns NSDictionary* /* NSString, NSNumber */
|
// @returns NSDictionary* /* NSString, NSNumber */
|
||||||
*/
|
//
|
||||||
-(NSNumber*) getInventoryWithCompletionBlock:
|
-(NSNumber*) getInventoryWithCompletionBlock:
|
||||||
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock
|
(void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/inventory", basePath];
|
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/inventory", basePath];
|
||||||
|
|
||||||
// remove format in URL if needed
|
// remove format in URL if needed
|
||||||
@ -142,12 +141,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Place an order for a pet
|
// Place an order for a pet
|
||||||
*
|
//
|
||||||
* \param body order placed for purchasing the pet
|
// @param body order placed for purchasing the pet
|
||||||
* \returns SWGOrder*
|
// @returns SWGOrder*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) placeOrderWithCompletionBlock: (SWGOrder*) body
|
-(NSNumber*) placeOrderWithCompletionBlock: (SWGOrder*) body
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
|
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
|
||||||
@ -238,12 +237,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* 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
|
||||||
* \param orderId ID of pet that needs to be fetched
|
// @param orderId ID of pet that needs to be fetched
|
||||||
* \returns SWGOrder*
|
// @returns SWGOrder*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) getOrderByIdWithCompletionBlock: (NSString*) orderId
|
-(NSNumber*) getOrderByIdWithCompletionBlock: (NSString*) orderId
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
|
completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
|
||||||
@ -315,12 +314,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Delete purchase order by ID
|
// Delete purchase order by ID
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
// 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
|
// @param orderId ID of the order that needs to be deleted
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) deleteOrderWithCompletionBlock: (NSString*) orderId
|
-(NSNumber*) deleteOrderWithCompletionBlock: (NSString*) orderId
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,65 +14,61 @@
|
|||||||
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
|
||||||
+(void) setBasePath:(NSString*)basePath;
|
+(void) setBasePath:(NSString*)basePath;
|
||||||
+(NSString*) getBasePath;
|
+(NSString*) getBasePath;
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Create user
|
// Create user
|
||||||
This can only be done by the logged in user.
|
// This can only be done by the logged in user.
|
||||||
|
//
|
||||||
@param body Created user object
|
// @param body Created user object
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body
|
-(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body
|
||||||
|
|
||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Creates list of users with given input array
|
// Creates list of users with given input array
|
||||||
|
//
|
||||||
|
//
|
||||||
@param body List of user object
|
// @param body List of user object
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray<SWGUser>*) body
|
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray<SWGUser>*) body
|
||||||
|
|
||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Creates list of users with given input array
|
// Creates list of users with given input array
|
||||||
|
//
|
||||||
|
//
|
||||||
@param body List of user object
|
// @param body List of user object
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray<SWGUser>*) body
|
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray<SWGUser>*) body
|
||||||
|
|
||||||
|
|
||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Logs user into the system
|
// Logs user into the system
|
||||||
|
//
|
||||||
|
//
|
||||||
@param username The user name for login
|
// @param username The user name for login
|
||||||
@param password The password for login in clear text
|
// @param password The password for login in clear text
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: NSString*
|
// @return NSString*
|
||||||
*/
|
|
||||||
-(NSNumber*) loginUserWithCompletionBlock :(NSString*) username
|
-(NSNumber*) loginUserWithCompletionBlock :(NSString*) username
|
||||||
password:(NSString*) password
|
password:(NSString*) password
|
||||||
|
|
||||||
@ -80,47 +76,44 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Logs out current logged in user session
|
// Logs out current logged in user session
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) logoutUserWithCompletionBlock :
|
-(NSNumber*) logoutUserWithCompletionBlock :
|
||||||
|
|
||||||
(void (^)(NSError* error))completionBlock;
|
(void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Get user by user name
|
// Get user by user name
|
||||||
|
//
|
||||||
|
//
|
||||||
@param username The name that needs to be fetched. Use user1 for testing.
|
// @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
|
//
|
||||||
|
//
|
||||||
return type: SWGUser*
|
// @return SWGUser*
|
||||||
*/
|
|
||||||
-(NSNumber*) getUserByNameWithCompletionBlock :(NSString*) username
|
-(NSNumber*) getUserByNameWithCompletionBlock :(NSString*) username
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock;
|
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Updated user
|
// Updated user
|
||||||
This can only be done by the logged in user.
|
// This can only be done by the logged in user.
|
||||||
|
//
|
||||||
@param username name that need to be deleted
|
// @param username name that need to be deleted
|
||||||
@param body Updated user object
|
// @param body Updated user object
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) updateUserWithCompletionBlock :(NSString*) username
|
-(NSNumber*) updateUserWithCompletionBlock :(NSString*) username
|
||||||
body:(SWGUser*) body
|
body:(SWGUser*) body
|
||||||
|
|
||||||
@ -128,16 +121,15 @@
|
|||||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||||
|
|
||||||
|
|
||||||
/**
|
//
|
||||||
|
//
|
||||||
Delete user
|
// Delete user
|
||||||
This can only be done by the logged in user.
|
// This can only be done by the logged in user.
|
||||||
|
//
|
||||||
@param username The name that needs to be deleted
|
// @param username The name that needs to be deleted
|
||||||
|
//
|
||||||
|
//
|
||||||
return type:
|
// @return
|
||||||
*/
|
|
||||||
-(NSNumber*) deleteUserWithCompletionBlock :(NSString*) username
|
-(NSNumber*) deleteUserWithCompletionBlock :(NSString*) username
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,12 +71,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Create user
|
// Create user
|
||||||
* This can only be done by the logged in user.
|
// This can only be done by the logged in user.
|
||||||
* \param body Created user object
|
// @param body Created user object
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) createUserWithCompletionBlock: (SWGUser*) body
|
-(NSNumber*) createUserWithCompletionBlock: (SWGUser*) body
|
||||||
|
|
||||||
|
|
||||||
@ -167,12 +167,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Creates list of users with given input array
|
// Creates list of users with given input array
|
||||||
*
|
//
|
||||||
* \param body List of user object
|
// @param body List of user object
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock: (NSArray<SWGUser>*) body
|
-(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
|
// Creates list of users with given input array
|
||||||
*
|
//
|
||||||
* \param body List of user object
|
// @param body List of user object
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray<SWGUser>*) body
|
-(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray<SWGUser>*) body
|
||||||
|
|
||||||
|
|
||||||
@ -359,13 +359,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Logs user into the system
|
// Logs user into the system
|
||||||
*
|
//
|
||||||
* \param username The user name for login
|
// @param username The user name for login
|
||||||
* \param password The password for login in clear text
|
// @param password The password for login in clear text
|
||||||
* \returns NSString*
|
// @returns NSString*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) loginUserWithCompletionBlock: (NSString*) username
|
-(NSNumber*) loginUserWithCompletionBlock: (NSString*) username
|
||||||
password: (NSString*) password
|
password: (NSString*) password
|
||||||
|
|
||||||
@ -442,11 +442,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Logs out current logged in user session
|
// Logs out current logged in user session
|
||||||
*
|
//
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) logoutUserWithCompletionBlock:
|
-(NSNumber*) logoutUserWithCompletionBlock:
|
||||||
|
|
||||||
(void (^)(NSError* error))completionBlock {
|
(void (^)(NSError* error))completionBlock {
|
||||||
@ -513,12 +513,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Get user by user name
|
// Get user by user name
|
||||||
*
|
//
|
||||||
* \param username The name that needs to be fetched. Use user1 for testing.
|
// @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
* \returns SWGUser*
|
// @returns SWGUser*
|
||||||
*/
|
//
|
||||||
-(NSNumber*) getUserByNameWithCompletionBlock: (NSString*) username
|
-(NSNumber*) getUserByNameWithCompletionBlock: (NSString*) username
|
||||||
|
|
||||||
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock
|
completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock
|
||||||
@ -590,13 +590,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Updated user
|
// Updated user
|
||||||
* This can only be done by the logged in user.
|
// This can only be done by the logged in user.
|
||||||
* \param username name that need to be deleted
|
// @param username name that need to be deleted
|
||||||
* \param body Updated user object
|
// @param body Updated user object
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) updateUserWithCompletionBlock: (NSString*) username
|
-(NSNumber*) updateUserWithCompletionBlock: (NSString*) username
|
||||||
body: (SWGUser*) body
|
body: (SWGUser*) body
|
||||||
|
|
||||||
@ -692,12 +692,12 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
//
|
||||||
* Delete user
|
// Delete user
|
||||||
* This can only be done by the logged in user.
|
// This can only be done by the logged in user.
|
||||||
* \param username The name that needs to be deleted
|
// @param username The name that needs to be deleted
|
||||||
* \returns void
|
// @returns void
|
||||||
*/
|
//
|
||||||
-(NSNumber*) deleteUserWithCompletionBlock: (NSString*) username
|
-(NSNumber*) deleteUserWithCompletionBlock: (NSString*) username
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user