diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java index 38c0c5307ba0..a8d664918518 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -6,6 +6,8 @@ import io.swagger.models.properties.*; import java.util.*; import java.io.File; +import org.apache.commons.lang.StringUtils; + public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public CodegenType getTag() { @@ -15,14 +17,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp public AbstractTypeScriptClientCodegen() { super(); supportsInheritance = true; - reservedWords = new HashSet(Arrays.asList("abstract", - "continue", "for", "new", "switch", "assert", "default", "if", - "package", "synchronized", "do", "goto", "private", - "this", "break", "double", "implements", "protected", "throw", - "byte", "else", "import", "public", "throws", "case", "enum", - "instanceof", "return", "transient", "catch", "extends", "int", - "short", "try", "char", "final", "interface", "static", "void", - "class", "finally", "const", "super", "while")); + reservedWords = new HashSet(Arrays.asList("abstract", "await", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "yield")); languageSpecificPrimitives = new HashSet(Arrays.asList( "String", @@ -79,7 +74,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp return name; // camelize the variable name - // pet_id => PetId + // pet_id => petId name = camelize(name, true); // for reserved word or word starting with number, append _ @@ -141,4 +136,20 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp type = swaggerType; return type; } + + @Override + public String toOperationId(String operationId) { + // throw exception if method name is empty + if (StringUtils.isEmpty(operationId)) { + throw new RuntimeException("Empty method name (operationId) not allowed"); + } + + // method name cannot use reserved keyword, e.g. return + // append _ at the beginning, e.g. _return + if (reservedWords.contains(operationId)) { + return escapeReservedWord(camelize(sanitizeName(operationId), true)); + } + + return camelize(sanitizeName(operationId), true); + } } diff --git a/samples/client/petstore/typescript-angular/API/Client/Category.ts b/samples/client/petstore/typescript-angular/API/Client/Category.ts index 532d9bb08566..ad34870b31aa 100644 --- a/samples/client/petstore/typescript-angular/API/Client/Category.ts +++ b/samples/client/petstore/typescript-angular/API/Client/Category.ts @@ -3,22 +3,11 @@ namespace API.Client { 'use strict'; - - - export interface Category { - - id: number; - - name: string; - } - - - } diff --git a/samples/client/petstore/typescript-angular/API/Client/Order.ts b/samples/client/petstore/typescript-angular/API/Client/Order.ts index 11a0fafe293b..dfffcd3d8284 100644 --- a/samples/client/petstore/typescript-angular/API/Client/Order.ts +++ b/samples/client/petstore/typescript-angular/API/Client/Order.ts @@ -3,65 +3,30 @@ namespace API.Client { 'use strict'; - - - export interface Order { - - id: number; - - petId: number; - - quantity: number; - - shipDate: Date; - - /** * Order Status */ - status: Order.StatusEnum; - - complete: boolean; - } - export namespace Order { - - - - - - - - - - export enum StatusEnum { placed = 'placed', approved = 'approved', delivered = 'delivered', } - - - - } - - - } diff --git a/samples/client/petstore/typescript-angular/API/Client/Pet.ts b/samples/client/petstore/typescript-angular/API/Client/Pet.ts index acbb6bcb6c25..fa86c457fcf0 100644 --- a/samples/client/petstore/typescript-angular/API/Client/Pet.ts +++ b/samples/client/petstore/typescript-angular/API/Client/Pet.ts @@ -3,65 +3,30 @@ namespace API.Client { 'use strict'; - - - export interface Pet { - - id: number; - - category: Category; - - name: string; - - photoUrls: Array; - - tags: Array; - - /** * pet status in the store */ - status: Pet.StatusEnum; - } - export namespace Pet { - - - - - - - - - - - - export enum StatusEnum { available = 'available', pending = 'pending', sold = 'sold', } - - } - - - } diff --git a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts index 6e7dd50c6aa7..7c89b754914a 100644 --- a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts @@ -2,11 +2,9 @@ /* tslint:disable:no-unused-variable member-ordering */ - namespace API.Client { 'use strict'; - export class PetApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : any = {}; @@ -29,20 +27,11 @@ namespace API.Client { } - public updatePet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const path = this.basePath + '/pet'; let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - - - - - - - - let httpRequestParams: any = { method: 'PUT', url: path, @@ -61,20 +50,11 @@ namespace API.Client { return this.$http(httpRequestParams); } - public addPet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const path = this.basePath + '/pet'; let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - - - - - - - - let httpRequestParams: any = { method: 'POST', url: path, @@ -93,25 +73,15 @@ namespace API.Client { return this.$http(httpRequestParams); } - public findPetsByStatus (status?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const path = this.basePath + '/pet/findByStatus'; let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - - - - - if (status !== undefined) { queryParameters['status'] = status; } - - - - let httpRequestParams: any = { method: 'GET', url: path, @@ -129,25 +99,15 @@ namespace API.Client { return this.$http(httpRequestParams); } - public findPetsByTags (tags?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> { const path = this.basePath + '/pet/findByTags'; let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - - - - - if (tags !== undefined) { queryParameters['tags'] = tags; } - - - - let httpRequestParams: any = { method: 'GET', url: path, @@ -165,26 +125,16 @@ namespace API.Client { return this.$http(httpRequestParams); } - public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise { const path = this.basePath + '/pet/{petId}' .replace('{' + 'petId' + '}', String(petId)); let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - - - // verify required parameter 'petId' is set if (!petId) { throw new Error('Missing required parameter petId when calling getPetById'); } - - - - - - let httpRequestParams: any = { method: 'GET', url: path, @@ -202,42 +152,24 @@ namespace API.Client { return this.$http(httpRequestParams); } - public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const path = this.basePath + '/pet/{petId}' .replace('{' + 'petId' + '}', String(petId)); let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'petId' is set if (!petId) { throw new Error('Missing required parameter petId when calling updatePetWithForm'); } - - - - - - - - - headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; - - formParams['name'] = name; - formParams['status'] = status; - let httpRequestParams: any = { method: 'POST', url: path, @@ -256,31 +188,18 @@ namespace API.Client { return this.$http(httpRequestParams); } - public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const path = this.basePath + '/pet/{petId}' .replace('{' + 'petId' + '}', String(petId)); let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - - - // verify required parameter 'petId' is set if (!petId) { throw new Error('Missing required parameter petId when calling deletePet'); } - - - - - - headerParams['api_key'] = apiKey; - - - let httpRequestParams: any = { method: 'DELETE', url: path, @@ -298,42 +217,24 @@ namespace API.Client { return this.$http(httpRequestParams); } - public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { const path = this.basePath + '/pet/{petId}/uploadImage' .replace('{' + 'petId' + '}', String(petId)); let queryParameters: any = {}; let headerParams: any = this.extendObj({}, this.defaultHeaders); - let formParams: any = {}; - - - // verify required parameter 'petId' is set if (!petId) { throw new Error('Missing required parameter petId when calling uploadFile'); } - - - - - - - - - headerParams['Content-Type'] = 'application/x-www-form-urlencoded'; - - formParams['additionalMetadata'] = additionalMetadata; - formParams['file'] = file; - let httpRequestParams: any = { method: 'POST', url: path, @@ -351,7 +252,5 @@ namespace API.Client { return this.$http(httpRequestParams); } - } } - diff --git a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts index 739f6039e6c5..801a86a4a04e 100644 --- a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts @@ -2,26 +2,37 @@ /* tslint:disable:no-unused-variable member-ordering */ -module API.Client { +namespace API.Client { 'use strict'; export class StoreApi { - private basePath = 'http://petstore.swagger.io/v2'; + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; static $inject: string[] = ['$http', '$httpParamSerializer']; - constructor(private $http: ng.IHttpService, basePath?: string, private $httpParamSerializer?: (any) => any) { + constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) { if (basePath) { this.basePath = basePath; } } - public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> { - var path = this.basePath + '/store/inventory'; + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } - var queryParameters: any = {}; - var headerParams: any = {}; - var httpRequestParams: any = { + + public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> { + const path = this.basePath + '/store/inventory'; + + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let httpRequestParams: any = { method: 'GET', url: path, json: true, @@ -32,22 +43,18 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public placeOrder (body?: Order, extraHttpRequestParams?: any ) : ng.IHttpPromise { - var path = this.basePath + '/store/order'; + const path = this.basePath + '/store/order'; - var queryParameters: any = {}; - var headerParams: any = {}; - var httpRequestParams: any = { + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let httpRequestParams: any = { method: 'POST', url: path, json: true, @@ -59,29 +66,23 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { - var path = this.basePath + '/store/order/{orderId}'; + const path = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); - path = path.replace('{' + 'orderId' + '}', String(orderId)); - - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); // verify required parameter 'orderId' is set if (!orderId) { throw new Error('Missing required parameter orderId when calling getOrderById'); } - - var httpRequestParams: any = { + let httpRequestParams: any = { method: 'GET', url: path, json: true, @@ -92,29 +93,23 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/store/order/{orderId}'; + const path = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); - path = path.replace('{' + 'orderId' + '}', String(orderId)); - - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); // verify required parameter 'orderId' is set if (!orderId) { throw new Error('Missing required parameter orderId when calling deleteOrder'); } - - var httpRequestParams: any = { + let httpRequestParams: any = { method: 'DELETE', url: path, json: true, @@ -125,11 +120,7 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); diff --git a/samples/client/petstore/typescript-angular/API/Client/Tag.ts b/samples/client/petstore/typescript-angular/API/Client/Tag.ts index 525d5ff8ab11..d206559a0ef7 100644 --- a/samples/client/petstore/typescript-angular/API/Client/Tag.ts +++ b/samples/client/petstore/typescript-angular/API/Client/Tag.ts @@ -3,22 +3,11 @@ namespace API.Client { 'use strict'; - - - export interface Tag { - - id: number; - - name: string; - } - - - } diff --git a/samples/client/petstore/typescript-angular/API/Client/User.ts b/samples/client/petstore/typescript-angular/API/Client/User.ts index 274b2e866e32..e60f84bb6c6d 100644 --- a/samples/client/petstore/typescript-angular/API/Client/User.ts +++ b/samples/client/petstore/typescript-angular/API/Client/User.ts @@ -3,50 +3,26 @@ namespace API.Client { 'use strict'; - - - export interface User { - - id: number; - - username: string; - - firstName: string; - - lastName: string; - - email: string; - - password: string; - - phone: string; - - /** * User Status */ - userStatus: number; - } - - - } diff --git a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts index 26ebd693db94..4deb8bc6ebe3 100644 --- a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts +++ b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts @@ -2,26 +2,37 @@ /* tslint:disable:no-unused-variable member-ordering */ -module API.Client { +namespace API.Client { 'use strict'; export class UserApi { - private basePath = 'http://petstore.swagger.io/v2'; + protected basePath = 'http://petstore.swagger.io/v2'; + public defaultHeaders : any = {}; static $inject: string[] = ['$http', '$httpParamSerializer']; - constructor(private $http: ng.IHttpService, basePath?: string, private $httpParamSerializer?: (any) => any) { + constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) { if (basePath) { this.basePath = basePath; } } - public createUser (body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/user'; + private extendObj(objA: T1, objB: T2) { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } - var queryParameters: any = {}; - var headerParams: any = {}; - var httpRequestParams: any = { + + public createUser (body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { + const path = this.basePath + '/user'; + + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let httpRequestParams: any = { method: 'POST', url: path, json: true, @@ -33,22 +44,18 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public createUsersWithArrayInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/user/createWithArray'; + const path = this.basePath + '/user/createWithArray'; - var queryParameters: any = {}; - var headerParams: any = {}; - var httpRequestParams: any = { + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let httpRequestParams: any = { method: 'POST', url: path, json: true, @@ -60,22 +67,18 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public createUsersWithListInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/user/createWithList'; + const path = this.basePath + '/user/createWithList'; - var queryParameters: any = {}; - var headerParams: any = {}; - var httpRequestParams: any = { + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let httpRequestParams: any = { method: 'POST', url: path, json: true, @@ -87,21 +90,17 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public loginUser (username?: string, password?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { - var path = this.basePath + '/user/login'; + const path = this.basePath + '/user/login'; - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); if (username !== undefined) { queryParameters['username'] = username; } @@ -110,7 +109,7 @@ module API.Client { queryParameters['password'] = password; } - var httpRequestParams: any = { + let httpRequestParams: any = { method: 'GET', url: path, json: true, @@ -121,22 +120,18 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public logoutUser (extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/user/logout'; + const path = this.basePath + '/user/logout'; - var queryParameters: any = {}; - var headerParams: any = {}; - var httpRequestParams: any = { + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + let httpRequestParams: any = { method: 'GET', url: path, json: true, @@ -147,29 +142,23 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise { - var path = this.basePath + '/user/{username}'; + const path = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); - path = path.replace('{' + 'username' + '}', String(username)); - - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); // verify required parameter 'username' is set if (!username) { throw new Error('Missing required parameter username when calling getUserByName'); } - - var httpRequestParams: any = { + let httpRequestParams: any = { method: 'GET', url: path, json: true, @@ -180,29 +169,23 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public updateUser (username: string, body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/user/{username}'; + const path = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); - path = path.replace('{' + 'username' + '}', String(username)); - - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); // verify required parameter 'username' is set if (!username) { throw new Error('Missing required parameter username when calling updateUser'); } - - var httpRequestParams: any = { + let httpRequestParams: any = { method: 'PUT', url: path, json: true, @@ -214,29 +197,23 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams); } public deleteUser (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> { - var path = this.basePath + '/user/{username}'; + const path = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); - path = path.replace('{' + 'username' + '}', String(username)); - - var queryParameters: any = {}; - var headerParams: any = {}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); // verify required parameter 'username' is set if (!username) { throw new Error('Missing required parameter username when calling deleteUser'); } - - var httpRequestParams: any = { + let httpRequestParams: any = { method: 'DELETE', url: path, json: true, @@ -247,11 +224,7 @@ module API.Client { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams) { - if (extraHttpRequestParams.hasOwnProperty(k)) { - httpRequestParams[k] = extraHttpRequestParams[k]; - } - } + httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams); } return this.$http(httpRequestParams);