From 8657720c09ea0011b50e286bfabcc65aa6a3acc2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 10 Apr 2016 19:34:09 +0800 Subject: [PATCH] fix spec with no model for objc client --- .../codegen/languages/ObjcClientCodegen.java | 2 +- .../resources/objc/ApiClient-header.mustache | 1 + .../src/main/resources/objc/api-body.mustache | 35 ++-- samples/client/petstore/objc/README.md | 12 +- .../petstore/objc/SwaggerClient.podspec | 2 +- .../objc/SwaggerClient/SWGApiClient.h | 2 + .../petstore/objc/SwaggerClient/SWGName.m | 2 +- .../petstore/objc/SwaggerClient/SWGPetApi.m | 153 +----------------- .../petstore/objc/SwaggerClient/SWGStoreApi.m | 76 +-------- .../petstore/objc/SwaggerClient/SWGUserApi.h | 2 +- .../petstore/objc/SwaggerClient/SWGUserApi.m | 98 +---------- 11 files changed, 36 insertions(+), 349 deletions(-) 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 74553f0e33c0..21e319f6ec96 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 @@ -95,7 +95,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { //TODO binary should be mapped to byte array // mapped to String as a workaround typeMapping.put("binary", "NSString"); - + typeMapping.put("ByteArray", "NSString"); // ref: http://www.tutorialspoint.com/objective_c/objective_c_basic_syntax.htm setReservedWordsLowerCase( diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache index b7ec5bb6021a..a039e7e168ec 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-header.mustache @@ -14,6 +14,7 @@ {{#models}}{{#model}}#import "{{classname}}.h" {{/model}}{{/models}} +{{^models}}#import "{{classPrefix}}Object.h"{{/models}} @class {{classPrefix}}Configuration; 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 41560eabd3ef..2a7880d8367e 100644 --- a/modules/swagger-codegen/src/main/resources/objc/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/api-body.mustache @@ -40,7 +40,6 @@ static {{classname}}* singletonAPI = nil; #pragma mark - +({{classname}}*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - if (singletonAPI == nil) { singletonAPI = [[{{classname}} alloc] init]; [singletonAPI addHeader:headerValue forKey:key]; @@ -49,7 +48,6 @@ static {{classname}}* singletonAPI = nil; } +({{classname}}*) sharedAPI { - if (singletonAPI == nil) { singletonAPI = [[{{classname}} alloc] init]; } @@ -82,14 +80,15 @@ static {{classname}}* singletonAPI = nil; -(NSNumber*) {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}} {{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}{{/allParams}} {{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error)) handler { - - {{#allParams}}{{#required}} + {{#allParams}} + {{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `{{paramName}}` when calling `{{nickname}}`"]; } - {{/required}}{{/allParams}} + {{/required}} + {{/allParams}} NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"{{path}}"]; // remove format in URL if needed @@ -98,13 +97,15 @@ static {{classname}}* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - {{#pathParams}}if ({{paramName}} != nil) { + {{#pathParams}} + if ({{paramName}} != nil) { pathParams[@"{{baseName}}"] = {{paramName}}; } {{/pathParams}} NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - {{#queryParams}}if ({{paramName}} != nil) { + {{#queryParams}} + if ({{paramName}} != nil) { {{#collectionFormat}} queryParams[@"{{baseName}}"] = [[{{classPrefix}}QueryParamCollection alloc] initWithValuesAndFormat: {{baseName}} format: @"{{collectionFormat}}"]; {{/collectionFormat}} @@ -112,12 +113,13 @@ static {{classname}}* singletonAPI = nil; } {{/queryParams}} NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - {{#headerParams}}if ({{paramName}} != nil) { + {{#headerParams}} + + if ({{paramName}} != nil) { headerParams[@"{{baseName}}"] = {{paramName}}; } - {{/headerParams}} + {{/headerParams}} // HTTP header `Accept` headerParams[@"Accept"] = [{{classPrefix}}ApiClient selectHeaderAccept:@[{{#produces}}@"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}]]; if ([headerParams[@"Accept"] length] == 0) { @@ -144,25 +146,20 @@ static {{classname}}* singletonAPI = nil; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; {{#bodyParam}} bodyParam = {{paramName}}; - {{/bodyParam}}{{^bodyParam}} + {{/bodyParam}} + {{^bodyParam}} {{#formParams}} {{#notFile}} if ({{paramName}}) { formParams[@"{{baseName}}"] = {{paramName}}; } - {{/notFile}}{{#isFile}} + {{/notFile}} + {{#isFile}} localVarFiles[@"{{paramName}}"] = {{paramName}}; {{/isFile}} {{/formParams}} {{/bodyParam}} - {{#requiredParamCount}} - {{#requiredParams}} - if ({{paramName}} == nil) { - // error - } - {{/requiredParams}} - {{/requiredParamCount}} return [self.apiClient requestWithPath: resourcePath method: @"{{httpMethod}}" pathParams: pathParams diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/README.md index 47c20a7af6cc..8da8058bc765 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-04-05T23:29:02.396+08:00 +- Build date: 2016-04-10T18:34:45.604+08:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements @@ -46,6 +46,7 @@ Import the following: #import #import #import +#import #import #import #import @@ -106,20 +107,20 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *SWGPetApi* | [**addPet**](docs/SWGPetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*SWGPetApi* | [**addPetUsingByteArray**](docs/SWGPetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store +*SWGPetApi* | [**addPetUsingByteArray**](docs/SWGPetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *SWGPetApi* | [**deletePet**](docs/SWGPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *SWGPetApi* | [**findPetsByStatus**](docs/SWGPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *SWGPetApi* | [**findPetsByTags**](docs/SWGPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *SWGPetApi* | [**getPetById**](docs/SWGPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*SWGPetApi* | [**getPetByIdInObject**](docs/SWGPetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*SWGPetApi* | [**petPetIdtestingByteArraytrueGet**](docs/SWGPetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' +*SWGPetApi* | [**getPetByIdInObject**](docs/SWGPetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +*SWGPetApi* | [**petPetIdtestingByteArraytrueGet**](docs/SWGPetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *SWGPetApi* | [**updatePet**](docs/SWGPetApi.md#updatepet) | **PUT** /pet | Update an existing pet *SWGPetApi* | [**updatePetWithForm**](docs/SWGPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *SWGPetApi* | [**uploadFile**](docs/SWGPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *SWGStoreApi* | [**deleteOrder**](docs/SWGStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID *SWGStoreApi* | [**findOrdersByStatus**](docs/SWGStoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status *SWGStoreApi* | [**getInventory**](docs/SWGStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*SWGStoreApi* | [**getInventoryInObject**](docs/SWGStoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' +*SWGStoreApi* | [**getInventoryInObject**](docs/SWGStoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *SWGStoreApi* | [**getOrderById**](docs/SWGStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *SWGStoreApi* | [**placeOrder**](docs/SWGStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *SWGUserApi* | [**createUser**](docs/SWGUserApi.md#createuser) | **POST** /user | Create user @@ -139,6 +140,7 @@ Class | Method | HTTP request | Description - [SWGCat](docs/SWGCat.md) - [SWGCategory](docs/SWGCategory.md) - [SWGDog](docs/SWGDog.md) + - [SWGFormatTest](docs/SWGFormatTest.md) - [SWGInlineResponse200](docs/SWGInlineResponse200.md) - [SWGName](docs/SWGName.md) - [SWGOrder](docs/SWGOrder.md) diff --git a/samples/client/petstore/objc/SwaggerClient.podspec b/samples/client/petstore/objc/SwaggerClient.podspec index 0afb511073c3..740680eb9e2c 100644 --- a/samples/client/petstore/objc/SwaggerClient.podspec +++ b/samples/client/petstore/objc/SwaggerClient.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| 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 + 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' diff --git a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h index a52df2230803..af299ff0008e 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGApiClient.h @@ -17,6 +17,7 @@ #import "SWGCat.h" #import "SWGCategory.h" #import "SWGDog.h" +#import "SWGFormatTest.h" #import "SWGInlineResponse200.h" #import "SWGName.h" #import "SWGOrder.h" @@ -27,6 +28,7 @@ #import "SWGUser.h" + @class SWGConfiguration; /** diff --git a/samples/client/petstore/objc/SwaggerClient/SWGName.m b/samples/client/petstore/objc/SwaggerClient/SWGName.m index e11242833c1e..16aec784549f 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGName.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGName.m @@ -30,7 +30,7 @@ */ + (BOOL)propertyIsOptional:(NSString *)propertyName { - NSArray *optionalProperties = @[@"name", @"snakeCase"]; + NSArray *optionalProperties = @[@"snakeCase"]; if ([optionalProperties containsObject:propertyName]) { return YES; diff --git a/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m index 2b7bab6144a7..8c7959a8c3fd 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGPetApi.m @@ -39,7 +39,6 @@ static SWGPetApi* singletonAPI = nil; #pragma mark - +(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - if (singletonAPI == nil) { singletonAPI = [[SWGPetApi alloc] init]; [singletonAPI addHeader:headerValue forKey:key]; @@ -48,7 +47,6 @@ static SWGPetApi* singletonAPI = nil; } +(SWGPetApi*) sharedAPI { - if (singletonAPI == nil) { singletonAPI = [[SWGPetApi alloc] init]; } @@ -79,9 +77,6 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) addPetWithBody: (SWGPet*) body completionHandler: (void (^)(NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; // remove format in URL if needed @@ -90,14 +85,9 @@ static SWGPetApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -122,11 +112,8 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams @@ -154,10 +141,7 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) addPetUsingByteArrayWithBody: (NSString*) body completionHandler: (void (^)(NSError* error)) handler { - - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet?testing_byte_array=true"]; + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet?testing_byte_array=true"]; // remove format in URL if needed if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) { @@ -165,14 +149,9 @@ static SWGPetApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -197,11 +176,8 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams @@ -232,13 +208,10 @@ static SWGPetApi* singletonAPI = nil; -(NSNumber*) deletePetWithPetId: (NSNumber*) petId apiKey: (NSString*) apiKey completionHandler: (void (^)(NSError* error)) handler { - - // verify the required parameter 'petId' is set if (petId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `deletePet`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"]; @@ -251,16 +224,13 @@ static SWGPetApi* singletonAPI = nil; if (petId != nil) { pathParams[@"petId"] = petId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - + if (apiKey != nil) { headerParams[@"api_key"] = apiKey; } - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; @@ -286,11 +256,7 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"DELETE" pathParams: pathParams @@ -318,9 +284,6 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) findPetsByStatusWithStatus: (NSArray* /* NSString */) status completionHandler: (void (^)(NSArray* output, NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"]; // remove format in URL if needed @@ -329,20 +292,13 @@ static SWGPetApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; if (status != nil) { - queryParams[@"status"] = [[SWGQueryParamCollection alloc] initWithValuesAndFormat: status format: @"multi"]; - } - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -367,11 +323,7 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -399,9 +351,6 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) findPetsByTagsWithTags: (NSArray* /* NSString */) tags completionHandler: (void (^)(NSArray* output, NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"]; // remove format in URL if needed @@ -410,20 +359,13 @@ static SWGPetApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; if (tags != nil) { - queryParams[@"tags"] = [[SWGQueryParamCollection alloc] initWithValuesAndFormat: tags format: @"multi"]; - } - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -448,11 +390,7 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -480,13 +418,10 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId completionHandler: (void (^)(SWGPet* output, NSError* error)) handler { - - // verify the required parameter 'petId' is set if (petId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `getPetById`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"]; @@ -499,14 +434,9 @@ static SWGPetApi* singletonAPI = nil; if (petId != nil) { pathParams[@"petId"] = petId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -531,11 +461,7 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -563,15 +489,12 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) getPetByIdInObjectWithPetId: (NSNumber*) petId completionHandler: (void (^)(SWGInlineResponse200* output, NSError* error)) handler { - - // verify the required parameter 'petId' is set if (petId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `getPetByIdInObject`"]; } - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}?response=inline_arbitrary_object"]; + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}?response=inline_arbitrary_object"]; // remove format in URL if needed if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) { @@ -582,14 +505,9 @@ static SWGPetApi* singletonAPI = nil; if (petId != nil) { pathParams[@"petId"] = petId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -614,11 +532,7 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -646,15 +560,12 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) petPetIdtestingByteArraytrueGetWithPetId: (NSNumber*) petId completionHandler: (void (^)(NSString* output, NSError* error)) handler { - - // verify the required parameter 'petId' is set if (petId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `petPetIdtestingByteArraytrueGet`"]; } - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}?testing_byte_array=true"]; + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}?testing_byte_array=true"]; // remove format in URL if needed if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) { @@ -665,14 +576,9 @@ static SWGPetApi* singletonAPI = nil; if (petId != nil) { pathParams[@"petId"] = petId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -697,11 +603,7 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -729,9 +631,6 @@ static SWGPetApi* singletonAPI = nil; /// -(NSNumber*) updatePetWithBody: (SWGPet*) body completionHandler: (void (^)(NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; // remove format in URL if needed @@ -740,14 +639,9 @@ static SWGPetApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -772,11 +666,8 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"PUT" pathParams: pathParams @@ -810,13 +701,10 @@ static SWGPetApi* singletonAPI = nil; name: (NSString*) name status: (NSString*) status completionHandler: (void (^)(NSError* error)) handler { - - // verify the required parameter 'petId' is set if (petId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `updatePetWithForm`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"]; @@ -829,14 +717,9 @@ static SWGPetApi* singletonAPI = nil; if (petId != nil) { pathParams[@"petId"] = petId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -861,23 +744,13 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - if (name) { formParams[@"name"] = name; } - - - if (status) { formParams[@"status"] = status; } - - - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams @@ -911,13 +784,10 @@ static SWGPetApi* singletonAPI = nil; additionalMetadata: (NSString*) additionalMetadata file: (NSURL*) file completionHandler: (void (^)(NSError* error)) handler { - - // verify the required parameter 'petId' is set if (petId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `uploadFile`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}/uploadImage"]; @@ -930,14 +800,9 @@ static SWGPetApi* singletonAPI = nil; if (petId != nil) { pathParams[@"petId"] = petId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -962,21 +827,11 @@ static SWGPetApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - if (additionalMetadata) { formParams[@"additionalMetadata"] = additionalMetadata; } - - - localVarFiles[@"file"] = file; - - - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams diff --git a/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m index b66ba1f125b7..af0002db3b34 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGStoreApi.m @@ -38,7 +38,6 @@ static SWGStoreApi* singletonAPI = nil; #pragma mark - +(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - if (singletonAPI == nil) { singletonAPI = [[SWGStoreApi alloc] init]; [singletonAPI addHeader:headerValue forKey:key]; @@ -47,7 +46,6 @@ static SWGStoreApi* singletonAPI = nil; } +(SWGStoreApi*) sharedAPI { - if (singletonAPI == nil) { singletonAPI = [[SWGStoreApi alloc] init]; } @@ -78,13 +76,10 @@ static SWGStoreApi* singletonAPI = nil; /// -(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId completionHandler: (void (^)(NSError* error)) handler { - - // verify the required parameter 'orderId' is set if (orderId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `orderId` when calling `deleteOrder`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order/{orderId}"]; @@ -97,14 +92,9 @@ static SWGStoreApi* singletonAPI = nil; if (orderId != nil) { pathParams[@"orderId"] = orderId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -129,11 +119,7 @@ static SWGStoreApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"DELETE" pathParams: pathParams @@ -161,9 +147,6 @@ static SWGStoreApi* singletonAPI = nil; /// -(NSNumber*) findOrdersByStatusWithStatus: (NSString*) status completionHandler: (void (^)(NSArray* output, NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/findByStatus"]; // remove format in URL if needed @@ -172,18 +155,12 @@ static SWGStoreApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; if (status != nil) { - queryParams[@"status"] = status; } - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -208,11 +185,7 @@ static SWGStoreApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -238,9 +211,6 @@ static SWGStoreApi* singletonAPI = nil; /// -(NSNumber*) getInventoryWithCompletionHandler: (void (^)(NSDictionary* /* NSString, NSNumber */ output, NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"]; // remove format in URL if needed @@ -249,14 +219,9 @@ static SWGStoreApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -281,11 +246,7 @@ static SWGStoreApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -311,10 +272,7 @@ static SWGStoreApi* singletonAPI = nil; /// -(NSNumber*) getInventoryInObjectWithCompletionHandler: (void (^)(NSObject* output, NSError* error)) handler { - - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory?response=arbitrary_object"]; + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory?response=arbitrary_object"]; // remove format in URL if needed if ([resourcePath rangeOfString:@".{format}"].location != NSNotFound) { @@ -322,14 +280,9 @@ static SWGStoreApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -354,11 +307,7 @@ static SWGStoreApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -386,13 +335,10 @@ static SWGStoreApi* singletonAPI = nil; /// -(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler { - - // verify the required parameter 'orderId' is set if (orderId == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `orderId` when calling `getOrderById`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order/{orderId}"]; @@ -405,14 +351,9 @@ static SWGStoreApi* singletonAPI = nil; if (orderId != nil) { pathParams[@"orderId"] = orderId; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -437,11 +378,7 @@ static SWGStoreApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -469,9 +406,6 @@ static SWGStoreApi* singletonAPI = nil; /// -(NSNumber*) placeOrderWithBody: (SWGOrder*) body completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"]; // remove format in URL if needed @@ -480,14 +414,9 @@ static SWGStoreApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -512,11 +441,8 @@ static SWGStoreApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams diff --git a/samples/client/petstore/objc/SwaggerClient/SWGUserApi.h b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.h index 209e0c4a1d6f..aa1c99c65956 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGUserApi.h +++ b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.h @@ -76,7 +76,7 @@ /// Get user by user name /// /// -/// @param username The name that needs to be fetched. Use user1 for testing. +/// @param username The name that needs to be fetched. Use user1 for testing. /// /// /// @return SWGUser* diff --git a/samples/client/petstore/objc/SwaggerClient/SWGUserApi.m b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.m index 7699ca74bcfe..71e729ef02c6 100644 --- a/samples/client/petstore/objc/SwaggerClient/SWGUserApi.m +++ b/samples/client/petstore/objc/SwaggerClient/SWGUserApi.m @@ -38,7 +38,6 @@ static SWGUserApi* singletonAPI = nil; #pragma mark - +(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key { - if (singletonAPI == nil) { singletonAPI = [[SWGUserApi alloc] init]; [singletonAPI addHeader:headerValue forKey:key]; @@ -47,7 +46,6 @@ static SWGUserApi* singletonAPI = nil; } +(SWGUserApi*) sharedAPI { - if (singletonAPI == nil) { singletonAPI = [[SWGUserApi alloc] init]; } @@ -78,9 +76,6 @@ static SWGUserApi* singletonAPI = nil; /// -(NSNumber*) createUserWithBody: (SWGUser*) body completionHandler: (void (^)(NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"]; // remove format in URL if needed @@ -89,14 +84,9 @@ static SWGUserApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -121,11 +111,8 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams @@ -153,9 +140,6 @@ static SWGUserApi* singletonAPI = nil; /// -(NSNumber*) createUsersWithArrayInputWithBody: (NSArray*) body completionHandler: (void (^)(NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"]; // remove format in URL if needed @@ -164,14 +148,9 @@ static SWGUserApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -196,11 +175,8 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams @@ -228,9 +204,6 @@ static SWGUserApi* singletonAPI = nil; /// -(NSNumber*) createUsersWithListInputWithBody: (NSArray*) body completionHandler: (void (^)(NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"]; // remove format in URL if needed @@ -239,14 +212,9 @@ static SWGUserApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -271,11 +239,8 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"POST" pathParams: pathParams @@ -303,13 +268,10 @@ static SWGUserApi* singletonAPI = nil; /// -(NSNumber*) deleteUserWithUsername: (NSString*) username completionHandler: (void (^)(NSError* error)) handler { - - // verify the required parameter 'username' is set if (username == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `deleteUser`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"]; @@ -322,14 +284,9 @@ static SWGUserApi* singletonAPI = nil; if (username != nil) { pathParams[@"username"] = username; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -354,11 +311,7 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"DELETE" pathParams: pathParams @@ -380,19 +333,16 @@ static SWGUserApi* singletonAPI = nil; /// /// Get user by user name /// -/// @param username The name that needs to be fetched. Use user1 for testing. +/// @param username The name that needs to be fetched. Use user1 for testing. /// /// @returns SWGUser* /// -(NSNumber*) getUserByNameWithUsername: (NSString*) username completionHandler: (void (^)(SWGUser* output, NSError* error)) handler { - - // verify the required parameter 'username' is set if (username == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `getUserByName`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"]; @@ -405,14 +355,9 @@ static SWGUserApi* singletonAPI = nil; if (username != nil) { pathParams[@"username"] = username; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -437,11 +382,7 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -472,9 +413,6 @@ static SWGUserApi* singletonAPI = nil; -(NSNumber*) loginUserWithUsername: (NSString*) username password: (NSString*) password completionHandler: (void (^)(NSString* output, NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/login"]; // remove format in URL if needed @@ -483,22 +421,15 @@ static SWGUserApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; if (username != nil) { - queryParams[@"username"] = username; } if (password != nil) { - queryParams[@"password"] = password; } - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -523,11 +454,7 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -553,9 +480,6 @@ static SWGUserApi* singletonAPI = nil; /// -(NSNumber*) logoutUserWithCompletionHandler: (void (^)(NSError* error)) handler { - - - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"]; // remove format in URL if needed @@ -564,14 +488,9 @@ static SWGUserApi* singletonAPI = nil; } NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -596,11 +515,7 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - - - - return [self.apiClient requestWithPath: resourcePath method: @"GET" pathParams: pathParams @@ -631,13 +546,10 @@ static SWGUserApi* singletonAPI = nil; -(NSNumber*) updateUserWithUsername: (NSString*) username body: (SWGUser*) body completionHandler: (void (^)(NSError* error)) handler { - - // verify the required parameter 'username' is set if (username == nil) { [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `username` when calling `updateUser`"]; } - NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"]; @@ -650,14 +562,9 @@ static SWGUserApi* singletonAPI = nil; if (username != nil) { pathParams[@"username"] = username; } - NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; - NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.defaultHeaders]; - - - // HTTP header `Accept` headerParams[@"Accept"] = [SWGApiClient selectHeaderAccept:@[@"application/json", @"application/xml"]]; if ([headerParams[@"Accept"] length] == 0) { @@ -682,11 +589,8 @@ static SWGUserApi* singletonAPI = nil; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; - bodyParam = body; - - return [self.apiClient requestWithPath: resourcePath method: @"PUT" pathParams: pathParams