diff --git a/.gitignore b/.gitignore index ab6b7da7269..b4d421e3c55 100644 --- a/.gitignore +++ b/.gitignore @@ -31,8 +31,10 @@ samples/client/petstore/qt5cpp/PetStore/PetStore samples/client/petstore/qt5cpp/PetStore/Makefile samples/client/petstore/java/hello.txt samples/client/petstore/android-java/hello.txt -samples/client/petstore/objc/Build -samples/client/petstore/objc/Pods +samples/client/petstore/objc/SwaggerClientTests/Build +samples/client/petstore/objc/SwaggerClientTests/Pods +samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcworkspace +samples/client/petstore/objc/SwaggerClientTests/Podfile.lock samples/server/petstore/nodejs/node_modules target .idea diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 03905cbdfaf..0fdb19e806d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -18,43 +18,60 @@ import java.util.Set; public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { protected Set foundationClasses = new HashSet(); - protected String sourceFolder = "client"; + protected String podName = "SwaggerClient"; + protected String podVersion = "1.0.0"; protected String classPrefix = "SWG"; - protected String projectName = "SwaggerClient"; public ObjcClientCodegen() { super(); + outputFolder = "generated-code" + File.separator + "objc"; modelTemplateFiles.put("model-header.mustache", ".h"); modelTemplateFiles.put("model-body.mustache", ".m"); apiTemplateFiles.put("api-header.mustache", ".h"); apiTemplateFiles.put("api-body.mustache", ".m"); templateDir = "objc"; - modelPackage = ""; - defaultIncludes = new HashSet( - Arrays.asList( - "bool", - "BOOL", - "int", - "NSString", - "NSObject", - "NSArray", - "NSNumber", - "NSDate", - "NSDictionary", - "NSMutableArray", - "NSMutableDictionary") - ); - languageSpecificPrimitives = new HashSet( - Arrays.asList( - "NSNumber", - "NSString", - "NSObject", - "NSDate", - "bool", - "BOOL") - ); + defaultIncludes.clear(); + defaultIncludes.add("bool"); + defaultIncludes.add("BOOL"); + defaultIncludes.add("int"); + defaultIncludes.add("NSURL"); + defaultIncludes.add("NSString"); + defaultIncludes.add("NSObject"); + defaultIncludes.add("NSArray"); + defaultIncludes.add("NSNumber"); + defaultIncludes.add("NSDate"); + defaultIncludes.add("NSDictionary"); + defaultIncludes.add("NSMutableArray"); + defaultIncludes.add("NSMutableDictionary"); + + languageSpecificPrimitives.clear(); + languageSpecificPrimitives.add("NSNumber"); + languageSpecificPrimitives.add("NSString"); + languageSpecificPrimitives.add("NSObject"); + languageSpecificPrimitives.add("NSDate"); + languageSpecificPrimitives.add("NSURL"); + languageSpecificPrimitives.add("bool"); + languageSpecificPrimitives.add("BOOL"); + + typeMapping.clear(); + typeMapping.put("enum", "NSString"); + typeMapping.put("Date", "NSDate"); + typeMapping.put("DateTime", "NSDate"); + typeMapping.put("boolean", "NSNumber"); + typeMapping.put("string", "NSString"); + typeMapping.put("integer", "NSNumber"); + typeMapping.put("int", "NSNumber"); + typeMapping.put("float", "NSNumber"); + typeMapping.put("long", "NSNumber"); + typeMapping.put("double", "NSNumber"); + typeMapping.put("array", "NSArray"); + typeMapping.put("map", "NSDictionary"); + typeMapping.put("number", "NSNumber"); + typeMapping.put("List", "NSArray"); + typeMapping.put("object", "NSObject"); + typeMapping.put("file", "NSURL"); // ref: http://www.tutorialspoint.com/objective_c/objective_c_basic_syntax.htm reservedWords = new HashSet( @@ -70,26 +87,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { "double", "protocol", "interface", "implementation", "NSObject", "NSInteger", "NSNumber", "CGFloat", "property", "nonatomic", "retain", "strong", - "weak", "unsafe_unretained", "readwrite", "readonly" + "weak", "unsafe_unretained", "readwrite", "readonly", + "description" )); - typeMapping = new HashMap(); - typeMapping.put("enum", "NSString"); - typeMapping.put("Date", "NSDate"); - typeMapping.put("DateTime", "NSDate"); - typeMapping.put("boolean", "BOOL"); - typeMapping.put("string", "NSString"); - typeMapping.put("integer", "NSNumber"); - typeMapping.put("int", "NSNumber"); - typeMapping.put("float", "NSNumber"); - typeMapping.put("long", "NSNumber"); - typeMapping.put("double", "NSNumber"); - typeMapping.put("array", "NSArray"); - typeMapping.put("map", "NSDictionary"); - typeMapping.put("number", "NSNumber"); - typeMapping.put("List", "NSArray"); - typeMapping.put("object", "NSObject"); - importMapping = new HashMap(); foundationClasses = new HashSet( @@ -98,15 +99,17 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { "NSObject", "NSString", "NSDate", + "NSURL", "NSDictionary") ); instantiationTypes.put("array", "NSMutableArray"); instantiationTypes.put("map", "NSMutableDictionary"); - cliOptions.add(new CliOption("classPrefix", "prefix for generated classes")); - cliOptions.add(new CliOption("sourceFolder", "source folder for generated code")); - cliOptions.add(new CliOption("projectName", "name of the Xcode project in generated Podfile")); + cliOptions.clear(); + cliOptions.add(new CliOption("classPrefix", "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`")); + cliOptions.add(new CliOption("podName", "cocoapods package name (convention: CameCase), default: `SwaggerClient`")); + cliOptions.add(new CliOption("podVersion", "cocoapods package version, default: `1.0.0`")); } public CodegenType getTag() { @@ -125,35 +128,43 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { public void processOpts() { super.processOpts(); - if (additionalProperties.containsKey("sourceFolder")) { - this.setSourceFolder((String) additionalProperties.get("sourceFolder")); + if (additionalProperties.containsKey("podName")) { + setPodName((String) additionalProperties.get("podName")); + } + + if (additionalProperties.containsKey("podVersion")) { + setPodVersion((String) additionalProperties.get("podVersion")); } if (additionalProperties.containsKey("classPrefix")) { - this.setClassPrefix((String) additionalProperties.get("classPrefix")); + setClassPrefix((String) additionalProperties.get("classPrefix")); } - if (additionalProperties.containsKey("projectName")) { - this.setProjectName((String) additionalProperties.get("projectName")); - } else { - additionalProperties.put("projectName", projectName); - } + additionalProperties.put("podName", podName); + additionalProperties.put("podVersion", podVersion); + additionalProperties.put("classPrefix", classPrefix); - supportingFiles.add(new SupportingFile("SWGObject.h", sourceFolder, "SWGObject.h")); - supportingFiles.add(new SupportingFile("SWGObject.m", sourceFolder, "SWGObject.m")); - supportingFiles.add(new SupportingFile("SWGQueryParamCollection.h", sourceFolder, "SWGQueryParamCollection.h")); - supportingFiles.add(new SupportingFile("SWGQueryParamCollection.m", sourceFolder, "SWGQueryParamCollection.m")); - supportingFiles.add(new SupportingFile("SWGApiClient-header.mustache", sourceFolder, "SWGApiClient.h")); - supportingFiles.add(new SupportingFile("SWGApiClient-body.mustache", sourceFolder, "SWGApiClient.m")); - supportingFiles.add(new SupportingFile("SWGJSONResponseSerializer-header.mustache", sourceFolder, "SWGJSONResponseSerializer.h")); - supportingFiles.add(new SupportingFile("SWGJSONResponseSerializer-body.mustache", sourceFolder, "SWGJSONResponseSerializer.m")); - supportingFiles.add(new SupportingFile("SWGFile.h", sourceFolder, "SWGFile.h")); - supportingFiles.add(new SupportingFile("SWGFile.m", sourceFolder, "SWGFile.m")); - supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.m", sourceFolder, "JSONValueTransformer+ISO8601.m")); - supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.h", sourceFolder, "JSONValueTransformer+ISO8601.h")); - supportingFiles.add(new SupportingFile("SWGConfiguration-body.mustache", sourceFolder, "SWGConfiguration.m")); - supportingFiles.add(new SupportingFile("SWGConfiguration-header.mustache", sourceFolder, "SWGConfiguration.h")); - supportingFiles.add(new SupportingFile("Podfile.mustache", "", "Podfile")); + String swaggerFolder = podName; + + modelPackage = swaggerFolder; + apiPackage = swaggerFolder; + + supportingFiles.add(new SupportingFile("Object-header.mustache", swaggerFolder, classPrefix + "Object.h")); + supportingFiles.add(new SupportingFile("Object-body.mustache", swaggerFolder, classPrefix + "Object.m")); + supportingFiles.add(new SupportingFile("QueryParamCollection-header.mustache", swaggerFolder, classPrefix + "QueryParamCollection.h")); + supportingFiles.add(new SupportingFile("QueryParamCollection-body.mustache", swaggerFolder, classPrefix + "QueryParamCollection.m")); + supportingFiles.add(new SupportingFile("ApiClient-header.mustache", swaggerFolder, classPrefix + "ApiClient.h")); + supportingFiles.add(new SupportingFile("ApiClient-body.mustache", swaggerFolder, classPrefix + "ApiClient.m")); + supportingFiles.add(new SupportingFile("JSONResponseSerializer-header.mustache", swaggerFolder, classPrefix + "JSONResponseSerializer.h")); + supportingFiles.add(new SupportingFile("JSONResponseSerializer-body.mustache", swaggerFolder, classPrefix + "JSONResponseSerializer.m")); + supportingFiles.add(new SupportingFile("JSONRequestSerializer-body.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.m")); + supportingFiles.add(new SupportingFile("JSONRequestSerializer-header.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.h")); + supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.m", swaggerFolder, "JSONValueTransformer+ISO8601.m")); + supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.h", swaggerFolder, "JSONValueTransformer+ISO8601.h")); + supportingFiles.add(new SupportingFile("Configuration-body.mustache", swaggerFolder, classPrefix + "Configuration.m")); + supportingFiles.add(new SupportingFile("Configuration-header.mustache", swaggerFolder, classPrefix + "Configuration.h")); + supportingFiles.add(new SupportingFile("podspec.mustache", "", podName + ".podspec")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); } @Override @@ -285,11 +296,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toModelImport(String name) { - if ("".equals(modelPackage())) { - return name; - } else { - return modelPackage() + "." + name; - } + return name; } @Override @@ -299,12 +306,12 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String apiFileFolder() { - return outputFolder + File.separator + sourceFolder; + return outputFolder + File.separatorChar + apiPackage(); } @Override public String modelFileFolder() { - return outputFolder + File.separator + sourceFolder; + return outputFolder + File.separatorChar + modelPackage(); } @Override @@ -359,15 +366,15 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { return camelize(operationId, true); } - public void setSourceFolder(String sourceFolder) { - this.sourceFolder = sourceFolder; - } - public void setClassPrefix(String classPrefix) { this.classPrefix = classPrefix; } - public void setProjectName(String projectName) { - this.projectName = projectName; + public void setPodName(String podName) { + this.podName = podName; + } + + public void setPodVersion(String podVersion) { + this.podVersion = podVersion; } } diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache similarity index 54% rename from modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache rename to modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index 1b479d039e6..569eade5db5 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -1,11 +1,8 @@ -#import "SWGApiClient.h" -#import "SWGFile.h" -#import "SWGQueryParamCollection.h" -#import "SWGConfiguration.h" +#import "{{classPrefix}}ApiClient.h" -@implementation SWGApiClient +@implementation {{classPrefix}}ApiClient -NSString *const SWGResponseObjectErrorKey = @"SWGResponseObject"; +NSString *const {{classPrefix}}ResponseObjectErrorKey = @"{{classPrefix}}ResponseObject"; static long requestId = 0; static bool offlineState = false; @@ -14,31 +11,38 @@ static bool cacheEnabled = false; static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable; static NSOperationQueue* sharedQueue; static void (^reachabilityChangeBlock)(int); -static bool loggingEnabled = true; #pragma mark - Log Methods -+(void)setLoggingEnabled:(bool) state { - loggingEnabled = state; +- (void)logResponse:(AFHTTPRequestOperation *)operation + forRequest:(NSURLRequest *)request + error:(NSError*)error { + {{classPrefix}}Configuration *config = [{{classPrefix}}Configuration sharedConfig]; + + NSString *message = [NSString stringWithFormat:@"\n[DEBUG] Request body \n~BEGIN~\n %@\n~END~\n"\ + "[DEBUG] HTTP Response body \n~BEGIN~\n %@\n~END~\n", + [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding], + operation.responseString]; + + if (config.loggingFileHanlder) { + [config.loggingFileHanlder seekToEndOfFile]; + [config.loggingFileHanlder writeData:[message dataUsingEncoding:NSUTF8StringEncoding]]; + } + + NSLog(@"%@", message); } -- (void)logRequest:(NSURLRequest*)request { - NSLog(@"request: %@", [self descriptionForRequest:request]); -} +#pragma mark - Cache Methods -- (void)logResponse:(id)data forRequest:(NSURLRequest*)request error:(NSError*)error { - NSLog(@"request: %@ response: %@ ", [self descriptionForRequest:request], data ); ++ (void) setCacheEnabled:(BOOL)enabled { + cacheEnabled = enabled; } -#pragma mark - - +(void)clearCache { [[NSURLCache sharedURLCache] removeAllCachedResponses]; } -+(void)setCacheEnabled:(BOOL)enabled { - cacheEnabled = enabled; -} +#pragma mark - +(void)configureCacheWithMemoryAndDiskCapacity: (unsigned long) memorySize diskSize: (unsigned long) diskSize { @@ -58,7 +62,7 @@ static bool loggingEnabled = true; return sharedQueue; } -+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl { ++({{classPrefix}}ApiClient *)sharedClientFromPool:(NSString *)baseUrl { static NSMutableDictionary *_pool = nil; if (queuedRequests == nil) { queuedRequests = [[NSMutableSet alloc]init]; @@ -72,21 +76,21 @@ static bool loggingEnabled = true; _pool = [[NSMutableDictionary alloc] init]; // initialize URL cache - [SWGApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024]; + [{{classPrefix}}ApiClient configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024]; // configure reachability - [SWGApiClient configureCacheReachibilityForHost:baseUrl]; + [{{classPrefix}}ApiClient configureCacheReachibilityForHost:baseUrl]; } @synchronized(self) { - SWGApiClient * client = [_pool objectForKey:baseUrl]; + {{classPrefix}}ApiClient * client = [_pool objectForKey:baseUrl]; if (client == nil) { - client = [[SWGApiClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]]; + client = [[{{classPrefix}}ApiClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]]; [_pool setValue:client forKey:baseUrl ]; - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"new client for path %@", baseUrl); } - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"returning client for path %@", baseUrl); return client; } @@ -149,15 +153,15 @@ static bool loggingEnabled = true; +(NSNumber*) nextRequestId { @synchronized(self) { long nextId = ++requestId; - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"got id %ld", nextId); return [NSNumber numberWithLong:nextId]; } } +(NSNumber*) queueRequest { - NSNumber* requestId = [SWGApiClient nextRequestId]; - if(loggingEnabled) + NSNumber* requestId = [{{classPrefix}}ApiClient nextRequestId]; + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"added %@ to request queue", requestId); [queuedRequests addObject:requestId]; return requestId; @@ -190,7 +194,7 @@ static bool loggingEnabled = true; }]; if(matchingItems.count == 1) { - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"removing request id %@", requestId); [queuedRequests removeObject:requestId]; return true; @@ -221,31 +225,31 @@ static bool loggingEnabled = true; } +(void) configureCacheReachibilityForHost:(NSString*)host { - [[SWGApiClient sharedClientFromPool:host].reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + [[{{classPrefix}}ApiClient sharedClientFromPool:host].reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { reachabilityStatus = status; switch (status) { case AFNetworkReachabilityStatusUnknown: - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusUnknown"); - [SWGApiClient setOfflineState:true]; + [{{classPrefix}}ApiClient setOfflineState:true]; break; case AFNetworkReachabilityStatusNotReachable: - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable"); - [SWGApiClient setOfflineState:true]; + [{{classPrefix}}ApiClient setOfflineState:true]; break; case AFNetworkReachabilityStatusReachableViaWWAN: - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN"); - [SWGApiClient setOfflineState:false]; + [{{classPrefix}}ApiClient setOfflineState:false]; break; case AFNetworkReachabilityStatusReachableViaWiFi: - if(loggingEnabled) + if([[{{classPrefix}}Configuration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi"); - [SWGApiClient setOfflineState:false]; + [{{classPrefix}}ApiClient setOfflineState:false]; break; default: break; @@ -255,7 +259,7 @@ static bool loggingEnabled = true; reachabilityChangeBlock(status); } }]; - [[SWGApiClient sharedClientFromPool:host].reachabilityManager startMonitoring]; + [[{{classPrefix}}ApiClient sharedClientFromPool:host].reachabilityManager startMonitoring]; } -(NSString*) pathWithQueryParamsToString:(NSString*) path @@ -268,36 +272,35 @@ static bool loggingEnabled = true; for(NSString * key in [queryParams keyEnumerator]){ if(counter == 0) separator = @"?"; else separator = @"&"; - NSString * value; id queryParam = [queryParams valueForKey:key]; if([queryParam isKindOfClass:[NSString class]]){ [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], [SWGApiClient escape:[queryParams valueForKey:key]]]]; + [{{classPrefix}}ApiClient escape:key], [{{classPrefix}}ApiClient escape:[queryParams valueForKey:key]]]]; } - else if([queryParam isKindOfClass:[SWGQueryParamCollection class]]){ - SWGQueryParamCollection * coll = (SWGQueryParamCollection*) queryParam; + else if([queryParam isKindOfClass:[{{classPrefix}}QueryParamCollection class]]){ + {{classPrefix}}QueryParamCollection * coll = ({{classPrefix}}QueryParamCollection*) queryParam; NSArray* values = [coll values]; NSString* format = [coll format]; if([format isEqualToString:@"csv"]) { [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@","]]]]; + [{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@","]]]]; } else if([format isEqualToString:@"tsv"]) { [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"\t"]]]]; + [{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"\t"]]]]; } else if([format isEqualToString:@"pipes"]) { [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"|"]]]]; + [{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [values componentsJoinedByString:@"|"]]]]; } else if([format isEqualToString:@"multi"]) { for(id obj in values) { [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], [NSString stringWithFormat:@"%@", obj]]]; + [{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", obj]]]; counter += 1; } @@ -305,7 +308,7 @@ static bool loggingEnabled = true; } else { [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, - [SWGApiClient escape:key], [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]]]; + [{{classPrefix}}ApiClient escape:key], [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]]]]; } counter += 1; @@ -314,11 +317,6 @@ static bool loggingEnabled = true; return requestUrl; } -- (NSString*)descriptionForRequest:(NSURLRequest*)request { - return [[request URL] absoluteString]; -} - - /** * Update header and query params based on authentication settings */ @@ -333,7 +331,7 @@ static bool loggingEnabled = true; NSMutableDictionary *headersWithAuth = [NSMutableDictionary dictionaryWithDictionary:*headers]; NSMutableDictionary *querysWithAuth = [NSMutableDictionary dictionaryWithDictionary:*querys]; - SWGConfiguration *config = [SWGConfiguration sharedConfig]; + {{classPrefix}}Configuration *config = [{{classPrefix}}Configuration sharedConfig]; for (NSString *auth in authSettings) { NSDictionary *authSetting = [[config authSettings] objectForKey:auth]; @@ -359,8 +357,8 @@ static bool loggingEnabled = true; NSMutableArray *resultArray = nil; NSMutableDictionary *resultDict = nil; - // return nil if data is nil - if (!data) { + // return nil if data is nil or class is nil + if (!data || !class) { return nil; } @@ -473,20 +471,112 @@ static bool loggingEnabled = true; return nil; } +#pragma mark - Operation Methods + +- (void) operationWithCompletionBlock: (NSURLRequest *)request + requestId: (NSNumber *) requestId + completionBlock: (void (^)(id, NSError *))completionBlock { + AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request + success:^(AFHTTPRequestOperation *operation, id response) { + if([self executeRequestWithId:requestId]) { + if([[{{classPrefix}}Configuration sharedConfig] debug]) { + [self logResponse:operation forRequest:request error:nil]; + } + completionBlock(response, nil); + } + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + if([self executeRequestWithId:requestId]) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if(operation.responseObject) { + // Add in the (parsed) response body. + userInfo[{{classPrefix}}ResponseObjectErrorKey] = operation.responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + + if([[{{classPrefix}}Configuration sharedConfig] debug]) + [self logResponse:nil forRequest:request error:augmentedError]; + completionBlock(nil, augmentedError); + } + }]; + + [self.operationQueue addOperation:op]; +} + +- (void) downloadOperationWithCompletionBlock: (NSURLRequest *)request + requestId: (NSNumber *) requestId + completionBlock: (void (^)(id, NSError *))completionBlock { + AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request + success:^(AFHTTPRequestOperation *operation, id responseObject) { + {{classPrefix}}Configuration *config = [{{classPrefix}}Configuration sharedConfig]; + NSString *directory = nil; + if (config.tempFolderPath) { + directory = config.tempFolderPath; + } + else { + directory = NSTemporaryDirectory(); + } + + NSDictionary *headers = operation.response.allHeaderFields; + NSString *filename = nil; + if ([headers objectForKey:@"Content-Disposition"]) { + + NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; + NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern + options:NSRegularExpressionCaseInsensitive + error:nil]; + NSString *contentDispositionHeader = [headers objectForKey:@"Content-Disposition"]; + NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader + options:0 + range:NSMakeRange(0, [contentDispositionHeader length])]; + filename = [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; + } + else { + filename = [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; + } + + NSString *filepath = [directory stringByAppendingPathComponent:filename]; + NSURL *file = [NSURL fileURLWithPath:filepath]; + + [operation.responseData writeToURL:file atomically:YES]; + completionBlock(file, nil); + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + + if ([self executeRequestWithId:requestId]) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (operation.responseObject) { + userInfo[{{classPrefix}}ResponseObjectErrorKey] = operation.responseObject; + } + + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + + if ([[{{classPrefix}}Configuration sharedConfig] debug]) { + [self logResponse:nil forRequest:request error:augmentedError]; + } + + completionBlock(nil, augmentedError); + } + }]; + + [self.operationQueue addOperation:op]; +} + #pragma mark - Perform Request Methods -(NSNumber*) requestWithCompletionBlock: (NSString*) path method: (NSString*) method queryParams: (NSDictionary*) queryParams + formParams: (NSDictionary *) formParams + files: (NSDictionary *) files body: (id) body headerParams: (NSDictionary*) headerParams authSettings: (NSArray *) authSettings requestContentType: (NSString*) requestContentType responseContentType: (NSString*) responseContentType + responseType: (NSString *) responseType completionBlock: (void (^)(id, NSError *))completionBlock { // setting request serializer if ([requestContentType isEqualToString:@"application/json"]) { - self.requestSerializer = [AFJSONRequestSerializer serializer]; + self.requestSerializer = [{{classPrefix}}JSONRequestSerializer serializer]; } else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) { self.requestSerializer = [AFHTTPRequestSerializer serializer]; @@ -500,7 +590,7 @@ static bool loggingEnabled = true; // setting response serializer if ([responseContentType isEqualToString:@"application/json"]) { - self.responseSerializer = [SWGJSONResponseSerializer serializer]; + self.responseSerializer = [{{classPrefix}}JSONResponseSerializer serializer]; } else { self.responseSerializer = [AFHTTPResponseSerializer serializer]; @@ -510,68 +600,42 @@ static bool loggingEnabled = true; [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; NSMutableURLRequest * request = nil; - if (body != nil && [body isKindOfClass:[NSArray class]]){ - SWGFile * file; - NSMutableDictionary * params = [[NSMutableDictionary alloc] init]; - for(id obj in body) { - if([obj isKindOfClass:[SWGFile class]]) { - file = (SWGFile*) obj; - requestContentType = @"multipart/form-data"; - } - else if([obj isKindOfClass:[NSDictionary class]]) { - for(NSString * key in obj) { - params[key] = obj[key]; - } - } - } - NSString * urlString = [[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString]; - - // request with multipart form - if([requestContentType isEqualToString:@"multipart/form-data"]) { - request = [self.requestSerializer multipartFormRequestWithMethod: @"POST" - URLString: urlString - parameters: nil - constructingBodyWithBlock: ^(id formData) { - - for(NSString * key in params) { - NSData* data = [params[key] dataUsingEncoding:NSUTF8StringEncoding]; - [formData appendPartWithFormData: data name: key]; - } - - if (file) { - [formData appendPartWithFileData: [file data] - name: [file paramName] - fileName: [file name] - mimeType: [file mimeType]]; - } - - } - error:nil]; - } - // request with form parameters or json - else { - NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams]; - NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; - - request = [self.requestSerializer requestWithMethod:method - URLString:urlString - parameters:params - error:nil]; - } - + NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams]; + NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; + if (files.count > 0) { + request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" + URLString:urlString + parameters:nil + constructingBodyWithBlock:^(id formData) { + [formParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSData *data = [obj dataUsingEncoding:NSUTF8StringEncoding]; + [formData appendPartWithFormData:data name:key]; + }]; + [files enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSURL *filePath = (NSURL *)obj; + [formData appendPartWithFileURL:filePath name:key error:nil]; + }]; + } error:nil]; } else { - NSString * pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams]; - NSString * urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; - - request = [self.requestSerializer requestWithMethod: method - URLString: urlString - parameters: body - error: nil]; + if (formParams) { + request = [self.requestSerializer requestWithMethod:method + URLString:urlString + parameters:formParams + error:nil]; + } + if (body) { + request = [self.requestSerializer requestWithMethod:method + URLString:urlString + parameters:body + error:nil]; + } } + BOOL hasHeaderParams = false; - if(headerParams != nil && [headerParams count] > 0) + if(headerParams != nil && [headerParams count] > 0) { hasHeaderParams = true; + } if(offlineState) { NSLog(@"%@ cache forced", path); [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; @@ -585,17 +649,7 @@ static bool loggingEnabled = true; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; } - - if(body != nil) { - if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){ - [self.requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"]; - } - else if ([body isKindOfClass:[SWGFile class]]){} - else { - NSAssert(false, @"unsupported post type!"); - } - } - if(headerParams != nil){ + if(hasHeaderParams){ for(NSString * key in [headerParams keyEnumerator]){ [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; } @@ -606,31 +660,17 @@ static bool loggingEnabled = true; // Always disable cookies! [request setHTTPShouldHandleCookies:NO]; - NSNumber* requestId = [SWGApiClient queueRequest]; - AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request - success:^(AFHTTPRequestOperation *operation, id response) { - if([self executeRequestWithId:requestId]) { - if(self.logServerResponses) { - [self logResponse:response forRequest:request error:nil]; - } - completionBlock(response, nil); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if([self executeRequestWithId:requestId]) { - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - if(operation.responseObject) { - // Add in the (parsed) response body. - userInfo[SWGResponseObjectErrorKey] = operation.responseObject; - } - NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; - - if(self.logServerResponses) - [self logResponse:nil forRequest:request error:augmentedError]; - completionBlock(nil, augmentedError); - } - }]; - - [self.operationQueue addOperation:op]; + NSNumber* requestId = [{{classPrefix}}ApiClient queueRequest]; + if ([responseType isEqualToString:@"NSURL*"]) { + [self downloadOperationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { + completionBlock(data, error); + }]; + } + else { + [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { + completionBlock([self deserialize:data class:responseType], error); + }]; + } return requestId; } @@ -639,8 +679,3 @@ static bool loggingEnabled = true; - - - - - diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache similarity index 80% rename from modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache rename to modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index 691c92cc625..0edab7414f1 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -1,7 +1,11 @@ #import #import -#import "AFHTTPRequestOperationManager.h" -#import "SWGJSONResponseSerializer.h" +#import +#import "{{classPrefix}}JSONResponseSerializer.h" +#import "{{classPrefix}}JSONRequestSerializer.h" +#import "{{classPrefix}}QueryParamCollection.h" +#import "{{classPrefix}}Configuration.h" + {{#models}}{{#model}}#import "{{classname}}.h" {{/model}}{{/models}} @@ -11,18 +15,13 @@ * * The corresponding value is the parsed response body for an HTTP error. */ -extern NSString *const SWGResponseObjectErrorKey; +extern NSString *const {{classPrefix}}ResponseObjectErrorKey; -@interface SWGApiClient : AFHTTPRequestOperationManager +@interface {{classPrefix}}ApiClient : AFHTTPRequestOperationManager @property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy; @property(nonatomic, assign) NSTimeInterval timeoutInterval; -@property(nonatomic, assign) BOOL logRequests; -@property(nonatomic, assign) BOOL logCacheHits; -@property(nonatomic, assign) BOOL logServerResponses; -@property(nonatomic, assign) BOOL logJSON; -@property(nonatomic, assign) BOOL logHTTP; @property(nonatomic, readonly) NSOperationQueue* queue; /** @@ -30,9 +29,9 @@ extern NSString *const SWGResponseObjectErrorKey; * * @param baseUrl The base url of api client. * - * @return The SWGApiClient instance. + * @return The {{classPrefix}}ApiClient instance. */ -+(SWGApiClient *)sharedClientFromPool:(NSString *)baseUrl; ++({{classPrefix}}ApiClient *)sharedClientFromPool:(NSString *)baseUrl; /** * Get the operations queue @@ -41,13 +40,6 @@ extern NSString *const SWGResponseObjectErrorKey; */ +(NSOperationQueue*) sharedQueue; -/** - * Turn on logging - * - * @param state logging state, must be `YES` or `NO` - */ -+(void)setLoggingEnabled:(bool) state; - /** * Clear Cache */ @@ -121,7 +113,7 @@ extern NSString *const SWGResponseObjectErrorKey; /** * Set the client reachability strategy * - * @param host The host of SWGApiClient. + * @param host The host of {{classPrefix}}ApiClient. */ +(void) configureCacheReachibilityForHost:(NSString*)host; @@ -171,6 +163,17 @@ extern NSString *const SWGResponseObjectErrorKey; */ - (id) deserialize:(id) data class:(NSString *) class; +/** + * Logging request and response + * + * @param operation AFHTTPRequestOperation for the HTTP request. + * @param request The HTTP request. + * @param error The error of the HTTP request. + */ +- (void)logResponse:(AFHTTPRequestOperation *)operation + forRequest:(NSURLRequest *)request + error:(NSError *)error; + /** * Perform request * @@ -189,15 +192,14 @@ extern NSString *const SWGResponseObjectErrorKey; -(NSNumber*) requestWithCompletionBlock:(NSString*) path method:(NSString*) method queryParams:(NSDictionary*) queryParams + formParams:(NSDictionary *) formParams + files:(NSDictionary *) files body:(id) body headerParams:(NSDictionary*) headerParams authSettings: (NSArray *) authSettings requestContentType:(NSString*) requestContentType responseContentType:(NSString*) responseContentType + responseType:(NSString *) responseType completionBlock:(void (^)(id, NSError *))completionBlock; - @end - - - diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGConfiguration-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache similarity index 68% rename from modules/swagger-codegen/src/main/resources/objc/SWGConfiguration-body.mustache rename to modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache index 1e5e7135574..832c69f417e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGConfiguration-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Configuration-body.mustache @@ -1,18 +1,18 @@ -#import "SWGConfiguration.h" +#import "{{classPrefix}}Configuration.h" -@interface SWGConfiguration () +@interface {{classPrefix}}Configuration () @property (readwrite, nonatomic, strong) NSMutableDictionary *mutableApiKey; @property (readwrite, nonatomic, strong) NSMutableDictionary *mutableApiKeyPrefix; @end -@implementation SWGConfiguration +@implementation {{classPrefix}}Configuration #pragma mark - Singletion Methods + (instancetype) sharedConfig { - static SWGConfiguration *shardConfig = nil; + static {{classPrefix}}Configuration *shardConfig = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ shardConfig = [[self alloc] init]; @@ -27,6 +27,9 @@ if (self) { self.username = @""; self.password = @""; + self.tempFolderPath = nil; + self.debug = NO; + self.loggingFile = nil; self.mutableApiKey = [NSMutableDictionary dictionary]; self.mutableApiKeyPrefix = [NSMutableDictionary dictionary]; } @@ -65,6 +68,20 @@ [self.mutableApiKeyPrefix setValue:value forKey:field]; } +- (void) setLoggingFile:(NSString *)loggingFile { + // close old file handler + if ([self.loggingFileHanlder isKindOfClass:[NSFileHandle class]]) { + [self.loggingFileHanlder closeFile]; + } + + _loggingFile = loggingFile; + self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile]; + if (self.loggingFileHanlder == nil) { + [[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil]; + self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile]; + } +} + #pragma mark - Getter Methods - (NSDictionary *) apiKey { @@ -78,21 +95,14 @@ #pragma mark - - (NSDictionary *) authSettings { - return @{ {{#authMethods}}{{#isApiKey}} - @"{{name}}": @{ + return @{ + @"api_key": @{ @"type": @"api_key", - @"in": {{#isKeyInHeader}}@"header"{{/isKeyInHeader}}{{#isKeyInQuery}}@"query"{{/isKeyInQuery}}, - @"key": @"{{keyParamName}}", - @"value": [self getApiKeyWithPrefix:@"{{keyParamName}}"] - }, - {{/isApiKey}}{{#isBasic}} - @"{{name}}": @{ - @"type": @"basic", @"in": @"header", - @"key": @"Authorization", - @"value": [self getBasicAuthToken] + @"key": @"api_key", + @"value": [self getApiKeyWithPrefix:@"api_key"] }, - {{/isBasic}}{{/authMethods}} + }; } diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGConfiguration-header.mustache b/modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache similarity index 78% rename from modules/swagger-codegen/src/main/resources/objc/SWGConfiguration-header.mustache rename to modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache index 33023ca3c6f..4f9518ea9d1 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGConfiguration-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Configuration-header.mustache @@ -1,6 +1,6 @@ #import -@interface SWGConfiguration : NSObject +@interface {{classPrefix}}Configuration : NSObject /** @@ -23,6 +23,18 @@ @property (nonatomic) NSString *username; @property (nonatomic) NSString *password; +/** + * Temp folder for file download + */ +@property (nonatomic) NSString *tempFolderPath; + +/** + * Logging Settings + */ +@property (nonatomic) BOOL debug; +@property (nonatomic) NSString *loggingFile; +@property (nonatomic) NSFileHandle *loggingFileHanlder; + /** * Get configuration singleton instance */ diff --git a/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache new file mode 100644 index 00000000000..78b1409b6b9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache @@ -0,0 +1,35 @@ +#import "{{classPrefix}}JSONRequestSerializer.h" + +@implementation {{classPrefix}}JSONRequestSerializer + +/// +/// When customize a request serializer, +/// the serializer must conform the protocol `AFURLRequestSerialization` +/// and implements the protocol method `requestBySerializingRequest:withParameters:error:` +/// +/// @param request The original request. +/// @param parameters The parameters to be encoded. +/// @param error The error that occurred while attempting to encode the request parameters. +/// +/// @return A serialized request. +/// +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + // If the body data which will be serialized isn't NSArray or NSDictionary + // then put the data in the http request body directly. + if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } else { + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + if (parameters) { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + + return mutableRequest; + } +} + +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-header.mustache new file mode 100644 index 00000000000..a0732b93706 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-header.mustache @@ -0,0 +1,5 @@ +#import +#import + +@interface {{classPrefix}}JSONRequestSerializer : AFJSONRequestSerializer +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGJSONResponseSerializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/JSONResponseSerializer-body.mustache similarity index 92% rename from modules/swagger-codegen/src/main/resources/objc/SWGJSONResponseSerializer-body.mustache rename to modules/swagger-codegen/src/main/resources/objc/JSONResponseSerializer-body.mustache index a2dd21bcf5d..3a19dd1ca4e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGJSONResponseSerializer-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/JSONResponseSerializer-body.mustache @@ -1,4 +1,4 @@ -#import "SWGJSONResponseSerializer.h" +#import "{{classPrefix}}JSONResponseSerializer.h" static BOOL JSONParseError(NSError *error) { if ([error.domain isEqualToString:NSCocoaErrorDomain] && error.code == 3840) { @@ -8,7 +8,7 @@ static BOOL JSONParseError(NSError *error) { return NO; } -@implementation SWGJSONResponseSerializer +@implementation {{classPrefix}}JSONResponseSerializer /// /// When customize a response serializer, diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGJSONResponseSerializer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/JSONResponseSerializer-header.mustache similarity index 55% rename from modules/swagger-codegen/src/main/resources/objc/SWGJSONResponseSerializer-header.mustache rename to modules/swagger-codegen/src/main/resources/objc/JSONResponseSerializer-header.mustache index 16cda122217..7a5f152e271 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGJSONResponseSerializer-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/JSONResponseSerializer-header.mustache @@ -1,6 +1,6 @@ #import #import -@interface SWGJSONResponseSerializer : AFJSONResponseSerializer +@interface {{classPrefix}}JSONResponseSerializer : AFJSONResponseSerializer @end diff --git a/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache new file mode 100644 index 00000000000..122484f1ad4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/Object-body.mustache @@ -0,0 +1,4 @@ +#import "{{classPrefix}}Object.h" + +@implementation {{classPrefix}}Object +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/Object-header.mustache b/modules/swagger-codegen/src/main/resources/objc/Object-header.mustache new file mode 100644 index 00000000000..d96e379908f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/Object-header.mustache @@ -0,0 +1,5 @@ +#import +#import + +@interface {{classPrefix}}Object : JSONModel +@end diff --git a/modules/swagger-codegen/src/main/resources/objc/Podfile.mustache b/modules/swagger-codegen/src/main/resources/objc/Podfile.mustache deleted file mode 100644 index c61ab59dd8f..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/Podfile.mustache +++ /dev/null @@ -1,5 +0,0 @@ -platform :ios, '6.0' -xcodeproj '{{projectName}}/{{projectName}}.xcodeproj' -pod 'AFNetworking', '~> 2.1' -pod 'JSONModel', '~> 1.0' -pod 'ISO8601' diff --git a/samples/client/petstore/objc/client/SWGQueryParamCollection.m b/modules/swagger-codegen/src/main/resources/objc/QueryParamCollection-body.mustache similarity index 70% rename from samples/client/petstore/objc/client/SWGQueryParamCollection.m rename to modules/swagger-codegen/src/main/resources/objc/QueryParamCollection-body.mustache index 83303045185..23d0c8eaa86 100644 --- a/samples/client/petstore/objc/client/SWGQueryParamCollection.m +++ b/modules/swagger-codegen/src/main/resources/objc/QueryParamCollection-body.mustache @@ -1,6 +1,6 @@ -#import "SWGQueryParamCollection.h" +#import "{{classPrefix}}QueryParamCollection.h" -@implementation SWGQueryParamCollection +@implementation {{classPrefix}}QueryParamCollection @synthesize values = _values; @synthesize format = _format; diff --git a/samples/client/petstore/objc/client/SWGQueryParamCollection.h b/modules/swagger-codegen/src/main/resources/objc/QueryParamCollection-header.mustache similarity index 80% rename from samples/client/petstore/objc/client/SWGQueryParamCollection.h rename to modules/swagger-codegen/src/main/resources/objc/QueryParamCollection-header.mustache index 3b771881b0f..0389cce98be 100644 --- a/samples/client/petstore/objc/client/SWGQueryParamCollection.h +++ b/modules/swagger-codegen/src/main/resources/objc/QueryParamCollection-header.mustache @@ -1,6 +1,6 @@ #import -@interface SWGQueryParamCollection : NSObject +@interface {{classPrefix}}QueryParamCollection : NSObject @property(nonatomic, readonly) NSArray* values; @property(nonatomic, readonly) NSString* format; diff --git a/modules/swagger-codegen/src/main/resources/objc/README.mustache b/modules/swagger-codegen/src/main/resources/objc/README.mustache new file mode 100644 index 00000000000..db2b1e5b31e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/README.mustache @@ -0,0 +1,19 @@ +# {{podName}} + +## Requirements + +The API client library requires ARC (Automatic Reference Counting) to be enabled in your Xcode project. + +## Installation + +To install it, put the API client library in your project and then simply add the following line to your Podfile: + +```ruby +pod "{{podName}}", :path => "/path/to/lib" +``` + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGFile.h b/modules/swagger-codegen/src/main/resources/objc/SWGFile.h deleted file mode 100644 index fd87e13bace..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/SWGFile.h +++ /dev/null @@ -1,14 +0,0 @@ -#import - -@interface SWGFile : NSObject - -@property(nonatomic, readonly) NSString* name; -@property(nonatomic, readonly) NSString* mimeType; -@property(nonatomic, readonly) NSData* data; -@property(nonatomic) NSString* paramName; - -- (id) initWithNameData: (NSString*) filename - mimeType: (NSString*) mimeType - data: (NSData*) data; - -@end \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGFile.m b/modules/swagger-codegen/src/main/resources/objc/SWGFile.m deleted file mode 100644 index 42552767af4..00000000000 --- a/modules/swagger-codegen/src/main/resources/objc/SWGFile.m +++ /dev/null @@ -1,26 +0,0 @@ -#import "SWGFile.h" - -@implementation SWGFile - -@synthesize name = _name; -@synthesize mimeType = _mimeType; -@synthesize data = _data; - -- (id) init { - self = [super init]; - return self; -} - -- (id) initWithNameData: (NSString*) filename - mimeType: (NSString*) fileMimeType - data: (NSData*) data { - self = [super init]; - if(self) { - _name = filename; - _mimeType = fileMimeType; - _data = data; - } - return self; -} - -@end \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache index 29dca1f4a7a..fa9fa3e29a9 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache @@ -1,7 +1,6 @@ {{#operations}} #import "{{classname}}.h" -#import "SWGFile.h" -#import "SWGQueryParamCollection.h" +#import "{{classPrefix}}QueryParamCollection.h" {{#imports}}#import "{{import}}.h" {{/imports}} {{newline}} @@ -19,20 +18,20 @@ static NSString * basePath = @"{{basePath}}"; - (id) init { self = [super init]; if (self) { - self.apiClient = [SWGApiClient sharedClientFromPool:basePath]; + self.apiClient = [{{classPrefix}}ApiClient sharedClientFromPool:basePath]; self.defaultHeaders = [NSMutableDictionary dictionary]; } return self; } -- (id) initWithApiClient:(SWGApiClient *)apiClient { +- (id) initWithApiClient:({{classPrefix}}ApiClient *)apiClient { self = [super init]; if (self) { if (apiClient) { self.apiClient = apiClient; } else { - self.apiClient = [SWGApiClient sharedClientFromPool:basePath]; + self.apiClient = [{{classPrefix}}ApiClient sharedClientFromPool:basePath]; } self.defaultHeaders = [NSMutableDictionary dictionary]; } @@ -69,7 +68,7 @@ static NSString * basePath = @"{{basePath}}"; } -(unsigned long) requestQueueSize { - return [SWGApiClient requestQueueSize]; + return [{{classPrefix}}ApiClient requestQueueSize]; } #pragma mark - Api Methods @@ -84,12 +83,14 @@ static NSString * basePath = @"{{basePath}}"; /// -(NSNumber*) {{nickname}}WithCompletionBlock{{^allParams}}: {{/allParams}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}} {{/allParams}} - {{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock{{/returnBaseType}} - {{^returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)(NSError* error))completionBlock{{/returnBaseType}} { + {{#returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{{returnType}}} output, NSError* error))completionBlock { {{/returnBaseType}} + {{^returnBaseType}}{{#hasParams}}completionHandler: {{/hasParams}}(void (^)(NSError* error))completionBlock { {{/returnBaseType}} {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set - NSAssert({{paramName}} != nil, @"Missing the required parameter `{{paramName}}` when calling {{nickname}}"); + if ({{paramName}} == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `{{paramName}}` when calling `{{nickname}}`"]; + } {{/required}}{{/allParams}} NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@{{path}}", basePath]; @@ -98,13 +99,13 @@ static NSString * basePath = @"{{basePath}}"; if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound) [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"]; - {{#pathParams}}[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"{{baseName}}", @"}"]] withString: [SWGApiClient escape:{{paramName}}]]; + {{#pathParams}}[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"{{baseName}}", @"}"]] withString: [{{classPrefix}}ApiClient escape:{{paramName}}]]; {{/pathParams}} NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; {{#queryParams}}if({{paramName}} != nil) { {{#collectionFormat}} - queryParams[@"{{baseName}}"] = [[SWGQueryParamCollection alloc] initWithValuesAndFormat: {{baseName}} format: @"{{collectionFormat}}"]; + queryParams[@"{{baseName}}"] = [[{{classPrefix}}QueryParamCollection alloc] initWithValuesAndFormat: {{baseName}} format: @"{{collectionFormat}}"]; {{/collectionFormat}} {{^collectionFormat}}queryParams[@"{{baseName}}"] = {{paramName}};{{/collectionFormat}} } @@ -114,9 +115,9 @@ static NSString * basePath = @"{{basePath}}"; {{#headerParams}}if({{paramName}} != nil) headerParams[@"{{baseName}}"] = {{paramName}}; {{/headerParams}} - - // HTTP header `Accept` - headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[{{#produces}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}]]; + + // HTTP header `Accept` + headerParams[@"Accept"] = [{{classPrefix}}ApiClient selectHeaderAccept:@[{{#produces}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; } @@ -131,62 +132,39 @@ static NSString * basePath = @"{{basePath}}"; } // request content type - NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[{{#consumes}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}]]; + NSString *requestContentType = [{{classPrefix}}ApiClient selectHeaderContentType:@[{{#consumes}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}]]; // Authentication setting NSArray *authSettings = @[{{#authMethods}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}]; - - id bodyDictionary = nil; - {{#bodyParam}} - id __body = {{paramName}}; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + {{#bodyParam}} + bodyParam = {{paramName}}; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { - [objs addObject:[(SWGObject*)dict toDictionary]]; + [objs addObject:[({{classPrefix}}Object*)dict toDictionary]]; } else{ [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [({{classPrefix}}Object*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - {{/bodyParam}} - {{^bodyParam}} - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; - + {{/bodyParam}}{{^bodyParam}} {{#formParams}} {{#notFile}} formParams[@"{{paramName}}"] = {{paramName}}; {{/notFile}}{{#isFile}} - requestContentType = @"multipart/form-data"; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - if({{paramName}} != nil) { - [bodyDictionary addObject:{{paramName}}]; - {{paramName}}.paramName = @"{{baseName}}"; - } + files[@"{{paramName}}"] = {{paramName}}; {{/isFile}} - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - [bodyDictionary addObject:formParams]; {{/formParams}} {{/bodyParam}} @@ -200,14 +178,17 @@ static NSString * basePath = @"{{basePath}}"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"{{httpMethod}}" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: {{^returnType}}nil{{/returnType}}{{#returnType}}@"{{{ returnType }}}"{{/returnType}} completionBlock: ^(id data, NSError *error) { {{^returnType}}completionBlock(error);{{/returnType}} - {{#returnType}}completionBlock([self.apiClient deserialize: data class:@"{{{returnType}}}"], error);{{/returnType}} + {{#returnType}}completionBlock(({{{ returnType }}})data, error);{{/returnType}} } ]; } @@ -217,6 +198,3 @@ static NSString * basePath = @"{{basePath}}"; {{newline}} {{/operations}} @end - - - diff --git a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache index 7f14262d116..263c213dd6f 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache @@ -1,16 +1,16 @@ #import {{#imports}}#import "{{import}}.h" {{/imports}} -#import "SWGObject.h" -#import "SWGApiClient.h" +#import "{{classPrefix}}Object.h" +#import "{{classPrefix}}ApiClient.h" {{newline}} {{#operations}} @interface {{classname}}: NSObject -@property(nonatomic, assign)SWGApiClient *apiClient; +@property(nonatomic, assign){{classPrefix}}ApiClient *apiClient; --(instancetype) initWithApiClient:(SWGApiClient *)apiClient; +-(instancetype) initWithApiClient:({{classPrefix}}ApiClient *)apiClient; -(void) addHeader:(NSString*)value forKey:(NSString*)key; -(unsigned long) requestQueueSize; +({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key; diff --git a/modules/swagger-codegen/src/main/resources/objc/model-header.mustache b/modules/swagger-codegen/src/main/resources/objc/model-header.mustache index 81ac19a0b73..4afaec31a24 100644 --- a/modules/swagger-codegen/src/main/resources/objc/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/model-header.mustache @@ -1,5 +1,5 @@ #import -#import "SWGObject.h" +#import "{{classPrefix}}Object.h" {{#imports}}#import "{{import}}.h" {{/imports}} {{newline}} @@ -9,7 +9,7 @@ @protocol {{classname}} @end -@interface {{classname}} : SWGObject +@interface {{classname}} : {{classPrefix}}Object {{#vars}} {{#description}}/* {{{description}}} {{^required}}[optional]{{/required}} diff --git a/modules/swagger-codegen/src/main/resources/objc/podspec.mustache b/modules/swagger-codegen/src/main/resources/objc/podspec.mustache new file mode 100644 index 00000000000..9ce03695bcf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/objc/podspec.mustache @@ -0,0 +1,31 @@ +# +# Be sure to run `pod lib lint {{podName}}.podspec' to ensure this is a +# valid spec and remove all comments before submitting the spec. +# +# Any lines starting with a # are optional, but encouraged +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = "{{podName}}" + s.version = "{{podVersion}}" +{{#apiInfo}}{{#apis}}{{^hasMore}} + s.summary = "{{appName}}" + s.description = <<-DESC + {{appDescription}} + DESC +{{/hasMore}}{{/apis}}{{/apiInfo}} + s.platform = :ios, '7.0' + s.requires_arc = true + + s.framework = 'SystemConfiguration' + + s.source_files = '{{podName}}/**/*' + s.public_header_files = '{{podName}}/**/*.h' + + s.dependency 'AFNetworking', '~> 2.3' + s.dependency 'JSONModel', '~> 1.1' + s.dependency 'ISO8601', '~> 0.3' +end + diff --git a/samples/client/petstore/objc/Podfile b/samples/client/petstore/objc/Podfile deleted file mode 100644 index ad41463f60c..00000000000 --- a/samples/client/petstore/objc/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -platform :ios, '6.0' -xcodeproj 'SwaggerClient/SwaggerClient.xcodeproj' -pod 'AFNetworking', '~> 2.1' -pod 'JSONModel', '~> 1.0' -pod 'ISO8601' diff --git a/samples/client/petstore/objc/Podfile.lock b/samples/client/petstore/objc/Podfile.lock deleted file mode 100644 index 48b1f809658..00000000000 --- a/samples/client/petstore/objc/Podfile.lock +++ /dev/null @@ -1,36 +0,0 @@ -PODS: - - AFNetworking (2.5.4): - - AFNetworking/NSURLConnection (= 2.5.4) - - AFNetworking/NSURLSession (= 2.5.4) - - AFNetworking/Reachability (= 2.5.4) - - AFNetworking/Security (= 2.5.4) - - AFNetworking/Serialization (= 2.5.4) - - AFNetworking/UIKit (= 2.5.4) - - AFNetworking/NSURLConnection (2.5.4): - - AFNetworking/Reachability - - AFNetworking/Security - - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.5.4): - - AFNetworking/Reachability - - AFNetworking/Security - - AFNetworking/Serialization - - AFNetworking/Reachability (2.5.4) - - AFNetworking/Security (2.5.4) - - AFNetworking/Serialization (2.5.4) - - AFNetworking/UIKit (2.5.4): - - AFNetworking/NSURLConnection - - AFNetworking/NSURLSession - - ISO8601 (0.3.0) - - JSONModel (1.1.0) - -DEPENDENCIES: - - AFNetworking (~> 2.1) - - ISO8601 - - JSONModel (~> 1.0) - -SPEC CHECKSUMS: - AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e - ISO8601: 8d8a22d5edf0554a1cf75bac028c76c1dc0ffaef - JSONModel: ec77e9865236a7a09d9cf7668df6b4b328d9ec1d - -COCOAPODS: 0.37.1 diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md new file mode 100644 index 00000000000..4cce2c882bb --- /dev/null +++ b/samples/client/petstore/objc/README.md @@ -0,0 +1,19 @@ +# SwaggerClient + +## Requirements + +The API client library requires ARC (Automatic Reference Counting) to be enabled in your Xcode project. + +## Installation + +To install it, put the API client library in your project and then simply add the following line to your Podfile: + +```ruby +pod "SwaggerClient", :path => "/path/to/lib" +``` + +## Author + +apiteam@swagger.io + + diff --git a/samples/client/petstore/objc/SwaggerClient.podspec b/samples/client/petstore/objc/SwaggerClient.podspec new file mode 100644 index 00000000000..d9b02841cf9 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient.podspec @@ -0,0 +1,31 @@ +# +# Be sure to run `pod lib lint SwaggerClient.podspec' to ensure this is a +# valid spec and remove all comments before submitting the spec. +# +# Any lines starting with a # are optional, but encouraged +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = "SwaggerClient" + s.version = "1.0.0" + + s.summary = "Swagger Petstore" + s.description = <<-DESC + This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + DESC + + s.platform = :ios, '7.0' + s.requires_arc = true + + s.framework = 'SystemConfiguration' + + s.source_files = 'SwaggerClient/**/*' + s.public_header_files = 'SwaggerClient/**/*.h' + + s.dependency 'AFNetworking', '~> 2.3' + s.dependency 'JSONModel', '~> 1.1' + s.dependency 'ISO8601', '~> 0.3' +end + diff --git a/samples/client/petstore/objc/SwaggerClient.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/objc/SwaggerClient.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 4fa5c7f565b..00000000000 --- a/samples/client/petstore/objc/SwaggerClient.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate b/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index d8a48b72bc2..00000000000 Binary files a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index e2573a5943c..00000000000 --- a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcuserdata/geekerzp.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/samples/client/petstore/objc/client/JSONValueTransformer+ISO8601.h b/samples/client/petstore/objc/SwaggerClient/JSONValueTransformer+ISO8601.h similarity index 100% rename from samples/client/petstore/objc/client/JSONValueTransformer+ISO8601.h rename to samples/client/petstore/objc/SwaggerClient/JSONValueTransformer+ISO8601.h diff --git a/samples/client/petstore/objc/client/JSONValueTransformer+ISO8601.m b/samples/client/petstore/objc/SwaggerClient/JSONValueTransformer+ISO8601.m similarity index 100% rename from samples/client/petstore/objc/client/JSONValueTransformer+ISO8601.m rename to samples/client/petstore/objc/SwaggerClient/JSONValueTransformer+ISO8601.m diff --git a/samples/client/petstore/objc/client/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h similarity index 86% rename from samples/client/petstore/objc/client/SWGApiClient.h rename to samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index 6ede775cb02..56c6adf30f2 100644 --- a/samples/client/petstore/objc/client/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -1,7 +1,11 @@ #import #import -#import "AFHTTPRequestOperationManager.h" -#import "SWGJSONResponseSerializer.h" +#import +#import "SWGJSONResponseSerializer.h" +#import "SWGJSONRequestSerializer.h" +#import "SWGQueryParamCollection.h" +#import "SWGConfiguration.h" + #import "SWGUser.h" #import "SWGCategory.h" @@ -22,11 +26,6 @@ extern NSString *const SWGResponseObjectErrorKey; @property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy; @property(nonatomic, assign) NSTimeInterval timeoutInterval; -@property(nonatomic, assign) BOOL logRequests; -@property(nonatomic, assign) BOOL logCacheHits; -@property(nonatomic, assign) BOOL logServerResponses; -@property(nonatomic, assign) BOOL logJSON; -@property(nonatomic, assign) BOOL logHTTP; @property(nonatomic, readonly) NSOperationQueue* queue; /** @@ -45,13 +44,6 @@ extern NSString *const SWGResponseObjectErrorKey; */ +(NSOperationQueue*) sharedQueue; -/** - * Turn on logging - * - * @param state logging state, must be `YES` or `NO` - */ -+(void)setLoggingEnabled:(bool) state; - /** * Clear Cache */ @@ -175,6 +167,17 @@ extern NSString *const SWGResponseObjectErrorKey; */ - (id) deserialize:(id) data class:(NSString *) class; +/** + * Logging request and response + * + * @param operation AFHTTPRequestOperation for the HTTP request. + * @param request The HTTP request. + * @param error The error of the HTTP request. + */ +- (void)logResponse:(AFHTTPRequestOperation *)operation + forRequest:(NSURLRequest *)request + error:(NSError *)error; + /** * Perform request * @@ -193,15 +196,14 @@ extern NSString *const SWGResponseObjectErrorKey; -(NSNumber*) requestWithCompletionBlock:(NSString*) path method:(NSString*) method queryParams:(NSDictionary*) queryParams + formParams:(NSDictionary *) formParams + files:(NSDictionary *) files body:(id) body headerParams:(NSDictionary*) headerParams authSettings: (NSArray *) authSettings requestContentType:(NSString*) requestContentType responseContentType:(NSString*) responseContentType + responseType:(NSString *) responseType completionBlock:(void (^)(id, NSError *))completionBlock; - @end - - - diff --git a/samples/client/petstore/objc/client/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m similarity index 61% rename from samples/client/petstore/objc/client/SWGApiClient.m rename to samples/client/petstore/objc/SwaggerClient/SWGApiClient.m index 1b479d039e6..f51a012a811 100644 --- a/samples/client/petstore/objc/client/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.m @@ -1,7 +1,4 @@ #import "SWGApiClient.h" -#import "SWGFile.h" -#import "SWGQueryParamCollection.h" -#import "SWGConfiguration.h" @implementation SWGApiClient @@ -14,31 +11,38 @@ static bool cacheEnabled = false; static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable; static NSOperationQueue* sharedQueue; static void (^reachabilityChangeBlock)(int); -static bool loggingEnabled = true; #pragma mark - Log Methods -+(void)setLoggingEnabled:(bool) state { - loggingEnabled = state; +- (void)logResponse:(AFHTTPRequestOperation *)operation + forRequest:(NSURLRequest *)request + error:(NSError*)error { + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + + NSString *message = [NSString stringWithFormat:@"\n[DEBUG] Request body \n~BEGIN~\n %@\n~END~\n"\ + "[DEBUG] HTTP Response body \n~BEGIN~\n %@\n~END~\n", + [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding], + operation.responseString]; + + if (config.loggingFileHanlder) { + [config.loggingFileHanlder seekToEndOfFile]; + [config.loggingFileHanlder writeData:[message dataUsingEncoding:NSUTF8StringEncoding]]; + } + + NSLog(@"%@", message); } -- (void)logRequest:(NSURLRequest*)request { - NSLog(@"request: %@", [self descriptionForRequest:request]); -} +#pragma mark - Cache Methods -- (void)logResponse:(id)data forRequest:(NSURLRequest*)request error:(NSError*)error { - NSLog(@"request: %@ response: %@ ", [self descriptionForRequest:request], data ); ++ (void) setCacheEnabled:(BOOL)enabled { + cacheEnabled = enabled; } -#pragma mark - - +(void)clearCache { [[NSURLCache sharedURLCache] removeAllCachedResponses]; } -+(void)setCacheEnabled:(BOOL)enabled { - cacheEnabled = enabled; -} +#pragma mark - +(void)configureCacheWithMemoryAndDiskCapacity: (unsigned long) memorySize diskSize: (unsigned long) diskSize { @@ -83,10 +87,10 @@ static bool loggingEnabled = true; if (client == nil) { client = [[SWGApiClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]]; [_pool setValue:client forKey:baseUrl ]; - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"new client for path %@", baseUrl); } - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"returning client for path %@", baseUrl); return client; } @@ -149,7 +153,7 @@ static bool loggingEnabled = true; +(NSNumber*) nextRequestId { @synchronized(self) { long nextId = ++requestId; - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"got id %ld", nextId); return [NSNumber numberWithLong:nextId]; } @@ -157,7 +161,7 @@ static bool loggingEnabled = true; +(NSNumber*) queueRequest { NSNumber* requestId = [SWGApiClient nextRequestId]; - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"added %@ to request queue", requestId); [queuedRequests addObject:requestId]; return requestId; @@ -190,7 +194,7 @@ static bool loggingEnabled = true; }]; if(matchingItems.count == 1) { - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"removing request id %@", requestId); [queuedRequests removeObject:requestId]; return true; @@ -225,25 +229,25 @@ static bool loggingEnabled = true; reachabilityStatus = status; switch (status) { case AFNetworkReachabilityStatusUnknown: - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusUnknown"); [SWGApiClient setOfflineState:true]; break; case AFNetworkReachabilityStatusNotReachable: - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusNotReachable"); [SWGApiClient setOfflineState:true]; break; case AFNetworkReachabilityStatusReachableViaWWAN: - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWWAN"); [SWGApiClient setOfflineState:false]; break; case AFNetworkReachabilityStatusReachableViaWiFi: - if(loggingEnabled) + if([[SWGConfiguration sharedConfig] debug]) NSLog(@"reachability changed to AFNetworkReachabilityStatusReachableViaWiFi"); [SWGApiClient setOfflineState:false]; break; @@ -268,7 +272,6 @@ static bool loggingEnabled = true; for(NSString * key in [queryParams keyEnumerator]){ if(counter == 0) separator = @"?"; else separator = @"&"; - NSString * value; id queryParam = [queryParams valueForKey:key]; if([queryParam isKindOfClass:[NSString class]]){ [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, @@ -314,11 +317,6 @@ static bool loggingEnabled = true; return requestUrl; } -- (NSString*)descriptionForRequest:(NSURLRequest*)request { - return [[request URL] absoluteString]; -} - - /** * Update header and query params based on authentication settings */ @@ -359,8 +357,8 @@ static bool loggingEnabled = true; NSMutableArray *resultArray = nil; NSMutableDictionary *resultDict = nil; - // return nil if data is nil - if (!data) { + // return nil if data is nil or class is nil + if (!data || !class) { return nil; } @@ -473,20 +471,112 @@ static bool loggingEnabled = true; return nil; } +#pragma mark - Operation Methods + +- (void) operationWithCompletionBlock: (NSURLRequest *)request + requestId: (NSNumber *) requestId + completionBlock: (void (^)(id, NSError *))completionBlock { + AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request + success:^(AFHTTPRequestOperation *operation, id response) { + if([self executeRequestWithId:requestId]) { + if([[SWGConfiguration sharedConfig] debug]) { + [self logResponse:operation forRequest:request error:nil]; + } + completionBlock(response, nil); + } + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + if([self executeRequestWithId:requestId]) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if(operation.responseObject) { + // Add in the (parsed) response body. + userInfo[SWGResponseObjectErrorKey] = operation.responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + + if([[SWGConfiguration sharedConfig] debug]) + [self logResponse:nil forRequest:request error:augmentedError]; + completionBlock(nil, augmentedError); + } + }]; + + [self.operationQueue addOperation:op]; +} + +- (void) downloadOperationWithCompletionBlock: (NSURLRequest *)request + requestId: (NSNumber *) requestId + completionBlock: (void (^)(id, NSError *))completionBlock { + AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request + success:^(AFHTTPRequestOperation *operation, id responseObject) { + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + NSString *directory = nil; + if (config.tempFolderPath) { + directory = config.tempFolderPath; + } + else { + directory = NSTemporaryDirectory(); + } + + NSDictionary *headers = operation.response.allHeaderFields; + NSString *filename = nil; + if ([headers objectForKey:@"Content-Disposition"]) { + + NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; + NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern + options:NSRegularExpressionCaseInsensitive + error:nil]; + NSString *contentDispositionHeader = [headers objectForKey:@"Content-Disposition"]; + NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader + options:0 + range:NSMakeRange(0, [contentDispositionHeader length])]; + filename = [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; + } + else { + filename = [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; + } + + NSString *filepath = [directory stringByAppendingPathComponent:filename]; + NSURL *file = [NSURL fileURLWithPath:filepath]; + + [operation.responseData writeToURL:file atomically:YES]; + completionBlock(file, nil); + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + + if ([self executeRequestWithId:requestId]) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (operation.responseObject) { + userInfo[SWGResponseObjectErrorKey] = operation.responseObject; + } + + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + + if ([[SWGConfiguration sharedConfig] debug]) { + [self logResponse:nil forRequest:request error:augmentedError]; + } + + completionBlock(nil, augmentedError); + } + }]; + + [self.operationQueue addOperation:op]; +} + #pragma mark - Perform Request Methods -(NSNumber*) requestWithCompletionBlock: (NSString*) path method: (NSString*) method queryParams: (NSDictionary*) queryParams + formParams: (NSDictionary *) formParams + files: (NSDictionary *) files body: (id) body headerParams: (NSDictionary*) headerParams authSettings: (NSArray *) authSettings requestContentType: (NSString*) requestContentType responseContentType: (NSString*) responseContentType + responseType: (NSString *) responseType completionBlock: (void (^)(id, NSError *))completionBlock { // setting request serializer if ([requestContentType isEqualToString:@"application/json"]) { - self.requestSerializer = [AFJSONRequestSerializer serializer]; + self.requestSerializer = [SWGJSONRequestSerializer serializer]; } else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) { self.requestSerializer = [AFHTTPRequestSerializer serializer]; @@ -510,68 +600,42 @@ static bool loggingEnabled = true; [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; NSMutableURLRequest * request = nil; - if (body != nil && [body isKindOfClass:[NSArray class]]){ - SWGFile * file; - NSMutableDictionary * params = [[NSMutableDictionary alloc] init]; - for(id obj in body) { - if([obj isKindOfClass:[SWGFile class]]) { - file = (SWGFile*) obj; - requestContentType = @"multipart/form-data"; - } - else if([obj isKindOfClass:[NSDictionary class]]) { - for(NSString * key in obj) { - params[key] = obj[key]; - } - } - } - NSString * urlString = [[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString]; - - // request with multipart form - if([requestContentType isEqualToString:@"multipart/form-data"]) { - request = [self.requestSerializer multipartFormRequestWithMethod: @"POST" - URLString: urlString - parameters: nil - constructingBodyWithBlock: ^(id formData) { - - for(NSString * key in params) { - NSData* data = [params[key] dataUsingEncoding:NSUTF8StringEncoding]; - [formData appendPartWithFormData: data name: key]; - } - - if (file) { - [formData appendPartWithFileData: [file data] - name: [file paramName] - fileName: [file name] - mimeType: [file mimeType]]; - } - - } - error:nil]; - } - // request with form parameters or json - else { - NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams]; - NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; - - request = [self.requestSerializer requestWithMethod:method - URLString:urlString - parameters:params - error:nil]; - } - + NSString* pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams]; + NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; + if (files.count > 0) { + request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" + URLString:urlString + parameters:nil + constructingBodyWithBlock:^(id formData) { + [formParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSData *data = [obj dataUsingEncoding:NSUTF8StringEncoding]; + [formData appendPartWithFormData:data name:key]; + }]; + [files enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSURL *filePath = (NSURL *)obj; + [formData appendPartWithFileURL:filePath name:key error:nil]; + }]; + } error:nil]; } else { - NSString * pathWithQueryParams = [self pathWithQueryParamsToString:path queryParams:queryParams]; - NSString * urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; - - request = [self.requestSerializer requestWithMethod: method - URLString: urlString - parameters: body - error: nil]; + if (formParams) { + request = [self.requestSerializer requestWithMethod:method + URLString:urlString + parameters:formParams + error:nil]; + } + if (body) { + request = [self.requestSerializer requestWithMethod:method + URLString:urlString + parameters:body + error:nil]; + } } + BOOL hasHeaderParams = false; - if(headerParams != nil && [headerParams count] > 0) + if(headerParams != nil && [headerParams count] > 0) { hasHeaderParams = true; + } if(offlineState) { NSLog(@"%@ cache forced", path); [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; @@ -585,17 +649,7 @@ static bool loggingEnabled = true; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; } - - if(body != nil) { - if([body isKindOfClass:[NSDictionary class]] || [body isKindOfClass:[NSArray class]]){ - [self.requestSerializer setValue:requestContentType forHTTPHeaderField:@"Content-Type"]; - } - else if ([body isKindOfClass:[SWGFile class]]){} - else { - NSAssert(false, @"unsupported post type!"); - } - } - if(headerParams != nil){ + if(hasHeaderParams){ for(NSString * key in [headerParams keyEnumerator]){ [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; } @@ -607,30 +661,16 @@ static bool loggingEnabled = true; [request setHTTPShouldHandleCookies:NO]; NSNumber* requestId = [SWGApiClient queueRequest]; - AFHTTPRequestOperation *op = [self HTTPRequestOperationWithRequest:request - success:^(AFHTTPRequestOperation *operation, id response) { - if([self executeRequestWithId:requestId]) { - if(self.logServerResponses) { - [self logResponse:response forRequest:request error:nil]; - } - completionBlock(response, nil); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if([self executeRequestWithId:requestId]) { - NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; - if(operation.responseObject) { - // Add in the (parsed) response body. - userInfo[SWGResponseObjectErrorKey] = operation.responseObject; - } - NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; - - if(self.logServerResponses) - [self logResponse:nil forRequest:request error:augmentedError]; - completionBlock(nil, augmentedError); - } - }]; - - [self.operationQueue addOperation:op]; + if ([responseType isEqualToString:@"NSURL*"]) { + [self downloadOperationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { + completionBlock(data, error); + }]; + } + else { + [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { + completionBlock([self deserialize:data class:responseType], error); + }]; + } return requestId; } @@ -639,8 +679,3 @@ static bool loggingEnabled = true; - - - - - diff --git a/samples/client/petstore/objc/client/SWGCategory.h b/samples/client/petstore/objc/SwaggerClient/SWGCategory.h similarity index 100% rename from samples/client/petstore/objc/client/SWGCategory.h rename to samples/client/petstore/objc/SwaggerClient/SWGCategory.h diff --git a/samples/client/petstore/objc/client/SWGCategory.m b/samples/client/petstore/objc/SwaggerClient/SWGCategory.m similarity index 100% rename from samples/client/petstore/objc/client/SWGCategory.m rename to samples/client/petstore/objc/SwaggerClient/SWGCategory.m diff --git a/samples/client/petstore/objc/client/SWGConfiguration.h b/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.h similarity index 82% rename from samples/client/petstore/objc/client/SWGConfiguration.h rename to samples/client/petstore/objc/SwaggerClient/SWGConfiguration.h index 33023ca3c6f..d3619c72ab5 100644 --- a/samples/client/petstore/objc/client/SWGConfiguration.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.h @@ -23,6 +23,18 @@ @property (nonatomic) NSString *username; @property (nonatomic) NSString *password; +/** + * Temp folder for file download + */ +@property (nonatomic) NSString *tempFolderPath; + +/** + * Logging Settings + */ +@property (nonatomic) BOOL debug; +@property (nonatomic) NSString *loggingFile; +@property (nonatomic) NSFileHandle *loggingFileHanlder; + /** * Get configuration singleton instance */ diff --git a/samples/client/petstore/objc/client/SWGConfiguration.m b/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m similarity index 79% rename from samples/client/petstore/objc/client/SWGConfiguration.m rename to samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m index 89d5a597946..81e308a53fc 100644 --- a/samples/client/petstore/objc/client/SWGConfiguration.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGConfiguration.m @@ -27,6 +27,9 @@ if (self) { self.username = @""; self.password = @""; + self.tempFolderPath = nil; + self.debug = NO; + self.loggingFile = nil; self.mutableApiKey = [NSMutableDictionary dictionary]; self.mutableApiKeyPrefix = [NSMutableDictionary dictionary]; } @@ -65,6 +68,20 @@ [self.mutableApiKeyPrefix setValue:value forKey:field]; } +- (void) setLoggingFile:(NSString *)loggingFile { + // close old file handler + if ([self.loggingFileHanlder isKindOfClass:[NSFileHandle class]]) { + [self.loggingFileHanlder closeFile]; + } + + _loggingFile = loggingFile; + self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile]; + if (self.loggingFileHanlder == nil) { + [[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil]; + self.loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile]; + } +} + #pragma mark - Getter Methods - (NSDictionary *) apiKey { diff --git a/samples/client/petstore/objc/SwaggerClient/SWGJSONRequestSerializer.h b/samples/client/petstore/objc/SwaggerClient/SWGJSONRequestSerializer.h new file mode 100644 index 00000000000..49dd7fca3e2 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient/SWGJSONRequestSerializer.h @@ -0,0 +1,5 @@ +#import +#import + +@interface SWGJSONRequestSerializer : AFJSONRequestSerializer +@end diff --git a/samples/client/petstore/objc/SwaggerClient/SWGJSONRequestSerializer.m b/samples/client/petstore/objc/SwaggerClient/SWGJSONRequestSerializer.m new file mode 100644 index 00000000000..631a20a5a6e --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClient/SWGJSONRequestSerializer.m @@ -0,0 +1,35 @@ +#import "SWGJSONRequestSerializer.h" + +@implementation SWGJSONRequestSerializer + +/// +/// When customize a request serializer, +/// the serializer must conform the protocol `AFURLRequestSerialization` +/// and implements the protocol method `requestBySerializingRequest:withParameters:error:` +/// +/// @param request The original request. +/// @param parameters The parameters to be encoded. +/// @param error The error that occurred while attempting to encode the request parameters. +/// +/// @return A serialized request. +/// +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + // If the body data which will be serialized isn't NSArray or NSDictionary + // then put the data in the http request body directly. + if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } else { + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + if (parameters) { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + + return mutableRequest; + } +} + +@end diff --git a/samples/client/petstore/objc/client/SWGJSONResponseSerializer.h b/samples/client/petstore/objc/SwaggerClient/SWGJSONResponseSerializer.h similarity index 100% rename from samples/client/petstore/objc/client/SWGJSONResponseSerializer.h rename to samples/client/petstore/objc/SwaggerClient/SWGJSONResponseSerializer.h diff --git a/samples/client/petstore/objc/client/SWGJSONResponseSerializer.m b/samples/client/petstore/objc/SwaggerClient/SWGJSONResponseSerializer.m similarity index 100% rename from samples/client/petstore/objc/client/SWGJSONResponseSerializer.m rename to samples/client/petstore/objc/SwaggerClient/SWGJSONResponseSerializer.m diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGObject.h b/samples/client/petstore/objc/SwaggerClient/SWGObject.h similarity index 69% rename from modules/swagger-codegen/src/main/resources/objc/SWGObject.h rename to samples/client/petstore/objc/SwaggerClient/SWGObject.h index ccec208abc0..fb27b4a4ebb 100644 --- a/modules/swagger-codegen/src/main/resources/objc/SWGObject.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGObject.h @@ -1,5 +1,5 @@ #import -#import "JSONModel.h" +#import @interface SWGObject : JSONModel @end diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGObject.m b/samples/client/petstore/objc/SwaggerClient/SWGObject.m similarity index 100% rename from modules/swagger-codegen/src/main/resources/objc/SWGObject.m rename to samples/client/petstore/objc/SwaggerClient/SWGObject.m diff --git a/samples/client/petstore/objc/client/SWGOrder.h b/samples/client/petstore/objc/SwaggerClient/SWGOrder.h similarity index 89% rename from samples/client/petstore/objc/client/SWGOrder.h rename to samples/client/petstore/objc/SwaggerClient/SWGOrder.h index c4f4f6e81ad..2e71906cd53 100644 --- a/samples/client/petstore/objc/client/SWGOrder.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGOrder.h @@ -19,6 +19,6 @@ */ @property(nonatomic) NSString* status; -@property(nonatomic) BOOL complete; +@property(nonatomic) NSNumber* complete; @end diff --git a/samples/client/petstore/objc/client/SWGOrder.m b/samples/client/petstore/objc/SwaggerClient/SWGOrder.m similarity index 100% rename from samples/client/petstore/objc/client/SWGOrder.m rename to samples/client/petstore/objc/SwaggerClient/SWGOrder.m diff --git a/samples/client/petstore/objc/client/SWGPet.h b/samples/client/petstore/objc/SwaggerClient/SWGPet.h similarity index 100% rename from samples/client/petstore/objc/client/SWGPet.h rename to samples/client/petstore/objc/SwaggerClient/SWGPet.h diff --git a/samples/client/petstore/objc/client/SWGPet.m b/samples/client/petstore/objc/SwaggerClient/SWGPet.m similarity index 100% rename from samples/client/petstore/objc/client/SWGPet.m rename to samples/client/petstore/objc/SwaggerClient/SWGPet.m diff --git a/samples/client/petstore/objc/client/SWGPetApi.h b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.h similarity index 95% rename from samples/client/petstore/objc/client/SWGPetApi.h rename to samples/client/petstore/objc/SwaggerClient/SWGPetApi.h index 257a7d1453e..39f23edb028 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.h @@ -1,6 +1,5 @@ #import #import "SWGPet.h" -#import "SWGFile.h" #import "SWGObject.h" #import "SWGApiClient.h" @@ -114,13 +113,13 @@ /// Deletes a pet /// /// -/// @param apiKey /// @param petId Pet id to delete +/// @param apiKey /// /// /// @return --(NSNumber*) deletePetWithCompletionBlock :(NSString*) apiKey - petId:(NSNumber*) petId +-(NSNumber*) deletePetWithCompletionBlock :(NSNumber*) petId + apiKey:(NSString*) apiKey completionHandler: (void (^)(NSError* error))completionBlock; @@ -139,7 +138,7 @@ /// @return -(NSNumber*) uploadFileWithCompletionBlock :(NSNumber*) petId additionalMetadata:(NSString*) additionalMetadata - file:(SWGFile*) file + file:(NSURL*) file completionHandler: (void (^)(NSError* error))completionBlock; diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m similarity index 79% rename from samples/client/petstore/objc/client/SWGPetApi.m rename to samples/client/petstore/objc/SwaggerClient/SWGPetApi.m index e4306f1b235..15f4af0564e 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m @@ -1,8 +1,6 @@ #import "SWGPetApi.h" -#import "SWGFile.h" #import "SWGQueryParamCollection.h" #import "SWGPet.h" -#import "SWGFile.h" @interface SWGPetApi () @@ -83,7 +81,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) updatePetWithCompletionBlock: (SWGPet*) body - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { @@ -100,8 +98,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -121,14 +119,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -136,33 +136,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"PUT" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -180,7 +172,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) addPetWithCompletionBlock: (SWGPet*) body - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { @@ -197,8 +189,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -218,14 +210,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -233,33 +227,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -276,8 +262,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) findPetsByStatusWithCompletionBlock: (NSArray*) status - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock - { + completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock { + @@ -300,8 +286,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -321,13 +307,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -335,14 +319,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"NSArray*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"NSArray*"], error); + completionBlock((NSArray*)data, error); } ]; } @@ -356,8 +343,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) findPetsByTagsWithCompletionBlock: (NSArray*) tags - completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock - { + completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock { + @@ -380,8 +367,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -401,13 +388,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -415,14 +400,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"NSArray*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"NSArray*"], error); + completionBlock((NSArray*)data, error); } ]; } @@ -436,12 +424,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) getPetByIdWithCompletionBlock: (NSNumber*) petId - completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock - { + completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock { + // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling getPetById"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `getPetById`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; @@ -458,8 +448,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -479,13 +469,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"api_key", @"petstore_auth"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -493,14 +481,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"SWGPet*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"SWGPet*"], error); + completionBlock((SWGPet*)data, error); } ]; } @@ -521,11 +512,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; status: (NSString*) status - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling updatePetWithForm"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `updatePetWithForm`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; @@ -542,8 +535,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -563,29 +556,19 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + formParams[@"name"] = name; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - [bodyDictionary addObject:formParams]; formParams[@"status"] = status; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - [bodyDictionary addObject:formParams]; @@ -593,11 +576,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -608,21 +594,23 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// /// Deletes a pet /// -/// @param apiKey -/// /// @param petId Pet id to delete /// +/// @param apiKey +/// /// @returns void /// --(NSNumber*) deletePetWithCompletionBlock: (NSString*) apiKey - petId: (NSNumber*) petId +-(NSNumber*) deletePetWithCompletionBlock: (NSNumber*) petId + apiKey: (NSString*) apiKey - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling deletePet"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `deletePet`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath]; @@ -641,8 +629,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; if(apiKey != nil) headerParams[@"api_key"] = apiKey; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -662,13 +650,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -676,11 +662,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -701,14 +690,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) uploadFileWithCompletionBlock: (NSNumber*) petId additionalMetadata: (NSString*) additionalMetadata - file: (SWGFile*) file + file: (NSURL*) file - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { // verify the required parameter 'petId' is set - NSAssert(petId != nil, @"Missing the required parameter `petId` when calling uploadFile"); + if (petId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `uploadFile`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}/uploadImage", basePath]; @@ -725,8 +716,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -746,36 +737,19 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"petstore_auth"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + formParams[@"additionalMetadata"] = additionalMetadata; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - [bodyDictionary addObject:formParams]; - requestContentType = @"multipart/form-data"; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - if(file != nil) { - [bodyDictionary addObject:file]; - file.paramName = @"file"; - } + files[@"file"] = file; - if(bodyDictionary == nil) { - bodyDictionary = [[NSMutableArray alloc] init]; - } - [bodyDictionary addObject:formParams]; @@ -783,11 +757,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -798,6 +775,3 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; @end - - - diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGQueryParamCollection.h b/samples/client/petstore/objc/SwaggerClient/SWGQueryParamCollection.h similarity index 100% rename from modules/swagger-codegen/src/main/resources/objc/SWGQueryParamCollection.h rename to samples/client/petstore/objc/SwaggerClient/SWGQueryParamCollection.h diff --git a/modules/swagger-codegen/src/main/resources/objc/SWGQueryParamCollection.m b/samples/client/petstore/objc/SwaggerClient/SWGQueryParamCollection.m similarity index 100% rename from modules/swagger-codegen/src/main/resources/objc/SWGQueryParamCollection.m rename to samples/client/petstore/objc/SwaggerClient/SWGQueryParamCollection.m diff --git a/samples/client/petstore/objc/client/SWGStoreApi.h b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.h similarity index 100% rename from samples/client/petstore/objc/client/SWGStoreApi.h rename to samples/client/petstore/objc/SwaggerClient/SWGStoreApi.h diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m similarity index 79% rename from samples/client/petstore/objc/client/SWGStoreApi.m rename to samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m index 98582602027..5304b67dd07 100644 --- a/samples/client/petstore/objc/client/SWGStoreApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m @@ -1,5 +1,4 @@ #import "SWGStoreApi.h" -#import "SWGFile.h" #import "SWGQueryParamCollection.h" #import "SWGOrder.h" @@ -78,8 +77,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// @returns NSDictionary* /* NSString, NSNumber */ /// -(NSNumber*) getInventoryWithCompletionBlock: - (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock - { + (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error))completionBlock { + @@ -96,8 +95,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -117,13 +116,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[@"api_key"]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -131,14 +128,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"NSDictionary* /* NSString, NSNumber */" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"NSDictionary* /* NSString, NSNumber */"], error); + completionBlock((NSDictionary* /* NSString, NSNumber */)data, error); } ]; } @@ -152,8 +152,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) placeOrderWithCompletionBlock: (SWGOrder*) body - completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock - { + completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock { + @@ -170,8 +170,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -191,14 +191,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -206,36 +208,28 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"SWGOrder*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"SWGOrder*"], error); + completionBlock((SWGOrder*)data, error); } ]; } @@ -249,12 +243,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) getOrderByIdWithCompletionBlock: (NSString*) orderId - completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock - { + completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock { + // verify the required parameter 'orderId' is set - NSAssert(orderId != nil, @"Missing the required parameter `orderId` when calling getOrderById"); + if (orderId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `orderId` when calling `getOrderById`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; @@ -271,8 +267,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -292,13 +288,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -306,14 +300,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"SWGOrder*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"SWGOrder*"], error); + completionBlock((SWGOrder*)data, error); } ]; } @@ -328,11 +325,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) deleteOrderWithCompletionBlock: (NSString*) orderId - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { // verify the required parameter 'orderId' is set - NSAssert(orderId != nil, @"Missing the required parameter `orderId` when calling deleteOrder"); + if (orderId == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `orderId` when calling `deleteOrder`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath]; @@ -349,8 +348,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -370,13 +369,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -384,11 +381,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -399,6 +399,3 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; @end - - - diff --git a/samples/client/petstore/objc/client/SWGTag.h b/samples/client/petstore/objc/SwaggerClient/SWGTag.h similarity index 100% rename from samples/client/petstore/objc/client/SWGTag.h rename to samples/client/petstore/objc/SwaggerClient/SWGTag.h diff --git a/samples/client/petstore/objc/client/SWGTag.m b/samples/client/petstore/objc/SwaggerClient/SWGTag.m similarity index 100% rename from samples/client/petstore/objc/client/SWGTag.m rename to samples/client/petstore/objc/SwaggerClient/SWGTag.m diff --git a/samples/client/petstore/objc/client/SWGUser.h b/samples/client/petstore/objc/SwaggerClient/SWGUser.h similarity index 100% rename from samples/client/petstore/objc/client/SWGUser.h rename to samples/client/petstore/objc/SwaggerClient/SWGUser.h diff --git a/samples/client/petstore/objc/client/SWGUser.m b/samples/client/petstore/objc/SwaggerClient/SWGUser.m similarity index 100% rename from samples/client/petstore/objc/client/SWGUser.m rename to samples/client/petstore/objc/SwaggerClient/SWGUser.m diff --git a/samples/client/petstore/objc/client/SWGUserApi.h b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.h similarity index 100% rename from samples/client/petstore/objc/client/SWGUserApi.h rename to samples/client/petstore/objc/SwaggerClient/SWGUserApi.h diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.m similarity index 78% rename from samples/client/petstore/objc/client/SWGUserApi.m rename to samples/client/petstore/objc/SwaggerClient/SWGUserApi.m index 2e8ce66b74e..845e8d93ae3 100644 --- a/samples/client/petstore/objc/client/SWGUserApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.m @@ -1,5 +1,4 @@ #import "SWGUserApi.h" -#import "SWGFile.h" #import "SWGQueryParamCollection.h" #import "SWGUser.h" @@ -82,7 +81,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) createUserWithCompletionBlock: (SWGUser*) body - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { @@ -99,8 +98,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -120,14 +119,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -135,33 +136,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -179,7 +172,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) createUsersWithArrayInputWithCompletionBlock: (NSArray*) body - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { @@ -196,8 +189,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -217,14 +210,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -232,33 +227,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -276,7 +263,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) createUsersWithListInputWithCompletionBlock: (NSArray*) body - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { @@ -293,8 +280,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -314,14 +301,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -329,33 +318,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"POST" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -375,8 +356,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) loginUserWithCompletionBlock: (NSString*) username password: (NSString*) password - completionHandler: (void (^)(NSString* output, NSError* error))completionBlock - { + completionHandler: (void (^)(NSString* output, NSError* error))completionBlock { + @@ -401,8 +382,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -422,13 +403,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -436,14 +415,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"NSString*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"NSString*"], error); + completionBlock((NSString*)data, error); } ]; } @@ -455,7 +437,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) logoutUserWithCompletionBlock: - (void (^)(NSError* error))completionBlock { + (void (^)(NSError* error))completionBlock { @@ -472,8 +454,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -493,13 +475,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -507,11 +487,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -528,12 +511,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; /// -(NSNumber*) getUserByNameWithCompletionBlock: (NSString*) username - completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock - { + completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock { + // verify the required parameter 'username' is set - NSAssert(username != nil, @"Missing the required parameter `username` when calling getUserByName"); + if (username == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `getUserByName`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; @@ -550,8 +535,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -571,13 +556,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -585,14 +568,17 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"GET" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: @"SWGUser*" completionBlock: ^(id data, NSError *error) { - completionBlock([self.apiClient deserialize: data class:@"SWGUser*"], error); + completionBlock((SWGUser*)data, error); } ]; } @@ -610,11 +596,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; body: (SWGUser*) body - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { // verify the required parameter 'username' is set - NSAssert(username != nil, @"Missing the required parameter `username` when calling updateUser"); + if (username == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `updateUser`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; @@ -631,8 +619,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -652,14 +640,16 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - id __body = body; - if(__body != nil && [__body isKindOfClass:[NSArray class]]){ - NSMutableArray * objs = [[NSMutableArray alloc] init]; - for (id dict in (NSArray*)__body) { + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + + bodyParam = body; + + if(bodyParam != nil && [bodyParam isKindOfClass:[NSArray class]]){ + NSMutableArray *objs = [[NSMutableArray alloc] init]; + for (id dict in (NSArray*)bodyParam) { if([dict respondsToSelector:@selector(toDictionary)]) { [objs addObject:[(SWGObject*)dict toDictionary]]; } @@ -667,33 +657,25 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [objs addObject:dict]; } } - bodyDictionary = objs; + bodyParam = objs; } - else if([__body respondsToSelector:@selector(toDictionary)]) { - bodyDictionary = [(SWGObject*)__body toDictionary]; + else if([bodyParam respondsToSelector:@selector(toDictionary)]) { + bodyParam = [(SWGObject*)bodyParam toDictionary]; } - else if([__body isKindOfClass:[NSString class]]) { - // convert it to a dictionary - NSError * error; - NSString * str = (NSString*)__body; - NSDictionary *JSON = - [NSJSONSerialization JSONObjectWithData: [str dataUsingEncoding: NSUTF8StringEncoding] - options: NSJSONReadingMutableContainers - error: &error]; - bodyDictionary = JSON; - } - return [self.apiClient requestWithCompletionBlock: requestUrl method: @"PUT" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -711,11 +693,13 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; -(NSNumber*) deleteUserWithCompletionBlock: (NSString*) username - completionHandler: (void (^)(NSError* error))completionBlock { + completionHandler: (void (^)(NSError* error))completionBlock { // verify the required parameter 'username' is set - NSAssert(username != nil, @"Missing the required parameter `username` when calling deleteUser"); + if (username == nil) { + [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `deleteUser`"]; + } NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath]; @@ -732,8 +716,8 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - // HTTP header `Accept` + + // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { [headerParams removeObjectForKey:@"Accept"]; @@ -753,13 +737,11 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; // Authentication setting NSArray *authSettings = @[]; - - id bodyDictionary = nil; - - - - NSMutableDictionary * formParams = [[NSMutableDictionary alloc]init]; + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *files = [[NSMutableDictionary alloc] init]; + @@ -767,11 +749,14 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; return [self.apiClient requestWithCompletionBlock: requestUrl method: @"DELETE" queryParams: queryParams - body: bodyDictionary + formParams: formParams + files: files + body: bodyParam headerParams: headerParams authSettings: authSettings requestContentType: requestContentType responseContentType: responseContentType + responseType: nil completionBlock: ^(id data, NSError *error) { completionBlock(error); @@ -782,6 +767,3 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; @end - - - diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj deleted file mode 100644 index ac15f78e357..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.pbxproj +++ /dev/null @@ -1,688 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - BA525648922D4C0E9F44D4F1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 73DA4F1067C343C3962F1542 /* libPods.a */; }; - CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */; }; - CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF31D0981B105E4B00509935 /* SWGApiClientTest.m */; }; - CF5B6E2D1B2BD70800862A1C /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF5B6E2C1B2BD70800862A1C /* UserApiTest.m */; }; - CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */; }; - CFCEFE511B2C1330006313BE /* SWGJSONResponseSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = CFCEFE501B2C1330006313BE /* SWGJSONResponseSerializer.m */; }; - CFD1B6701B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; }; - CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */; }; - EA66999A1811D2FA00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; }; - EA66999C1811D2FA00A70D03 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999B1811D2FA00A70D03 /* CoreGraphics.framework */; }; - EA66999E1811D2FA00A70D03 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999D1811D2FA00A70D03 /* UIKit.framework */; }; - EA6699A41811D2FA00A70D03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EA6699A21811D2FA00A70D03 /* InfoPlist.strings */; }; - EA6699A61811D2FA00A70D03 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699A51811D2FA00A70D03 /* main.m */; }; - EA6699AA1811D2FA00A70D03 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699A91811D2FA00A70D03 /* AppDelegate.m */; }; - EA6699AD1811D2FA00A70D03 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA6699AB1811D2FA00A70D03 /* Main_iPhone.storyboard */; }; - EA6699B01811D2FA00A70D03 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA6699AE1811D2FA00A70D03 /* Main_iPad.storyboard */; }; - EA6699B31811D2FA00A70D03 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699B21811D2FA00A70D03 /* ViewController.m */; }; - EA6699B51811D2FA00A70D03 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EA6699B41811D2FA00A70D03 /* Images.xcassets */; }; - EA6699BD1811D2FB00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; }; - EA6699BE1811D2FB00A70D03 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999D1811D2FA00A70D03 /* UIKit.framework */; }; - EA6699C61811D2FB00A70D03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EA6699C41811D2FB00A70D03 /* InfoPlist.strings */; }; - EA8B8AA41AC6683700638FBB /* SWGQueryParamCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = EA8B8AA31AC6683700638FBB /* SWGQueryParamCollection.m */; }; - EA8CD3ED1AC2763600C47D0B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */; }; - EAB26B091AC8DE24002F5C7A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EAB26B081AC8DE24002F5C7A /* libPods.a */; }; - EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */ = {isa = PBXBuildFile; fileRef = EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */; }; - EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699C71811D2FB00A70D03 /* PetApiTest.m */; }; - EAEA85E41811D3AE00F06E69 /* SWGApiClient.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */; }; - EAEA85E51811D3AE00F06E69 /* SWGCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85CF1811D3AE00F06E69 /* SWGCategory.m */; }; - EAEA85E71811D3AE00F06E69 /* SWGFile.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85D31811D3AE00F06E69 /* SWGFile.m */; }; - EAEA85E81811D3AE00F06E69 /* SWGObject.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85D51811D3AE00F06E69 /* SWGObject.m */; }; - EAEA85E91811D3AE00F06E69 /* SWGOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85D71811D3AE00F06E69 /* SWGOrder.m */; }; - EAEA85EA1811D3AE00F06E69 /* SWGPet.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85D91811D3AE00F06E69 /* SWGPet.m */; }; - EAEA85EB1811D3AE00F06E69 /* SWGPetApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85DB1811D3AE00F06E69 /* SWGPetApi.m */; }; - EAEA85EC1811D3AE00F06E69 /* SWGStoreApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85DD1811D3AE00F06E69 /* SWGStoreApi.m */; }; - EAEA85ED1811D3AE00F06E69 /* SWGTag.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85DF1811D3AE00F06E69 /* SWGTag.m */; }; - EAEA85EE1811D3AE00F06E69 /* SWGUser.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85E11811D3AE00F06E69 /* SWGUser.m */; }; - EAEA85EF1811D3AE00F06E69 /* SWGUserApi.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85E31811D3AE00F06E69 /* SWGUserApi.m */; }; - EAFBEABB1A925B8500A27431 /* test-1.png in Resources */ = {isa = PBXBuildFile; fileRef = EAFBEABA1A925B8500A27431 /* test-1.png */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - EA6699BF1811D2FB00A70D03 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = EA66998E1811D2FA00A70D03 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EA6699951811D2FA00A70D03; - remoteInfo = PetstoreClient; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 73DA4F1067C343C3962F1542 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - A425648B5C0A4849C7668069 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "../Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; - CF0560E91B1855CF00C0D4EC /* SWGConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGConfiguration.h; sourceTree = ""; }; - CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGConfiguration.m; sourceTree = ""; }; - CF31D0981B105E4B00509935 /* SWGApiClientTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClientTest.m; sourceTree = ""; }; - CF5B6E2C1B2BD70800862A1C /* UserApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserApiTest.m; sourceTree = ""; }; - CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.m; sourceTree = ""; }; - CFCEFE4F1B2C1330006313BE /* SWGJSONResponseSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGJSONResponseSerializer.h; sourceTree = ""; }; - CFCEFE501B2C1330006313BE /* SWGJSONResponseSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGJSONResponseSerializer.m; sourceTree = ""; }; - CFD1B66E1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSONValueTransformer+ISO8601.h"; sourceTree = ""; }; - CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSONValueTransformer+ISO8601.m"; sourceTree = ""; }; - E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "../Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; - EA6699961811D2FA00A70D03 /* SwaggerClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwaggerClient.app; sourceTree = BUILT_PRODUCTS_DIR; }; - EA6699991811D2FA00A70D03 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - EA66999B1811D2FA00A70D03 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - EA66999D1811D2FA00A70D03 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - EA6699A11811D2FA00A70D03 /* SwaggerClient-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SwaggerClient-Info.plist"; sourceTree = ""; }; - EA6699A31811D2FA00A70D03 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - EA6699A51811D2FA00A70D03 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - EA6699A71811D2FA00A70D03 /* SwaggerClient-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwaggerClient-Prefix.pch"; sourceTree = ""; }; - EA6699A81811D2FA00A70D03 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - EA6699A91811D2FA00A70D03 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - EA6699AC1811D2FA00A70D03 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; - EA6699AF1811D2FA00A70D03 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; - EA6699B11811D2FA00A70D03 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - EA6699B21811D2FA00A70D03 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - EA6699B41811D2FA00A70D03 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - EA6699BA1811D2FB00A70D03 /* SwaggerClientTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClientTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - EA6699C31811D2FB00A70D03 /* SwaggerClientTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SwaggerClientTests-Info.plist"; sourceTree = ""; }; - EA6699C51811D2FB00A70D03 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - EA6699C71811D2FB00A70D03 /* PetApiTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PetApiTest.m; sourceTree = ""; }; - EA8B8AA21AC6683700638FBB /* SWGQueryParamCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGQueryParamCollection.h; sourceTree = ""; }; - EA8B8AA31AC6683700638FBB /* SWGQueryParamCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGQueryParamCollection.m; sourceTree = ""; }; - EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PetApiTest.h; sourceTree = ""; }; - EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; - EAB26B081AC8DE24002F5C7A /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos/libPods.a"; sourceTree = ""; }; - EAB26B0E1AC8E692002F5C7A /* SWGPet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGPet.h; sourceTree = ""; }; - EAEA85CC1811D3AE00F06E69 /* SWGApiClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGApiClient.h; sourceTree = ""; }; - EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClient.m; sourceTree = ""; }; - EAEA85CE1811D3AE00F06E69 /* SWGCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGCategory.h; sourceTree = ""; }; - EAEA85CF1811D3AE00F06E69 /* SWGCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGCategory.m; sourceTree = ""; }; - EAEA85D21811D3AE00F06E69 /* SWGFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGFile.h; sourceTree = ""; }; - EAEA85D31811D3AE00F06E69 /* SWGFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGFile.m; sourceTree = ""; }; - EAEA85D41811D3AE00F06E69 /* SWGObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGObject.h; sourceTree = ""; }; - EAEA85D51811D3AE00F06E69 /* SWGObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGObject.m; sourceTree = ""; }; - EAEA85D61811D3AE00F06E69 /* SWGOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGOrder.h; sourceTree = ""; }; - EAEA85D71811D3AE00F06E69 /* SWGOrder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGOrder.m; sourceTree = ""; }; - EAEA85D91811D3AE00F06E69 /* SWGPet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGPet.m; sourceTree = ""; }; - EAEA85DA1811D3AE00F06E69 /* SWGPetApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGPetApi.h; sourceTree = ""; }; - EAEA85DB1811D3AE00F06E69 /* SWGPetApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGPetApi.m; sourceTree = ""; }; - EAEA85DC1811D3AE00F06E69 /* SWGStoreApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGStoreApi.h; sourceTree = ""; }; - EAEA85DD1811D3AE00F06E69 /* SWGStoreApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGStoreApi.m; sourceTree = ""; }; - EAEA85DE1811D3AE00F06E69 /* SWGTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGTag.h; sourceTree = ""; }; - EAEA85DF1811D3AE00F06E69 /* SWGTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGTag.m; sourceTree = ""; }; - EAEA85E01811D3AE00F06E69 /* SWGUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGUser.h; sourceTree = ""; }; - EAEA85E11811D3AE00F06E69 /* SWGUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGUser.m; sourceTree = ""; }; - EAEA85E21811D3AE00F06E69 /* SWGUserApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGUserApi.h; sourceTree = ""; }; - EAEA85E31811D3AE00F06E69 /* SWGUserApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGUserApi.m; sourceTree = ""; }; - EAFBEABA1A925B8500A27431 /* test-1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "test-1.png"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - EA6699931811D2FA00A70D03 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - EA66999C1811D2FA00A70D03 /* CoreGraphics.framework in Frameworks */, - EA66999E1811D2FA00A70D03 /* UIKit.framework in Frameworks */, - EA66999A1811D2FA00A70D03 /* Foundation.framework in Frameworks */, - BA525648922D4C0E9F44D4F1 /* libPods.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EA6699B71811D2FB00A70D03 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - EA8CD3ED1AC2763600C47D0B /* SenTestingKit.framework in Frameworks */, - EA6699BE1811D2FB00A70D03 /* UIKit.framework in Frameworks */, - EA6699BD1811D2FB00A70D03 /* Foundation.framework in Frameworks */, - EAB26B091AC8DE24002F5C7A /* libPods.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1A15B3DE4358A178ABAEC251 /* Pods */ = { - isa = PBXGroup; - children = ( - E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */, - A425648B5C0A4849C7668069 /* Pods.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; - EA66998D1811D2FA00A70D03 = { - isa = PBXGroup; - children = ( - EAEA85CB1811D3AE00F06E69 /* client */, - EA66999F1811D2FA00A70D03 /* SwaggerClient */, - EA6699C11811D2FB00A70D03 /* SwaggerClientTests */, - EA6699981811D2FA00A70D03 /* Frameworks */, - EA6699971811D2FA00A70D03 /* Products */, - 1A15B3DE4358A178ABAEC251 /* Pods */, - ); - sourceTree = ""; - }; - EA6699971811D2FA00A70D03 /* Products */ = { - isa = PBXGroup; - children = ( - EA6699961811D2FA00A70D03 /* SwaggerClient.app */, - EA6699BA1811D2FB00A70D03 /* SwaggerClientTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - EA6699981811D2FA00A70D03 /* Frameworks */ = { - isa = PBXGroup; - children = ( - EAB26B081AC8DE24002F5C7A /* libPods.a */, - EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */, - EA6699991811D2FA00A70D03 /* Foundation.framework */, - EA66999B1811D2FA00A70D03 /* CoreGraphics.framework */, - EA66999D1811D2FA00A70D03 /* UIKit.framework */, - 73DA4F1067C343C3962F1542 /* libPods.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - EA66999F1811D2FA00A70D03 /* SwaggerClient */ = { - isa = PBXGroup; - children = ( - EA6699A81811D2FA00A70D03 /* AppDelegate.h */, - EA6699A91811D2FA00A70D03 /* AppDelegate.m */, - EA6699AB1811D2FA00A70D03 /* Main_iPhone.storyboard */, - EA6699AE1811D2FA00A70D03 /* Main_iPad.storyboard */, - EA6699B11811D2FA00A70D03 /* ViewController.h */, - EA6699B21811D2FA00A70D03 /* ViewController.m */, - EA6699B41811D2FA00A70D03 /* Images.xcassets */, - EA6699A01811D2FA00A70D03 /* Supporting Files */, - ); - path = SwaggerClient; - sourceTree = ""; - }; - EA6699A01811D2FA00A70D03 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - EAFBEABA1A925B8500A27431 /* test-1.png */, - EA6699A11811D2FA00A70D03 /* SwaggerClient-Info.plist */, - EA6699A21811D2FA00A70D03 /* InfoPlist.strings */, - EA6699A51811D2FA00A70D03 /* main.m */, - EA6699A71811D2FA00A70D03 /* SwaggerClient-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - EA6699C11811D2FB00A70D03 /* SwaggerClientTests */ = { - isa = PBXGroup; - children = ( - EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */, - CF5B6E2C1B2BD70800862A1C /* UserApiTest.m */, - CFB37D051B2B11DC00D2E5F1 /* StoreApiTest.m */, - CF31D0981B105E4B00509935 /* SWGApiClientTest.m */, - EA6699C71811D2FB00A70D03 /* PetApiTest.m */, - EA6699C21811D2FB00A70D03 /* Supporting Files */, - ); - path = SwaggerClientTests; - sourceTree = ""; - }; - EA6699C21811D2FB00A70D03 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - EA6699C31811D2FB00A70D03 /* SwaggerClientTests-Info.plist */, - EA6699C41811D2FB00A70D03 /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - EAEA85CB1811D3AE00F06E69 /* client */ = { - isa = PBXGroup; - children = ( - CFD1B66E1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.h */, - CFD1B66F1B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m */, - EA8B8AA21AC6683700638FBB /* SWGQueryParamCollection.h */, - EA8B8AA31AC6683700638FBB /* SWGQueryParamCollection.m */, - EAEA85CC1811D3AE00F06E69 /* SWGApiClient.h */, - EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */, - CF0560E91B1855CF00C0D4EC /* SWGConfiguration.h */, - CF0560EA1B1855CF00C0D4EC /* SWGConfiguration.m */, - EAEA85CE1811D3AE00F06E69 /* SWGCategory.h */, - EAEA85CF1811D3AE00F06E69 /* SWGCategory.m */, - EAEA85D21811D3AE00F06E69 /* SWGFile.h */, - EAEA85D31811D3AE00F06E69 /* SWGFile.m */, - EAEA85D41811D3AE00F06E69 /* SWGObject.h */, - EAEA85D51811D3AE00F06E69 /* SWGObject.m */, - EAEA85D61811D3AE00F06E69 /* SWGOrder.h */, - EAEA85D71811D3AE00F06E69 /* SWGOrder.m */, - EAB26B0E1AC8E692002F5C7A /* SWGPet.h */, - CFCEFE4F1B2C1330006313BE /* SWGJSONResponseSerializer.h */, - CFCEFE501B2C1330006313BE /* SWGJSONResponseSerializer.m */, - EAEA85D91811D3AE00F06E69 /* SWGPet.m */, - EAEA85DA1811D3AE00F06E69 /* SWGPetApi.h */, - EAEA85DB1811D3AE00F06E69 /* SWGPetApi.m */, - EAEA85DC1811D3AE00F06E69 /* SWGStoreApi.h */, - EAEA85DD1811D3AE00F06E69 /* SWGStoreApi.m */, - EAEA85DE1811D3AE00F06E69 /* SWGTag.h */, - EAEA85DF1811D3AE00F06E69 /* SWGTag.m */, - EAEA85E01811D3AE00F06E69 /* SWGUser.h */, - EAEA85E11811D3AE00F06E69 /* SWGUser.m */, - EAEA85E21811D3AE00F06E69 /* SWGUserApi.h */, - EAEA85E31811D3AE00F06E69 /* SWGUserApi.m */, - ); - name = client; - path = ../client; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - EA6699951811D2FA00A70D03 /* SwaggerClient */ = { - isa = PBXNativeTarget; - buildConfigurationList = EA6699CB1811D2FB00A70D03 /* Build configuration list for PBXNativeTarget "SwaggerClient" */; - buildPhases = ( - 04DAA264FD78471BBAD25173 /* Check Pods Manifest.lock */, - EA6699921811D2FA00A70D03 /* Sources */, - EA6699931811D2FA00A70D03 /* Frameworks */, - 3692D11BB04F489DAA7C0B6A /* Copy Pods Resources */, - EA6699941811D2FA00A70D03 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SwaggerClient; - productName = PetstoreClient; - productReference = EA6699961811D2FA00A70D03 /* SwaggerClient.app */; - productType = "com.apple.product-type.application"; - }; - EA6699B91811D2FB00A70D03 /* SwaggerClientTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = EA6699CE1811D2FB00A70D03 /* Build configuration list for PBXNativeTarget "SwaggerClientTests" */; - buildPhases = ( - EA6699B61811D2FB00A70D03 /* Sources */, - EA6699B71811D2FB00A70D03 /* Frameworks */, - EA6699B81811D2FB00A70D03 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - EA6699C01811D2FB00A70D03 /* PBXTargetDependency */, - ); - name = SwaggerClientTests; - productName = PetstoreClientTests; - productReference = EA6699BA1811D2FB00A70D03 /* SwaggerClientTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - EA66998E1811D2FA00A70D03 /* Project object */ = { - isa = PBXProject; - attributes = { - LastTestingUpgradeCheck = 0620; - LastUpgradeCheck = 0500; - ORGANIZATIONNAME = Reverb; - TargetAttributes = { - EA6699B91811D2FB00A70D03 = { - TestTargetID = EA6699951811D2FA00A70D03; - }; - }; - }; - buildConfigurationList = EA6699911811D2FA00A70D03 /* Build configuration list for PBXProject "SwaggerClient" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = EA66998D1811D2FA00A70D03; - productRefGroup = EA6699971811D2FA00A70D03 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - EA6699951811D2FA00A70D03 /* SwaggerClient */, - EA6699B91811D2FB00A70D03 /* SwaggerClientTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - EA6699941811D2FA00A70D03 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EA6699B01811D2FA00A70D03 /* Main_iPad.storyboard in Resources */, - EA6699B51811D2FA00A70D03 /* Images.xcassets in Resources */, - EA6699AD1811D2FA00A70D03 /* Main_iPhone.storyboard in Resources */, - EAFBEABB1A925B8500A27431 /* test-1.png in Resources */, - EA6699A41811D2FA00A70D03 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EA6699B81811D2FB00A70D03 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EA6699C61811D2FB00A70D03 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 04DAA264FD78471BBAD25173 /* Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 3692D11BB04F489DAA7C0B6A /* Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - EA6699921811D2FA00A70D03 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EAEA85E51811D3AE00F06E69 /* SWGCategory.m in Sources */, - CF0560EB1B1855CF00C0D4EC /* SWGConfiguration.m in Sources */, - EAEA85ED1811D3AE00F06E69 /* SWGTag.m in Sources */, - EA6699B31811D2FA00A70D03 /* ViewController.m in Sources */, - EA6699AA1811D2FA00A70D03 /* AppDelegate.m in Sources */, - EAEA85EE1811D3AE00F06E69 /* SWGUser.m in Sources */, - EAEA85EF1811D3AE00F06E69 /* SWGUserApi.m in Sources */, - EAEA85EB1811D3AE00F06E69 /* SWGPetApi.m in Sources */, - EA6699A61811D2FA00A70D03 /* main.m in Sources */, - CFD1B6701B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */, - EAEA85EA1811D3AE00F06E69 /* SWGPet.m in Sources */, - EAEA85E41811D3AE00F06E69 /* SWGApiClient.m in Sources */, - EAEA85EC1811D3AE00F06E69 /* SWGStoreApi.m in Sources */, - EAEA85E91811D3AE00F06E69 /* SWGOrder.m in Sources */, - EAEA85E81811D3AE00F06E69 /* SWGObject.m in Sources */, - EA8B8AA41AC6683700638FBB /* SWGQueryParamCollection.m in Sources */, - CFCEFE511B2C1330006313BE /* SWGJSONResponseSerializer.m in Sources */, - EAEA85E71811D3AE00F06E69 /* SWGFile.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EA6699B61811D2FB00A70D03 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EAB26B0C1AC8DF78002F5C7A /* PetApiTest.h in Sources */, - CFD1B6711B05EC7D00DCCD51 /* JSONValueTransformer+ISO8601.m in Sources */, - EAB26B0D1AC8DF78002F5C7A /* PetApiTest.m in Sources */, - CF5B6E2D1B2BD70800862A1C /* UserApiTest.m in Sources */, - CFB37D061B2B11DD00D2E5F1 /* StoreApiTest.m in Sources */, - CF31D0991B105E4B00509935 /* SWGApiClientTest.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - EA6699C01811D2FB00A70D03 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EA6699951811D2FA00A70D03 /* SwaggerClient */; - targetProxy = EA6699BF1811D2FB00A70D03 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - EA6699A21811D2FA00A70D03 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - EA6699A31811D2FA00A70D03 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - EA6699AB1811D2FA00A70D03 /* Main_iPhone.storyboard */ = { - isa = PBXVariantGroup; - children = ( - EA6699AC1811D2FA00A70D03 /* Base */, - ); - name = Main_iPhone.storyboard; - sourceTree = ""; - }; - EA6699AE1811D2FA00A70D03 /* Main_iPad.storyboard */ = { - isa = PBXVariantGroup; - children = ( - EA6699AF1811D2FA00A70D03 /* Base */, - ); - name = Main_iPad.storyboard; - sourceTree = ""; - }; - EA6699C41811D2FB00A70D03 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - EA6699C51811D2FB00A70D03 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - EA6699C91811D2FB00A70D03 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - 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_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - EA6699CA1811D2FB00A70D03 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - EA6699CC1811D2FB00A70D03 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; - INFOPLIST_FILE = "SwaggerClient/SwaggerClient-Info.plist"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos", - ); - PRODUCT_NAME = SwaggerClient; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - EA6699CD1811D2FB00A70D03 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A425648B5C0A4849C7668069 /* Pods.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; - INFOPLIST_FILE = "SwaggerClient/SwaggerClient-Info.plist"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos", - ); - PRODUCT_NAME = SwaggerClient; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - EA6699CF1811D2FB00A70D03 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E2B6DA00BE52336E23783686 /* Pods.debug.xcconfig */; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwaggerClient.app/SwaggerClient"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "SwaggerClientTests/SwaggerClientTests-Info.plist"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos", - ); - PRODUCT_NAME = SwaggerClientTests; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - EA6699D01811D2FB00A70D03 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A425648B5C0A4849C7668069 /* Pods.release.xcconfig */; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwaggerClient.app/SwaggerClient"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; - INFOPLIST_FILE = "SwaggerClientTests/SwaggerClientTests-Info.plist"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "/Users/tony/dev/projects/swagger-api/swagger-codegen/samples/client/petstore/objc/Pods/../build/Debug-iphoneos", - ); - PRODUCT_NAME = SwaggerClientTests; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - EA6699911811D2FA00A70D03 /* Build configuration list for PBXProject "SwaggerClient" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EA6699C91811D2FB00A70D03 /* Debug */, - EA6699CA1811D2FB00A70D03 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EA6699CB1811D2FB00A70D03 /* Build configuration list for PBXNativeTarget "SwaggerClient" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EA6699CC1811D2FB00A70D03 /* Debug */, - EA6699CD1811D2FB00A70D03 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - EA6699CE1811D2FB00A70D03 /* Build configuration list for PBXNativeTarget "SwaggerClientTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EA6699CF1811D2FB00A70D03 /* Debug */, - EA6699D01811D2FB00A70D03 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = EA66998E1811D2FA00A70D03 /* Project object */; -} diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/PetstoreClient.xccheckout b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/PetstoreClient.xccheckout deleted file mode 100644 index bbe327e168b..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/PetstoreClient.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 7A33CEA3-5D3F-4B6D-8F47-84701AB3E283 - IDESourceControlProjectName - PetstoreClient - IDESourceControlProjectOriginsDictionary - - 92840518-904D-4771-AA3D-9AF52CA48B71 - ssh://github.com/wordnik/swagger-codegen.git - - IDESourceControlProjectPath - samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.xcworkspace - IDESourceControlProjectRelativeInstallPathDictionary - - 92840518-904D-4771-AA3D-9AF52CA48B71 - ../../../../../../.. - - IDESourceControlProjectURL - ssh://github.com/wordnik/swagger-codegen.git - IDESourceControlProjectVersion - 110 - IDESourceControlProjectWCCIdentifier - 92840518-904D-4771-AA3D-9AF52CA48B71 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 92840518-904D-4771-AA3D-9AF52CA48B71 - IDESourceControlWCCName - swagger-codegen - - - - diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 53cb85903b2..00000000000 Binary files a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/tony.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index a0145d5cea8..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - SwaggerClient.xcscheme_^#shared#^_ - - orderHint - 4 - - - SuppressBuildableAutocreation - - EA6699951811D2FA00A70D03 - - primary - - - EA6699B91811D2FB00A70D03 - - primary - - - - - diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme deleted file mode 100644 index fd55bb26268..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/AppDelegate.h b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/AppDelegate.h deleted file mode 100644 index 622ab1d3916..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// PetstoreClient -// -// Created by Tony Tam on 10/18/13. -// Copyright (c) 2015 SmartBear Software. All rights reserved. -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Base.lproj/Main_iPad.storyboard b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Base.lproj/Main_iPad.storyboard deleted file mode 100644 index a185e8a5dfa..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Base.lproj/Main_iPad.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Base.lproj/Main_iPhone.storyboard b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Base.lproj/Main_iPhone.storyboard deleted file mode 100644 index b99208bd774..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Base.lproj/Main_iPhone.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 64224a68564..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images": [ - { - "idiom": "iphone", - "size": "29x29", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "40x40", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "2x" - }, - { - "idiom": "iphone", - "size": "60x60", - "scale": "3x" - }, - { - "idiom": "ipad", - "size": "29x29", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "29x29", - "scale": "2x" - }, - { - "idiom": "ipad", - "size": "40x40", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "40x40", - "scale": "2x" - }, - { - "idiom": "ipad", - "size": "76x76", - "scale": "1x" - }, - { - "idiom": "ipad", - "size": "76x76", - "scale": "2x" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} \ No newline at end of file diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index eaa3ad8a5dc..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images": [ - { - "orientation": "portrait", - "idiom": "iphone", - "extent": "full-screen", - "minimum-system-version": "7.0", - "scale": "2x" - }, - { - "orientation": "portrait", - "idiom": "iphone", - "subtype": "retina4", - "extent": "full-screen", - "minimum-system-version": "7.0", - "scale": "2x" - }, - { - "orientation": "portrait", - "idiom": "ipad", - "extent": "full-screen", - "minimum-system-version": "7.0", - "scale": "1x" - }, - { - "orientation": "landscape", - "idiom": "ipad", - "extent": "full-screen", - "minimum-system-version": "7.0", - "scale": "1x" - }, - { - "orientation": "portrait", - "idiom": "ipad", - "extent": "full-screen", - "minimum-system-version": "7.0", - "scale": "2x" - }, - { - "orientation": "landscape", - "idiom": "ipad", - "extent": "full-screen", - "minimum-system-version": "7.0", - "scale": "2x" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} \ No newline at end of file diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.h b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.h deleted file mode 100644 index f6e0cde9cd6..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// PetstoreClient -// -// Created by Tony Tam on 10/18/13. -// Copyright (c) 2015 SmartBear Software. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m deleted file mode 100644 index 388cacbb157..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/ViewController.m +++ /dev/null @@ -1,75 +0,0 @@ -// -// ViewController.m -// PetstoreClient -// -// Created by Tony Tam on 10/18/13. -// Copyright (c) 2015 SmartBear Software. All rights reserved. -// - -#import "ViewController.h" -#import "SWGPetApi.h" -#import "SWGStoreApi.h" -#import "SWGUserApi.h" -#import "SWGConfiguration.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - -/* - SWGPetApi * api = [[SWGPetApi alloc] init]; - [api getPetByIdWithCompletionBlock:@10 completionHandler:^(SWGPet *output, NSError *error) { - NSLog(@"%@", [output asDictionary]); - [output set_id:@101]; - [api addPetWithCompletionBlock:output completionHandler:^(NSError *error) { - NSLog(@"Done!"); - }]; - -// load data into file - }]; - NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test-1" ofType:@"png"]; - NSData *myData = [NSData dataWithContentsOfFile:filePath]; - - SWGFile *file = [[SWGFile alloc] initWithNameData:@"test-2.png" mimeType:@"image/png" data:myData]; - [api uploadFileWithCompletionBlock:@1 - additionalMetadata:@"some metadata" - file:file - completionHandler:^(NSError *error) { - if(error) { - NSLog(@"%@", error); - } - } -// completionHandler:^(SWGApiResponse *output, NSError *error) { -// if(error) { -// NSLog(@"%@", error); -// } -// else { -// NSLog(@"%@", [output asDictionary]); -// } -// } - ]; - */ - SWGPetApi *api = [[SWGPetApi alloc] init]; - [api deletePetWithCompletionBlock:@"hello" - petId:@1434529787992 - completionHandler:^(NSError *error) { - if (error) { - NSLog(@"%@", error); - } - }]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/main.m b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/main.m deleted file mode 100644 index d351099cbe1..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// PetstoreClient -// -// Created by Tony Tam on 10/18/13. -// Copyright (c) 2015 SmartBear Software. All rights reserved. -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/test-1.png b/samples/client/petstore/objc/SwaggerClient/SwaggerClient/test-1.png deleted file mode 100644 index 1da243e1d23..00000000000 Binary files a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/test-1.png and /dev/null differ diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/PetApiTest.h b/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/PetApiTest.h deleted file mode 100644 index a9a924467d3..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/PetApiTest.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import "SWGPetApi.h" - -@interface PetApiTest : XCTestCase { -@private - SWGPetApi * api; -} - -@end \ No newline at end of file diff --git a/samples/client/petstore/objc/SwaggerClient/pom.xml b/samples/client/petstore/objc/SwaggerClient/pom.xml deleted file mode 100644 index 5cb5024538c..00000000000 --- a/samples/client/petstore/objc/SwaggerClient/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - de.felixschulze.my-project - PetstoreClient - xcode - 1.0-SNAPSHOT - Swagger Petstore Client - - - - de.felixschulze.maven.plugins.xcode - xcode-maven-plugin - 1.2 - - PetstoreClient.xcodeproj - PetstoreClient - Debug - iphoneos - - true - - - - diff --git a/samples/client/petstore/objc/SwaggerClientTests/Podfile b/samples/client/petstore/objc/SwaggerClientTests/Podfile new file mode 100644 index 00000000000..ea5cdb0e6e8 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/Podfile @@ -0,0 +1,12 @@ +source 'https://github.com/CocoaPods/Specs.git' + +target 'SwaggerClient_Example', :exclusive => true do + pod "SwaggerClient", :path => "../" +end + +target 'SwaggerClient_Tests', :exclusive => true do + pod "SwaggerClient", :path => "../" + + pod 'Specta' + pod 'Expecta' +end diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..0ba21c560ef --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -0,0 +1,587 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 158CE3AA214CB1B31C7ADC48 /* libPods-SwaggerClient_Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FDEF5BA3CF9CFFDEB5A47DB4 /* libPods-SwaggerClient_Tests.a */; }; + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; + 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; + 6003F59E195388D20070C39A /* SWGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* SWGAppDelegate.m */; }; + 6003F5A7195388D20070C39A /* SWGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* SWGViewController.m */; }; + 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; + 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; + 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; + 94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */; }; + CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */; }; + CFDFB4131B3CFFDD009739C5 /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */; }; + CFDFB4141B3CFFF6009739C5 /* StoreApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */; }; + CFDFB4151B3D000B009739C5 /* SWGApiClientTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6003F582195388D10070C39A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6003F589195388D20070C39A; + remoteInfo = SwaggerClient; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.release.xcconfig"; sourceTree = ""; }; + 4CCE21315897B7D544C83242 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; + 6003F58A195388D20070C39A /* SwaggerClient_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwaggerClient_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 6003F595195388D20070C39A /* SwaggerClient-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SwaggerClient-Info.plist"; sourceTree = ""; }; + 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 6003F59B195388D20070C39A /* SwaggerClient-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwaggerClient-Prefix.pch"; sourceTree = ""; }; + 6003F59C195388D20070C39A /* SWGAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWGAppDelegate.h; sourceTree = ""; }; + 6003F59D195388D20070C39A /* SWGAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGAppDelegate.m; sourceTree = ""; }; + 6003F5A5195388D20070C39A /* SWGViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWGViewController.h; sourceTree = ""; }; + 6003F5A6195388D20070C39A /* SWGViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGViewController.m; sourceTree = ""; }; + 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClient_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; + 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; + 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.debug.xcconfig"; sourceTree = ""; }; + 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = ""; }; + CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetApiTest.m; sourceTree = ""; }; + CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoreApiTest.m; sourceTree = ""; }; + CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClientTest.m; sourceTree = ""; }; + CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserApiTest.m; sourceTree = ""; }; + E445A633FA767F207D7EE6CE /* Pods-SwaggerClient_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.debug.xcconfig"; sourceTree = ""; }; + E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SwaggerClient.podspec; path = ../SwaggerClient.podspec; sourceTree = ""; }; + FDEF5BA3CF9CFFDEB5A47DB4 /* libPods-SwaggerClient_Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6003F587195388D20070C39A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, + 94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6003F5AB195388D20070C39A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, + 158CE3AA214CB1B31C7ADC48 /* libPods-SwaggerClient_Tests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6003F581195388D10070C39A = { + isa = PBXGroup; + children = ( + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, + 6003F593195388D20070C39A /* Example for SwaggerClient */, + 6003F5B5195388D20070C39A /* Tests */, + 6003F58C195388D20070C39A /* Frameworks */, + 6003F58B195388D20070C39A /* Products */, + CCE77F10C6D41F74B075ECD0 /* Pods */, + ); + sourceTree = ""; + }; + 6003F58B195388D20070C39A /* Products */ = { + isa = PBXGroup; + children = ( + 6003F58A195388D20070C39A /* SwaggerClient_Example.app */, + 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 6003F58C195388D20070C39A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6003F58D195388D20070C39A /* Foundation.framework */, + 6003F58F195388D20070C39A /* CoreGraphics.framework */, + 6003F591195388D20070C39A /* UIKit.framework */, + 6003F5AF195388D20070C39A /* XCTest.framework */, + 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */, + FDEF5BA3CF9CFFDEB5A47DB4 /* libPods-SwaggerClient_Tests.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6003F593195388D20070C39A /* Example for SwaggerClient */ = { + isa = PBXGroup; + children = ( + 6003F59C195388D20070C39A /* SWGAppDelegate.h */, + 6003F59D195388D20070C39A /* SWGAppDelegate.m */, + 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, + 6003F5A5195388D20070C39A /* SWGViewController.h */, + 6003F5A6195388D20070C39A /* SWGViewController.m */, + 6003F5A8195388D20070C39A /* Images.xcassets */, + 6003F594195388D20070C39A /* Supporting Files */, + ); + name = "Example for SwaggerClient"; + path = SwaggerClient; + sourceTree = ""; + }; + 6003F594195388D20070C39A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 6003F595195388D20070C39A /* SwaggerClient-Info.plist */, + 6003F596195388D20070C39A /* InfoPlist.strings */, + 6003F599195388D20070C39A /* main.m */, + 6003F59B195388D20070C39A /* SwaggerClient-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 6003F5B5195388D20070C39A /* Tests */ = { + isa = PBXGroup; + children = ( + CFDFB40A1B3CFEC3009739C5 /* PetApiTest.m */, + CFDFB40B1B3CFEC3009739C5 /* StoreApiTest.m */, + CFDFB40C1B3CFEC3009739C5 /* SWGApiClientTest.m */, + CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */, + 6003F5BB195388D20070C39A /* Tests.m */, + 6003F5B6195388D20070C39A /* Supporting Files */, + ); + path = Tests; + sourceTree = ""; + }; + 6003F5B6195388D20070C39A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 6003F5B7195388D20070C39A /* Tests-Info.plist */, + 6003F5B8195388D20070C39A /* InfoPlist.strings */, + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { + isa = PBXGroup; + children = ( + E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */, + 4CCE21315897B7D544C83242 /* README.md */, + ); + name = "Podspec Metadata"; + sourceTree = ""; + }; + CCE77F10C6D41F74B075ECD0 /* Pods */ = { + isa = PBXGroup; + children = ( + E445A633FA767F207D7EE6CE /* Pods-SwaggerClient_Example.debug.xcconfig */, + BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */, + 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */, + 1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6003F589195388D20070C39A /* SwaggerClient_Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */; + buildPhases = ( + 799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */, + 6003F586195388D20070C39A /* Sources */, + 6003F587195388D20070C39A /* Frameworks */, + 6003F588195388D20070C39A /* Resources */, + 429AF5C69E165ED75311B4B0 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwaggerClient_Example; + productName = SwaggerClient; + productReference = 6003F58A195388D20070C39A /* SwaggerClient_Example.app */; + productType = "com.apple.product-type.application"; + }; + 6003F5AD195388D20070C39A /* SwaggerClient_Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */; + buildPhases = ( + 7B069562A9F91E498732474F /* Check Pods Manifest.lock */, + 6003F5AA195388D20070C39A /* Sources */, + 6003F5AB195388D20070C39A /* Frameworks */, + 6003F5AC195388D20070C39A /* Resources */, + E337D7E459CCFFDF27046FFC /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 6003F5B4195388D20070C39A /* PBXTargetDependency */, + ); + name = SwaggerClient_Tests; + productName = SwaggerClientTests; + productReference = 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6003F582195388D10070C39A /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = SWG; + LastUpgradeCheck = 0510; + ORGANIZATIONNAME = geekerzp; + }; + buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "SwaggerClient" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6003F581195388D10070C39A; + productRefGroup = 6003F58B195388D20070C39A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6003F589195388D20070C39A /* SwaggerClient_Example */, + 6003F5AD195388D20070C39A /* SwaggerClient_Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6003F588195388D20070C39A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */, + 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6003F5AC195388D20070C39A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 429AF5C69E165ED75311B4B0 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 7B069562A9F91E498732474F /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + E337D7E459CCFFDF27046FFC /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6003F586195388D20070C39A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F59E195388D20070C39A /* SWGAppDelegate.m in Sources */, + 6003F5A7195388D20070C39A /* SWGViewController.m in Sources */, + 6003F59A195388D20070C39A /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6003F5AA195388D20070C39A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CFDFB4141B3CFFF6009739C5 /* StoreApiTest.m in Sources */, + CFDFB4131B3CFFDD009739C5 /* PetApiTest.m in Sources */, + 6003F5BC195388D20070C39A /* Tests.m in Sources */, + CFDFB4151B3D000B009739C5 /* SWGApiClientTest.m in Sources */, + CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6003F589195388D20070C39A /* SwaggerClient_Example */; + targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 6003F596195388D20070C39A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 6003F597195388D20070C39A /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 6003F5B9195388D20070C39A /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 6003F5BD195388D20070C39A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + 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_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6003F5BE195388D20070C39A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6003F5C0195388D20070C39A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E445A633FA767F207D7EE6CE /* Pods-SwaggerClient_Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; + INFOPLIST_FILE = "SwaggerClient/SwaggerClient-Info.plist"; + MODULE_NAME = ExampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 6003F5C1195388D20070C39A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; + INFOPLIST_FILE = "SwaggerClient/SwaggerClient-Info.plist"; + MODULE_NAME = ExampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 6003F5C3195388D20070C39A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "Tests/Tests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 6003F5C4195388D20070C39A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; + INFOPLIST_FILE = "Tests/Tests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6003F585195388D10070C39A /* Build configuration list for PBXProject "SwaggerClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6003F5BD195388D20070C39A /* Debug */, + 6003F5BE195388D20070C39A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6003F5C0195388D20070C39A /* Debug */, + 6003F5C1195388D20070C39A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6003F5C3195388D20070C39A /* Debug */, + 6003F5C4195388D20070C39A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6003F582195388D10070C39A /* Project object */; +} diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 68% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0..13bdd8ab8b7 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:SwaggerClient.xcodeproj"> diff --git a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcshareddata/SwaggerClient.xccheckout b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout similarity index 88% rename from samples/client/petstore/objc/SwaggerClient.xcworkspace/xcshareddata/SwaggerClient.xccheckout rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout index 325cb92c1b8..879945048b3 100644 --- a/samples/client/petstore/objc/SwaggerClient.xcworkspace/xcshareddata/SwaggerClient.xccheckout +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout @@ -5,7 +5,7 @@ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier - 15AAFA18-9D61-437F-988D-A691BA4C08B1 + 303FE0A9-4715-4C57-8D01-F604EF82CF6D IDESourceControlProjectName SwaggerClient IDESourceControlProjectOriginsDictionary @@ -14,11 +14,11 @@ https://github.com/geekerzp/swagger-codegen.git IDESourceControlProjectPath - samples/client/petstore/objc/SwaggerClient.xcworkspace + samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary E5BBF0AA85077C865C95437976D06D819733A208 - ../../../../.. + ../../../../../../.. IDESourceControlProjectURL https://github.com/geekerzp/swagger-codegen.git diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000000..4b91a2c5500 Binary files /dev/null and b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient.xcscheme b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme similarity index 66% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient.xcscheme rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme index f79c2dc99ab..d34e508f438 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient.xcscheme +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme @@ -1,6 +1,6 @@ - - - - @@ -46,9 +32,9 @@ skipped = "NO"> @@ -56,9 +42,9 @@ @@ -76,9 +62,9 @@ runnableDebuggingMode = "0"> @@ -95,9 +81,9 @@ runnableDebuggingMode = "0"> diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/xcschememanagement.plist b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist similarity index 60% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/xcschememanagement.plist rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist index 163c84ef64d..adfa137d3e3 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist @@ -2,22 +2,14 @@ - SchemeUserState - - PetstoreClient.xcscheme - - orderHint - 0 - - SuppressBuildableAutocreation - EA6699951811D2FA00A70D03 + 6003F589195388D20070C39A primary - EA6699B91811D2FB00A70D03 + 6003F5AD195388D20070C39A primary diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..f697f61f4aa --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,53 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 00000000000..4458b40c055 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,51 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Main.storyboard b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Main.storyboard new file mode 100644 index 00000000000..f204320d333 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Main.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h new file mode 100644 index 00000000000..eb867594fde --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h @@ -0,0 +1,15 @@ +// +// SWGAppDelegate.h +// SwaggerClient +// +// Created by CocoaPods on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +@import UIKit; + +@interface SWGAppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/AppDelegate.m b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m similarity index 90% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient/AppDelegate.m rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m index a63c7d1ad89..492c6026d6b 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/AppDelegate.m +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m @@ -1,14 +1,14 @@ // -// AppDelegate.m -// PetstoreClient +// SWGAppDelegate.m +// SwaggerClient // -// Created by Tony Tam on 10/18/13. -// Copyright (c) 2015 SmartBear Software. All rights reserved. +// Created by CocoaPods on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. // -#import "AppDelegate.h" +#import "SWGAppDelegate.h" -@implementation AppDelegate +@implementation SWGAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.h b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.h new file mode 100644 index 00000000000..7847f2d05b1 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.h @@ -0,0 +1,13 @@ +// +// SWGViewController.h +// SwaggerClient +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +@import UIKit; + +@interface SWGViewController : UIViewController + +@end diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m new file mode 100644 index 00000000000..a56f31408aa --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m @@ -0,0 +1,29 @@ +// +// SWGViewController.m +// SwaggerClient +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +#import "SWGViewController.h" + +@interface SWGViewController () + +@end + +@implementation SWGViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/SwaggerClient-Info.plist b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist similarity index 89% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient/SwaggerClient-Info.plist rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist index 7296c17fbf8..d2cd320c27d 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/SwaggerClient-Info.plist +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.reverb.${PRODUCT_NAME:rfc1034identifier} + org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -25,9 +25,7 @@ LSRequiresIPhoneOS UIMainStoryboardFile - Main_iPhone - UIMainStoryboardFile~ipad - Main_iPad + Main UIRequiredDeviceCapabilities armv7 diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/SwaggerClient-Prefix.pch b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch similarity index 69% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient/SwaggerClient-Prefix.pch rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch index 80b02fc3cad..7825372cbdd 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/SwaggerClient-Prefix.pch +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch @@ -11,7 +11,6 @@ #endif #ifdef __OBJC__ - #import - #import - #import + @import UIKit; + @import Foundation; #endif diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClient/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClient/en.lproj/InfoPlist.strings rename to samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/main.m b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/main.m new file mode 100644 index 00000000000..4a47f1fd69e --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/main.m @@ -0,0 +1,17 @@ +// +// main.m +// SwaggerClient +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +@import UIKit; +#import "SWGAppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([SWGAppDelegate class])); + } +} diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/PetApiTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m similarity index 92% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/PetApiTest.m rename to samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m index 5b5f145cc12..f861cb0605e 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/PetApiTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m @@ -1,5 +1,14 @@ -#import "PetApiTest.h" -#import "SWGFile.h" +#import +#import +#import +#import + +@interface PetApiTest : XCTestCase { +@private + SWGPetApi * api; +} + +@end @implementation PetApiTest @@ -190,7 +199,7 @@ if(error){ XCTFail(@"got error %@", error); } - [api deletePetWithCompletionBlock:@"" petId:[NSString stringWithFormat:@"%@", [pet _id]] completionHandler:^(NSError *error) { + [api deletePetWithCompletionBlock:pet._id apiKey:@"" completionHandler:^(NSError *error) { if(error){ XCTFail(@"got error %@", error); } @@ -210,14 +219,11 @@ } - (void)testUploadFile { - XCTestExpectation *expectation = [self expectationWithDescription:@"testUploadFile"]; - - NSString* str = @"teststring"; - NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding]; + XCTestExpectation *expectation = [self expectationWithDescription:@"testUploadWithFile"]; - SWGFile * file = [[SWGFile alloc] initWithNameData: @"myFile.txt" mimeType:@"text/plain" data:data]; + NSURL *fileURL = [self createTempFile]; - [api uploadFileWithCompletionBlock:@1 additionalMetadata:@"special-metadata" file:file completionHandler:^(NSError *error) { + [api uploadFileWithCompletionBlock:@1 additionalMetadata:@"special-metadata" file:fileURL completionHandler:^(NSError *error) { if(error) { // good XCTFail(@"expected a failure"); @@ -269,4 +275,12 @@ pet.photoUrls = photos; return pet; } + +- (NSURL *) createTempFile { + NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]]; + NSData *data = [@"test string" dataUsingEncoding:NSUTF8StringEncoding]; + [data writeToFile:filePath atomically:YES]; + + return [NSURL fileURLWithPath:filePath]; +} @end diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m similarity index 98% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m rename to samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m index c68b3e2a42e..00c6bf70da6 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SWGApiClientTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m @@ -1,7 +1,7 @@ #import #import -#import "SWGApiClient.h" -#import "SWGConfiguration.h" +#import +#import @interface SWGApiClientTest : XCTestCase diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/StoreApiTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/StoreApiTest.m similarity index 95% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/StoreApiTest.m rename to samples/client/petstore/objc/SwaggerClientTests/Tests/StoreApiTest.m index d2864afe51d..9a250e1cb3a 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/StoreApiTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/StoreApiTest.m @@ -1,6 +1,6 @@ #import #import -#import "SWGStoreApi.h" +#import @interface StoreApiTest : XCTestCase diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SwaggerClientTests-Info.plist b/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Info.plist similarity index 89% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SwaggerClientTests-Info.plist rename to samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Info.plist index f445ddd474d..41520eda89e 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/SwaggerClientTests-Info.plist +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.reverb.${PRODUCT_NAME:rfc1034identifier} + org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Prefix.pch b/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Prefix.pch new file mode 100644 index 00000000000..6d08c288215 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Prefix.pch @@ -0,0 +1,8 @@ +// The contents of this file are implicitly included at the beginning of every test case source file. + +#ifdef __OBJC__ + + //@import Specta; + //@import Expecta; + +#endif diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests.m new file mode 100644 index 00000000000..527c8abd348 --- /dev/null +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests.m @@ -0,0 +1,52 @@ +// +// SwaggerClientTests.m +// SwaggerClientTests +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2015 geekerzp. All rights reserved. +// + +// https://github.com/Specta/Specta + +/** + * show cases for Specta + ** + +SpecBegin(InitialSpecs) + +describe(@"these will fail", ^{ + + it(@"can do maths", ^{ + expect(1).to.equal(2); + }); + + it(@"can read", ^{ + expect(@"number").to.equal(@"string"); + }); + + it(@"will wait for 10 seconds and fail", ^{ + waitUntil(^(DoneCallback done) { + + }); + }); +}); + +describe(@"these will pass", ^{ + + it(@"can do maths", ^{ + expect(1).beLessThan(23); + }); + + it(@"can read", ^{ + expect(@"team").toNot.contain(@"I"); + }); + + it(@"will wait and succeed", ^{ + waitUntil(^(DoneCallback done) { + done(); + }); + }); +}); + +SpecEnd +*/ diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/UserApiTest.m b/samples/client/petstore/objc/SwaggerClientTests/Tests/UserApiTest.m similarity index 97% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/UserApiTest.m rename to samples/client/petstore/objc/SwaggerClientTests/Tests/UserApiTest.m index b703797a280..620a6922e9f 100644 --- a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/UserApiTest.m +++ b/samples/client/petstore/objc/SwaggerClientTests/Tests/UserApiTest.m @@ -1,6 +1,6 @@ #import #import -#import "SWGUserApi.h" +#import @interface UserApiTest : XCTestCase diff --git a/samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/SwaggerClientTests/en.lproj/InfoPlist.strings rename to samples/client/petstore/objc/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings diff --git a/samples/client/petstore/objc/pom.xml b/samples/client/petstore/objc/SwaggerClientTests/pom.xml similarity index 97% rename from samples/client/petstore/objc/pom.xml rename to samples/client/petstore/objc/SwaggerClientTests/pom.xml index 85fc5ff6139..d1f461da7fd 100644 --- a/samples/client/petstore/objc/pom.xml +++ b/samples/client/petstore/objc/SwaggerClientTests/pom.xml @@ -51,7 +51,7 @@ -workspace SwaggerClient.xcworkspace -scheme - SwaggerClient + SwaggerClient-Example test -destination platform=iOS Simulator,name=iPhone 6,OS=8.3 diff --git a/samples/client/petstore/objc/client/SWGFile.h b/samples/client/petstore/objc/client/SWGFile.h deleted file mode 100644 index fd87e13bace..00000000000 --- a/samples/client/petstore/objc/client/SWGFile.h +++ /dev/null @@ -1,14 +0,0 @@ -#import - -@interface SWGFile : NSObject - -@property(nonatomic, readonly) NSString* name; -@property(nonatomic, readonly) NSString* mimeType; -@property(nonatomic, readonly) NSData* data; -@property(nonatomic) NSString* paramName; - -- (id) initWithNameData: (NSString*) filename - mimeType: (NSString*) mimeType - data: (NSData*) data; - -@end \ No newline at end of file diff --git a/samples/client/petstore/objc/client/SWGFile.m b/samples/client/petstore/objc/client/SWGFile.m deleted file mode 100644 index 42552767af4..00000000000 --- a/samples/client/petstore/objc/client/SWGFile.m +++ /dev/null @@ -1,26 +0,0 @@ -#import "SWGFile.h" - -@implementation SWGFile - -@synthesize name = _name; -@synthesize mimeType = _mimeType; -@synthesize data = _data; - -- (id) init { - self = [super init]; - return self; -} - -- (id) initWithNameData: (NSString*) filename - mimeType: (NSString*) fileMimeType - data: (NSData*) data { - self = [super init]; - if(self) { - _name = filename; - _mimeType = fileMimeType; - _data = data; - } - return self; -} - -@end \ No newline at end of file diff --git a/samples/client/petstore/objc/client/SWGObject.h b/samples/client/petstore/objc/client/SWGObject.h deleted file mode 100644 index ccec208abc0..00000000000 --- a/samples/client/petstore/objc/client/SWGObject.h +++ /dev/null @@ -1,5 +0,0 @@ -#import -#import "JSONModel.h" - -@interface SWGObject : JSONModel -@end diff --git a/samples/client/petstore/objc/client/SWGObject.m b/samples/client/petstore/objc/client/SWGObject.m deleted file mode 100644 index 1f897ab1d56..00000000000 --- a/samples/client/petstore/objc/client/SWGObject.m +++ /dev/null @@ -1,4 +0,0 @@ -#import "SWGObject.h" - -@implementation SWGObject -@end