forked from loafle/openapi-generator-original
removed raw
This commit is contained in:
parent
67ce62c622
commit
031dd20072
@ -25,6 +25,13 @@ static NSString * basePath = @"{{basePath}}";
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: {{returnTypeIsPrimitive}}
|
||||
* returnBaseType: {{returnBaseType}}
|
||||
* returnContainer: {{returnContainer}}
|
||||
*
|
||||
**/
|
||||
-(void) {{nickname}}WithCompletionBlock {{^allParams}}:{{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}:({{{dataType}}}) {{paramName}} {{#hasMore}}{{newline}}{{/hasMore}}{{/allParams}}{{newline}}
|
||||
{{#returnBaseType}}completionHandler:(void (^)({{returnType}}, NSError *))completionBlock{{/returnBaseType}}
|
||||
{{^returnBaseType}}completionHandler:(void (^)(NSError *))completionBlock{{/returnBaseType}} {
|
||||
@ -81,22 +88,13 @@ static NSString * basePath = @"{{basePath}}";
|
||||
{{/requiredParams}}
|
||||
{{/requiredParamCount}}
|
||||
|
||||
{{#returnTypeIsPrimitive}}
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"{{httpMethod}}"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{^returnTypeIsPrimitive}}
|
||||
{{#returnContainer}}
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"{{httpMethod}}"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
{{/returnTypeIsPrimitive}}
|
||||
if (error) {
|
||||
{{#returnBaseType}}completionBlock(nil, error);{{/returnBaseType}}
|
||||
{{^returnBaseType}}completionBlock(error);{{/returnBaseType}}
|
||||
@ -104,16 +102,19 @@ static NSString * basePath = @"{{basePath}}";
|
||||
}
|
||||
|
||||
{{#returnBaseType}}
|
||||
{{#returnContainer}}
|
||||
if([data isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]];
|
||||
for (NSDictionary* dict in (NSArray*)data) {
|
||||
{{#returnTypeIsPrimitive}}
|
||||
{{returnBaseType}}* d = [[{{returnBaseType}} alloc]initWithString: data];
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{^returnTypeIsPrimitive}}
|
||||
{{{returnBaseType}}}* d = [[{{{returnBaseType}}} alloc]initWithValues: dict];
|
||||
{{/returnTypeIsPrimitive}}
|
||||
[objs addObject:d];
|
||||
}
|
||||
completionBlock(objs, nil);
|
||||
}
|
||||
{{/returnContainer}}
|
||||
{{#returnSimpleType}}
|
||||
{{#returnTypeIsPrimitive}}{{#returnBaseType}}completionBlock( [[{{returnBaseType}} alloc]initWithString: data], nil);{{/returnBaseType}}
|
||||
{{/returnTypeIsPrimitive}}
|
||||
@ -123,9 +124,67 @@ static NSString * basePath = @"{{basePath}}";
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{/returnSimpleType}}
|
||||
{{/returnBaseType}}
|
||||
|
||||
{{^returnBaseType}}completionBlock(nil);{{/returnBaseType}}{{newline}}
|
||||
}];
|
||||
{{/returnContainer}}
|
||||
|
||||
{{#returnSimpleType}}
|
||||
{{#returnTypeIsPrimitive}}
|
||||
{{#returnBaseType}}
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"{{httpMethod}}"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock( [[{{returnBaseType}} alloc]initWithString: data], nil);
|
||||
}];
|
||||
{{/returnBaseType}}
|
||||
{{^returnBaseType}}
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"{{httpMethod}}"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
completionBlock(nil);
|
||||
}];
|
||||
{{/returnBaseType}}
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{#returnBaseType}}
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"{{httpMethod}}"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
{{#returnBaseType}}completionBlock(nil, error);{{/returnBaseType}}
|
||||
{{^returnBaseType}}completionBlock(error);{{/returnBaseType}}
|
||||
return;
|
||||
}
|
||||
|
||||
{{#returnBaseType}}
|
||||
{{#returnSimpleType}}
|
||||
{{#returnTypeIsPrimitive}}{{#returnBaseType}}completionBlock( [[{{returnBaseType}} alloc]initWithString: data], nil);{{/returnBaseType}}
|
||||
{{/returnTypeIsPrimitive}}
|
||||
|
||||
{{^returnTypeIsPrimitive}}
|
||||
{{#returnBaseType}}completionBlock( [[{{returnBaseType}} alloc]initWithValues: data], nil);{{/returnBaseType}}
|
||||
{{/returnTypeIsPrimitive}}
|
||||
{{/returnSimpleType}}
|
||||
{{/returnBaseType}}
|
||||
}];
|
||||
{{/returnBaseType}}
|
||||
{{/returnSimpleType}}
|
||||
{{newline}}
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
@implementation {{classname}}
|
||||
|
||||
@synthesize raw = _raw;
|
||||
|
||||
{{#vars}}
|
||||
@synthesize {{name}} = _{{name}};
|
||||
{{/vars}}
|
||||
@ -23,6 +21,7 @@
|
||||
- (id) initWithValues: (NSDictionary*)dict
|
||||
{
|
||||
{{#vars}}
|
||||
|
||||
{{#isPrimitiveType}}
|
||||
_{{name}} = [dict objectForKey:@"{{baseName}}"];
|
||||
{{/isPrimitiveType}}
|
||||
@ -38,9 +37,6 @@
|
||||
}
|
||||
_{{{name}}} = [[NSArray alloc] initWithArray:objs];
|
||||
}
|
||||
}
|
||||
else if([{{name}}_dict isKindOfClass:[NSDictionary class]] && [(NSDictionary*){{name}}_dict count] > 0) {
|
||||
_{{name}} = [[{{complexType}} alloc]initWithValues:(NSDictionary*){{name}}_dict];
|
||||
}
|
||||
{{/isContainer}}
|
||||
{{#isNotContainer}}
|
||||
@ -49,7 +45,6 @@
|
||||
{{/complexType}}
|
||||
{{/vars}}
|
||||
|
||||
self.raw = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -84,9 +79,6 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asRaw {
|
||||
return _raw;
|
||||
}
|
||||
{{/model}}
|
||||
@end
|
||||
{{/models}}
|
||||
|
@ -8,13 +8,11 @@
|
||||
|
||||
@interface {{classname}} : NIKSwaggerObject {
|
||||
@private
|
||||
NSDictionary* raw;
|
||||
{{#vars}}
|
||||
{{datatype}} _{{name}}; //{{baseType}}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
@property(nonatomic) NSDictionary* raw;
|
||||
{{newline}}
|
||||
{{#vars}}
|
||||
@property(nonatomic) {{datatype}} {{name}};
|
||||
@ -24,7 +22,6 @@
|
||||
{{newline}}
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
- (NSDictionary*) asRaw;
|
||||
{{newline}}
|
||||
@end
|
||||
{{/model}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user