forked from loafle/openapi-generator-original
updated sample
This commit is contained in:
@@ -18,13 +18,14 @@
|
||||
EA6699B01811D2FA00A70D03 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA6699AE1811D2FA00A70D03 /* Main_iPad.storyboard */; };
|
||||
EA6699B31811D2FA00A70D03 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699B21811D2FA00A70D03 /* ViewController.m */; };
|
||||
EA6699B51811D2FA00A70D03 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EA6699B41811D2FA00A70D03 /* Images.xcassets */; };
|
||||
EA6699BC1811D2FB00A70D03 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699BB1811D2FB00A70D03 /* XCTest.framework */; };
|
||||
EA6699BD1811D2FB00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; };
|
||||
EA6699BE1811D2FB00A70D03 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999D1811D2FA00A70D03 /* UIKit.framework */; };
|
||||
EA6699C61811D2FB00A70D03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EA6699C41811D2FB00A70D03 /* InfoPlist.strings */; };
|
||||
EA6699C81811D2FB00A70D03 /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699C71811D2FB00A70D03 /* PetApiTest.m */; };
|
||||
EA8B8AA41AC6683700638FBB /* SWGQueryParamCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = EA8B8AA31AC6683700638FBB /* SWGQueryParamCollection.m */; };
|
||||
EA8CD3ED1AC2763600C47D0B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */; };
|
||||
EAB26B091AC8DE24002F5C7A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EAB26B081AC8DE24002F5C7A /* libPods.a */; };
|
||||
EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */ = {isa = PBXBuildFile; fileRef = EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */; };
|
||||
EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699C71811D2FB00A70D03 /* PetApiTest.m */; };
|
||||
EAEA85E41811D3AE00F06E69 /* SWGApiClient.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */; };
|
||||
EAEA85E51811D3AE00F06E69 /* SWGCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85CF1811D3AE00F06E69 /* SWGCategory.m */; };
|
||||
EAEA85E61811D3AE00F06E69 /* SWGDate.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85D11811D3AE00F06E69 /* SWGDate.m */; };
|
||||
@@ -37,7 +38,6 @@
|
||||
EAEA85ED1811D3AE00F06E69 /* SWGTag.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85DF1811D3AE00F06E69 /* SWGTag.m */; };
|
||||
EAEA85EE1811D3AE00F06E69 /* SWGUser.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85E11811D3AE00F06E69 /* SWGUser.m */; };
|
||||
EAEA85EF1811D3AE00F06E69 /* SWGUserApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85E31811D3AE00F06E69 /* SWGUserApi.m */; };
|
||||
EAEA85F11811D8F100F06E69 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EAEA85F01811D8F100F06E69 /* libPods.a */; };
|
||||
EAFBEABB1A925B8500A27431 /* test-1.png in Resources */ = {isa = PBXBuildFile; fileRef = EAFBEABA1A925B8500A27431 /* test-1.png */; };
|
||||
EAFBEABE1A92C42700A27431 /* SWGApiResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = EAFBEABD1A92C42700A27431 /* SWGApiResponse.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -72,7 +72,6 @@
|
||||
EA6699B21811D2FA00A70D03 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
||||
EA6699B41811D2FA00A70D03 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
EA6699BA1811D2FB00A70D03 /* PetstoreClientTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PetstoreClientTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EA6699BB1811D2FB00A70D03 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
|
||||
EA6699C31811D2FB00A70D03 /* PetstoreClientTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PetstoreClientTests-Info.plist"; sourceTree = "<group>"; };
|
||||
EA6699C51811D2FB00A70D03 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
EA6699C71811D2FB00A70D03 /* PetApiTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PetApiTest.m; sourceTree = "<group>"; };
|
||||
@@ -80,6 +79,8 @@
|
||||
EA8B8AA31AC6683700638FBB /* SWGQueryParamCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGQueryParamCollection.m; sourceTree = "<group>"; };
|
||||
EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PetApiTest.h; sourceTree = "<group>"; };
|
||||
EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
EAB26B081AC8DE24002F5C7A /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos/libPods.a"; sourceTree = "<absolute>"; };
|
||||
EAB26B0E1AC8E692002F5C7A /* SWGPet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGPet.h; sourceTree = "<group>"; };
|
||||
EAEA85CC1811D3AE00F06E69 /* SWGApiClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGApiClient.h; sourceTree = "<group>"; };
|
||||
EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClient.m; sourceTree = "<group>"; };
|
||||
EAEA85CE1811D3AE00F06E69 /* SWGCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGCategory.h; sourceTree = "<group>"; };
|
||||
@@ -92,7 +93,6 @@
|
||||
EAEA85D51811D3AE00F06E69 /* SWGObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGObject.m; sourceTree = "<group>"; };
|
||||
EAEA85D61811D3AE00F06E69 /* SWGOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGOrder.h; sourceTree = "<group>"; };
|
||||
EAEA85D71811D3AE00F06E69 /* SWGOrder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGOrder.m; sourceTree = "<group>"; };
|
||||
EAEA85D81811D3AE00F06E69 /* SWGPet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGPet.h; sourceTree = "<group>"; };
|
||||
EAEA85D91811D3AE00F06E69 /* SWGPet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGPet.m; sourceTree = "<group>"; };
|
||||
EAEA85DA1811D3AE00F06E69 /* SWGPetApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGPetApi.h; sourceTree = "<group>"; };
|
||||
EAEA85DB1811D3AE00F06E69 /* SWGPetApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGPetApi.m; sourceTree = "<group>"; };
|
||||
@@ -104,7 +104,6 @@
|
||||
EAEA85E11811D3AE00F06E69 /* SWGUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGUser.m; sourceTree = "<group>"; };
|
||||
EAEA85E21811D3AE00F06E69 /* SWGUserApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGUserApi.h; sourceTree = "<group>"; };
|
||||
EAEA85E31811D3AE00F06E69 /* SWGUserApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGUserApi.m; sourceTree = "<group>"; };
|
||||
EAEA85F01811D8F100F06E69 /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "../Pods/build/Debug-iphoneos/libPods.a"; sourceTree = "<group>"; };
|
||||
EAFBEABA1A925B8500A27431 /* test-1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "test-1.png"; sourceTree = "<group>"; };
|
||||
EAFBEABC1A92C42700A27431 /* SWGApiResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGApiResponse.h; sourceTree = "<group>"; };
|
||||
EAFBEABD1A92C42700A27431 /* SWGApiResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiResponse.m; sourceTree = "<group>"; };
|
||||
@@ -127,10 +126,9 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA8CD3ED1AC2763600C47D0B /* SenTestingKit.framework in Frameworks */,
|
||||
EAEA85F11811D8F100F06E69 /* libPods.a in Frameworks */,
|
||||
EA6699BC1811D2FB00A70D03 /* XCTest.framework in Frameworks */,
|
||||
EA6699BE1811D2FB00A70D03 /* UIKit.framework in Frameworks */,
|
||||
EA6699BD1811D2FB00A70D03 /* Foundation.framework in Frameworks */,
|
||||
EAB26B091AC8DE24002F5C7A /* libPods.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -170,12 +168,11 @@
|
||||
EA6699981811D2FA00A70D03 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EAB26B081AC8DE24002F5C7A /* libPods.a */,
|
||||
EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */,
|
||||
EAEA85F01811D8F100F06E69 /* libPods.a */,
|
||||
EA6699991811D2FA00A70D03 /* Foundation.framework */,
|
||||
EA66999B1811D2FA00A70D03 /* CoreGraphics.framework */,
|
||||
EA66999D1811D2FA00A70D03 /* UIKit.framework */,
|
||||
EA6699BB1811D2FB00A70D03 /* XCTest.framework */,
|
||||
73DA4F1067C343C3962F1542 /* libPods.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
@@ -246,7 +243,7 @@
|
||||
EAEA85D51811D3AE00F06E69 /* SWGObject.m */,
|
||||
EAEA85D61811D3AE00F06E69 /* SWGOrder.h */,
|
||||
EAEA85D71811D3AE00F06E69 /* SWGOrder.m */,
|
||||
EAEA85D81811D3AE00F06E69 /* SWGPet.h */,
|
||||
EAB26B0E1AC8E692002F5C7A /* SWGPet.h */,
|
||||
EAEA85D91811D3AE00F06E69 /* SWGPet.m */,
|
||||
EAEA85DA1811D3AE00F06E69 /* SWGPetApi.h */,
|
||||
EAEA85DB1811D3AE00F06E69 /* SWGPetApi.m */,
|
||||
@@ -273,8 +270,8 @@
|
||||
04DAA264FD78471BBAD25173 /* Check Pods Manifest.lock */,
|
||||
EA6699921811D2FA00A70D03 /* Sources */,
|
||||
EA6699931811D2FA00A70D03 /* Frameworks */,
|
||||
EA6699941811D2FA00A70D03 /* Resources */,
|
||||
3692D11BB04F489DAA7C0B6A /* Copy Pods Resources */,
|
||||
EA6699941811D2FA00A70D03 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -309,6 +306,7 @@
|
||||
EA66998E1811D2FA00A70D03 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastTestingUpgradeCheck = 0620;
|
||||
LastUpgradeCheck = 0500;
|
||||
ORGANIZATIONNAME = Reverb;
|
||||
TargetAttributes = {
|
||||
@@ -421,7 +419,8 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA6699C81811D2FB00A70D03 /* PetApiTest.m in Sources */,
|
||||
EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */,
|
||||
EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -554,6 +553,10 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "PetstoreClient/PetstoreClient-Prefix.pch";
|
||||
INFOPLIST_FILE = "PetstoreClient/PetstoreClient-Info.plist";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -568,6 +571,10 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "PetstoreClient/PetstoreClient-Prefix.pch";
|
||||
INFOPLIST_FILE = "PetstoreClient/PetstoreClient-Info.plist";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -575,6 +582,7 @@
|
||||
};
|
||||
EA6699CF1811D2FB00A70D03 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
|
||||
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PetstoreClient.app/PetstoreClient";
|
||||
@@ -590,6 +598,10 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = "PetstoreClientTests/PetstoreClientTests-Info.plist";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
@@ -598,6 +610,7 @@
|
||||
};
|
||||
EA6699D01811D2FB00A70D03 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = A425648B5C0A4849C7668069 /* Pods.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
|
||||
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PetstoreClient.app/PetstoreClient";
|
||||
@@ -609,6 +622,10 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "PetstoreClient/PetstoreClient-Prefix.pch";
|
||||
INFOPLIST_FILE = "PetstoreClientTests/PetstoreClientTests-Info.plist";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
|
||||
/*
|
||||
SWGPetApi * api = [[SWGPetApi alloc] init];
|
||||
/*
|
||||
[api getPetByIdWithCompletionBlock:@10 completionHandler:^(SWGPet *output, NSError *error) {
|
||||
NSLog(@"%@", [output asDictionary]);
|
||||
[output set_id:@101];
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
SWGPet* pet = [self createPet];
|
||||
SWGTag* tag = [[SWGTag alloc] init];
|
||||
tag.name = @"tony";
|
||||
NSLog(@"%@", pet._id);
|
||||
pet.tags = [[NSArray alloc] initWithObjects:tag, nil];
|
||||
|
||||
[api addPetWithCompletionBlock:pet completionHandler:^(NSError *error) {
|
||||
@@ -141,9 +142,9 @@
|
||||
if(fetched._id == pet._id && [[tag name] isEqualToString:@"tony"])
|
||||
hasTag = true;
|
||||
}
|
||||
if(!hasTag)
|
||||
XCTFail(@"failed to find tag in pet");
|
||||
}
|
||||
if(!hasTag)
|
||||
XCTFail(@"failed to find tag in pet");
|
||||
if(hasTag)
|
||||
[expectation fulfill];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
platform :ios, '6.0'
|
||||
xcodeproj 'PetstoreClient/PetstoreClient.xcodeproj'
|
||||
pod 'AFNetworking', '~> 2.1'
|
||||
pod 'JSONModel', '~> 1.0'
|
||||
|
||||
@@ -20,11 +20,14 @@ PODS:
|
||||
- AFNetworking/UIKit (2.5.1):
|
||||
- AFNetworking/NSURLConnection
|
||||
- AFNetworking/NSURLSession
|
||||
- JSONModel (1.0.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking (~> 2.1)
|
||||
- JSONModel (~> 1.0)
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: 8bee59492a6ff15d69130efa4d0dc67e0094a52a
|
||||
AFNetworking: 10e85a00bb0f475124e4ff2677bf15693b2c1523
|
||||
JSONModel: 6ffcb4ffa3659c9e9a2e5d45d6c7705bab187c03
|
||||
|
||||
COCOAPODS: 0.36.0
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
#import "SWGObject.h"
|
||||
|
||||
|
||||
@protocol SWGCategory
|
||||
@end
|
||||
|
||||
@interface SWGCategory : SWGObject
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@property(nonatomic) NSString* name;
|
||||
- (id) _id: (NSNumber*) _id
|
||||
name: (NSString*) name;
|
||||
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
@property(nonatomic) NSNumber<Optional>* _id;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* name;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,46 +1,10 @@
|
||||
#import "SWGDate.h"
|
||||
#import "SWGCategory.h"
|
||||
|
||||
@implementation SWGCategory
|
||||
|
||||
-(id)_id: (NSNumber*) _id
|
||||
name: (NSString*) name
|
||||
|
||||
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
__id = _id;
|
||||
_name = name;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithValues:(NSDictionary*)dict
|
||||
{
|
||||
self = [super init];
|
||||
if(self) {
|
||||
__id = dict[@"id"];
|
||||
|
||||
_name = dict[@"name"];
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asDictionary {
|
||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
if(__id != nil) dict[@"id"] = __id ;
|
||||
|
||||
|
||||
|
||||
if(_name != nil) dict[@"name"] = _name ;
|
||||
|
||||
|
||||
|
||||
NSDictionary* output = [dict copy];
|
||||
return output;
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "JSONModel.h"
|
||||
|
||||
@interface SWGObject : NSObject
|
||||
- (id) initWithValues:(NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
@interface SWGObject : JSONModel
|
||||
@end
|
||||
|
||||
@@ -1,17 +1,4 @@
|
||||
#import "SWGObject.h"
|
||||
|
||||
@implementation SWGObject
|
||||
|
||||
- (id) initWithValues:(NSDictionary*)dict {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDictionary*) asDictionary{
|
||||
return [NSDictionary init];
|
||||
}
|
||||
|
||||
- (NSString*)description {
|
||||
return [NSString stringWithFormat:@"%@ %@", [super description], [self asDictionary]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SWGObject.h"
|
||||
#import "SWGDate.h"
|
||||
|
||||
|
||||
@protocol SWGOrder
|
||||
@end
|
||||
|
||||
@interface SWGOrder : SWGObject
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@property(nonatomic) NSNumber* petId;
|
||||
@property(nonatomic) NSNumber* quantity;
|
||||
@property(nonatomic) SWGDate* shipDate;
|
||||
@property(nonatomic) NSString* status; /* Order Status */
|
||||
@property(nonatomic) NSNumber* complete;
|
||||
- (id) _id: (NSNumber*) _id
|
||||
petId: (NSNumber*) petId
|
||||
quantity: (NSNumber*) quantity
|
||||
shipDate: (SWGDate*) shipDate
|
||||
status: (NSString*) status
|
||||
complete: (NSNumber*) complete;
|
||||
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
@property(nonatomic) NSNumber<Optional>* _id;
|
||||
|
||||
@property(nonatomic) NSNumber<Optional>* petId;
|
||||
|
||||
@property(nonatomic) NSNumber<Optional>* quantity;
|
||||
|
||||
@property(nonatomic) NSDate<Optional>* shipDate;
|
||||
/* Order Status [optional]
|
||||
*/
|
||||
@property(nonatomic) NSString<Optional>* status;
|
||||
|
||||
@property(nonatomic) NSNumber<Optional>* complete;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,103 +1,10 @@
|
||||
#import "SWGDate.h"
|
||||
#import "SWGOrder.h"
|
||||
|
||||
@implementation SWGOrder
|
||||
|
||||
-(id)_id: (NSNumber*) _id
|
||||
petId: (NSNumber*) petId
|
||||
quantity: (NSNumber*) quantity
|
||||
shipDate: (SWGDate*) shipDate
|
||||
status: (NSString*) status
|
||||
complete: (NSNumber*) complete
|
||||
|
||||
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
__id = _id;
|
||||
_petId = petId;
|
||||
_quantity = quantity;
|
||||
_shipDate = shipDate;
|
||||
_status = status;
|
||||
_complete = complete;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithValues:(NSDictionary*)dict
|
||||
{
|
||||
self = [super init];
|
||||
if(self) {
|
||||
__id = dict[@"id"];
|
||||
|
||||
_petId = dict[@"petId"];
|
||||
|
||||
_quantity = dict[@"quantity"];
|
||||
|
||||
|
||||
|
||||
id shipDate_dict = dict[@"shipDate"];
|
||||
|
||||
if(shipDate_dict != nil)
|
||||
_shipDate = [[SWGDate alloc]initWithValues:shipDate_dict];
|
||||
|
||||
|
||||
_status = dict[@"status"];
|
||||
|
||||
_complete = dict[@"complete"];
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asDictionary {
|
||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
if(__id != nil) dict[@"id"] = __id ;
|
||||
|
||||
|
||||
|
||||
if(_petId != nil) dict[@"petId"] = _petId ;
|
||||
|
||||
|
||||
|
||||
if(_quantity != nil) dict[@"quantity"] = _quantity ;
|
||||
|
||||
|
||||
|
||||
if(_shipDate != nil){
|
||||
if([_shipDate isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
||||
for( SWGDate *shipDate in (NSArray*)_shipDate) {
|
||||
[array addObject:[(SWGObject*)shipDate asDictionary]];
|
||||
}
|
||||
dict[@"shipDate"] = array;
|
||||
}
|
||||
else if(_shipDate && [_shipDate isKindOfClass:[SWGDate class]]) {
|
||||
NSString * dateString = [(SWGDate*)_shipDate toString];
|
||||
if(dateString){
|
||||
dict[@"shipDate"] = dateString;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if(_shipDate != nil) dict[@"shipDate"] = [(SWGObject*)_shipDate asDictionary];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(_status != nil) dict[@"status"] = _status ;
|
||||
|
||||
|
||||
|
||||
if(_complete != nil) dict[@"complete"] = _complete ;
|
||||
|
||||
|
||||
|
||||
NSDictionary* output = [dict copy];
|
||||
return output;
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -4,23 +4,23 @@
|
||||
#import "SWGCategory.h"
|
||||
|
||||
|
||||
@protocol SWGPet
|
||||
@end
|
||||
|
||||
@interface SWGPet : SWGObject
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@property(nonatomic) SWGCategory* category;
|
||||
@property(nonatomic) NSString* name;
|
||||
@property(nonatomic) NSArray* photoUrls;
|
||||
@property(nonatomic) NSArray* tags;
|
||||
@property(nonatomic) NSString* status; /* pet status in the store */
|
||||
- (id) _id: (NSNumber*) _id
|
||||
category: (SWGCategory*) category
|
||||
name: (NSString*) name
|
||||
photoUrls: (NSArray*) photoUrls
|
||||
tags: (NSArray*) tags
|
||||
status: (NSString*) status;
|
||||
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
@property(nonatomic) NSNumber<Optional>* _id;
|
||||
|
||||
@property(nonatomic) SWGCategory<Optional, SWGCategory>* category;
|
||||
|
||||
@property(nonatomic) NSString* name;
|
||||
|
||||
@property(nonatomic) NSArray* photoUrls;
|
||||
|
||||
@property(nonatomic) NSArray<Optional, SWGTag>* tags;
|
||||
/* pet status in the store [optional]
|
||||
*/
|
||||
@property(nonatomic) NSString<Optional>* status;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,141 +1,10 @@
|
||||
#import "SWGDate.h"
|
||||
#import "SWGPet.h"
|
||||
|
||||
@implementation SWGPet
|
||||
|
||||
-(id)_id: (NSNumber*) _id
|
||||
category: (SWGCategory*) category
|
||||
name: (NSString*) name
|
||||
photoUrls: (NSArray*) photoUrls
|
||||
tags: (NSArray*) tags
|
||||
status: (NSString*) status
|
||||
|
||||
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
__id = _id;
|
||||
_category = category;
|
||||
_name = name;
|
||||
_photoUrls = photoUrls;
|
||||
_tags = tags;
|
||||
_status = status;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithValues:(NSDictionary*)dict
|
||||
{
|
||||
self = [super init];
|
||||
if(self) {
|
||||
__id = dict[@"id"];
|
||||
|
||||
|
||||
|
||||
id category_dict = dict[@"category"];
|
||||
|
||||
if(category_dict != nil)
|
||||
_category = [[SWGCategory alloc]initWithValues:category_dict];
|
||||
|
||||
|
||||
_name = dict[@"name"];
|
||||
|
||||
_photoUrls = dict[@"photoUrls"];
|
||||
|
||||
|
||||
|
||||
id tags_dict = dict[@"tags"];
|
||||
|
||||
if([tags_dict isKindOfClass:[NSArray class]]) {
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)tags_dict count]];
|
||||
if([(NSArray*)tags_dict count] > 0) {
|
||||
for (NSDictionary* dict in (NSArray*)tags_dict) {
|
||||
SWGTag* d = [[SWGTag alloc] initWithValues:dict];
|
||||
[objs addObject:d];
|
||||
}
|
||||
_tags = [[NSArray alloc] initWithArray:objs];
|
||||
}
|
||||
else
|
||||
_tags = [[NSArray alloc] init];
|
||||
}
|
||||
else {
|
||||
_tags = [[NSArray alloc] init];
|
||||
}
|
||||
|
||||
|
||||
_status = dict[@"status"];
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asDictionary {
|
||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
if(__id != nil) dict[@"id"] = __id ;
|
||||
|
||||
|
||||
|
||||
if(_category != nil){
|
||||
if([_category isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
||||
for( SWGCategory *category in (NSArray*)_category) {
|
||||
[array addObject:[(SWGObject*)category asDictionary]];
|
||||
}
|
||||
dict[@"category"] = array;
|
||||
}
|
||||
else if(_category && [_category isKindOfClass:[SWGDate class]]) {
|
||||
NSString * dateString = [(SWGDate*)_category toString];
|
||||
if(dateString){
|
||||
dict[@"category"] = dateString;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if(_category != nil) dict[@"category"] = [(SWGObject*)_category asDictionary];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(_name != nil) dict[@"name"] = _name ;
|
||||
|
||||
|
||||
|
||||
if(_photoUrls != nil) dict[@"photoUrls"] = _photoUrls ;
|
||||
|
||||
|
||||
|
||||
if(_tags != nil){
|
||||
if([_tags isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
||||
for( SWGTag *tags in (NSArray*)_tags) {
|
||||
[array addObject:[(SWGObject*)tags asDictionary]];
|
||||
}
|
||||
dict[@"tags"] = array;
|
||||
}
|
||||
else if(_tags && [_tags isKindOfClass:[SWGDate class]]) {
|
||||
NSString * dateString = [(SWGDate*)_tags toString];
|
||||
if(dateString){
|
||||
dict[@"tags"] = dateString;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if(_tags != nil) dict[@"tags"] = [(SWGObject*)_tags asDictionary];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(_status != nil) dict[@"status"] = _status ;
|
||||
|
||||
|
||||
|
||||
NSDictionary* output = [dict copy];
|
||||
return output;
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -51,11 +51,11 @@
|
||||
@param status Status values that need to be considered for filter
|
||||
|
||||
|
||||
return type: NSArray*
|
||||
return type: NSArray<SWGPet>*
|
||||
*/
|
||||
-(NSNumber*) findPetsByStatusWithCompletionBlock :(NSArray*) status
|
||||
|
||||
completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
|
||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
|
||||
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@
|
||||
@param tags Tags to filter by
|
||||
|
||||
|
||||
return type: NSArray*
|
||||
return type: NSArray<SWGPet>*
|
||||
*/
|
||||
-(NSNumber*) findPetsByTagsWithCompletionBlock :(NSArray*) tags
|
||||
|
||||
completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
|
||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -89,8 +89,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
@@ -161,8 +161,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -170,8 +170,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
@@ -216,7 +216,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
|
||||
-(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status
|
||||
|
||||
completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock
|
||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
|
||||
{
|
||||
|
||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByStatus", basePath];
|
||||
@@ -275,11 +275,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
for (NSDictionary* dict in (NSArray*)data) {
|
||||
|
||||
|
||||
SWGPet* d = [[SWGPet alloc]initWithValues: dict];
|
||||
SWGPet* d = [[SWGPet alloc] initWithDictionary:dict error:nil];
|
||||
|
||||
[objs addObject:d];
|
||||
}
|
||||
completionBlock(objs, nil);
|
||||
completionBlock((NSArray<SWGPet>*)objs, nil);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
|
||||
-(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags
|
||||
|
||||
completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock
|
||||
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error))completionBlock
|
||||
{
|
||||
|
||||
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByTags", basePath];
|
||||
@@ -352,11 +352,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
for (NSDictionary* dict in (NSArray*)data) {
|
||||
|
||||
|
||||
SWGPet* d = [[SWGPet alloc]initWithValues: dict];
|
||||
SWGPet* d = [[SWGPet alloc] initWithDictionary:dict error:nil];
|
||||
|
||||
[objs addObject:d];
|
||||
}
|
||||
completionBlock(objs, nil);
|
||||
completionBlock((NSArray<SWGPet>*)objs, nil);
|
||||
}
|
||||
|
||||
|
||||
@@ -414,10 +414,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
// complex response
|
||||
|
||||
// comples response type
|
||||
return [client dictionary: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
return [client dictionary: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
requestContentType: requestContentType
|
||||
responseContentType: responseContentType
|
||||
@@ -429,12 +429,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
SWGPet* result = nil;
|
||||
if (data) {
|
||||
result = [[SWGPet alloc] initWithValues : data];
|
||||
result = [[SWGPet alloc] initWithDictionary:data error:nil];
|
||||
}
|
||||
completionBlock(result , nil);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -142,8 +142,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -151,8 +151,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
@@ -182,10 +182,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
// complex response
|
||||
|
||||
// comples response type
|
||||
return [client dictionary: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
return [client dictionary: requestUrl
|
||||
method: @"POST"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
requestContentType: requestContentType
|
||||
responseContentType: responseContentType
|
||||
@@ -197,12 +197,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
SWGOrder* result = nil;
|
||||
if (data) {
|
||||
result = [[SWGOrder alloc] initWithValues : data];
|
||||
result = [[SWGOrder alloc] initWithDictionary:data error:nil];
|
||||
}
|
||||
completionBlock(result , nil);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -254,10 +255,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
// complex response
|
||||
|
||||
// comples response type
|
||||
return [client dictionary: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
return [client dictionary: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
requestContentType: requestContentType
|
||||
responseContentType: responseContentType
|
||||
@@ -269,12 +270,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
SWGOrder* result = nil;
|
||||
if (data) {
|
||||
result = [[SWGOrder alloc] initWithValues : data];
|
||||
result = [[SWGOrder alloc] initWithDictionary:data error:nil];
|
||||
}
|
||||
completionBlock(result , nil);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,15 +2,14 @@
|
||||
#import "SWGObject.h"
|
||||
|
||||
|
||||
@protocol SWGTag
|
||||
@end
|
||||
|
||||
@interface SWGTag : SWGObject
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@property(nonatomic) NSString* name;
|
||||
- (id) _id: (NSNumber*) _id
|
||||
name: (NSString*) name;
|
||||
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
@property(nonatomic) NSNumber<Optional>* _id;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* name;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,46 +1,10 @@
|
||||
#import "SWGDate.h"
|
||||
#import "SWGTag.h"
|
||||
|
||||
@implementation SWGTag
|
||||
|
||||
-(id)_id: (NSNumber*) _id
|
||||
name: (NSString*) name
|
||||
|
||||
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
__id = _id;
|
||||
_name = name;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithValues:(NSDictionary*)dict
|
||||
{
|
||||
self = [super init];
|
||||
if(self) {
|
||||
__id = dict[@"id"];
|
||||
|
||||
_name = dict[@"name"];
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asDictionary {
|
||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
if(__id != nil) dict[@"id"] = __id ;
|
||||
|
||||
|
||||
|
||||
if(_name != nil) dict[@"name"] = _name ;
|
||||
|
||||
|
||||
|
||||
NSDictionary* output = [dict copy];
|
||||
return output;
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
#import "SWGObject.h"
|
||||
|
||||
|
||||
@protocol SWGUser
|
||||
@end
|
||||
|
||||
@interface SWGUser : SWGObject
|
||||
|
||||
@property(nonatomic) NSNumber* _id;
|
||||
@property(nonatomic) NSString* username;
|
||||
@property(nonatomic) NSString* firstName;
|
||||
@property(nonatomic) NSString* lastName;
|
||||
@property(nonatomic) NSString* email;
|
||||
@property(nonatomic) NSString* password;
|
||||
@property(nonatomic) NSString* phone;
|
||||
@property(nonatomic) NSNumber* userStatus; /* User Status */
|
||||
- (id) _id: (NSNumber*) _id
|
||||
username: (NSString*) username
|
||||
firstName: (NSString*) firstName
|
||||
lastName: (NSString*) lastName
|
||||
email: (NSString*) email
|
||||
password: (NSString*) password
|
||||
phone: (NSString*) phone
|
||||
userStatus: (NSNumber*) userStatus;
|
||||
|
||||
|
||||
- (id) initWithValues: (NSDictionary*)dict;
|
||||
- (NSDictionary*) asDictionary;
|
||||
@property(nonatomic) NSNumber<Optional>* _id;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* username;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* firstName;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* lastName;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* email;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* password;
|
||||
|
||||
@property(nonatomic) NSString<Optional>* phone;
|
||||
/* User Status [optional]
|
||||
*/
|
||||
@property(nonatomic) NSNumber<Optional>* userStatus;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,94 +1,10 @@
|
||||
#import "SWGDate.h"
|
||||
#import "SWGUser.h"
|
||||
|
||||
@implementation SWGUser
|
||||
|
||||
-(id)_id: (NSNumber*) _id
|
||||
username: (NSString*) username
|
||||
firstName: (NSString*) firstName
|
||||
lastName: (NSString*) lastName
|
||||
email: (NSString*) email
|
||||
password: (NSString*) password
|
||||
phone: (NSString*) phone
|
||||
userStatus: (NSNumber*) userStatus
|
||||
|
||||
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
__id = _id;
|
||||
_username = username;
|
||||
_firstName = firstName;
|
||||
_lastName = lastName;
|
||||
_email = email;
|
||||
_password = password;
|
||||
_phone = phone;
|
||||
_userStatus = userStatus;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithValues:(NSDictionary*)dict
|
||||
{
|
||||
self = [super init];
|
||||
if(self) {
|
||||
__id = dict[@"id"];
|
||||
|
||||
_username = dict[@"username"];
|
||||
|
||||
_firstName = dict[@"firstName"];
|
||||
|
||||
_lastName = dict[@"lastName"];
|
||||
|
||||
_email = dict[@"email"];
|
||||
|
||||
_password = dict[@"password"];
|
||||
|
||||
_phone = dict[@"phone"];
|
||||
|
||||
_userStatus = dict[@"userStatus"];
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(NSDictionary*) asDictionary {
|
||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
|
||||
if(__id != nil) dict[@"id"] = __id ;
|
||||
|
||||
|
||||
|
||||
if(_username != nil) dict[@"username"] = _username ;
|
||||
|
||||
|
||||
|
||||
if(_firstName != nil) dict[@"firstName"] = _firstName ;
|
||||
|
||||
|
||||
|
||||
if(_lastName != nil) dict[@"lastName"] = _lastName ;
|
||||
|
||||
|
||||
|
||||
if(_email != nil) dict[@"email"] = _email ;
|
||||
|
||||
|
||||
|
||||
if(_password != nil) dict[@"password"] = _password ;
|
||||
|
||||
|
||||
|
||||
if(_phone != nil) dict[@"phone"] = _phone ;
|
||||
|
||||
|
||||
|
||||
if(_userStatus != nil) dict[@"userStatus"] = _userStatus ;
|
||||
|
||||
|
||||
|
||||
NSDictionary* output = [dict copy];
|
||||
return output;
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
return type:
|
||||
*/
|
||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body
|
||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray<SWGUser>*) body
|
||||
|
||||
|
||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
return type:
|
||||
*/
|
||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray*) body
|
||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray<SWGUser>*) body
|
||||
|
||||
|
||||
completionHandler: (void (^)(NSError* error))completionBlock;
|
||||
|
||||
@@ -79,8 +79,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -88,8 +88,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
@@ -132,7 +132,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
|
||||
}
|
||||
|
||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock: (NSArray*) body
|
||||
-(NSNumber*) createUsersWithArrayInputWithCompletionBlock: (NSArray<SWGUser>*) body
|
||||
|
||||
|
||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||
@@ -160,8 +160,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -169,8 +169,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
@@ -213,7 +213,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
|
||||
}
|
||||
|
||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray*) body
|
||||
-(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray<SWGUser>*) body
|
||||
|
||||
|
||||
completionHandler: (void (^)(NSError* error))completionBlock {
|
||||
@@ -241,8 +241,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -250,8 +250,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
@@ -367,6 +367,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
|
||||
// complex response
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -475,10 +476,10 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
// complex response
|
||||
|
||||
// comples response type
|
||||
return [client dictionary: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
return [client dictionary: requestUrl
|
||||
method: @"GET"
|
||||
queryParams: queryParams
|
||||
body: bodyDictionary
|
||||
headerParams: headerParams
|
||||
requestContentType: requestContentType
|
||||
responseContentType: responseContentType
|
||||
@@ -490,12 +491,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
SWGUser* result = nil;
|
||||
if (data) {
|
||||
result = [[SWGUser alloc] initWithValues : data];
|
||||
result = [[SWGUser alloc] initWithDictionary:data error:nil];
|
||||
}
|
||||
completionBlock(result , nil);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -531,8 +533,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
if(__body != nil && [__body isKindOfClass:[NSArray class]]){
|
||||
NSMutableArray * objs = [[NSMutableArray alloc] init];
|
||||
for (id dict in (NSArray*)__body) {
|
||||
if([dict respondsToSelector:@selector(asDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict asDictionary]];
|
||||
if([dict respondsToSelector:@selector(toDictionary)]) {
|
||||
[objs addObject:[(SWGObject*)dict toDictionary]];
|
||||
}
|
||||
else{
|
||||
[objs addObject:dict];
|
||||
@@ -540,8 +542,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2";
|
||||
}
|
||||
bodyDictionary = objs;
|
||||
}
|
||||
else if([__body respondsToSelector:@selector(asDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body asDictionary];
|
||||
else if([__body respondsToSelector:@selector(toDictionary)]) {
|
||||
bodyDictionary = [(SWGObject*)__body toDictionary];
|
||||
}
|
||||
else if([__body isKindOfClass:[NSString class]]) {
|
||||
// convert it to a dictionary
|
||||
|
||||
@@ -21,28 +21,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${jetty-version}</version>
|
||||
<configuration>
|
||||
<war>${project.build.directory}/swagger-java-jersey-sample-app-${webapp-version}.war</war>
|
||||
<stopKey>alpha</stopKey>
|
||||
<stopPort>9099</stopPort>
|
||||
<httpConnector>
|
||||
<port>8080</port>
|
||||
</httpConnector>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-jetty</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>deploy-war</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
@@ -84,25 +62,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-java-jersey-sample-app</artifactId>
|
||||
<version>${webapp-version}</version>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<webapp-version>1.5.4-M1-SNAPSHOT</webapp-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user