forked from loafle/openapi-generator-original
removed raw value
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
/**
|
||||
* Copyright 2012 Wordnik, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import com.wordnik.swagger.codegen.BasicObjcGenerator
|
||||
|
||||
import com.wordnik.swagger.core._
|
||||
@@ -8,6 +24,9 @@ object ObjcPetstoreCodegen extends BasicObjcGenerator {
|
||||
// where to write generated code
|
||||
override def destinationDir = "samples/client/petstore/objc/client"
|
||||
|
||||
// to avoid recompiling ...
|
||||
override def templateDir = "src/main/resources/objc"
|
||||
|
||||
// supporting classes
|
||||
override def supportingFiles =
|
||||
List(
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
EA07F54816135916006A2112 /* NIKUser.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51F1613569A006A2112 /* NIKUser.m */; };
|
||||
EA07F54916135916006A2112 /* NIKUserApi.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5201613569A006A2112 /* NIKUserApi.h */; };
|
||||
EA07F54A16135916006A2112 /* NIKUserApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5211613569A006A2112 /* NIKUserApi.m */; };
|
||||
EA5A034416141443003B3E41 /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA5A034316141443003B3E41 /* UserApiTest.m */; };
|
||||
EAE96DE616138695004AB97C /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA81837816137FD500341A6E /* PetApiTest.m */; };
|
||||
EAE96DE716138695004AB97C /* PetApiTest.h in Sources */ = {isa = PBXBuildFile; fileRef = EA81837916137FD500341A6E /* PetApiTest.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -103,6 +104,8 @@
|
||||
EA07F5211613569A006A2112 /* NIKUserApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKUserApi.m; path = ../client/NIKUserApi.m; sourceTree = "<group>"; };
|
||||
EA07F5301613580E006A2112 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
EA07F53216135819006A2112 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
EA5A034216141443003B3E41 /* UserApiTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserApiTest.h; path = ../tests/UserApiTest.h; sourceTree = "<group>"; };
|
||||
EA5A034316141443003B3E41 /* UserApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UserApiTest.m; path = ../tests/UserApiTest.m; sourceTree = "<group>"; };
|
||||
EA81837816137FD500341A6E /* PetApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PetApiTest.m; path = ../tests/PetApiTest.m; sourceTree = "<group>"; };
|
||||
EA81837916137FD500341A6E /* PetApiTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PetApiTest.h; path = ../tests/PetApiTest.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@@ -218,6 +221,8 @@
|
||||
children = (
|
||||
EA81837816137FD500341A6E /* PetApiTest.m */,
|
||||
EA81837916137FD500341A6E /* PetApiTest.h */,
|
||||
EA5A034216141443003B3E41 /* UserApiTest.h */,
|
||||
EA5A034316141443003B3E41 /* UserApiTest.m */,
|
||||
);
|
||||
name = Tests;
|
||||
sourceTree = "<group>";
|
||||
@@ -362,6 +367,7 @@
|
||||
EA07F54816135916006A2112 /* NIKUser.m in Sources */,
|
||||
EA07F54916135916006A2112 /* NIKUserApi.h in Sources */,
|
||||
EA07F54A16135916006A2112 /* NIKUserApi.m in Sources */,
|
||||
EA5A034416141443003B3E41 /* UserApiTest.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
Binary file not shown.
@@ -237,5 +237,18 @@
|
||||
landmarkName = "-testGetPetByTags"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "../tests/UserApiTest.m"
|
||||
timestampString = "370414932.195391"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "44"
|
||||
endingLineNumber = "44"
|
||||
landmarkName = "-testLoginUser"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
</FileBreakpoints>
|
||||
</Bucket>
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
|
||||
@interface NIKCategory : NIKSwaggerObject {
|
||||
@private
|
||||
NSDictionary* raw;
|
||||
NSNumber* __id; //NSNumber
|
||||
NSString* _name; //NSString
|
||||
}
|
||||
|
||||
@property(nonatomic) NSDictionary* raw;
|
||||
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@@ -18,7 +16,6 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
- (NSDictionary*) asRaw;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
@implementation NIKCategory
|
||||
|
||||
@synthesize raw = _raw;
|
||||
|
||||
@synthesize _id = __id;
|
||||
@synthesize name = _name;
|
||||
- (id) _id: (NSNumber*) _id
|
||||
@@ -17,9 +15,10 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict
|
||||
{
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
__id = [dict objectForKey:@"id"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_name = [dict objectForKey:@"name"];
|
||||
self.raw = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -31,8 +30,5 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asRaw {
|
||||
return _raw;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
@interface NIKOrder : NIKSwaggerObject {
|
||||
@private
|
||||
NSDictionary* raw;
|
||||
NSNumber* __id; //NSNumber
|
||||
NSNumber* _petId; //NSNumber
|
||||
NSString* _status; //NSString
|
||||
@@ -12,7 +11,6 @@
|
||||
NIKDate* _shipDate; //NIKDate
|
||||
}
|
||||
|
||||
@property(nonatomic) NSDictionary* raw;
|
||||
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@@ -28,7 +26,6 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
- (NSDictionary*) asRaw;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
@implementation NIKOrder
|
||||
|
||||
@synthesize raw = _raw;
|
||||
|
||||
@synthesize _id = __id;
|
||||
@synthesize petId = _petId;
|
||||
@synthesize status = _status;
|
||||
@@ -26,13 +24,17 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict
|
||||
{
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
__id = [dict objectForKey:@"id"];
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
_petId = [dict objectForKey:@"petId"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_status = [dict objectForKey:@"status"];
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
_quantity = [dict objectForKey:@"quantity"];
|
||||
/* isContainer: , baseType: NIKDate, complexType: NIKDate */
|
||||
id shipDate_dict = [dict objectForKey:@"shipDate"];
|
||||
_shipDate = [[NIKDate alloc]initWithValues:shipDate_dict];
|
||||
self.raw = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -64,8 +66,5 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asRaw {
|
||||
return _raw;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
@interface NIKPet : NIKSwaggerObject {
|
||||
@private
|
||||
NSDictionary* raw;
|
||||
NSNumber* __id; //NSNumber
|
||||
NSArray* _tags; //Tag
|
||||
NIKCategory* _category; //Category
|
||||
@@ -14,7 +13,6 @@
|
||||
NSArray* _photoUrls; //NSString
|
||||
}
|
||||
|
||||
@property(nonatomic) NSDictionary* raw;
|
||||
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@@ -32,7 +30,6 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
- (NSDictionary*) asRaw;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
@implementation NIKPet
|
||||
|
||||
@synthesize raw = _raw;
|
||||
|
||||
@synthesize _id = __id;
|
||||
@synthesize tags = _tags;
|
||||
@synthesize category = _category;
|
||||
@@ -29,7 +27,9 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict
|
||||
{
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
__id = [dict objectForKey:@"id"];
|
||||
/* isContainer: true, baseType: Tag, complexType: NIKTag */
|
||||
id tags_dict = [dict objectForKey:@"tags"];
|
||||
if([tags_dict isKindOfClass:[NSArray class]]) {
|
||||
if([(NSArray*)tags_dict count] > 0) {
|
||||
@@ -40,16 +40,16 @@
|
||||
}
|
||||
_tags = [[NSArray alloc] initWithArray:objs];
|
||||
}
|
||||
}
|
||||
else if([tags_dict isKindOfClass:[NSDictionary class]] && [(NSDictionary*)tags_dict count] > 0) {
|
||||
_tags = [[NIKTag alloc]initWithValues:(NSDictionary*)tags_dict];
|
||||
}
|
||||
/* isContainer: , baseType: Category, complexType: NIKCategory */
|
||||
id category_dict = [dict objectForKey:@"category"];
|
||||
_category = [[NIKCategory alloc]initWithValues:category_dict];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_status = [dict objectForKey:@"status"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_name = [dict objectForKey:@"name"];
|
||||
/* isContainer: true, baseType: NSString, complexType: */
|
||||
_photoUrls = [dict objectForKey:@"photoUrls"];
|
||||
self.raw = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -99,8 +99,5 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asRaw {
|
||||
return _raw;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -22,6 +22,13 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
[_api addHeader:value forKey:key];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive:
|
||||
* returnBaseType: NIKPet
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) getPetByIdWithCompletionBlock :(NSString*) petId
|
||||
completionHandler:(void (^)(NIKPet*, NSError *))completionBlock{
|
||||
|
||||
@@ -38,21 +45,28 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(petId == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
}
|
||||
|
||||
completionBlock( [[NIKPet alloc]initWithValues: data], nil);
|
||||
}];
|
||||
|
||||
completionBlock( [[NIKPet alloc]initWithValues: data], nil);}];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) addPetWithCompletionBlock :(NIKPet*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -90,21 +104,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) updatePetWithCompletionBlock :(NIKPet*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -142,21 +164,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"PUT"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive:
|
||||
* returnBaseType: NIKPet
|
||||
* returnContainer: List
|
||||
*
|
||||
**/
|
||||
-(void) findPetsByStatusWithCompletionBlock :(NSString*) status
|
||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock{
|
||||
|
||||
@@ -174,13 +204,14 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(status == nil) {
|
||||
// error
|
||||
}
|
||||
// it's a returnContainer
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
}
|
||||
|
||||
@@ -192,11 +223,17 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
}
|
||||
completionBlock(objs, nil);
|
||||
}
|
||||
|
||||
}];
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive:
|
||||
* returnBaseType: NIKPet
|
||||
* returnContainer: List
|
||||
*
|
||||
**/
|
||||
-(void) findPetsByTagsWithCompletionBlock :(NSString*) tags
|
||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock{
|
||||
|
||||
@@ -214,13 +251,14 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(tags == nil) {
|
||||
// error
|
||||
}
|
||||
// it's a returnContainer
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
}
|
||||
|
||||
@@ -232,9 +270,8 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
}
|
||||
completionBlock(objs, nil);
|
||||
}
|
||||
|
||||
}];
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void) getPetByIdAsJsonWithCompletionBlock :(NSString*) petId
|
||||
|
||||
@@ -22,6 +22,13 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
[_api addHeader:value forKey:key];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive:
|
||||
* returnBaseType: NIKOrder
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) getOrderByIdWithCompletionBlock :(NSString*) orderId
|
||||
completionHandler:(void (^)(NIKOrder*, NSError *))completionBlock{
|
||||
|
||||
@@ -38,21 +45,28 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(orderId == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
}
|
||||
|
||||
completionBlock( [[NIKOrder alloc]initWithValues: data], nil);
|
||||
}];
|
||||
|
||||
completionBlock( [[NIKOrder alloc]initWithValues: data], nil);}];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) deleteOrderWithCompletionBlock :(NSString*) orderId
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -69,21 +83,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(orderId == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"DELETE"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) placeOrderWithCompletionBlock :(NIKOrder*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -121,19 +143,20 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void) getOrderByIdAsJsonWithCompletionBlock :(NSString*) orderId
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
|
||||
@interface NIKTag : NIKSwaggerObject {
|
||||
@private
|
||||
NSDictionary* raw;
|
||||
NSNumber* __id; //NSNumber
|
||||
NSString* _name; //NSString
|
||||
}
|
||||
|
||||
@property(nonatomic) NSDictionary* raw;
|
||||
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@@ -18,7 +16,6 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
- (NSDictionary*) asRaw;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
@implementation NIKTag
|
||||
|
||||
@synthesize raw = _raw;
|
||||
|
||||
@synthesize _id = __id;
|
||||
@synthesize name = _name;
|
||||
- (id) _id: (NSNumber*) _id
|
||||
@@ -17,9 +15,10 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict
|
||||
{
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
__id = [dict objectForKey:@"id"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_name = [dict objectForKey:@"name"];
|
||||
self.raw = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -31,8 +30,5 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asRaw {
|
||||
return _raw;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
@interface NIKUser : NIKSwaggerObject {
|
||||
@private
|
||||
NSDictionary* raw;
|
||||
NSNumber* __id; //NSNumber
|
||||
NSString* _lastName; //NSString
|
||||
NSString* _username; //NSString
|
||||
@@ -14,7 +13,6 @@
|
||||
NSString* _password; //NSString
|
||||
}
|
||||
|
||||
@property(nonatomic) NSDictionary* raw;
|
||||
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@@ -36,7 +34,6 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
- (NSDictionary*) asRaw;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
@implementation NIKUser
|
||||
|
||||
@synthesize raw = _raw;
|
||||
|
||||
@synthesize _id = __id;
|
||||
@synthesize lastName = _lastName;
|
||||
@synthesize username = _username;
|
||||
@@ -35,15 +33,22 @@
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict
|
||||
{
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
__id = [dict objectForKey:@"id"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_lastName = [dict objectForKey:@"lastName"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_username = [dict objectForKey:@"username"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_phone = [dict objectForKey:@"phone"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_email = [dict objectForKey:@"email"];
|
||||
/* isContainer: , baseType: NSNumber, complexType: */
|
||||
_userStatus = [dict objectForKey:@"userStatus"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_firstName = [dict objectForKey:@"firstName"];
|
||||
/* isContainer: , baseType: NSString, complexType: */
|
||||
_password = [dict objectForKey:@"password"];
|
||||
self.raw = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -61,8 +66,5 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asRaw {
|
||||
return _raw;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@@ -22,6 +22,13 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
[_api addHeader:value forKey:key];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -59,21 +66,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) createUserWithCompletionBlock :(NIKUser*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -111,21 +126,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) createUsersWithListInputWithCompletionBlock :(NSArray*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -163,21 +186,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) updateUserWithCompletionBlock :(NSString*) username body:(NIKUser*) body
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -219,21 +250,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(body == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"PUT"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) deleteUserWithCompletionBlock :(NSString*) username
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -250,21 +289,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(username == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"DELETE"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive:
|
||||
* returnBaseType: NIKUser
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) getUserByNameWithCompletionBlock :(NSString*) username
|
||||
completionHandler:(void (^)(NIKUser*, NSError *))completionBlock{
|
||||
|
||||
@@ -281,21 +328,28 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(username == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
}
|
||||
|
||||
completionBlock( [[NIKUser alloc]initWithValues: data], nil);
|
||||
}];
|
||||
|
||||
completionBlock( [[NIKUser alloc]initWithValues: data], nil);}];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType: NSString
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) loginUserWithCompletionBlock :(NSString*) username password:(NSString*) password
|
||||
completionHandler:(void (^)(NSString*, NSError *))completionBlock{
|
||||
|
||||
@@ -318,21 +372,42 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
if(password == nil) {
|
||||
// error
|
||||
}
|
||||
// not a return container
|
||||
// not an array, need to get json string as response
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
if (error) {
|
||||
completionBlock(nil, error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock( [[NSString alloc]initWithString: data], nil);
|
||||
}];
|
||||
|
||||
[_api dictionaryWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(nil, error);return;
|
||||
}
|
||||
|
||||
completionBlock( [[NSString alloc]initWithString: data], nil);}];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* returnTypeIsPrimitive: true
|
||||
* returnBaseType:
|
||||
* returnContainer:
|
||||
*
|
||||
**/
|
||||
-(void) logoutUserWithCompletionBlock :
|
||||
completionHandler:(void (^)(NSError *))completionBlock{
|
||||
|
||||
@@ -345,19 +420,20 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
|
||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
||||
id bodyDictionary = nil;
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
// not a return container
|
||||
[_api stringWithCompletionBlock: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
completionHandler: ^(NSString *data, NSError *error) {
|
||||
if (error) {
|
||||
completionBlock(error);return;
|
||||
if (error) {
|
||||
completionBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
completionBlock(nil);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void) createUsersWithArrayInputAsJsonWithCompletionBlock :(NSArray*) body
|
||||
|
||||
9
samples/client/petstore/objc/tests/UserApiTest.h
Normal file
9
samples/client/petstore/objc/tests/UserApiTest.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
#import "NIKUserApi.h"
|
||||
|
||||
@interface UserApiTest : SenTestCase {
|
||||
@private
|
||||
NIKUserApi * api;
|
||||
}
|
||||
|
||||
@end
|
||||
47
samples/client/petstore/objc/tests/UserApiTest.m
Normal file
47
samples/client/petstore/objc/tests/UserApiTest.m
Normal file
@@ -0,0 +1,47 @@
|
||||
#import "UserApiTest.h"
|
||||
|
||||
@implementation UserApiTest
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
api = [[NIKUserApi alloc ]init];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testLoginUser {
|
||||
bool done = false;
|
||||
static NSString* authString = nil;
|
||||
static NSError * gError = nil;
|
||||
|
||||
[api loginUserWithCompletionBlock:@"foo"
|
||||
password:@"bar"
|
||||
completionHandler:^(NSString *output, NSError *error) {
|
||||
if(error) {
|
||||
gError = error;
|
||||
}
|
||||
if(output == nil){
|
||||
NSLog(@"failed to login");
|
||||
}
|
||||
else {
|
||||
authString = [NSString stringWithString:output];
|
||||
}
|
||||
}];
|
||||
|
||||
NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10];
|
||||
while(!done && [loopUntil timeIntervalSinceNow] > 0){
|
||||
if(gError){
|
||||
STFail(@"got error %@", gError);
|
||||
done = true;
|
||||
}
|
||||
if(authString){
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
STAssertTrue([authString length] > 0, @"string was zero chars");
|
||||
NSLog(@"got login %@", authString);
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user