forked from loafle/openapi-generator-original
Merge pull request #1096 from geekerzp/objc-param-to-str
[Objc] Sanitize request parameters in objc client
This commit is contained in:
@@ -467,6 +467,7 @@ static void (^reachabilityChangeBlock)(int);
|
||||
|
||||
-(NSNumber*) requestWithCompletionBlock: (NSString*) path
|
||||
method: (NSString*) method
|
||||
pathParams: (NSDictionary *) pathParams
|
||||
queryParams: (NSDictionary*) queryParams
|
||||
formParams: (NSDictionary *) formParams
|
||||
files: (NSDictionary *) files
|
||||
@@ -499,12 +500,25 @@ static void (^reachabilityChangeBlock)(int);
|
||||
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||
}
|
||||
|
||||
// sanitize parameters
|
||||
pathParams = [self sanitizeForSerialization:pathParams];
|
||||
queryParams = [self sanitizeForSerialization:queryParams];
|
||||
headerParams = [self sanitizeForSerialization:headerParams];
|
||||
formParams = [self sanitizeForSerialization:formParams];
|
||||
body = [self sanitizeForSerialization:body];
|
||||
|
||||
// auth setting
|
||||
[self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings];
|
||||
|
||||
NSMutableString *resourcePath = [NSMutableString stringWithString:path];
|
||||
[pathParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
[resourcePath replaceCharactersInRange:[resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", key, @"}"]]
|
||||
withString:[SWGApiClient escape:obj]];
|
||||
}];
|
||||
|
||||
NSMutableURLRequest * request = nil;
|
||||
|
||||
NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
||||
NSString* pathWithQueryParams = [self pathWithQueryParamsToString:resourcePath queryParams:queryParams];
|
||||
if ([pathWithQueryParams hasPrefix:@"/"]) {
|
||||
pathWithQueryParams = [pathWithQueryParams substringFromIndex:1];
|
||||
}
|
||||
@@ -540,20 +554,21 @@ static void (^reachabilityChangeBlock)(int);
|
||||
}
|
||||
}
|
||||
|
||||
// request cache
|
||||
BOOL hasHeaderParams = false;
|
||||
if(headerParams != nil && [headerParams count] > 0) {
|
||||
hasHeaderParams = true;
|
||||
}
|
||||
if(offlineState) {
|
||||
NSLog(@"%@ cache forced", path);
|
||||
NSLog(@"%@ cache forced", resourcePath);
|
||||
[request setCachePolicy:NSURLRequestReturnCacheDataDontLoad];
|
||||
}
|
||||
else if(!hasHeaderParams && [method isEqualToString:@"GET"] && cacheEnabled) {
|
||||
NSLog(@"%@ cache enabled", path);
|
||||
NSLog(@"%@ cache enabled", resourcePath);
|
||||
[request setCachePolicy:NSURLRequestUseProtocolCachePolicy];
|
||||
}
|
||||
else {
|
||||
NSLog(@"%@ cache disabled", path);
|
||||
NSLog(@"%@ cache disabled", resourcePath);
|
||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
||||
}
|
||||
|
||||
@@ -671,4 +686,44 @@ static void (^reachabilityChangeBlock)(int);
|
||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||
}
|
||||
|
||||
- (id) sanitizeForSerialization:(id) object {
|
||||
if (object == nil) {
|
||||
return nil;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[SWGQueryParamCollection class]]) {
|
||||
return object;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSDate class]]) {
|
||||
return [object ISO8601String];
|
||||
}
|
||||
else if ([object isKindOfClass:[NSArray class]]) {
|
||||
NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[object count]];
|
||||
[object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs addObject:[self sanitizeForSerialization:obj]];
|
||||
}
|
||||
}];
|
||||
return sanitizedObjs;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[object count]];
|
||||
[object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs setValue:[self sanitizeForSerialization:obj] forKey:key];
|
||||
}
|
||||
}];
|
||||
return sanitizedObjs;
|
||||
}
|
||||
else if ([object isKindOfClass:[SWGObject class]]) {
|
||||
return [object toDictionary];
|
||||
}
|
||||
else {
|
||||
NSException *e = [NSException
|
||||
exceptionWithName:@"InvalidObjectArgumentException"
|
||||
reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object]
|
||||
userInfo:nil];
|
||||
@throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -168,6 +168,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
||||
*
|
||||
* @param path Request url.
|
||||
* @param method Request method.
|
||||
* @param pathParams Request path parameters.
|
||||
* @param queryParams Request query parameters.
|
||||
* @param body Request body.
|
||||
* @param headerParams Request header parameters.
|
||||
@@ -180,6 +181,7 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
||||
*/
|
||||
-(NSNumber*) requestWithCompletionBlock:(NSString*) path
|
||||
method:(NSString*) method
|
||||
pathParams:(NSDictionary *) pathParams
|
||||
queryParams:(NSDictionary*) queryParams
|
||||
formParams:(NSDictionary *) formParams
|
||||
files:(NSDictionary *) files
|
||||
@@ -191,4 +193,11 @@ extern NSString *const {{classPrefix}}ResponseObjectErrorKey;
|
||||
responseType:(NSString *) responseType
|
||||
completionBlock:(void (^)(id, NSError *))completionBlock;
|
||||
|
||||
/**
|
||||
* Sanitize object for request
|
||||
*
|
||||
* @param object The query/path/header/form/body param to be sanitized.
|
||||
*/
|
||||
- (id) sanitizeForSerialization:(id) object;
|
||||
|
||||
@end
|
||||
|
||||
@@ -88,8 +88,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
{{#pathParams}}[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"{{baseName}}", @"}"]] withString: [{{classPrefix}}ApiClient escape:{{paramName}}]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
{{#pathParams}}if ({{paramName}} != nil) {
|
||||
pathParams[@"{{baseName}}"] = {{paramName}};
|
||||
}
|
||||
{{/pathParams}}
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -132,26 +135,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
{{#bodyParam}}
|
||||
bodyParam = {{paramName}};
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[({{classPrefix}}Object*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [({{classPrefix}}Object*)bodyParam toDictionary];
|
||||
}
|
||||
{{/bodyParam}}{{^bodyParam}}
|
||||
{{#formParams}}
|
||||
{{#notFile}}
|
||||
formParams[@"{{paramName}}"] = {{paramName}};
|
||||
if ({{paramName}}) {
|
||||
formParams[@"{{baseName}}"] = {{paramName}};
|
||||
}
|
||||
{{/notFile}}{{#isFile}}
|
||||
files[@"{{paramName}}"] = {{paramName}};
|
||||
{{/isFile}}
|
||||
@@ -167,6 +156,7 @@
|
||||
{{/requiredParamCount}}
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"{{httpMethod}}"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
|
||||
@@ -172,6 +172,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
*
|
||||
* @param path Request url.
|
||||
* @param method Request method.
|
||||
* @param pathParams Request path parameters.
|
||||
* @param queryParams Request query parameters.
|
||||
* @param body Request body.
|
||||
* @param headerParams Request header parameters.
|
||||
@@ -184,6 +185,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
*/
|
||||
-(NSNumber*) requestWithCompletionBlock:(NSString*) path
|
||||
method:(NSString*) method
|
||||
pathParams:(NSDictionary *) pathParams
|
||||
queryParams:(NSDictionary*) queryParams
|
||||
formParams:(NSDictionary *) formParams
|
||||
files:(NSDictionary *) files
|
||||
@@ -195,4 +197,11 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
responseType:(NSString *) responseType
|
||||
completionBlock:(void (^)(id, NSError *))completionBlock;
|
||||
|
||||
/**
|
||||
* Sanitize object for request
|
||||
*
|
||||
* @param object The query/path/header/form/body param to be sanitized.
|
||||
*/
|
||||
- (id) sanitizeForSerialization:(id) object;
|
||||
|
||||
@end
|
||||
|
||||
@@ -467,6 +467,7 @@ static void (^reachabilityChangeBlock)(int);
|
||||
|
||||
-(NSNumber*) requestWithCompletionBlock: (NSString*) path
|
||||
method: (NSString*) method
|
||||
pathParams: (NSDictionary *) pathParams
|
||||
queryParams: (NSDictionary*) queryParams
|
||||
formParams: (NSDictionary *) formParams
|
||||
files: (NSDictionary *) files
|
||||
@@ -499,12 +500,25 @@ static void (^reachabilityChangeBlock)(int);
|
||||
self.responseSerializer = [AFHTTPResponseSerializer serializer];
|
||||
}
|
||||
|
||||
// sanitize parameters
|
||||
pathParams = [self sanitizeForSerialization:pathParams];
|
||||
queryParams = [self sanitizeForSerialization:queryParams];
|
||||
headerParams = [self sanitizeForSerialization:headerParams];
|
||||
formParams = [self sanitizeForSerialization:formParams];
|
||||
body = [self sanitizeForSerialization:body];
|
||||
|
||||
// auth setting
|
||||
[self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings];
|
||||
|
||||
NSMutableString *resourcePath = [NSMutableString stringWithString:path];
|
||||
[pathParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
[resourcePath replaceCharactersInRange:[resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", key, @"}"]]
|
||||
withString:[SWGApiClient escape:obj]];
|
||||
}];
|
||||
|
||||
NSMutableURLRequest * request = nil;
|
||||
|
||||
NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams];
|
||||
NSString* pathWithQueryParams = [self pathWithQueryParamsToString:resourcePath queryParams:queryParams];
|
||||
if ([pathWithQueryParams hasPrefix:@"/"]) {
|
||||
pathWithQueryParams = [pathWithQueryParams substringFromIndex:1];
|
||||
}
|
||||
@@ -540,20 +554,21 @@ static void (^reachabilityChangeBlock)(int);
|
||||
}
|
||||
}
|
||||
|
||||
// request cache
|
||||
BOOL hasHeaderParams = false;
|
||||
if(headerParams != nil && [headerParams count] > 0) {
|
||||
hasHeaderParams = true;
|
||||
}
|
||||
if(offlineState) {
|
||||
NSLog(@"%@ cache forced", path);
|
||||
NSLog(@"%@ cache forced", resourcePath);
|
||||
[request setCachePolicy:NSURLRequestReturnCacheDataDontLoad];
|
||||
}
|
||||
else if(!hasHeaderParams && [method isEqualToString:@"GET"] && cacheEnabled) {
|
||||
NSLog(@"%@ cache enabled", path);
|
||||
NSLog(@"%@ cache enabled", resourcePath);
|
||||
[request setCachePolicy:NSURLRequestUseProtocolCachePolicy];
|
||||
}
|
||||
else {
|
||||
NSLog(@"%@ cache disabled", path);
|
||||
NSLog(@"%@ cache disabled", resourcePath);
|
||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
||||
}
|
||||
|
||||
@@ -671,4 +686,44 @@ static void (^reachabilityChangeBlock)(int);
|
||||
*querys = [NSDictionary dictionaryWithDictionary:querysWithAuth];
|
||||
}
|
||||
|
||||
- (id) sanitizeForSerialization:(id) object {
|
||||
if (object == nil) {
|
||||
return nil;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[SWGQueryParamCollection class]]) {
|
||||
return object;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSDate class]]) {
|
||||
return [object ISO8601String];
|
||||
}
|
||||
else if ([object isKindOfClass:[NSArray class]]) {
|
||||
NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[object count]];
|
||||
[object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs addObject:[self sanitizeForSerialization:obj]];
|
||||
}
|
||||
}];
|
||||
return sanitizedObjs;
|
||||
}
|
||||
else if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[object count]];
|
||||
[object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||
if (obj) {
|
||||
[sanitizedObjs setValue:[self sanitizeForSerialization:obj] forKey:key];
|
||||
}
|
||||
}];
|
||||
return sanitizedObjs;
|
||||
}
|
||||
else if ([object isKindOfClass:[SWGObject class]]) {
|
||||
return [object toDictionary];
|
||||
}
|
||||
else {
|
||||
NSException *e = [NSException
|
||||
exceptionWithName:@"InvalidObjectArgumentException"
|
||||
reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object]
|
||||
userInfo:nil];
|
||||
@throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
#import "SWGTag.h"
|
||||
#import "SWGCategory.h"
|
||||
#import "SWGTag.h"
|
||||
|
||||
|
||||
@protocol SWGPet
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -115,27 +116,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"PUT"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -172,7 +158,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -207,27 +194,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -264,7 +236,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -310,6 +283,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -346,7 +320,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -392,6 +367,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -433,8 +409,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (petId != nil) {
|
||||
pathParams[@"petId"] = petId;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -462,7 +441,7 @@
|
||||
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
|
||||
|
||||
// Authentication setting
|
||||
NSArray *authSettings = @[@"api_key", @"petstore_auth"];
|
||||
NSArray *authSettings = @[@"petstore_auth", @"api_key"];
|
||||
|
||||
id bodyParam = nil;
|
||||
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -474,6 +453,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -521,8 +501,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (petId != nil) {
|
||||
pathParams[@"petId"] = petId;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -558,11 +541,15 @@
|
||||
|
||||
|
||||
|
||||
formParams[@"name"] = name;
|
||||
if (name) {
|
||||
formParams[@"name"] = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
formParams[@"status"] = status;
|
||||
if (status) {
|
||||
formParams[@"status"] = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -570,6 +557,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -614,8 +602,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (petId != nil) {
|
||||
pathParams[@"petId"] = petId;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -657,6 +648,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"DELETE"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -704,8 +696,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (petId != nil) {
|
||||
pathParams[@"petId"] = petId;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -741,7 +736,9 @@
|
||||
|
||||
|
||||
|
||||
formParams[@"additionalMetadata"] = additionalMetadata;
|
||||
if (additionalMetadata) {
|
||||
formParams[@"additionalMetadata"] = additionalMetadata;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -753,6 +750,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
|
||||
@@ -77,7 +77,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -117,6 +118,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -153,7 +155,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -188,27 +191,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -250,8 +238,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [SWGApiClient escape:orderId]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (orderId != nil) {
|
||||
pathParams[@"orderId"] = orderId;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -291,6 +282,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -332,8 +324,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [SWGApiClient escape:orderId]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (orderId != nil) {
|
||||
pathParams[@"orderId"] = orderId;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -373,6 +368,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"DELETE"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -115,27 +116,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -172,7 +158,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -207,27 +194,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -264,7 +236,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -299,27 +272,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"POST"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -359,7 +317,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -407,6 +366,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -440,7 +400,8 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -480,6 +441,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -521,8 +483,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (username != nil) {
|
||||
pathParams[@"username"] = username;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -562,6 +527,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"GET"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -606,8 +572,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (username != nil) {
|
||||
pathParams[@"username"] = username;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -642,27 +611,12 @@
|
||||
NSMutableDictionary *files = [[NSMutableDictionary alloc] init];
|
||||
|
||||
bodyParam = body;
|
||||
|
||||
if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray *objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)bodyParam) {
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
}
|
||||
}
|
||||
bodyParam = objs;
|
||||
}
|
||||
else if([bodyParam respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyParam = [(SWGObject*)bodyParam toDictionary];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"PUT"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
@@ -704,8 +658,11 @@
|
||||
if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) {
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:@".{format}"] withString:@".json"];
|
||||
}
|
||||
|
||||
[resourcePath replaceCharactersInRange: [resourcePath rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
|
||||
|
||||
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
|
||||
if (username != nil) {
|
||||
pathParams[@"username"] = username;
|
||||
}
|
||||
|
||||
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
@@ -745,6 +702,7 @@
|
||||
|
||||
return [self.apiClient requestWithCompletionBlock: resourcePath
|
||||
method: @"DELETE"
|
||||
pathParams: pathParams
|
||||
queryParams: queryParams
|
||||
formParams: formParams
|
||||
files: files
|
||||
|
||||
Reference in New Issue
Block a user