Merge pull request #793 from geekerzp/develop_2.0_objc_apiclient

Make objc client more pluggable
This commit is contained in:
Tony Tam 2015-06-05 00:40:17 -07:00
commit 29bd743391
15 changed files with 186 additions and 129 deletions

View File

@ -134,10 +134,12 @@ static bool loggingEnabled = true;
} }
+(NSNumber*) nextRequestId { +(NSNumber*) nextRequestId {
long nextId = ++requestId; @synchronized(self) {
if(loggingEnabled) long nextId = ++requestId;
NSLog(@"got id %ld", nextId); if(loggingEnabled)
return [NSNumber numberWithLong:nextId]; NSLog(@"got id %ld", nextId);
return [NSNumber numberWithLong:nextId];
}
} }
+(NSNumber*) queueRequest { +(NSNumber*) queueRequest {

View File

@ -2,7 +2,6 @@
#import "{{classname}}.h" #import "{{classname}}.h"
#import "SWGFile.h" #import "SWGFile.h"
#import "SWGQueryParamCollection.h" #import "SWGQueryParamCollection.h"
#import "SWGApiClient.h"
{{#imports}}#import "{{import}}.h" {{#imports}}#import "{{import}}.h"
{{/imports}} {{/imports}}
{{newline}} {{newline}}
@ -12,8 +11,34 @@
@end @end
@implementation {{classname}} @implementation {{classname}}
static NSString * basePath = @"{{basePath}}"; static NSString * basePath = @"{{basePath}}";
#pragma mark - Initialize methods
- (id) init {
self = [super init];
if (self) {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
- (id) initWithApiClient:(SWGApiClient *)apiClient {
self = [super init];
if (self) {
if (apiClient) {
self.apiClient = apiClient;
}
else {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
}
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { +({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static {{classname}}* singletonAPI = nil; static {{classname}}* singletonAPI = nil;
@ -32,21 +57,10 @@ static NSString * basePath = @"{{basePath}}";
return basePath; return basePath;
} }
-(SWGApiClient*) apiClient {
return [SWGApiClient sharedClientFromPool:basePath];
}
-(void) addHeader:(NSString*)value forKey:(NSString*)key { -(void) addHeader:(NSString*)value forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
} }
-(id) init {
self = [super init];
self.defaultHeaders = [NSMutableDictionary dictionary];
[self apiClient];
return self;
}
-(void) setHeaderValue:(NSString*) value -(void) setHeaderValue:(NSString*) value
forKey:(NSString*)key { forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
@ -177,8 +191,6 @@ static NSString * basePath = @"{{basePath}}";
{{/requiredParams}} {{/requiredParams}}
{{/requiredParamCount}} {{/requiredParamCount}}
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
{{#returnContainer}} {{#returnContainer}}
// response is in a container // response is in a container
{{>apiBodyResponseWithContainer}}{{/returnContainer}} {{>apiBodyResponseWithContainer}}{{/returnContainer}}
@ -206,3 +218,6 @@ static NSString * basePath = @"{{basePath}}";
{{newline}} {{newline}}
{{/operations}} {{/operations}}
@end @end

View File

@ -2,11 +2,14 @@
{{#imports}}#import "{{import}}.h" {{#imports}}#import "{{import}}.h"
{{/imports}} {{/imports}}
#import "SWGObject.h" #import "SWGObject.h"
#import "SWGApiClient.h"
{{newline}} {{newline}}
{{#operations}} {{#operations}}
@interface {{classname}}: NSObject @interface {{classname}}: NSObject
@property(nonatomic, assign)SWGApiClient *apiClient;
-(void) addHeader:(NSString*)value forKey:(NSString*)key; -(void) addHeader:(NSString*)value forKey:(NSString*)key;
-(unsigned long) requestQueueSize; -(unsigned long) requestQueueSize;
+({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
@ -34,4 +37,4 @@
{{/operation}} {{/operation}}
{{/operations}} {{/operations}}
@end @end

View File

@ -1,5 +1,5 @@
// {{returnContainer}} container response type // {{returnContainer}} container response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"{{httpMethod}}" method: @"{{httpMethod}}"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -34,4 +34,4 @@
{{/returnBaseType}} {{/returnBaseType}}
{{/isListContainer}} {{/isListContainer}}
}]; }];

View File

@ -1,6 +1,6 @@
{{^returnTypeIsPrimitive}} {{^returnTypeIsPrimitive}}
// comples response type // comples response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"{{httpMethod}}" method: @"{{httpMethod}}"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary

View File

@ -1,5 +1,5 @@
// primitive response type // primitive response type
{{#returnBaseType}}return [client stringWithCompletionBlock: requestUrl {{#returnBaseType}}return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"{{httpMethod}}" method: @"{{httpMethod}}"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -17,7 +17,7 @@
{{/returnBaseType}} {{/returnBaseType}}
{{^returnBaseType}} {{^returnBaseType}}
// no return base type // no return base type
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"{{httpMethod}}" method: @"{{httpMethod}}"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -32,4 +32,4 @@
completionBlock(nil); completionBlock(nil);
}]; }];
{{/returnBaseType}} {{/returnBaseType}}

View File

@ -1,4 +1,4 @@
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"{{httpMethod}}" method: @"{{httpMethod}}"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary

View File

@ -12,6 +12,16 @@
[super tearDown]; [super tearDown];
} }
- (void)testCreatePetApi {
SWGPetApi *api1 = [[SWGPetApi alloc] init];
SWGPetApi *api2 = [[SWGPetApi alloc] init];
XCTAssertEqual(api1.apiClient, api2.apiClient);
SWGApiClient *client = [[SWGApiClient alloc] init];
SWGPetApi *api3 = [[SWGPetApi alloc] initWithApiClient:client];
XCTAssertNotEqual(api1.apiClient, api3.apiClient);
}
- (void)testCreateAndGetPet { - (void)testCreateAndGetPet {
XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"]; XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"];
SWGPet* pet = [self createPet]; SWGPet* pet = [self createPet];

View File

@ -134,10 +134,12 @@ static bool loggingEnabled = true;
} }
+(NSNumber*) nextRequestId { +(NSNumber*) nextRequestId {
long nextId = ++requestId; @synchronized(self) {
if(loggingEnabled) long nextId = ++requestId;
NSLog(@"got id %ld", nextId); if(loggingEnabled)
return [NSNumber numberWithLong:nextId]; NSLog(@"got id %ld", nextId);
return [NSNumber numberWithLong:nextId];
}
} }
+(NSNumber*) queueRequest { +(NSNumber*) queueRequest {

View File

@ -2,10 +2,14 @@
#import "SWGPet.h" #import "SWGPet.h"
#import "SWGFile.h" #import "SWGFile.h"
#import "SWGObject.h" #import "SWGObject.h"
#import "SWGApiClient.h"
@interface SWGPetApi: NSObject @interface SWGPetApi: NSObject
@property(nonatomic, assign)SWGApiClient *apiClient;
-(instancetype) initWithApiClient:(SWGApiClient *)apiClient;
-(void) addHeader:(NSString*)value forKey:(NSString*)key; -(void) addHeader:(NSString*)value forKey:(NSString*)key;
-(unsigned long) requestQueueSize; -(unsigned long) requestQueueSize;
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
@ -150,4 +154,4 @@
@end @end

View File

@ -1,7 +1,6 @@
#import "SWGPetApi.h" #import "SWGPetApi.h"
#import "SWGFile.h" #import "SWGFile.h"
#import "SWGQueryParamCollection.h" #import "SWGQueryParamCollection.h"
#import "SWGApiClient.h"
#import "SWGPet.h" #import "SWGPet.h"
#import "SWGFile.h" #import "SWGFile.h"
@ -11,8 +10,34 @@
@end @end
@implementation SWGPetApi @implementation SWGPetApi
static NSString * basePath = @"http://petstore.swagger.io/v2"; static NSString * basePath = @"http://petstore.swagger.io/v2";
#pragma mark - Initialize methods
- (id) init {
self = [super init];
if (self) {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
- (id) initWithApiClient:(SWGApiClient *)apiClient {
self = [super init];
if (self) {
if (apiClient) {
self.apiClient = apiClient;
}
else {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
}
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { +(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static SWGPetApi* singletonAPI = nil; static SWGPetApi* singletonAPI = nil;
@ -31,21 +56,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
return basePath; return basePath;
} }
-(SWGApiClient*) apiClient {
return [SWGApiClient sharedClientFromPool:basePath];
}
-(void) addHeader:(NSString*)value forKey:(NSString*)key { -(void) addHeader:(NSString*)value forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
} }
-(id) init {
self = [super init];
self.defaultHeaders = [NSMutableDictionary dictionary];
[self apiClient];
return self;
}
-(void) setHeaderValue:(NSString*) value -(void) setHeaderValue:(NSString*) value
forKey:(NSString*)key { forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
@ -135,15 +149,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"PUT" method: @"PUT"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -240,15 +252,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -328,12 +338,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// response is in a container // response is in a container
// array container response type // array container response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -362,6 +370,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
}]; }];
@ -429,12 +438,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// response is in a container // response is in a container
// array container response type // array container response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -463,6 +470,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
}]; }];
@ -528,8 +536,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
@ -541,7 +547,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
// complex response // complex response
// comples response type // comples response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -648,15 +654,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -738,15 +742,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"DELETE" method: @"DELETE"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -851,15 +853,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -880,3 +880,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
@end @end

View File

@ -1,10 +1,13 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SWGOrder.h" #import "SWGOrder.h"
#import "SWGObject.h" #import "SWGObject.h"
#import "SWGApiClient.h"
@interface SWGStoreApi: NSObject @interface SWGStoreApi: NSObject
@property(nonatomic, assign)SWGApiClient *apiClient;
-(void) addHeader:(NSString*)value forKey:(NSString*)key; -(void) addHeader:(NSString*)value forKey:(NSString*)key;
-(unsigned long) requestQueueSize; -(unsigned long) requestQueueSize;
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
@ -73,4 +76,4 @@
@end @end

View File

@ -1,7 +1,6 @@
#import "SWGStoreApi.h" #import "SWGStoreApi.h"
#import "SWGFile.h" #import "SWGFile.h"
#import "SWGQueryParamCollection.h" #import "SWGQueryParamCollection.h"
#import "SWGApiClient.h"
#import "SWGOrder.h" #import "SWGOrder.h"
@ -10,8 +9,34 @@
@end @end
@implementation SWGStoreApi @implementation SWGStoreApi
static NSString * basePath = @"http://petstore.swagger.io/v2"; static NSString * basePath = @"http://petstore.swagger.io/v2";
#pragma mark - Initialize methods
- (id) init {
self = [super init];
if (self) {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
- (id) initWithApiClient:(SWGApiClient *)apiClient {
self = [super init];
if (self) {
if (apiClient) {
self.apiClient = apiClient;
}
else {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
}
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { +(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static SWGStoreApi* singletonAPI = nil; static SWGStoreApi* singletonAPI = nil;
@ -30,21 +55,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
return basePath; return basePath;
} }
-(SWGApiClient*) apiClient {
return [SWGApiClient sharedClientFromPool:basePath];
}
-(void) addHeader:(NSString*)value forKey:(NSString*)key { -(void) addHeader:(NSString*)value forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
} }
-(id) init {
self = [super init];
self.defaultHeaders = [NSMutableDictionary dictionary];
[self apiClient];
return self;
}
-(void) setHeaderValue:(NSString*) value -(void) setHeaderValue:(NSString*) value
forKey:(NSString*)key { forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
@ -109,12 +123,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// response is in a container // response is in a container
// map container response type // map container response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -136,6 +148,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
}]; }];
@ -220,8 +233,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
@ -233,7 +244,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
// complex response // complex response
// comples response type // comples response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -320,8 +331,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
@ -333,7 +342,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
// complex response // complex response
// comples response type // comples response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -420,15 +429,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"DELETE" method: @"DELETE"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -449,3 +456,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
@end @end

View File

@ -1,10 +1,13 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SWGUser.h" #import "SWGUser.h"
#import "SWGObject.h" #import "SWGObject.h"
#import "SWGApiClient.h"
@interface SWGUserApi: NSObject @interface SWGUserApi: NSObject
@property(nonatomic, assign)SWGApiClient *apiClient;
-(void) addHeader:(NSString*)value forKey:(NSString*)key; -(void) addHeader:(NSString*)value forKey:(NSString*)key;
-(unsigned long) requestQueueSize; -(unsigned long) requestQueueSize;
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; +(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key;
@ -141,4 +144,4 @@
@end @end

View File

@ -1,7 +1,6 @@
#import "SWGUserApi.h" #import "SWGUserApi.h"
#import "SWGFile.h" #import "SWGFile.h"
#import "SWGQueryParamCollection.h" #import "SWGQueryParamCollection.h"
#import "SWGApiClient.h"
#import "SWGUser.h" #import "SWGUser.h"
@ -10,8 +9,34 @@
@end @end
@implementation SWGUserApi @implementation SWGUserApi
static NSString * basePath = @"http://petstore.swagger.io/v2"; static NSString * basePath = @"http://petstore.swagger.io/v2";
#pragma mark - Initialize methods
- (id) init {
self = [super init];
if (self) {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
- (id) initWithApiClient:(SWGApiClient *)apiClient {
self = [super init];
if (self) {
if (apiClient) {
self.apiClient = apiClient;
}
else {
self.apiClient = [SWGApiClient sharedClientFromPool:basePath];
}
self.defaultHeaders = [NSMutableDictionary dictionary];
}
return self;
}
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { +(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static SWGUserApi* singletonAPI = nil; static SWGUserApi* singletonAPI = nil;
@ -30,21 +55,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
return basePath; return basePath;
} }
-(SWGApiClient*) apiClient {
return [SWGApiClient sharedClientFromPool:basePath];
}
-(void) addHeader:(NSString*)value forKey:(NSString*)key { -(void) addHeader:(NSString*)value forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
} }
-(id) init {
self = [super init];
self.defaultHeaders = [NSMutableDictionary dictionary];
[self apiClient];
return self;
}
-(void) setHeaderValue:(NSString*) value -(void) setHeaderValue:(NSString*) value
forKey:(NSString*)key { forKey:(NSString*)key {
[self.defaultHeaders setValue:value forKey:key]; [self.defaultHeaders setValue:value forKey:key];
@ -134,15 +148,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -239,15 +251,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -344,15 +354,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"POST" method: @"POST"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -436,8 +444,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
@ -446,7 +452,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
// primitive response // primitive response
// primitive response type // primitive response type
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -465,6 +471,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
// complex response // complex response
@ -528,15 +535,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -614,8 +619,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
@ -627,7 +630,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
// complex response // complex response
// comples response type // comples response type
return [client dictionary: requestUrl return [self.apiClient dictionary: requestUrl
method: @"GET" method: @"GET"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -739,15 +742,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"PUT" method: @"PUT"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -825,15 +826,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
// it's void // it's void
return [client stringWithCompletionBlock: requestUrl return [self.apiClient stringWithCompletionBlock: requestUrl
method: @"DELETE" method: @"DELETE"
queryParams: queryParams queryParams: queryParams
body: bodyDictionary body: bodyDictionary
@ -854,3 +853,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
@end @end