From e65e5a730db449c0034e09459529bdb7f4204f04 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Wed, 26 Sep 2012 11:09:40 -0700 Subject: [PATCH] moved folders --- samples/client/petstore/objc/NIKApiInvoker.h | 32 - samples/client/petstore/objc/NIKApiInvoker.m | 223 ------ samples/client/petstore/objc/NIKCategory.h | 25 - samples/client/petstore/objc/NIKCategory.m | 38 - samples/client/petstore/objc/NIKDate.h | 13 - samples/client/petstore/objc/NIKDate.m | 34 - samples/client/petstore/objc/NIKOrder.h | 35 - samples/client/petstore/objc/NIKOrder.m | 71 -- samples/client/petstore/objc/NIKPet.h | 39 - samples/client/petstore/objc/NIKPet.m | 106 --- samples/client/petstore/objc/NIKPetApi.h | 28 - samples/client/petstore/objc/NIKPetApi.m | 473 ------------ samples/client/petstore/objc/NIKStoreApi.h | 24 - samples/client/petstore/objc/NIKStoreApi.m | 265 ------- .../client/petstore/objc/NIKSwaggerObject.h | 6 - .../client/petstore/objc/NIKSwaggerObject.m | 10 - samples/client/petstore/objc/NIKTag.h | 25 - samples/client/petstore/objc/NIKTag.m | 38 - samples/client/petstore/objc/NIKUser.h | 43 -- samples/client/petstore/objc/NIKUser.m | 68 -- samples/client/petstore/objc/NIKUserApi.h | 34 - samples/client/petstore/objc/NIKUserApi.m | 724 ------------------ .../petstore/objc/ObjcPetstoreCodegen.scala | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 554 ++++++++++++++ .../PetstoreClient/PetstoreClient-Prefix.pch | 7 + .../PetstoreClient/PetstoreClient.1 | 79 ++ .../objc/PetstoreClient/PetstoreClient/main.m | 22 + .../PetstoreClientTests-Info.plist | 22 + .../PetstoreClientTests-Prefix.pch | 7 + .../en.lproj/InfoPlist.strings | 2 + .../client/petstore/objc/tests/PetApiTest.h | 9 + .../client/petstore/objc/tests/PetApiTest.m | 323 ++++++++ 32 files changed, 1026 insertions(+), 2355 deletions(-) delete mode 100644 samples/client/petstore/objc/NIKApiInvoker.h delete mode 100644 samples/client/petstore/objc/NIKApiInvoker.m delete mode 100644 samples/client/petstore/objc/NIKCategory.h delete mode 100644 samples/client/petstore/objc/NIKCategory.m delete mode 100644 samples/client/petstore/objc/NIKDate.h delete mode 100644 samples/client/petstore/objc/NIKDate.m delete mode 100644 samples/client/petstore/objc/NIKOrder.h delete mode 100644 samples/client/petstore/objc/NIKOrder.m delete mode 100644 samples/client/petstore/objc/NIKPet.h delete mode 100644 samples/client/petstore/objc/NIKPet.m delete mode 100644 samples/client/petstore/objc/NIKPetApi.h delete mode 100644 samples/client/petstore/objc/NIKPetApi.m delete mode 100644 samples/client/petstore/objc/NIKStoreApi.h delete mode 100644 samples/client/petstore/objc/NIKStoreApi.m delete mode 100644 samples/client/petstore/objc/NIKSwaggerObject.h delete mode 100644 samples/client/petstore/objc/NIKSwaggerObject.m delete mode 100644 samples/client/petstore/objc/NIKTag.h delete mode 100644 samples/client/petstore/objc/NIKTag.m delete mode 100644 samples/client/petstore/objc/NIKUser.h delete mode 100644 samples/client/petstore/objc/NIKUser.m delete mode 100644 samples/client/petstore/objc/NIKUserApi.h delete mode 100644 samples/client/petstore/objc/NIKUserApi.m create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient-Prefix.pch create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient.1 create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClient/main.m create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Info.plist create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Prefix.pch create mode 100644 samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/en.lproj/InfoPlist.strings create mode 100644 samples/client/petstore/objc/tests/PetApiTest.h create mode 100644 samples/client/petstore/objc/tests/PetApiTest.m diff --git a/samples/client/petstore/objc/NIKApiInvoker.h b/samples/client/petstore/objc/NIKApiInvoker.h deleted file mode 100644 index 1e1c28aef37..00000000000 --- a/samples/client/petstore/objc/NIKApiInvoker.h +++ /dev/null @@ -1,32 +0,0 @@ -#import - -@interface NIKApiInvoker : NSObject { - -@private - NSOperationQueue *_queue; - NSMutableDictionary * _defaultHeaders; -} -@property(nonatomic, readonly) NSOperationQueue* queue; -@property(nonatomic, readonly) NSMutableDictionary * defaultHeaders; - - --(void) addHeader:(NSString*) value - forKey:(NSString*)key; - --(NSString*) escapeString:(NSString*) string; - --(id) dictionaryWithCompletionBlock:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id)body - headerParams:(NSDictionary*) headerParams - completionHandler:(void (^)(NSDictionary*, NSError *))completionBlock; - --(id) stringWithCompletionBlock:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id)body - headerParams:(NSDictionary*) headerParams - completionHandler:(void (^)(NSString*, NSError *))completionBlock; - -@end diff --git a/samples/client/petstore/objc/NIKApiInvoker.m b/samples/client/petstore/objc/NIKApiInvoker.m deleted file mode 100644 index dd11365aeca..00000000000 --- a/samples/client/petstore/objc/NIKApiInvoker.m +++ /dev/null @@ -1,223 +0,0 @@ -#import "NIKApiInvoker.h" - -@implementation NIKApiInvoker - -@synthesize queue = _queue; -@synthesize defaultHeaders = _defaultHeaders; - -- (id) init { - self = [super init]; - _queue = [[NSOperationQueue alloc] init]; - _defaultHeaders = [[NSMutableDictionary alloc] init]; - return self; -} - --(void) addHeader:(NSString*) value - forKey:(NSString*)key { - [_defaultHeaders setValue:value forKey:key]; -} - --(NSString*) escapeString:(NSString *)unescaped { - return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes( - NULL, - (__bridge CFStringRef) unescaped, - NULL, - (CFStringRef)@"!*'();:@&=+$,/?%#[]", - kCFStringEncodingUTF8)); -} - --(id) dictionaryWithCompletionBlock:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id) body - headerParams:(NSDictionary*) headerParams - completionHandler:(void (^)(NSDictionary*, NSError *))completionBlock -{ - NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path]; - NSString * separator = nil; - int counter = 0; - if(queryParams != nil){ - for(NSString * key in [queryParams keyEnumerator]){ - if(counter == 0) separator = @"?"; - else separator = @"&"; - NSString * value; - if([[queryParams valueForKey:key] isKindOfClass:[NSString class]]){ - value = [self escapeString:[queryParams valueForKey:key]]; - } - else { - value = [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]; - } - [requestUrl appendFormat:[NSString stringWithFormat:@"%@%@=%@", separator, - [self escapeString:key], value]]; - counter += 1; - } - } - NSLog(@"request url: %@", requestUrl); - - NSURL* URL = [NSURL URLWithString:requestUrl]; - - NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init]; - [request setURL:URL]; - [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; - [request setTimeoutInterval:30]; - - for(NSString * key in [_defaultHeaders keyEnumerator]){ - [request setValue:[_defaultHeaders valueForKey:key] forHTTPHeaderField:key]; - } - if(headerParams != nil){ - for(NSString * key in [headerParams keyEnumerator]){ - [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; - } - } - [request setHTTPMethod:method]; - if(body != nil) { - NSError * error = [NSError new]; - NSData * data = nil; - if([body isKindOfClass:[NSDictionary class]]){ - data = [NSJSONSerialization dataWithJSONObject:body - options:kNilOptions error:&error]; - } - else if ([body isKindOfClass:[NSArray class]]){ - data = [NSJSONSerialization dataWithJSONObject:body - options:kNilOptions error:&error]; - } - else { - data = [body dataUsingEncoding:NSUTF8StringEncoding]; - } - NSString *postLength = [NSString stringWithFormat:@"%d", [data length]]; - [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; - [request setHTTPBody:data]; - - [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; - [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; - - NSLog(@"request: %@", request); - } - - [NSURLConnection sendAsynchronousRequest:request queue:_queue completionHandler: - ^(NSURLResponse *response, NSData *data, NSError *error) { - int statusCode = [(NSHTTPURLResponse*)response statusCode]; - NSString* jsonData = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - - if (error) { - completionBlock(nil, error); - return; - } - else if (!NSLocationInRange(statusCode, NSMakeRange(200, 99))){ - error = [NSError errorWithDomain:@"swagger" - code:statusCode - userInfo:[NSJSONSerialization JSONObjectWithData:data - options:kNilOptions - error:&error]]; - completionBlock(nil, error); - return; - } - else { - NSDictionary* results = [NSJSONSerialization JSONObjectWithData:data - options:kNilOptions - error:&error]; - completionBlock(results, nil); - } - }]; - return nil; -} - --(id) stringWithCompletionBlock:(NSString*) path - method:(NSString*) method - queryParams:(NSDictionary*) queryParams - body:(id) body - headerParams:(NSDictionary*) headerParams - completionHandler:(void (^)(NSString*, NSError *))completionBlock -{ - NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path]; - NSString * separator = nil; - int counter = 0; - if(queryParams != nil){ - for(NSString * key in [queryParams keyEnumerator]){ - if(counter == 0) separator = @"?"; - else separator = @"&"; - NSString * value; - if([[queryParams valueForKey:key] isKindOfClass:[NSString class]]){ - value = [self escapeString:[queryParams valueForKey:key]]; - } - else { - value = [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]; - } - [requestUrl appendFormat:[NSString stringWithFormat:@"%@%@=%@", separator, - [self escapeString:key], value]]; - counter += 1; - } - } - NSLog(@"request url: %@", requestUrl); - - NSURL* URL = [NSURL URLWithString:requestUrl]; - - NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init]; - [request setURL:URL]; - [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; - [request setTimeoutInterval:30]; - - for(NSString * key in [_defaultHeaders keyEnumerator]){ - [request setValue:[_defaultHeaders valueForKey:key] forHTTPHeaderField:key]; - } - if(headerParams != nil){ - for(NSString * key in [headerParams keyEnumerator]){ - [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; - } - } - [request setHTTPMethod:method]; - if(body != nil) { - NSError * error = [NSError new]; - NSData * data = nil; - if([body isKindOfClass:[NSDictionary class]]){ - data = [NSJSONSerialization dataWithJSONObject:body - options:kNilOptions error:&error]; - } - else if ([body isKindOfClass:[NSArray class]]){ - data = [NSJSONSerialization dataWithJSONObject:body - options:kNilOptions error:&error]; - } - else { - data = [body dataUsingEncoding:NSUTF8StringEncoding]; - } - NSString *postLength = [NSString stringWithFormat:@"%d", [data length]]; - [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; - [request setHTTPBody:data]; - - [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; - [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; - - NSLog(@"request: %@", request); - } - - [NSURLConnection sendAsynchronousRequest:request queue:_queue completionHandler: - ^(NSURLResponse *response, NSData *data, NSError *error) { - int statusCode = [(NSHTTPURLResponse*)response statusCode]; - - if (error) { - completionBlock(nil, error); - return; - } - else if (!NSLocationInRange(statusCode, NSMakeRange(200, 99))){ - error = [NSError errorWithDomain:@"swagger" - code:statusCode - userInfo:[NSJSONSerialization JSONObjectWithData:data - options:kNilOptions - error:&error]]; - completionBlock(nil, error); - return; - } - else { - NSString* results = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - - if(results && [results length] >= 2) { - if(([results characterAtIndex:0] == '\"') && ([results characterAtIndex:([results length] - 1) == '\"'])){ - results = [results substringWithRange:NSMakeRange(1, [results length] -2)]; - } - } - completionBlock(results, nil); - } - }]; - return nil; -} -@end \ No newline at end of file diff --git a/samples/client/petstore/objc/NIKCategory.h b/samples/client/petstore/objc/NIKCategory.h deleted file mode 100644 index 7c66bd1aced..00000000000 --- a/samples/client/petstore/objc/NIKCategory.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "NIKSwaggerObject.h" - -@interface NIKCategory : NIKSwaggerObject { -@private - NSDictionary* raw; - NSNumber* __id; //NSNumber - NSString* _name; //NSString - } - -@property(nonatomic) NSDictionary* raw; - - -@property(nonatomic) NSNumber* _id; -@property(nonatomic) NSString* name; -- (id) _id: (NSNumber*) _id - name: (NSString*) name; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; -- (NSDictionary*) asRaw; - - -@end - diff --git a/samples/client/petstore/objc/NIKCategory.m b/samples/client/petstore/objc/NIKCategory.m deleted file mode 100644 index b0ca3f239a9..00000000000 --- a/samples/client/petstore/objc/NIKCategory.m +++ /dev/null @@ -1,38 +0,0 @@ -#import "NIKDate.h" -#import "NIKCategory.h" - -@implementation NIKCategory - -@synthesize raw = _raw; - -@synthesize _id = __id; -@synthesize name = _name; -- (id) _id: (NSNumber*) _id - name: (NSString*) name - { - __id = _id; - _name = name; - return self; - } - -- (id) initWithValues: (NSDictionary*)dict -{ - __id = [dict objectForKey:@"id"]; - _name = [dict objectForKey:@"name"]; - self.raw = [[NSDictionary alloc] initWithDictionary:dict]; - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) [dict setObject:__id forKey:@"id"]; - if(_name != nil) [dict setObject:_name forKey:@"name"]; - NSDictionary* output = [dict copy]; - return output; -} - --(NSDictionary*) asRaw { - return _raw; -} -@end - diff --git a/samples/client/petstore/objc/NIKDate.h b/samples/client/petstore/objc/NIKDate.h deleted file mode 100644 index b72c7dc5479..00000000000 --- a/samples/client/petstore/objc/NIKDate.h +++ /dev/null @@ -1,13 +0,0 @@ -#import -#import "NIKSwaggerObject.h" - -@interface NIKDate : NIKSwaggerObject { -@private - NSDate *_date; -} -@property(nonatomic, readonly) NSDate* date; - -- (id) initWithValues: (NSString*)input; --(NSString*) toString; -@end - diff --git a/samples/client/petstore/objc/NIKDate.m b/samples/client/petstore/objc/NIKDate.m deleted file mode 100644 index c1f9a163deb..00000000000 --- a/samples/client/petstore/objc/NIKDate.m +++ /dev/null @@ -1,34 +0,0 @@ -#import "NIKDate.h" - -@implementation NIKDate - -@synthesize date = _date; - -- (id) initWithValues:(NSString*)input { - if([input isKindOfClass:[NSString class]]){ - NSDateFormatter* df = [NSDateFormatter new]; - NSLocale *locale = [[NSLocale new] - initWithLocaleIdentifier:@"en_US_POSIX"]; - [df setLocale:locale]; - [df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; - - _date = [df dateFromString:input]; - } - else if([input isKindOfClass:[NSNumber class]]) { - NSTimeInterval interval = [input doubleValue]; - _date = [[NSDate alloc] initWithTimeIntervalSince1970:interval]; - } - return self; -} - --(NSString*) toString { - NSDateFormatter* df = [NSDateFormatter new]; - NSLocale *locale = [[NSLocale new] - initWithLocaleIdentifier:@"en_US_POSIX"]; - [df setLocale:locale]; - [df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; - - return [df stringFromDate:_date]; -} - -@end \ No newline at end of file diff --git a/samples/client/petstore/objc/NIKOrder.h b/samples/client/petstore/objc/NIKOrder.h deleted file mode 100644 index d3f9d23fcce..00000000000 --- a/samples/client/petstore/objc/NIKOrder.h +++ /dev/null @@ -1,35 +0,0 @@ -#import -#import "NIKSwaggerObject.h" -#import "NIKDate.h" - -@interface NIKOrder : NIKSwaggerObject { -@private - NSDictionary* raw; - NSNumber* __id; //NSNumber - NSNumber* _petId; //NSNumber - NSString* _status; //NSString - NSNumber* _quantity; //NSNumber - NIKDate* _shipDate; //NIKDate - } - -@property(nonatomic) NSDictionary* raw; - - -@property(nonatomic) NSNumber* _id; -@property(nonatomic) NSNumber* petId; -@property(nonatomic) NSString* status; -@property(nonatomic) NSNumber* quantity; -@property(nonatomic) NIKDate* shipDate; -- (id) _id: (NSNumber*) _id - petId: (NSNumber*) petId - status: (NSString*) status - quantity: (NSNumber*) quantity - shipDate: (NIKDate*) shipDate; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; -- (NSDictionary*) asRaw; - - -@end - diff --git a/samples/client/petstore/objc/NIKOrder.m b/samples/client/petstore/objc/NIKOrder.m deleted file mode 100644 index be0ff590c50..00000000000 --- a/samples/client/petstore/objc/NIKOrder.m +++ /dev/null @@ -1,71 +0,0 @@ -#import "NIKDate.h" -#import "NIKOrder.h" - -@implementation NIKOrder - -@synthesize raw = _raw; - -@synthesize _id = __id; -@synthesize petId = _petId; -@synthesize status = _status; -@synthesize quantity = _quantity; -@synthesize shipDate = _shipDate; -- (id) _id: (NSNumber*) _id - petId: (NSNumber*) petId - status: (NSString*) status - quantity: (NSNumber*) quantity - shipDate: (NIKDate*) shipDate - { - __id = _id; - _petId = petId; - _status = status; - _quantity = quantity; - _shipDate = shipDate; - return self; - } - -- (id) initWithValues: (NSDictionary*)dict -{ - __id = [dict objectForKey:@"id"]; - _petId = [dict objectForKey:@"petId"]; - _status = [dict objectForKey:@"status"]; - _quantity = [dict objectForKey:@"quantity"]; - id shipDate_dict = [dict objectForKey:@"shipDate"]; - _shipDate = [[NIKDate alloc]initWithValues:shipDate_dict]; - self.raw = [[NSDictionary alloc] initWithDictionary:dict]; - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) [dict setObject:__id forKey:@"id"]; - if(_petId != nil) [dict setObject:_petId forKey:@"petId"]; - if(_status != nil) [dict setObject:_status forKey:@"status"]; - if(_quantity != nil) [dict setObject:_quantity forKey:@"quantity"]; - if(_shipDate != nil){ - if([_shipDate isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( NIKDate * shipDate in (NSArray*)_shipDate) { - [array addObject:[(NIKSwaggerObject*)shipDate asDictionary]]; - } - [dict setObject:array forKey:@"shipDate"]; - } - else if(_shipDate && [_shipDate isKindOfClass:[NIKDate class]]) { - NSString * dateString = [(NIKDate*)_shipDate toString]; - if(dateString){ - [dict setObject:dateString forKey:@"shipDate"]; - } - } - } - else { - if(_shipDate != nil) [dict setObject:[(NIKSwaggerObject*)_shipDate asDictionary]forKey:@"shipDate"]; - } - NSDictionary* output = [dict copy]; - return output; -} - --(NSDictionary*) asRaw { - return _raw; -} -@end - diff --git a/samples/client/petstore/objc/NIKPet.h b/samples/client/petstore/objc/NIKPet.h deleted file mode 100644 index 6d1e649f06e..00000000000 --- a/samples/client/petstore/objc/NIKPet.h +++ /dev/null @@ -1,39 +0,0 @@ -#import -#import "NIKSwaggerObject.h" -#import "NIKCategory.h" -#import "NIKTag.h" - -@interface NIKPet : NIKSwaggerObject { -@private - NSDictionary* raw; - NSNumber* __id; //NSNumber - NSArray* _tags; //Tag - NIKCategory* _category; //Category - NSString* _status; //NSString - NSString* _name; //NSString - NSArray* _photoUrls; //NSString - } - -@property(nonatomic) NSDictionary* raw; - - -@property(nonatomic) NSNumber* _id; -@property(nonatomic) NSArray* tags; -@property(nonatomic) NIKCategory* category; -@property(nonatomic) NSString* status; -@property(nonatomic) NSString* name; -@property(nonatomic) NSArray* photoUrls; -- (id) _id: (NSNumber*) _id - tags: (NSArray*) tags - category: (NIKCategory*) category - status: (NSString*) status - name: (NSString*) name - photoUrls: (NSArray*) photoUrls; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; -- (NSDictionary*) asRaw; - - -@end - diff --git a/samples/client/petstore/objc/NIKPet.m b/samples/client/petstore/objc/NIKPet.m deleted file mode 100644 index 3af9f9e9a89..00000000000 --- a/samples/client/petstore/objc/NIKPet.m +++ /dev/null @@ -1,106 +0,0 @@ -#import "NIKDate.h" -#import "NIKPet.h" - -@implementation NIKPet - -@synthesize raw = _raw; - -@synthesize _id = __id; -@synthesize tags = _tags; -@synthesize category = _category; -@synthesize status = _status; -@synthesize name = _name; -@synthesize photoUrls = _photoUrls; -- (id) _id: (NSNumber*) _id - tags: (NSArray*) tags - category: (NIKCategory*) category - status: (NSString*) status - name: (NSString*) name - photoUrls: (NSArray*) photoUrls - { - __id = _id; - _tags = tags; - _category = category; - _status = status; - _name = name; - _photoUrls = photoUrls; - return self; - } - -- (id) initWithValues: (NSDictionary*)dict -{ - __id = [dict objectForKey:@"id"]; - id tags_dict = [dict objectForKey:@"tags"]; - if([tags_dict isKindOfClass:[NSArray class]]) { - if([(NSArray*)tags_dict count] > 0) { - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)tags_dict count]]; - for (NSDictionary* dict in (NSArray*)tags_dict) { - NIKTag* d = [[NIKTag alloc]initWithValues:dict]; - [objs addObject:d]; - } - _tags = [[NSArray alloc] initWithArray:objs]; - } - } - else if([tags_dict isKindOfClass:[NSDictionary class]] && [(NSDictionary*)tags_dict count] > 0) { - _tags = [[NIKTag alloc]initWithValues:(NSDictionary*)tags_dict]; - } - id category_dict = [dict objectForKey:@"category"]; - _category = [[NIKCategory alloc]initWithValues:category_dict]; - _status = [dict objectForKey:@"status"]; - _name = [dict objectForKey:@"name"]; - _photoUrls = [dict objectForKey:@"photoUrls"]; - self.raw = [[NSDictionary alloc] initWithDictionary:dict]; - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) [dict setObject:__id forKey:@"id"]; - if(_tags != nil){ - if([_tags isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( NIKTag * tags in (NSArray*)_tags) { - [array addObject:[(NIKSwaggerObject*)tags asDictionary]]; - } - [dict setObject:array forKey:@"tags"]; - } - else if(_tags && [_tags isKindOfClass:[NIKDate class]]) { - NSString * dateString = [(NIKDate*)_tags toString]; - if(dateString){ - [dict setObject:dateString forKey:@"tags"]; - } - } - } - else { - if(_tags != nil) [dict setObject:[(NIKSwaggerObject*)_tags asDictionary]forKey:@"tags"]; - } - if(_category != nil){ - if([_category isKindOfClass:[NSArray class]]){ - NSMutableArray * array = [[NSMutableArray alloc] init]; - for( NIKCategory * category in (NSArray*)_category) { - [array addObject:[(NIKSwaggerObject*)category asDictionary]]; - } - [dict setObject:array forKey:@"category"]; - } - else if(_category && [_category isKindOfClass:[NIKDate class]]) { - NSString * dateString = [(NIKDate*)_category toString]; - if(dateString){ - [dict setObject:dateString forKey:@"category"]; - } - } - } - else { - if(_category != nil) [dict setObject:[(NIKSwaggerObject*)_category asDictionary]forKey:@"category"]; - } - if(_status != nil) [dict setObject:_status forKey:@"status"]; - if(_name != nil) [dict setObject:_name forKey:@"name"]; - if(_photoUrls != nil) [dict setObject:_photoUrls forKey:@"photoUrls"]; - NSDictionary* output = [dict copy]; - return output; -} - --(NSDictionary*) asRaw { - return _raw; -} -@end - diff --git a/samples/client/petstore/objc/NIKPetApi.h b/samples/client/petstore/objc/NIKPetApi.h deleted file mode 100644 index 181f457e134..00000000000 --- a/samples/client/petstore/objc/NIKPetApi.h +++ /dev/null @@ -1,28 +0,0 @@ -#import -#import "NIKApiInvoker.h" -#import "NIKPet.h" - - -@interface NIKPetApi: NSObject { - -@private - NSOperationQueue *_queue; - NIKApiInvoker * _api; -} -@property(nonatomic, readonly) NSOperationQueue* queue; -@property(nonatomic, readonly) NIKApiInvoker* api; - --(void) addHeader:(NSString*) value - forKey:(NSString*)key; - --(void) getPetByIdWithCompletionBlock :(NSString*) petId - completionHandler:(void (^)(NIKPet*, NSError *))completionBlock; --(void) addPetWithCompletionBlock :(NIKPet*) body - completionHandler:(void (^)(NSError *))completionBlock; --(void) updatePetWithCompletionBlock :(NIKPet*) body - completionHandler:(void (^)(NSError *))completionBlock; --(void) findPetsByStatusWithCompletionBlock :(NSString*) status - completionHandler:(void (^)(NSArray*, NSError *))completionBlock; --(void) findPetsByTagsWithCompletionBlock :(NSString*) tags - completionHandler:(void (^)(NSArray*, NSError *))completionBlock; -@end diff --git a/samples/client/petstore/objc/NIKPetApi.m b/samples/client/petstore/objc/NIKPetApi.m deleted file mode 100644 index c92bd9ab336..00000000000 --- a/samples/client/petstore/objc/NIKPetApi.m +++ /dev/null @@ -1,473 +0,0 @@ -#import "NIKPetApi.h" -#import "NIKPet.h" - - - -@implementation NIKPetApi -static NSString * basePath = @"http://petstore.swagger.wordnik.com/api"; - -@synthesize queue = _queue; -@synthesize api = _api; - -- (id) init { - self = [super init]; - _queue = [[NSOperationQueue alloc] init]; - _api = [[NIKApiInvoker alloc] init]; - - return self; -} - --(void) addHeader:(NSString*) value - forKey:(NSString*)key { - [_api addHeader:value forKey:key]; -} - --(void) getPetByIdWithCompletionBlock :(NSString*) petId - completionHandler:(void (^)(NIKPet*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}/{petId}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [_api escapeString:petId]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(petId == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - completionBlock( [[NIKPet alloc]initWithValues: data], nil); - }]; - -} - --(void) addPetWithCompletionBlock :(NIKPet*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) updatePetWithCompletionBlock :(NIKPet*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"PUT" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) findPetsByStatusWithCompletionBlock :(NSString*) status - completionHandler:(void (^)(NSArray*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}/findByStatus", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(status != nil) - [queryParams setValue:status forKey:@"status"]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(status == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - NIKPet* d = [[NIKPet alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - - }]; - -} - --(void) findPetsByTagsWithCompletionBlock :(NSString*) tags - completionHandler:(void (^)(NSArray*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}/findByTags", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(tags != nil) - [queryParams setValue:tags forKey:@"tags"]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(tags == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - if([data isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]]; - for (NSDictionary* dict in (NSArray*)data) { - NIKPet* d = [[NIKPet alloc]initWithValues: dict]; - [objs addObject:d]; - } - completionBlock(objs, nil); - } - - }]; - -} - --(void) getPetByIdAsJsonWithCompletionBlock :(NSString*) petId - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}/{petId}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [_api escapeString:petId]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(petId == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - NSData * responseData = nil; - if([data isKindOfClass:[NSDictionary class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - else if ([data isKindOfClass:[NSArray class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding]; - completionBlock(json, nil); - - }]; - -} - --(void) addPetAsJsonWithCompletionBlock :(NIKPet*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) updatePetAsJsonWithCompletionBlock :(NIKPet*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"PUT" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) findPetsByStatusAsJsonWithCompletionBlock :(NSString*) status - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}/findByStatus", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(status != nil) - [queryParams setValue:status forKey:@"status"]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(status == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - NSData * responseData = nil; - if([data isKindOfClass:[NSDictionary class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - else if ([data isKindOfClass:[NSArray class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding]; - completionBlock(json, nil); - - }]; - -} - --(void) findPetsByTagsAsJsonWithCompletionBlock :(NSString*) tags - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet.{format}/findByTags", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(tags != nil) - [queryParams setValue:tags forKey:@"tags"]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(tags == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - NSData * responseData = nil; - if([data isKindOfClass:[NSDictionary class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - else if ([data isKindOfClass:[NSArray class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding]; - completionBlock(json, nil); - - }]; - -} - - -@end diff --git a/samples/client/petstore/objc/NIKStoreApi.h b/samples/client/petstore/objc/NIKStoreApi.h deleted file mode 100644 index 5454798e01e..00000000000 --- a/samples/client/petstore/objc/NIKStoreApi.h +++ /dev/null @@ -1,24 +0,0 @@ -#import -#import "NIKApiInvoker.h" -#import "NIKOrder.h" - - -@interface NIKStoreApi: NSObject { - -@private - NSOperationQueue *_queue; - NIKApiInvoker * _api; -} -@property(nonatomic, readonly) NSOperationQueue* queue; -@property(nonatomic, readonly) NIKApiInvoker* api; - --(void) addHeader:(NSString*) value - forKey:(NSString*)key; - --(void) getOrderByIdWithCompletionBlock :(NSString*) orderId - completionHandler:(void (^)(NIKOrder*, NSError *))completionBlock; --(void) deleteOrderWithCompletionBlock :(NSString*) orderId - completionHandler:(void (^)(NSError *))completionBlock; --(void) placeOrderWithCompletionBlock :(NIKOrder*) body - completionHandler:(void (^)(NSError *))completionBlock; -@end diff --git a/samples/client/petstore/objc/NIKStoreApi.m b/samples/client/petstore/objc/NIKStoreApi.m deleted file mode 100644 index 70c89413658..00000000000 --- a/samples/client/petstore/objc/NIKStoreApi.m +++ /dev/null @@ -1,265 +0,0 @@ -#import "NIKStoreApi.h" -#import "NIKOrder.h" - - - -@implementation NIKStoreApi -static NSString * basePath = @"http://petstore.swagger.wordnik.com/api"; - -@synthesize queue = _queue; -@synthesize api = _api; - -- (id) init { - self = [super init]; - _queue = [[NSOperationQueue alloc] init]; - _api = [[NIKApiInvoker alloc] init]; - - return self; -} - --(void) addHeader:(NSString*) value - forKey:(NSString*)key { - [_api addHeader:value forKey:key]; -} - --(void) getOrderByIdWithCompletionBlock :(NSString*) orderId - completionHandler:(void (^)(NIKOrder*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store.{format}/order/{orderId}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [_api escapeString:orderId]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(orderId == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - completionBlock( [[NIKOrder alloc]initWithValues: data], nil); - }]; - -} - --(void) deleteOrderWithCompletionBlock :(NSString*) orderId - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store.{format}/order/{orderId}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [_api escapeString:orderId]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(orderId == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"DELETE" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) placeOrderWithCompletionBlock :(NIKOrder*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store.{format}/order", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) getOrderByIdAsJsonWithCompletionBlock :(NSString*) orderId - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store.{format}/order/{orderId}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [_api escapeString:orderId]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(orderId == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - NSData * responseData = nil; - if([data isKindOfClass:[NSDictionary class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - else if ([data isKindOfClass:[NSArray class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding]; - completionBlock(json, nil); - - }]; - -} - --(void) deleteOrderAsJsonWithCompletionBlock :(NSString*) orderId - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store.{format}/order/{orderId}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [_api escapeString:orderId]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(orderId == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"DELETE" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) placeOrderAsJsonWithCompletionBlock :(NIKOrder*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store.{format}/order", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - - -@end diff --git a/samples/client/petstore/objc/NIKSwaggerObject.h b/samples/client/petstore/objc/NIKSwaggerObject.h deleted file mode 100644 index 18f95663de1..00000000000 --- a/samples/client/petstore/objc/NIKSwaggerObject.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - -@interface NIKSwaggerObject : NSObject -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; -@end diff --git a/samples/client/petstore/objc/NIKSwaggerObject.m b/samples/client/petstore/objc/NIKSwaggerObject.m deleted file mode 100644 index 2467ce13ca8..00000000000 --- a/samples/client/petstore/objc/NIKSwaggerObject.m +++ /dev/null @@ -1,10 +0,0 @@ -#import "NIKSwaggerObject.h" - -@implementation NIKSwaggerObject -- (id) initWithValues: (NSDictionary*)dict { - return self; -} -- (NSDictionary*) asDictionary{ - return [NSDictionary init]; -} -@end diff --git a/samples/client/petstore/objc/NIKTag.h b/samples/client/petstore/objc/NIKTag.h deleted file mode 100644 index e7043f7a350..00000000000 --- a/samples/client/petstore/objc/NIKTag.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import "NIKSwaggerObject.h" - -@interface NIKTag : NIKSwaggerObject { -@private - NSDictionary* raw; - NSNumber* __id; //NSNumber - NSString* _name; //NSString - } - -@property(nonatomic) NSDictionary* raw; - - -@property(nonatomic) NSNumber* _id; -@property(nonatomic) NSString* name; -- (id) _id: (NSNumber*) _id - name: (NSString*) name; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; -- (NSDictionary*) asRaw; - - -@end - diff --git a/samples/client/petstore/objc/NIKTag.m b/samples/client/petstore/objc/NIKTag.m deleted file mode 100644 index ba5dfca9849..00000000000 --- a/samples/client/petstore/objc/NIKTag.m +++ /dev/null @@ -1,38 +0,0 @@ -#import "NIKDate.h" -#import "NIKTag.h" - -@implementation NIKTag - -@synthesize raw = _raw; - -@synthesize _id = __id; -@synthesize name = _name; -- (id) _id: (NSNumber*) _id - name: (NSString*) name - { - __id = _id; - _name = name; - return self; - } - -- (id) initWithValues: (NSDictionary*)dict -{ - __id = [dict objectForKey:@"id"]; - _name = [dict objectForKey:@"name"]; - self.raw = [[NSDictionary alloc] initWithDictionary:dict]; - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) [dict setObject:__id forKey:@"id"]; - if(_name != nil) [dict setObject:_name forKey:@"name"]; - NSDictionary* output = [dict copy]; - return output; -} - --(NSDictionary*) asRaw { - return _raw; -} -@end - diff --git a/samples/client/petstore/objc/NIKUser.h b/samples/client/petstore/objc/NIKUser.h deleted file mode 100644 index d6cd60bb527..00000000000 --- a/samples/client/petstore/objc/NIKUser.h +++ /dev/null @@ -1,43 +0,0 @@ -#import -#import "NIKSwaggerObject.h" - -@interface NIKUser : NIKSwaggerObject { -@private - NSDictionary* raw; - NSNumber* __id; //NSNumber - NSString* _lastName; //NSString - NSString* _username; //NSString - NSString* _phone; //NSString - NSString* _email; //NSString - NSNumber* _userStatus; //NSNumber - NSString* _firstName; //NSString - NSString* _password; //NSString - } - -@property(nonatomic) NSDictionary* raw; - - -@property(nonatomic) NSNumber* _id; -@property(nonatomic) NSString* lastName; -@property(nonatomic) NSString* username; -@property(nonatomic) NSString* phone; -@property(nonatomic) NSString* email; -@property(nonatomic) NSNumber* userStatus; -@property(nonatomic) NSString* firstName; -@property(nonatomic) NSString* password; -- (id) _id: (NSNumber*) _id - lastName: (NSString*) lastName - username: (NSString*) username - phone: (NSString*) phone - email: (NSString*) email - userStatus: (NSNumber*) userStatus - firstName: (NSString*) firstName - password: (NSString*) password; - -- (id) initWithValues: (NSDictionary*)dict; -- (NSDictionary*) asDictionary; -- (NSDictionary*) asRaw; - - -@end - diff --git a/samples/client/petstore/objc/NIKUser.m b/samples/client/petstore/objc/NIKUser.m deleted file mode 100644 index cf51906457f..00000000000 --- a/samples/client/petstore/objc/NIKUser.m +++ /dev/null @@ -1,68 +0,0 @@ -#import "NIKDate.h" -#import "NIKUser.h" - -@implementation NIKUser - -@synthesize raw = _raw; - -@synthesize _id = __id; -@synthesize lastName = _lastName; -@synthesize username = _username; -@synthesize phone = _phone; -@synthesize email = _email; -@synthesize userStatus = _userStatus; -@synthesize firstName = _firstName; -@synthesize password = _password; -- (id) _id: (NSNumber*) _id - lastName: (NSString*) lastName - username: (NSString*) username - phone: (NSString*) phone - email: (NSString*) email - userStatus: (NSNumber*) userStatus - firstName: (NSString*) firstName - password: (NSString*) password - { - __id = _id; - _lastName = lastName; - _username = username; - _phone = phone; - _email = email; - _userStatus = userStatus; - _firstName = firstName; - _password = password; - return self; - } - -- (id) initWithValues: (NSDictionary*)dict -{ - __id = [dict objectForKey:@"id"]; - _lastName = [dict objectForKey:@"lastName"]; - _username = [dict objectForKey:@"username"]; - _phone = [dict objectForKey:@"phone"]; - _email = [dict objectForKey:@"email"]; - _userStatus = [dict objectForKey:@"userStatus"]; - _firstName = [dict objectForKey:@"firstName"]; - _password = [dict objectForKey:@"password"]; - self.raw = [[NSDictionary alloc] initWithDictionary:dict]; - return self; -} - --(NSDictionary*) asDictionary { - NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; - if(__id != nil) [dict setObject:__id forKey:@"id"]; - if(_lastName != nil) [dict setObject:_lastName forKey:@"lastName"]; - if(_username != nil) [dict setObject:_username forKey:@"username"]; - if(_phone != nil) [dict setObject:_phone forKey:@"phone"]; - if(_email != nil) [dict setObject:_email forKey:@"email"]; - if(_userStatus != nil) [dict setObject:_userStatus forKey:@"userStatus"]; - if(_firstName != nil) [dict setObject:_firstName forKey:@"firstName"]; - if(_password != nil) [dict setObject:_password forKey:@"password"]; - NSDictionary* output = [dict copy]; - return output; -} - --(NSDictionary*) asRaw { - return _raw; -} -@end - diff --git a/samples/client/petstore/objc/NIKUserApi.h b/samples/client/petstore/objc/NIKUserApi.h deleted file mode 100644 index 09c9f9d68d9..00000000000 --- a/samples/client/petstore/objc/NIKUserApi.h +++ /dev/null @@ -1,34 +0,0 @@ -#import -#import "NIKApiInvoker.h" -#import "NIKUser.h" - - -@interface NIKUserApi: NSObject { - -@private - NSOperationQueue *_queue; - NIKApiInvoker * _api; -} -@property(nonatomic, readonly) NSOperationQueue* queue; -@property(nonatomic, readonly) NIKApiInvoker* api; - --(void) addHeader:(NSString*) value - forKey:(NSString*)key; - --(void) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body - completionHandler:(void (^)(NSError *))completionBlock; --(void) createUserWithCompletionBlock :(NIKUser*) body - completionHandler:(void (^)(NSError *))completionBlock; --(void) createUsersWithListInputWithCompletionBlock :(NSArray*) body - completionHandler:(void (^)(NSError *))completionBlock; --(void) updateUserWithCompletionBlock :(NSString*) username body:(NIKUser*) body - completionHandler:(void (^)(NSError *))completionBlock; --(void) deleteUserWithCompletionBlock :(NSString*) username - completionHandler:(void (^)(NSError *))completionBlock; --(void) getUserByNameWithCompletionBlock :(NSString*) username - completionHandler:(void (^)(NIKUser*, NSError *))completionBlock; --(void) loginUserWithCompletionBlock :(NSString*) username password:(NSString*) password - completionHandler:(void (^)(NSString*, NSError *))completionBlock; --(void) logoutUserWithCompletionBlock : - completionHandler:(void (^)(NSError *))completionBlock; -@end diff --git a/samples/client/petstore/objc/NIKUserApi.m b/samples/client/petstore/objc/NIKUserApi.m deleted file mode 100644 index aaed562d80a..00000000000 --- a/samples/client/petstore/objc/NIKUserApi.m +++ /dev/null @@ -1,724 +0,0 @@ -#import "NIKUserApi.h" -#import "NIKUser.h" - - - -@implementation NIKUserApi -static NSString * basePath = @"http://petstore.swagger.wordnik.com/api"; - -@synthesize queue = _queue; -@synthesize api = _api; - -- (id) init { - self = [super init]; - _queue = [[NSOperationQueue alloc] init]; - _api = [[NIKApiInvoker alloc] init]; - - return self; -} - --(void) addHeader:(NSString*) value - forKey:(NSString*)key { - [_api addHeader:value forKey:key]; -} - --(void) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/createWithArray", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) createUserWithCompletionBlock :(NIKUser*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) createUsersWithListInputWithCompletionBlock :(NSArray*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/createWithList", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) updateUserWithCompletionBlock :(NSString*) username body:(NIKUser*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(username == nil) { - // error - } - if(body == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"PUT" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) deleteUserWithCompletionBlock :(NSString*) username - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"DELETE" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) getUserByNameWithCompletionBlock :(NSString*) username - completionHandler:(void (^)(NIKUser*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - completionBlock( [[NIKUser alloc]initWithValues: data], nil); - }]; - -} - --(void) loginUserWithCompletionBlock :(NSString*) username password:(NSString*) password - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/login", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(username != nil) - [queryParams setValue:username forKey:@"username"]; - if(password != nil) - [queryParams setValue:password forKey:@"password"]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - if(password == nil) { - // error - } - [_api stringWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - completionBlock( [[NSString alloc]initWithString: data], nil); - }]; - -} - --(void) logoutUserWithCompletionBlock : - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/logout", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - [_api stringWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSString *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) createUsersWithArrayInputAsJsonWithCompletionBlock :(NSArray*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/createWithArray", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) createUserAsJsonWithCompletionBlock :(NIKUser*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) createUsersWithListInputAsJsonWithCompletionBlock :(NSArray*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/createWithList", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"POST" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) updateUserAsJsonWithCompletionBlock :(NSString*) username body:(NIKUser*) body - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - 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:[(NIKSwaggerObject*)dict asDictionary]]; - } - else{ - [objs addObject:dict]; - } - } - bodyDictionary = objs; - } - else if([body respondsToSelector:@selector(asDictionary)]) { - bodyDictionary = [(NIKSwaggerObject*)body asDictionary]; - } - else if([body isKindOfClass:[NSString class]]) { - bodyDictionary = body; - } - else{ - NSLog(@"don't know what to do with %@", body); - } - - if(username == nil) { - // error - } - if(body == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"PUT" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) deleteUserAsJsonWithCompletionBlock :(NSString*) username - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"DELETE" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - --(void) getUserByNameAsJsonWithCompletionBlock :(NSString*) username - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/{username}", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - NSData * responseData = nil; - if([data isKindOfClass:[NSDictionary class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - else if ([data isKindOfClass:[NSArray class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding]; - completionBlock(json, nil); - - }]; - -} - --(void) loginUserAsJsonWithCompletionBlock :(NSString*) username password:(NSString*) password - completionHandler:(void (^)(NSString*, NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/login", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - if(username != nil) - [queryParams setValue:username forKey:@"username"]; - if(password != nil) - [queryParams setValue:password forKey:@"password"]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - if(username == nil) { - // error - } - if(password == nil) { - // error - } - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(nil, error);return; - } - - NSData * responseData = nil; - if([data isKindOfClass:[NSDictionary class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - else if ([data isKindOfClass:[NSArray class]]){ - responseData = [NSJSONSerialization dataWithJSONObject:data - options:kNilOptions error:&error]; - } - NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding]; - completionBlock(json, nil); - - }]; - -} - --(void) logoutUserAsJsonWithCompletionBlock : - completionHandler:(void (^)(NSError *))completionBlock{ - - NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user.{format}/logout", basePath]; - - // remove format in URL if needed - if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) - [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@""]; - - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init]; - id bodyDictionary = nil; - [_api dictionaryWithCompletionBlock: requestUrl - method: @"GET" - queryParams: queryParams - body: bodyDictionary - headerParams: headerParams - completionHandler: ^(NSDictionary *data, NSError *error) { - if (error) { - completionBlock(error);return; - } - - completionBlock(nil); - }]; - -} - - -@end diff --git a/samples/client/petstore/objc/ObjcPetstoreCodegen.scala b/samples/client/petstore/objc/ObjcPetstoreCodegen.scala index 713fe0cb0da..1451bd45b2d 100644 --- a/samples/client/petstore/objc/ObjcPetstoreCodegen.scala +++ b/samples/client/petstore/objc/ObjcPetstoreCodegen.scala @@ -6,7 +6,7 @@ object ObjcPetstoreCodegen extends BasicObjcGenerator { def main(args: Array[String]) = generateClient(args) // where to write generated code - override def destinationDir = "samples/client/petstore/objc" + override def destinationDir = "samples/client/petstore/objc/client" // supporting classes override def supportingFiles = diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..b5e73b4dd61 --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj @@ -0,0 +1,554 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + EA07F4BE16134F27006A2112 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA07F4BD16134F27006A2112 /* Foundation.framework */; }; + EA07F4C116134F27006A2112 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F4C016134F27006A2112 /* main.m */; }; + EA07F4C516134F27006A2112 /* PetstoreClient.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EA07F4C416134F27006A2112 /* PetstoreClient.1 */; }; + EA07F5001613521A006A2112 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EA07F4FE1613521A006A2112 /* InfoPlist.strings */; }; + EA07F50A161355BC006A2112 /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F509161355BC006A2112 /* PetApiTest.m */; }; + EA07F5221613569A006A2112 /* NIKApiInvoker.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F50D1613569A006A2112 /* NIKApiInvoker.m */; }; + EA07F5231613569A006A2112 /* NIKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F50F1613569A006A2112 /* NIKCategory.m */; }; + EA07F5241613569A006A2112 /* NIKDate.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5111613569A006A2112 /* NIKDate.m */; }; + EA07F5251613569A006A2112 /* NIKOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5131613569A006A2112 /* NIKOrder.m */; }; + EA07F5261613569A006A2112 /* NIKPet.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5151613569A006A2112 /* NIKPet.m */; }; + EA07F5271613569A006A2112 /* NIKPetApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5171613569A006A2112 /* NIKPetApi.m */; }; + EA07F5281613569A006A2112 /* NIKStoreApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5191613569A006A2112 /* NIKStoreApi.m */; }; + EA07F5291613569A006A2112 /* NIKSwaggerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51B1613569A006A2112 /* NIKSwaggerObject.m */; }; + EA07F52A1613569A006A2112 /* NIKTag.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51D1613569A006A2112 /* NIKTag.m */; }; + EA07F52B1613569A006A2112 /* NIKUser.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51F1613569A006A2112 /* NIKUser.m */; }; + EA07F52C1613569A006A2112 /* NIKUserApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5211613569A006A2112 /* NIKUserApi.m */; }; + EA07F5311613580E006A2112 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA07F5301613580E006A2112 /* SenTestingKit.framework */; }; + EA07F53316135819006A2112 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA07F53216135819006A2112 /* Cocoa.framework */; }; + EA07F53516135916006A2112 /* NIKApiInvoker.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F50C1613569A006A2112 /* NIKApiInvoker.h */; }; + EA07F53616135916006A2112 /* NIKApiInvoker.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F50D1613569A006A2112 /* NIKApiInvoker.m */; }; + EA07F53716135916006A2112 /* NIKCategory.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F50E1613569A006A2112 /* NIKCategory.h */; }; + EA07F53816135916006A2112 /* NIKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F50F1613569A006A2112 /* NIKCategory.m */; }; + EA07F53916135916006A2112 /* NIKDate.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5101613569A006A2112 /* NIKDate.h */; }; + EA07F53A16135916006A2112 /* NIKDate.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5111613569A006A2112 /* NIKDate.m */; }; + EA07F53B16135916006A2112 /* NIKOrder.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5121613569A006A2112 /* NIKOrder.h */; }; + EA07F53C16135916006A2112 /* NIKOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5131613569A006A2112 /* NIKOrder.m */; }; + EA07F53D16135916006A2112 /* NIKPet.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5141613569A006A2112 /* NIKPet.h */; }; + EA07F53E16135916006A2112 /* NIKPet.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5151613569A006A2112 /* NIKPet.m */; }; + EA07F53F16135916006A2112 /* NIKPetApi.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5161613569A006A2112 /* NIKPetApi.h */; }; + EA07F54016135916006A2112 /* NIKPetApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5171613569A006A2112 /* NIKPetApi.m */; }; + EA07F54116135916006A2112 /* NIKStoreApi.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5181613569A006A2112 /* NIKStoreApi.h */; }; + EA07F54216135916006A2112 /* NIKStoreApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F5191613569A006A2112 /* NIKStoreApi.m */; }; + EA07F54316135916006A2112 /* NIKSwaggerObject.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51A1613569A006A2112 /* NIKSwaggerObject.h */; }; + EA07F54416135916006A2112 /* NIKSwaggerObject.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51B1613569A006A2112 /* NIKSwaggerObject.m */; }; + EA07F54516135916006A2112 /* NIKTag.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51C1613569A006A2112 /* NIKTag.h */; }; + EA07F54616135916006A2112 /* NIKTag.m in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51D1613569A006A2112 /* NIKTag.m */; }; + EA07F54716135916006A2112 /* NIKUser.h in Sources */ = {isa = PBXBuildFile; fileRef = EA07F51E1613569A006A2112 /* NIKUser.h */; }; + 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 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + EA07F52E161357A5006A2112 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = EA07F4B016134F27006A2112 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EA07F4B816134F27006A2112; + remoteInfo = PetstoreClient; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + EA07F4B716134F27006A2112 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + EA07F4C516134F27006A2112 /* PetstoreClient.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + EA07F4B916134F27006A2112 /* PetstoreClient */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PetstoreClient; sourceTree = BUILT_PRODUCTS_DIR; }; + EA07F4BD16134F27006A2112 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + EA07F4C016134F27006A2112 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + EA07F4C316134F27006A2112 /* PetstoreClient-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PetstoreClient-Prefix.pch"; sourceTree = ""; }; + EA07F4C416134F27006A2112 /* PetstoreClient.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = PetstoreClient.1; sourceTree = ""; }; + EA07F4F21613521A006A2112 /* PetstoreClientTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PetstoreClientTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + EA07F4F31613521A006A2112 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; + EA07F4F51613521A006A2112 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + EA07F4F81613521A006A2112 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + EA07F4F91613521A006A2112 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + EA07F4FA1613521A006A2112 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + EA07F4FD1613521A006A2112 /* PetstoreClientTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PetstoreClientTests-Info.plist"; sourceTree = ""; }; + EA07F4FF1613521A006A2112 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + EA07F5041613521A006A2112 /* PetstoreClientTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PetstoreClientTests-Prefix.pch"; sourceTree = ""; }; + EA07F508161355BC006A2112 /* PetApiTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PetApiTest.h; path = ../../tests/PetApiTest.h; sourceTree = ""; }; + EA07F509161355BC006A2112 /* PetApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PetApiTest.m; path = ../../tests/PetApiTest.m; sourceTree = ""; }; + EA07F50C1613569A006A2112 /* NIKApiInvoker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKApiInvoker.h; path = ../client/NIKApiInvoker.h; sourceTree = ""; }; + EA07F50D1613569A006A2112 /* NIKApiInvoker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKApiInvoker.m; path = ../client/NIKApiInvoker.m; sourceTree = ""; }; + EA07F50E1613569A006A2112 /* NIKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKCategory.h; path = ../client/NIKCategory.h; sourceTree = ""; }; + EA07F50F1613569A006A2112 /* NIKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKCategory.m; path = ../client/NIKCategory.m; sourceTree = ""; }; + EA07F5101613569A006A2112 /* NIKDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKDate.h; path = ../client/NIKDate.h; sourceTree = ""; }; + EA07F5111613569A006A2112 /* NIKDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKDate.m; path = ../client/NIKDate.m; sourceTree = ""; }; + EA07F5121613569A006A2112 /* NIKOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKOrder.h; path = ../client/NIKOrder.h; sourceTree = ""; }; + EA07F5131613569A006A2112 /* NIKOrder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKOrder.m; path = ../client/NIKOrder.m; sourceTree = ""; }; + EA07F5141613569A006A2112 /* NIKPet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKPet.h; path = ../client/NIKPet.h; sourceTree = ""; }; + EA07F5151613569A006A2112 /* NIKPet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKPet.m; path = ../client/NIKPet.m; sourceTree = ""; }; + EA07F5161613569A006A2112 /* NIKPetApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKPetApi.h; path = ../client/NIKPetApi.h; sourceTree = ""; }; + EA07F5171613569A006A2112 /* NIKPetApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKPetApi.m; path = ../client/NIKPetApi.m; sourceTree = ""; }; + EA07F5181613569A006A2112 /* NIKStoreApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKStoreApi.h; path = ../client/NIKStoreApi.h; sourceTree = ""; }; + EA07F5191613569A006A2112 /* NIKStoreApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKStoreApi.m; path = ../client/NIKStoreApi.m; sourceTree = ""; }; + EA07F51A1613569A006A2112 /* NIKSwaggerObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKSwaggerObject.h; path = ../client/NIKSwaggerObject.h; sourceTree = ""; }; + EA07F51B1613569A006A2112 /* NIKSwaggerObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKSwaggerObject.m; path = ../client/NIKSwaggerObject.m; sourceTree = ""; }; + EA07F51C1613569A006A2112 /* NIKTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKTag.h; path = ../client/NIKTag.h; sourceTree = ""; }; + EA07F51D1613569A006A2112 /* NIKTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKTag.m; path = ../client/NIKTag.m; sourceTree = ""; }; + EA07F51E1613569A006A2112 /* NIKUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKUser.h; path = ../client/NIKUser.h; sourceTree = ""; }; + EA07F51F1613569A006A2112 /* NIKUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKUser.m; path = ../client/NIKUser.m; sourceTree = ""; }; + EA07F5201613569A006A2112 /* NIKUserApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NIKUserApi.h; path = ../client/NIKUserApi.h; sourceTree = ""; }; + EA07F5211613569A006A2112 /* NIKUserApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NIKUserApi.m; path = ../client/NIKUserApi.m; sourceTree = ""; }; + 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; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + EA07F4B616134F27006A2112 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + EA07F4BE16134F27006A2112 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EA07F4EE1613521A006A2112 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + EA07F53316135819006A2112 /* Cocoa.framework in Frameworks */, + EA07F5311613580E006A2112 /* SenTestingKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + EA07F4AE16134F27006A2112 = { + isa = PBXGroup; + children = ( + EA07F53216135819006A2112 /* Cocoa.framework */, + EA07F5301613580E006A2112 /* SenTestingKit.framework */, + EA07F52D1613569E006A2112 /* Generated Client */, + EA07F4BF16134F27006A2112 /* PetstoreClient */, + EA07F4FB1613521A006A2112 /* PetstoreClientTests */, + EA07F4BC16134F27006A2112 /* Frameworks */, + EA07F4BA16134F27006A2112 /* Products */, + ); + sourceTree = ""; + }; + EA07F4BA16134F27006A2112 /* Products */ = { + isa = PBXGroup; + children = ( + EA07F4B916134F27006A2112 /* PetstoreClient */, + EA07F4F21613521A006A2112 /* PetstoreClientTests.octest */, + ); + name = Products; + sourceTree = ""; + }; + EA07F4BC16134F27006A2112 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EA07F4BD16134F27006A2112 /* Foundation.framework */, + EA07F4F31613521A006A2112 /* SenTestingKit.framework */, + EA07F4F51613521A006A2112 /* Cocoa.framework */, + EA07F4F71613521A006A2112 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + EA07F4BF16134F27006A2112 /* PetstoreClient */ = { + isa = PBXGroup; + children = ( + EA07F4C016134F27006A2112 /* main.m */, + EA07F4C416134F27006A2112 /* PetstoreClient.1 */, + EA07F4C216134F27006A2112 /* Supporting Files */, + ); + path = PetstoreClient; + sourceTree = ""; + }; + EA07F4C216134F27006A2112 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + EA07F4C316134F27006A2112 /* PetstoreClient-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + EA07F4F71613521A006A2112 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + EA07F4F81613521A006A2112 /* AppKit.framework */, + EA07F4F91613521A006A2112 /* CoreData.framework */, + EA07F4FA1613521A006A2112 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + EA07F4FB1613521A006A2112 /* PetstoreClientTests */ = { + isa = PBXGroup; + children = ( + EA07F508161355BC006A2112 /* PetApiTest.h */, + EA07F509161355BC006A2112 /* PetApiTest.m */, + EA07F4FC1613521A006A2112 /* Supporting Files */, + ); + path = PetstoreClientTests; + sourceTree = ""; + }; + EA07F4FC1613521A006A2112 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + EA07F4FD1613521A006A2112 /* PetstoreClientTests-Info.plist */, + EA07F4FE1613521A006A2112 /* InfoPlist.strings */, + EA07F5041613521A006A2112 /* PetstoreClientTests-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + EA07F52D1613569E006A2112 /* Generated Client */ = { + isa = PBXGroup; + children = ( + EA07F50C1613569A006A2112 /* NIKApiInvoker.h */, + EA07F50D1613569A006A2112 /* NIKApiInvoker.m */, + EA07F50E1613569A006A2112 /* NIKCategory.h */, + EA07F50F1613569A006A2112 /* NIKCategory.m */, + EA07F5101613569A006A2112 /* NIKDate.h */, + EA07F5111613569A006A2112 /* NIKDate.m */, + EA07F5121613569A006A2112 /* NIKOrder.h */, + EA07F5131613569A006A2112 /* NIKOrder.m */, + EA07F5141613569A006A2112 /* NIKPet.h */, + EA07F5151613569A006A2112 /* NIKPet.m */, + EA07F5161613569A006A2112 /* NIKPetApi.h */, + EA07F5171613569A006A2112 /* NIKPetApi.m */, + EA07F5181613569A006A2112 /* NIKStoreApi.h */, + EA07F5191613569A006A2112 /* NIKStoreApi.m */, + EA07F51A1613569A006A2112 /* NIKSwaggerObject.h */, + EA07F51B1613569A006A2112 /* NIKSwaggerObject.m */, + EA07F51C1613569A006A2112 /* NIKTag.h */, + EA07F51D1613569A006A2112 /* NIKTag.m */, + EA07F51E1613569A006A2112 /* NIKUser.h */, + EA07F51F1613569A006A2112 /* NIKUser.m */, + EA07F5201613569A006A2112 /* NIKUserApi.h */, + EA07F5211613569A006A2112 /* NIKUserApi.m */, + ); + name = "Generated Client"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + EA07F4B816134F27006A2112 /* PetstoreClient */ = { + isa = PBXNativeTarget; + buildConfigurationList = EA07F4C816134F27006A2112 /* Build configuration list for PBXNativeTarget "PetstoreClient" */; + buildPhases = ( + EA07F4B516134F27006A2112 /* Sources */, + EA07F4B616134F27006A2112 /* Frameworks */, + EA07F4B716134F27006A2112 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PetstoreClient; + productName = PetstoreClient; + productReference = EA07F4B916134F27006A2112 /* PetstoreClient */; + productType = "com.apple.product-type.tool"; + }; + EA07F4F11613521A006A2112 /* PetstoreClientTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = EA07F5051613521A006A2112 /* Build configuration list for PBXNativeTarget "PetstoreClientTests" */; + buildPhases = ( + EA07F4ED1613521A006A2112 /* Sources */, + EA07F4EE1613521A006A2112 /* Frameworks */, + EA07F4EF1613521A006A2112 /* Resources */, + EA07F4F01613521A006A2112 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + EA07F52F161357A5006A2112 /* PBXTargetDependency */, + ); + name = PetstoreClientTests; + productName = PetstoreClientTests; + productReference = EA07F4F21613521A006A2112 /* PetstoreClientTests.octest */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + EA07F4B016134F27006A2112 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = "Tony Tam"; + }; + buildConfigurationList = EA07F4B316134F27006A2112 /* Build configuration list for PBXProject "PetstoreClient" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = EA07F4AE16134F27006A2112; + productRefGroup = EA07F4BA16134F27006A2112 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + EA07F4B816134F27006A2112 /* PetstoreClient */, + EA07F4F11613521A006A2112 /* PetstoreClientTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + EA07F4EF1613521A006A2112 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EA07F5001613521A006A2112 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + EA07F4F01613521A006A2112 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + EA07F4B516134F27006A2112 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EA07F4C116134F27006A2112 /* main.m in Sources */, + EA07F5221613569A006A2112 /* NIKApiInvoker.m in Sources */, + EA07F5231613569A006A2112 /* NIKCategory.m in Sources */, + EA07F5241613569A006A2112 /* NIKDate.m in Sources */, + EA07F5251613569A006A2112 /* NIKOrder.m in Sources */, + EA07F5261613569A006A2112 /* NIKPet.m in Sources */, + EA07F5271613569A006A2112 /* NIKPetApi.m in Sources */, + EA07F5281613569A006A2112 /* NIKStoreApi.m in Sources */, + EA07F5291613569A006A2112 /* NIKSwaggerObject.m in Sources */, + EA07F52A1613569A006A2112 /* NIKTag.m in Sources */, + EA07F52B1613569A006A2112 /* NIKUser.m in Sources */, + EA07F52C1613569A006A2112 /* NIKUserApi.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EA07F4ED1613521A006A2112 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EA07F53516135916006A2112 /* NIKApiInvoker.h in Sources */, + EA07F53616135916006A2112 /* NIKApiInvoker.m in Sources */, + EA07F53716135916006A2112 /* NIKCategory.h in Sources */, + EA07F53816135916006A2112 /* NIKCategory.m in Sources */, + EA07F53916135916006A2112 /* NIKDate.h in Sources */, + EA07F53A16135916006A2112 /* NIKDate.m in Sources */, + EA07F53B16135916006A2112 /* NIKOrder.h in Sources */, + EA07F53C16135916006A2112 /* NIKOrder.m in Sources */, + EA07F53D16135916006A2112 /* NIKPet.h in Sources */, + EA07F53E16135916006A2112 /* NIKPet.m in Sources */, + EA07F53F16135916006A2112 /* NIKPetApi.h in Sources */, + EA07F54016135916006A2112 /* NIKPetApi.m in Sources */, + EA07F54116135916006A2112 /* NIKStoreApi.h in Sources */, + EA07F54216135916006A2112 /* NIKStoreApi.m in Sources */, + EA07F54316135916006A2112 /* NIKSwaggerObject.h in Sources */, + EA07F54416135916006A2112 /* NIKSwaggerObject.m in Sources */, + EA07F54516135916006A2112 /* NIKTag.h in Sources */, + EA07F54616135916006A2112 /* NIKTag.m in Sources */, + EA07F54716135916006A2112 /* NIKUser.h in Sources */, + EA07F54816135916006A2112 /* NIKUser.m in Sources */, + EA07F54916135916006A2112 /* NIKUserApi.h in Sources */, + EA07F54A16135916006A2112 /* NIKUserApi.m in Sources */, + EA07F50A161355BC006A2112 /* PetApiTest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + EA07F52F161357A5006A2112 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EA07F4B816134F27006A2112 /* PetstoreClient */; + targetProxy = EA07F52E161357A5006A2112 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + EA07F4FE1613521A006A2112 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + EA07F4FF1613521A006A2112 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + EA07F4C616134F27006A2112 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "\"$(SDKROOT)/Developer/Library/Frameworks $(DEVELOPER_LIBRARY_DIR)/Frameworks\"", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + EA07F4C716134F27006A2112 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "\"$(SDKROOT)/Developer/Library/Frameworks $(DEVELOPER_LIBRARY_DIR)/Frameworks\"", + ); + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + SDKROOT = macosx; + }; + name = Release; + }; + EA07F4C916134F27006A2112 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PetstoreClient/PetstoreClient-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + EA07F4CA16134F27006A2112 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PetstoreClient/PetstoreClient-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + EA07F5061613521A006A2112 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", + "\"$(SDKROOT)/Developer/Library/Frameworks $(DEVELOPER_LIBRARY_DIR)/Frameworks\"", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PetstoreClientTests/PetstoreClientTests-Prefix.pch"; + INFOPLIST_FILE = "PetstoreClientTests/PetstoreClientTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + EA07F5071613521A006A2112 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", + "\"$(SDKROOT)/Developer/Library/Frameworks $(DEVELOPER_LIBRARY_DIR)/Frameworks\"", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PetstoreClientTests/PetstoreClientTests-Prefix.pch"; + INFOPLIST_FILE = "PetstoreClientTests/PetstoreClientTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = octest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + EA07F4B316134F27006A2112 /* Build configuration list for PBXProject "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EA07F4C616134F27006A2112 /* Debug */, + EA07F4C716134F27006A2112 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + EA07F4C816134F27006A2112 /* Build configuration list for PBXNativeTarget "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EA07F4C916134F27006A2112 /* Debug */, + EA07F4CA16134F27006A2112 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + EA07F5051613521A006A2112 /* Build configuration list for PBXNativeTarget "PetstoreClientTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EA07F5061613521A006A2112 /* Debug */, + EA07F5071613521A006A2112 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = EA07F4B016134F27006A2112 /* Project object */; +} diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient-Prefix.pch b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient-Prefix.pch new file mode 100644 index 00000000000..2a173ae6548 --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'PetstoreClient' target in the 'PetstoreClient' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient.1 b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient.1 new file mode 100644 index 00000000000..5ba144aa7e8 --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/PetstoreClient.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 9/26/12 \" DATE +.Dt PetstoreClient 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm PetstoreClient, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient/main.m b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/main.m new file mode 100644 index 00000000000..33b41ff2485 --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient/main.m @@ -0,0 +1,22 @@ +// +// main.m +// PetstoreClient +// +// Created by Tony Tam on 9/26/12. +// Copyright (c) 2012 Tony Tam. All rights reserved. +// + +#import + +int main(int argc, const char * argv[]) +{ + + @autoreleasepool { + + // insert code here... + NSLog(@"Hello, World!"); + + } + return 0; +} + diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Info.plist b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Info.plist new file mode 100644 index 00000000000..dd6d9a681de --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.wordnik.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Prefix.pch b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Prefix.pch new file mode 100644 index 00000000000..c07489a293a --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'PetstoreClientTests' target in the 'PetstoreClientTests' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/en.lproj/InfoPlist.strings new file mode 100644 index 00000000000..477b28ff8f8 --- /dev/null +++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/samples/client/petstore/objc/tests/PetApiTest.h b/samples/client/petstore/objc/tests/PetApiTest.h new file mode 100644 index 00000000000..a36a8d2f6c3 --- /dev/null +++ b/samples/client/petstore/objc/tests/PetApiTest.h @@ -0,0 +1,9 @@ +#import +#import "NIKPetApi.h" + +@interface PetApiTest : SenTestCase { +@private + NIKPetApi * api; +} + +@end diff --git a/samples/client/petstore/objc/tests/PetApiTest.m b/samples/client/petstore/objc/tests/PetApiTest.m new file mode 100644 index 00000000000..7ced16415ca --- /dev/null +++ b/samples/client/petstore/objc/tests/PetApiTest.m @@ -0,0 +1,323 @@ +#import "PetApiTest.h" + +@implementation PetApiTest + +- (void)setUp { + [super setUp]; + api = [[NIKPetApi alloc ]init]; +} + +- (void)tearDown { + [super tearDown]; +} + +- (void)testGetPetById { + bool done = false; + static NIKPet* pet = nil; + static NSError * gError = nil; + + [api getPetByIdWithCompletionBlock:@"1" completionHandler:^(NIKPet *output, NSError *error) { + if(error) { + gError = error; + } + if(output == nil){ + NSLog(@"failed to fetch pet"); + } + else { + pet = [[NIKPet alloc] initWithValues:[output asDictionary]]; + } + }]; + + NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(pet){ + STAssertNotNil([pet _id], @"token was nil"); + done = true; + } + } + STAssertNotNil(pet, @"failed to fetch valid result in 10 seconds"); +} + +- (void) testAddPet { + bool done = false; + static NSError * gError = nil; + + NIKPet * petToAdd = [[NIKPet alloc] init]; + [petToAdd set_id:@"1000"]; + NSMutableArray* tags = [[NSMutableArray alloc] init]; + for(int i = 0; i < 5; i++){ + NIKTag * tag = [[NIKTag alloc] init]; + [tag set_id:[NSNumber numberWithInt:i]]; + [tag setName:[NSString stringWithFormat:@"tag-%d", i]]; + [tags addObject:tag]; + } + [petToAdd setTags:tags]; + [petToAdd setStatus:@"lost"]; + + NIKCategory * category = [[NIKCategory alloc] init]; + [category setName:@"sold"]; + [petToAdd setCategory:category]; + [petToAdd setName:@"dragon"]; + + NSMutableArray* photos = [[NSMutableArray alloc] init]; + for(int i = 0; i < 10; i++){ + NSString * url = [NSString stringWithFormat:@"http://foo.com/photo/%d", i]; + [photos addObject:url]; + } + [petToAdd setPhotoUrls:photos]; + + static bool hasResponse = false; + [api addPetWithCompletionBlock:petToAdd completionHandler:^(NSError *error) { + if(error) { + gError = error; + } + hasResponse = true; + }]; + NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(hasResponse){ + done = true; + } + } + + static NIKPet* pet = nil; + + [api getPetByIdWithCompletionBlock:[NSString stringWithFormat:@"%@",[petToAdd _id]] completionHandler:^(NIKPet *output, NSError *error) { + if(error) { + gError = error; + } + if(output == nil){ + NSLog(@"failed to fetch pet"); + } + else { + pet = [[NIKPet alloc] initWithValues:[output asDictionary]]; + } + }]; + + loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + done = false; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(pet){ + STAssertNotNil([pet _id], @"pet was nil"); + done = true; + } + } + STAssertNotNil(pet, @"failed to fetch valid result in 10 seconds"); + +} + +- (void) testUpdatePet { + bool done = false; + static NSError * gError = nil; + + NIKPet * petToAdd = [[NIKPet alloc] init]; + [petToAdd set_id:[NSNumber numberWithInt:1000]]; + NSMutableArray* tags = [[NSMutableArray alloc] init]; + for(int i = 0; i < 5; i++){ + NIKTag * tag = [[NIKTag alloc] init]; + [tag set_id:[NSNumber numberWithInt:i]]; + [tag setName:[NSString stringWithFormat:@"tag-%d", i]]; + [tags addObject:tag]; + } + [petToAdd setTags:tags]; + [petToAdd setStatus:@"lost"]; + + NIKCategory * category = [[NIKCategory alloc] init]; + [category setName:@"sold"]; + [petToAdd setCategory:category]; + [petToAdd setName:@"dragon"]; + + NSMutableArray* photos = [[NSMutableArray alloc] init]; + for(int i = 0; i < 10; i++){ + NSString * url = [NSString stringWithFormat:@"http://foo.com/photo/%d", i]; + [photos addObject:url]; + } + [petToAdd setPhotoUrls:photos]; + + static bool hasResponse = false; + [api addPetWithCompletionBlock:petToAdd completionHandler:^(NSError *error) { + if(error) { + gError = error; + } + hasResponse = true; + }]; + NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + done = false; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + done = true; + STFail(@"got error %@", gError); + } + if(hasResponse){ + done = true; + NSLog(@"pet was added"); + } + } + + static NIKPet* pet = nil; + done = false; + + [api getPetByIdWithCompletionBlock:[NSString stringWithFormat:@"%@",[petToAdd _id]] completionHandler:^(NIKPet *output, NSError *error) { + if(error) { + gError = error; + } + if(output == nil){ + NSLog(@"failed to fetch pet"); + } + else { + pet = [[NIKPet alloc] initWithValues:[output asDictionary]]; + NSLog(@"got the pet"); + } + }]; + + loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(pet){ + STAssertNotNil([pet _id], @"pet was nil"); + done = true; + } + } + STAssertNotNil(pet, @"failed to fetch valid result in 10 seconds"); + + [pet setName:@"programmer"]; + [pet setStatus:@"confused"]; + + hasResponse = false; + [api updatePetWithCompletionBlock:pet + completionHandler:^(NSError *error) { + if(error) { + gError = error; + } + hasResponse = true; + }]; + + loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + done = false; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + else if(hasResponse) { + done = true; + } + } + + pet = nil; + done = false; + + [api getPetByIdWithCompletionBlock:[NSString stringWithFormat:@"%d",1000] completionHandler:^(NIKPet *output, NSError *error) { + if(error) { + gError = error; + } + if(output == nil){ + NSLog(@"failed to fetch pet"); + } + else { + pet = [[NIKPet alloc] initWithValues:[output asDictionary]]; + } + }]; + + loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(pet){ + STAssertNotNil([pet _id], @"pet was nil"); + STAssertEqualObjects([pet name], @"programmer", @"pet name was not updated"); + STAssertEqualObjects([pet status], @"confused", @"pet status was not updated"); + done = true; + } + } + STAssertNotNil(pet, @"failed to fetch valid result in 10 seconds"); +} + +- (void)testGetPetByStatus { + bool done = false; + static NSMutableArray* pets = nil; + static NSError * gError = nil; + [api findPetsByStatusWithCompletionBlock:@"available" completionHandler:^(NSArray *output, NSError *error) { + if(error) { + gError = error; + } + if(output == nil){ + NSLog(@"failed to fetch pets"); + } + else { + pets = [[NSMutableArray alloc]init]; + for(NIKPet* pet in output) { + [pets addObject:[[NIKPet alloc] initWithValues:[pet asDictionary]]]; + } + } + }]; + NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(pets){ + for(NIKPet * pet in pets) { + STAssertEqualObjects([pet status], @"available", @"got invalid status for pets"); + } + done = true; + } + } +} + +- (void)testGetPetByTags { + bool done = false; + static NSMutableArray* pets = nil; + static NSError * gError = nil; + [api findPetsByTagsWithCompletionBlock:@"tag1,tag2" completionHandler:^(NSArray *output, NSError *error) { + if(error) { + gError = error; + } + if(output == nil){ + NSLog(@"failed to fetch pets"); + } + else { + pets = [[NSMutableArray alloc]init]; + for(NIKPet* pet in output) { + [pets addObject:[[NIKPet alloc] initWithValues:[pet asDictionary]]]; + } + } + }]; + NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10]; + while(!done && [loopUntil timeIntervalSinceNow] > 0){ + if(gError){ + STFail(@"got error %@", gError); + done = true; + } + if(pets){ + for(NIKPet * pet in pets) { + bool hasTag = false; + for(NIKTag * tag in [pet tags]){ + if([[tag name] isEqualToString:@"tag1"] || [[tag name] isEqualToString:@"tag2"]) + hasTag = true; + } + STAssertEquals(hasTag, true, @"didn't find tag in pet"); + } + done = true; + } + } +} +@end