diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient.m b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient.m index 15dbee07459..b38b02e0e03 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient.m +++ b/modules/swagger-codegen/src/main/resources/objc/SWGApiClient.m @@ -134,10 +134,12 @@ static bool loggingEnabled = true; } +(NSNumber*) nextRequestId { - long nextId = ++requestId; - if(loggingEnabled) - NSLog(@"got id %ld", nextId); - return [NSNumber numberWithLong:nextId]; + @synchronized(self) { + long nextId = ++requestId; + if(loggingEnabled) + NSLog(@"got id %ld", nextId); + return [NSNumber numberWithLong:nextId]; + } } +(NSNumber*) queueRequest { diff --git a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache index b18790e3b6f..abe4376d1ac 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache @@ -2,7 +2,6 @@ #import "{{classname}}.h" #import "SWGFile.h" #import "SWGQueryParamCollection.h" -#import "SWGApiClient.h" {{#imports}}#import "{{import}}.h" {{/imports}} {{newline}} @@ -12,8 +11,34 @@ @end @implementation {{classname}} + 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 { static {{classname}}* singletonAPI = nil; @@ -32,21 +57,10 @@ static NSString * basePath = @"{{basePath}}"; return basePath; } --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - -(void) addHeader:(NSString*)value forKey:(NSString*)key { [self.defaultHeaders setValue:value forKey:key]; } --(id) init { - self = [super init]; - self.defaultHeaders = [NSMutableDictionary dictionary]; - [self apiClient]; - return self; -} - -(void) setHeaderValue:(NSString*) value forKey:(NSString*)key { [self.defaultHeaders setValue:value forKey:key]; @@ -177,8 +191,6 @@ static NSString * basePath = @"{{basePath}}"; {{/requiredParams}} {{/requiredParamCount}} - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - {{#returnContainer}} // response is in a container {{>apiBodyResponseWithContainer}}{{/returnContainer}} @@ -206,3 +218,6 @@ static NSString * basePath = @"{{basePath}}"; {{newline}} {{/operations}} @end + + + diff --git a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache index 0cdccf1b39b..4d571f756ce 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache @@ -2,11 +2,14 @@ {{#imports}}#import "{{import}}.h" {{/imports}} #import "SWGObject.h" +#import "SWGApiClient.h" {{newline}} {{#operations}} @interface {{classname}}: NSObject +@property(nonatomic, assign)SWGApiClient *apiClient; + -(void) addHeader:(NSString*)value forKey:(NSString*)key; -(unsigned long) requestQueueSize; +({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; @@ -34,4 +37,4 @@ {{/operation}} {{/operations}} -@end \ No newline at end of file +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache b/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache index 9a53eb2fa06..5aabef86841 100644 --- a/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/apiBodyResponseWithContainer.mustache @@ -1,5 +1,5 @@ // {{returnContainer}} container response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"{{httpMethod}}" queryParams: queryParams body: bodyDictionary @@ -34,4 +34,4 @@ {{/returnBaseType}} {{/isListContainer}} }]; - \ No newline at end of file + diff --git a/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache b/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache index ff2dcba7a47..81cf1343e53 100644 --- a/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/apiNonPrimitiveResponse.mustache @@ -1,6 +1,6 @@ {{^returnTypeIsPrimitive}} // comples response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"{{httpMethod}}" queryParams: queryParams body: bodyDictionary diff --git a/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache b/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache index 8e6588c456e..3d6b105f227 100644 --- a/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/apiPrimitiveResponse.mustache @@ -1,5 +1,5 @@ // primitive response type - {{#returnBaseType}}return [client stringWithCompletionBlock: requestUrl + {{#returnBaseType}}return [self.apiClient stringWithCompletionBlock: requestUrl method: @"{{httpMethod}}" queryParams: queryParams body: bodyDictionary @@ -17,7 +17,7 @@ {{/returnBaseType}} {{^returnBaseType}} // no return base type - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"{{httpMethod}}" queryParams: queryParams body: bodyDictionary @@ -32,4 +32,4 @@ completionBlock(nil); }]; {{/returnBaseType}} - \ No newline at end of file + diff --git a/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache b/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache index b128bfd21cc..ab4062a6dbe 100644 --- a/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/voidResponse.mustache @@ -1,4 +1,4 @@ - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"{{httpMethod}}" queryParams: queryParams body: bodyDictionary diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m index 6fb2b6e57c2..cfc2dc7804f 100644 --- a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m @@ -12,6 +12,16 @@ [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 { XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"]; SWGPet* pet = [self createPet]; diff --git a/samples/client/petstore/objc/client/SWGApiClient.m b/samples/client/petstore/objc/client/SWGApiClient.m index 15dbee07459..b38b02e0e03 100644 --- a/samples/client/petstore/objc/client/SWGApiClient.m +++ b/samples/client/petstore/objc/client/SWGApiClient.m @@ -134,10 +134,12 @@ static bool loggingEnabled = true; } +(NSNumber*) nextRequestId { - long nextId = ++requestId; - if(loggingEnabled) - NSLog(@"got id %ld", nextId); - return [NSNumber numberWithLong:nextId]; + @synchronized(self) { + long nextId = ++requestId; + if(loggingEnabled) + NSLog(@"got id %ld", nextId); + return [NSNumber numberWithLong:nextId]; + } } +(NSNumber*) queueRequest { diff --git a/samples/client/petstore/objc/client/SWGPetApi.h b/samples/client/petstore/objc/client/SWGPetApi.h index e7a3a84a9f5..aa255cd144e 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.h +++ b/samples/client/petstore/objc/client/SWGPetApi.h @@ -2,10 +2,14 @@ #import "SWGPet.h" #import "SWGFile.h" #import "SWGObject.h" +#import "SWGApiClient.h" @interface SWGPetApi: NSObject +@property(nonatomic, assign)SWGApiClient *apiClient; + +-(instancetype) initWithApiClient:(SWGApiClient *)apiClient; -(void) addHeader:(NSString*)value forKey:(NSString*)key; -(unsigned long) requestQueueSize; +(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; @@ -150,4 +154,4 @@ -@end \ No newline at end of file +@end diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m index 9f2b79c51f8..9487713984b 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/client/SWGPetApi.m @@ -1,7 +1,6 @@ #import "SWGPetApi.h" #import "SWGFile.h" #import "SWGQueryParamCollection.h" -#import "SWGApiClient.h" #import "SWGPet.h" #import "SWGFile.h" @@ -11,8 +10,34 @@ @end @implementation SWGPetApi + 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 { static SWGPetApi* singletonAPI = nil; @@ -31,21 +56,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return basePath; } --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - -(void) addHeader:(NSString*)value forKey:(NSString*)key { [self.defaultHeaders setValue:value forKey:key]; } --(id) init { - self = [super init]; - self.defaultHeaders = [NSMutableDictionary dictionary]; - [self apiClient]; - return self; -} - -(void) setHeaderValue:(NSString*) value forKey:(NSString*)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 - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"PUT" queryParams: queryParams body: bodyDictionary @@ -240,15 +252,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams body: bodyDictionary @@ -328,12 +338,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // response is in a container // array container response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"GET" queryParams: queryParams 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 // array container response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"GET" queryParams: queryParams 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 // comples response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"GET" queryParams: queryParams body: bodyDictionary @@ -648,15 +654,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams body: bodyDictionary @@ -738,15 +742,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams body: bodyDictionary @@ -851,15 +853,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams body: bodyDictionary @@ -880,3 +880,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; @end + + + diff --git a/samples/client/petstore/objc/client/SWGStoreApi.h b/samples/client/petstore/objc/client/SWGStoreApi.h index b4b8e5af5dc..c2d0dd6b36b 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.h +++ b/samples/client/petstore/objc/client/SWGStoreApi.h @@ -1,10 +1,13 @@ #import #import "SWGOrder.h" #import "SWGObject.h" +#import "SWGApiClient.h" @interface SWGStoreApi: NSObject +@property(nonatomic, assign)SWGApiClient *apiClient; + -(void) addHeader:(NSString*)value forKey:(NSString*)key; -(unsigned long) requestQueueSize; +(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; @@ -73,4 +76,4 @@ -@end \ No newline at end of file +@end diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/client/SWGStoreApi.m index 75875ff4eae..98b9d9a4eec 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.m +++ b/samples/client/petstore/objc/client/SWGStoreApi.m @@ -1,7 +1,6 @@ #import "SWGStoreApi.h" #import "SWGFile.h" #import "SWGQueryParamCollection.h" -#import "SWGApiClient.h" #import "SWGOrder.h" @@ -10,8 +9,34 @@ @end @implementation SWGStoreApi + 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 { static SWGStoreApi* singletonAPI = nil; @@ -30,21 +55,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return basePath; } --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - -(void) addHeader:(NSString*)value forKey:(NSString*)key { [self.defaultHeaders setValue:value forKey:key]; } --(id) init { - self = [super init]; - self.defaultHeaders = [NSMutableDictionary dictionary]; - [self apiClient]; - return self; -} - -(void) setHeaderValue:(NSString*) value forKey:(NSString*)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 // map container response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"GET" queryParams: queryParams 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 // comples response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"POST" queryParams: queryParams 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 // comples response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"GET" queryParams: queryParams body: bodyDictionary @@ -420,15 +429,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams body: bodyDictionary @@ -449,3 +456,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; @end + + + diff --git a/samples/client/petstore/objc/client/SWGUserApi.h b/samples/client/petstore/objc/client/SWGUserApi.h index 47a5dd95e09..d9d5a8abc18 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.h +++ b/samples/client/petstore/objc/client/SWGUserApi.h @@ -1,10 +1,13 @@ #import #import "SWGUser.h" #import "SWGObject.h" +#import "SWGApiClient.h" @interface SWGUserApi: NSObject +@property(nonatomic, assign)SWGApiClient *apiClient; + -(void) addHeader:(NSString*)value forKey:(NSString*)key; -(unsigned long) requestQueueSize; +(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; @@ -141,4 +144,4 @@ -@end \ No newline at end of file +@end diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/client/SWGUserApi.m index 3e87268a4c6..97a79f01b6d 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.m +++ b/samples/client/petstore/objc/client/SWGUserApi.m @@ -1,7 +1,6 @@ #import "SWGUserApi.h" #import "SWGFile.h" #import "SWGQueryParamCollection.h" -#import "SWGApiClient.h" #import "SWGUser.h" @@ -10,8 +9,34 @@ @end @implementation SWGUserApi + 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 { static SWGUserApi* singletonAPI = nil; @@ -30,21 +55,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return basePath; } --(SWGApiClient*) apiClient { - return [SWGApiClient sharedClientFromPool:basePath]; -} - -(void) addHeader:(NSString*)value forKey:(NSString*)key { [self.defaultHeaders setValue:value forKey:key]; } --(id) init { - self = [super init]; - self.defaultHeaders = [NSMutableDictionary dictionary]; - [self apiClient]; - return self; -} - -(void) setHeaderValue:(NSString*) value forKey:(NSString*)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 - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams body: bodyDictionary @@ -239,15 +251,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams body: bodyDictionary @@ -344,15 +354,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams 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 type - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams body: bodyDictionary @@ -465,6 +471,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; + // complex response @@ -528,15 +535,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams 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 // comples response type - return [client dictionary: requestUrl + return [self.apiClient dictionary: requestUrl method: @"GET" queryParams: queryParams body: bodyDictionary @@ -739,15 +742,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"PUT" queryParams: queryParams body: bodyDictionary @@ -825,15 +826,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath]; - // it's void - return [client stringWithCompletionBlock: requestUrl + return [self.apiClient stringWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams body: bodyDictionary @@ -854,3 +853,6 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; @end + + +