forked from loafle/openapi-generator-original
fixed issue that it throw exceptions when request with form parameters
in objective-c client
This commit is contained in:
parent
b10445f3f6
commit
a927d679f0
@ -31,13 +31,13 @@ static bool loggingEnabled = true;
|
|||||||
diskSize: (unsigned long) diskSize {
|
diskSize: (unsigned long) diskSize {
|
||||||
NSAssert(memorySize > 0, @"invalid in-memory cache size");
|
NSAssert(memorySize > 0, @"invalid in-memory cache size");
|
||||||
NSAssert(diskSize >= 0, @"invalid disk cache size");
|
NSAssert(diskSize >= 0, @"invalid disk cache size");
|
||||||
|
|
||||||
NSURLCache *cache =
|
NSURLCache *cache =
|
||||||
[[NSURLCache alloc]
|
[[NSURLCache alloc]
|
||||||
initWithMemoryCapacity:memorySize
|
initWithMemoryCapacity:memorySize
|
||||||
diskCapacity:diskSize
|
diskCapacity:diskSize
|
||||||
diskPath:@"swagger_url_cache"];
|
diskPath:@"swagger_url_cache"];
|
||||||
|
|
||||||
[NSURLCache setSharedURLCache:cache];
|
[NSURLCache setSharedURLCache:cache];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,17 +54,17 @@ static bool loggingEnabled = true;
|
|||||||
// setup static vars
|
// setup static vars
|
||||||
// create queue
|
// create queue
|
||||||
sharedQueue = [[NSOperationQueue alloc] init];
|
sharedQueue = [[NSOperationQueue alloc] init];
|
||||||
|
|
||||||
// create pool
|
// create pool
|
||||||
_pool = [[NSMutableDictionary alloc] init];
|
_pool = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
// initialize URL cache
|
// initialize URL cache
|
||||||
[SWGApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024];
|
[SWGApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024];
|
||||||
|
|
||||||
// configure reachability
|
// configure reachability
|
||||||
[SWGApiClient configureCacheReachibilityForHost:baseUrl];
|
[SWGApiClient configureCacheReachibilityForHost:baseUrl];
|
||||||
}
|
}
|
||||||
|
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
SWGApiClient * client = [_pool objectForKey:baseUrl];
|
SWGApiClient * client = [_pool objectForKey:baseUrl];
|
||||||
if (client == nil) {
|
if (client == nil) {
|
||||||
@ -128,7 +128,7 @@ static bool loggingEnabled = true;
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if(matchingItems.count == 1) {
|
if(matchingItems.count == 1) {
|
||||||
if(loggingEnabled)
|
if(loggingEnabled)
|
||||||
NSLog(@"removing request id %@", requestId);
|
NSLog(@"removing request id %@", requestId);
|
||||||
@ -169,19 +169,19 @@ static bool loggingEnabled = true;
|
|||||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusUnknown");
|
NSLog(@"reachability changed to AFNetworkReachabilityStatusUnknown");
|
||||||
[SWGApiClient setOfflineState:true];
|
[SWGApiClient setOfflineState:true];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AFNetworkReachabilityStatusNotReachable:
|
case AFNetworkReachabilityStatusNotReachable:
|
||||||
if(loggingEnabled)
|
if(loggingEnabled)
|
||||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable");
|
NSLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable");
|
||||||
[SWGApiClient setOfflineState:true];
|
[SWGApiClient setOfflineState:true];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AFNetworkReachabilityStatusReachableViaWWAN:
|
case AFNetworkReachabilityStatusReachableViaWWAN:
|
||||||
if(loggingEnabled)
|
if(loggingEnabled)
|
||||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN");
|
NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN");
|
||||||
[SWGApiClient setOfflineState:false];
|
[SWGApiClient setOfflineState:false];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AFNetworkReachabilityStatusReachableViaWiFi:
|
case AFNetworkReachabilityStatusReachableViaWiFi:
|
||||||
if(loggingEnabled)
|
if(loggingEnabled)
|
||||||
NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi");
|
NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi");
|
||||||
@ -202,7 +202,7 @@ static bool loggingEnabled = true;
|
|||||||
queryParams:(NSDictionary*) queryParams {
|
queryParams:(NSDictionary*) queryParams {
|
||||||
NSString * separator = nil;
|
NSString * separator = nil;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
|
||||||
NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path];
|
NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path];
|
||||||
if(queryParams != nil){
|
if(queryParams != nil){
|
||||||
for(NSString * key in [queryParams keyEnumerator]){
|
for(NSString * key in [queryParams keyEnumerator]){
|
||||||
@ -218,7 +218,7 @@ static bool loggingEnabled = true;
|
|||||||
SWGQueryParamCollection * coll = (SWGQueryParamCollection*) queryParam;
|
SWGQueryParamCollection * coll = (SWGQueryParamCollection*) queryParam;
|
||||||
NSArray* values = [coll values];
|
NSArray* values = [coll values];
|
||||||
NSString* format = [coll format];
|
NSString* format = [coll format];
|
||||||
|
|
||||||
if([format isEqualToString:@"csv"]) {
|
if([format isEqualToString:@"csv"]) {
|
||||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
||||||
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@","]]]];
|
[SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@","]]]];
|
||||||
@ -274,7 +274,28 @@ static bool loggingEnabled = true;
|
|||||||
requestContentType: (NSString*) requestContentType
|
requestContentType: (NSString*) requestContentType
|
||||||
responseContentType: (NSString*) responseContentType
|
responseContentType: (NSString*) responseContentType
|
||||||
completionBlock: (void (^)(NSDictionary*, NSError *))completionBlock {
|
completionBlock: (void (^)(NSDictionary*, NSError *))completionBlock {
|
||||||
|
// setting request serializer
|
||||||
|
if ([requestContentType isEqualToString:@"application/json"]) {
|
||||||
|
self.requestSerializer = [AFJSONRequestSerializer serializer];
|
||||||
|
}
|
||||||
|
else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) {
|
||||||
|
self.requestSerializer = [AFHTTPRequestSerializer serializer];
|
||||||
|
}
|
||||||
|
else if ([requestContentType isEqualToString:@"multipart/form-data"]) {
|
||||||
|
self.requestSerializer = [AFHTTPRequestSerializer serializer];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
NSAssert(false, @"unsupport request type %@", requestContentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// setting response serializer
|
||||||
|
if ([responseContentType isEqualToString:@"application/json"]) {
|
||||||
|
self.responseSerializer = [AFJSONResponseSerializer serializer];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableURLRequest * request = nil;
|
NSMutableURLRequest * request = nil;
|
||||||
if (body != nil && [body isKindOfClass:[NSArray class]]){
|
if (body != nil && [body isKindOfClass:[NSArray class]]){
|
||||||
SWGFile * file;
|
SWGFile * file;
|
||||||
@ -291,7 +312,8 @@ static bool loggingEnabled = true;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSString * urlString = [[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString];
|
NSString * urlString = [[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString];
|
||||||
|
|
||||||
|
// request with multipart form
|
||||||
if(file != nil) {
|
if(file != nil) {
|
||||||
request = [self.requestSerializer multipartFormRequestWithMethod: @"POST"
|
request = [self.requestSerializer multipartFormRequestWithMethod: @"POST"
|
||||||
URLString: urlString
|
URLString: urlString
|
||||||
@ -302,20 +324,30 @@ static bool loggingEnabled = true;
|
|||||||
NSData* data = [params[key] dataUsingEncoding:NSUTF8StringEncoding];
|
NSData* data = [params[key] dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
[formData appendPartWithFormData: data name: key];
|
[formData appendPartWithFormData: data name: key];
|
||||||
}
|
}
|
||||||
|
|
||||||
[formData appendPartWithFileData: [file data]
|
[formData appendPartWithFileData: [file data]
|
||||||
name: [file paramName]
|
name: [file paramName]
|
||||||
fileName: [file name]
|
fileName: [file name]
|
||||||
mimeType: [file mimeType]];
|
mimeType: [file mimeType]];
|
||||||
|
|
||||||
}
|
}
|
||||||
error:nil];
|
error:nil];
|
||||||
}
|
}
|
||||||
|
// request with form parameters
|
||||||
|
else {
|
||||||
|
NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
||||||
|
NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString];
|
||||||
|
|
||||||
|
request = [self.requestSerializer requestWithMethod:method
|
||||||
|
URLString:urlString
|
||||||
|
parameters:params
|
||||||
|
error:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NSString * pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
NSString * pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
||||||
NSString * urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString];
|
NSString * urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString];
|
||||||
|
|
||||||
request = [self.requestSerializer requestWithMethod:method
|
request = [self.requestSerializer requestWithMethod:method
|
||||||
URLString:urlString
|
URLString:urlString
|
||||||
parameters:body
|
parameters:body
|
||||||
@ -337,11 +369,9 @@ static bool loggingEnabled = true;
|
|||||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
||||||
}
|
}
|
||||||
|
|
||||||
AFJSONRequestSerializer *requestSerializer = [AFJSONRequestSerializer serializer];
|
|
||||||
|
|
||||||
if(body != nil) {
|
if(body != nil) {
|
||||||
if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){
|
if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){
|
||||||
[requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
[self.requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
||||||
}
|
}
|
||||||
else if ([body isKindOfClass:[SWGFile class]]) {}
|
else if ([body isKindOfClass:[SWGFile class]]) {}
|
||||||
else {
|
else {
|
||||||
@ -353,16 +383,16 @@ static bool loggingEnabled = true;
|
|||||||
[request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key];
|
[request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[requestSerializer setValue:responseContentType forHTTPHeaderField:@"Accept"];
|
[self.requestSerializer setValue:responseContentType forHTTPHeaderField:@"Accept"];
|
||||||
|
|
||||||
// Always disable cookies!
|
// Always disable cookies!
|
||||||
[request setHTTPShouldHandleCookies:NO];
|
[request setHTTPShouldHandleCookies:NO];
|
||||||
|
|
||||||
|
|
||||||
if (self.logRequests) {
|
if (self.logRequests) {
|
||||||
[self logRequest:request];
|
[self logRequest:request];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSNumber* requestId = [SWGApiClient queueRequest];
|
NSNumber* requestId = [SWGApiClient queueRequest];
|
||||||
AFHTTPRequestOperation *op =
|
AFHTTPRequestOperation *op =
|
||||||
[self HTTPRequestOperationWithRequest:request
|
[self HTTPRequestOperationWithRequest:request
|
||||||
@ -380,14 +410,14 @@ static bool loggingEnabled = true;
|
|||||||
userInfo[SWGResponseObjectErrorKey] = operation.responseObject;
|
userInfo[SWGResponseObjectErrorKey] = operation.responseObject;
|
||||||
}
|
}
|
||||||
NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo];
|
NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo];
|
||||||
|
|
||||||
if(self.logServerResponses)
|
if(self.logServerResponses)
|
||||||
[self logResponse:nil forRequest:request error:augmentedError];
|
[self logResponse:nil forRequest:request error:augmentedError];
|
||||||
completionBlock(nil, augmentedError);
|
completionBlock(nil, augmentedError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
[self.operationQueue addOperation:op];
|
[self.operationQueue addOperation:op];
|
||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
@ -400,6 +430,28 @@ static bool loggingEnabled = true;
|
|||||||
requestContentType: (NSString*) requestContentType
|
requestContentType: (NSString*) requestContentType
|
||||||
responseContentType: (NSString*) responseContentType
|
responseContentType: (NSString*) responseContentType
|
||||||
completionBlock: (void (^)(NSString*, NSError *))completionBlock {
|
completionBlock: (void (^)(NSString*, NSError *))completionBlock {
|
||||||
|
// setting request serializer
|
||||||
|
if ([requestContentType isEqualToString:@"application/json"]) {
|
||||||
|
self.requestSerializer = [AFJSONRequestSerializer serializer];
|
||||||
|
}
|
||||||
|
else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) {
|
||||||
|
self.requestSerializer = [AFHTTPRequestSerializer serializer];
|
||||||
|
}
|
||||||
|
else if ([requestContentType isEqualToString:@"multipart/form-data"]) {
|
||||||
|
self.requestSerializer = [AFHTTPRequestSerializer serializer];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
NSAssert(false, @"unsupport request type %@", requestContentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// setting response serializer
|
||||||
|
if ([responseContentType isEqualToString:@"application/json"]) {
|
||||||
|
self.responseSerializer = [AFJSONResponseSerializer serializer];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableURLRequest * request = nil;
|
NSMutableURLRequest * request = nil;
|
||||||
if (body != nil && [body isKindOfClass:[NSArray class]]){
|
if (body != nil && [body isKindOfClass:[NSArray class]]){
|
||||||
SWGFile * file;
|
SWGFile * file;
|
||||||
@ -416,31 +468,43 @@ static bool loggingEnabled = true;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSString * urlString = [[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString];
|
NSString * urlString = [[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString];
|
||||||
|
|
||||||
|
// request with multipart form
|
||||||
if(file != nil) {
|
if(file != nil) {
|
||||||
request = [self.requestSerializer multipartFormRequestWithMethod: @"POST"
|
request = [self.requestSerializer multipartFormRequestWithMethod: @"POST"
|
||||||
URLString: urlString
|
URLString: urlString
|
||||||
parameters: nil
|
parameters: nil
|
||||||
constructingBodyWithBlock: ^(id<AFMultipartFormData> formData) {
|
constructingBodyWithBlock: ^(id<AFMultipartFormData> formData) {
|
||||||
|
|
||||||
for(NSString * key in params) {
|
for(NSString * key in params) {
|
||||||
NSData* data = [params[key] dataUsingEncoding:NSUTF8StringEncoding];
|
NSData* data = [params[key] dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
[formData appendPartWithFormData: data name: key];
|
[formData appendPartWithFormData: data name: key];
|
||||||
}
|
}
|
||||||
|
|
||||||
[formData appendPartWithFileData: [file data]
|
[formData appendPartWithFileData: [file data]
|
||||||
name: [file paramName]
|
name: [file paramName]
|
||||||
fileName: [file name]
|
fileName: [file name]
|
||||||
mimeType: [file mimeType]];
|
mimeType: [file mimeType]];
|
||||||
|
|
||||||
}
|
}
|
||||||
error:nil];
|
error:nil];
|
||||||
}
|
}
|
||||||
|
// request with form parameters
|
||||||
|
else {
|
||||||
|
NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
||||||
|
NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString];
|
||||||
|
|
||||||
|
request = [self.requestSerializer requestWithMethod:method
|
||||||
|
URLString:urlString
|
||||||
|
parameters:params
|
||||||
|
error:nil];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NSString * pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
NSString * pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
||||||
NSString * urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString];
|
NSString * urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString];
|
||||||
|
|
||||||
request = [self.requestSerializer requestWithMethod: method
|
request = [self.requestSerializer requestWithMethod: method
|
||||||
URLString: urlString
|
URLString: urlString
|
||||||
parameters: body
|
parameters: body
|
||||||
@ -461,13 +525,11 @@ static bool loggingEnabled = true;
|
|||||||
NSLog(@"%@ cache disabled", path);
|
NSLog(@"%@ cache disabled", path);
|
||||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AFJSONRequestSerializer *requestSerializer = [AFJSONRequestSerializer serializer];
|
|
||||||
|
|
||||||
if(body != nil) {
|
if(body != nil) {
|
||||||
if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){
|
if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){
|
||||||
[requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
[self.requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"];
|
||||||
}
|
}
|
||||||
else if ([body isKindOfClass:[SWGFile class]]){}
|
else if ([body isKindOfClass:[SWGFile class]]){}
|
||||||
else {
|
else {
|
||||||
@ -479,12 +541,12 @@ static bool loggingEnabled = true;
|
|||||||
[request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key];
|
[request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[requestSerializer setValue:responseContentType forHTTPHeaderField:@"Accept"];
|
[self.requestSerializer setValue:responseContentType forHTTPHeaderField:@"Accept"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Always disable cookies!
|
// Always disable cookies!
|
||||||
[request setHTTPShouldHandleCookies:NO];
|
[request setHTTPShouldHandleCookies:NO];
|
||||||
|
|
||||||
NSNumber* requestId = [SWGApiClient queueRequest];
|
NSNumber* requestId = [SWGApiClient queueRequest];
|
||||||
AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request
|
AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request
|
||||||
success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
success:^(AFHTTPRequestOperation *operation, id responseObject) {
|
||||||
@ -502,15 +564,15 @@ static bool loggingEnabled = true;
|
|||||||
userInfo[SWGResponseObjectErrorKey] = operation.responseObject;
|
userInfo[SWGResponseObjectErrorKey] = operation.responseObject;
|
||||||
}
|
}
|
||||||
NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo];
|
NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo];
|
||||||
|
|
||||||
if(self.logServerResponses)
|
if(self.logServerResponses)
|
||||||
[self logResponse:nil forRequest:request error:augmentedError];
|
[self logResponse:nil forRequest:request error:augmentedError];
|
||||||
completionBlock(nil, augmentedError);
|
completionBlock(nil, augmentedError);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.operationQueue addOperation:op];
|
[self.operationQueue addOperation:op];
|
||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -68,8 +68,11 @@ static NSString * basePath = @"{{basePath}}";
|
|||||||
{{#pathParams}}[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"{{baseName}}", @"}"]] withString: [SWGApiClient escape:{{paramName}}]];
|
{{#pathParams}}[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"{{baseName}}", @"}"]] withString: [SWGApiClient escape:{{paramName}}]];
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
|
|
||||||
NSString* requestContentType = @"application/json";
|
NSArray* requestContentTypes = @[{{#consumes}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}];
|
||||||
NSString* responseContentType = @"application/json";
|
NSString* requestContentType = [requestContentTypes count] > 0 ? requestContentTypes[0] : @"application/json";
|
||||||
|
|
||||||
|
NSArray* responseContentTypes = @[{{#produces}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}];
|
||||||
|
NSString* responseContentType = [responseContentTypes count] > 0 ? responseContentTypes[0] : @"application/json";
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||||
{{#queryParams}}if({{paramName}} != nil) {
|
{{#queryParams}}if({{paramName}} != nil) {
|
||||||
@ -116,7 +119,7 @@ static NSString * basePath = @"{{basePath}}";
|
|||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
{{^bodyParam}}
|
{{^bodyParam}}
|
||||||
|
|
||||||
NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init];
|
NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init];
|
||||||
|
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
{{#notFile}}
|
{{#notFile}}
|
||||||
@ -172,4 +175,4 @@ static NSString * basePath = @"{{basePath}}";
|
|||||||
|
|
||||||
{{newline}}
|
{{newline}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user