diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache index debe4c15a54..371db3a8d9d 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; {{#useHttpClient}} @@ -65,7 +65,7 @@ export class {{classname}} { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -170,14 +170,14 @@ export class {{classname}} { // authentication ({{name}}) required {{#isApiKey}} {{#isKeyInHeader}} - if (this.configuration.apiKeys["{{keyParamName}}"]) { - {{#useHttpClient}}headers = {{/useHttpClient}}headers.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]); + if (this.configuration.apiKeys['{{keyParamName}}']) { + {{#useHttpClient}}headers = {{/useHttpClient}}headers.set('{{keyParamName}}', this.configuration.apiKeys['{{keyParamName}}']); } {{/isKeyInHeader}} {{#isKeyInQuery}} - if (this.configuration.apiKeys["{{keyParamName}}"]) { - {{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]); + if (this.configuration.apiKeys['{{keyParamName}}']) { + {{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{keyParamName}}', this.configuration.apiKeys['{{keyParamName}}']); } {{/isKeyInQuery}} @@ -199,35 +199,35 @@ export class {{classname}} { {{/isOAuth}} {{/authMethods}} // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ {{#produces}} '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} {{/produces}} ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { {{^useHttpClient}} - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); {{/useHttpClient}} {{#useHttpClient}} - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); {{/useHttpClient}} } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ {{#consumes}} '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} {{/consumes}} ]; {{#bodyParam}} - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { {{^useHttpClient}} headers.set('Content-Type', httpContentTypeSelected); {{/useHttpClient}} {{#useHttpClient}} - headers = headers.set("Content-Type", httpContentTypeSelected); + headers = headers.set('Content-Type', httpContentTypeSelected); {{/useHttpClient}} } {{/bodyParam}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache index d486fc9f97d..a8a63d5ae1c 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache @@ -28,15 +28,15 @@ export class Configuration { * Select the correct content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} contentTypes - the array of content types that are available for selection + * @param {Array} contentTypes - the array of content types that are available for selection * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderContentType (contentTypes: string[]): string { - if (contentTypes.length == 0) { + selectHeaderContentType(contentTypes: Array): string { + if (contentTypes.length === 0) { return undefined; } - let type = contentTypes.find(x => this.isJsonMime(x)); + const type = contentTypes.find(x => this.isJsonMime(x)); if (type === undefined) { return contentTypes[0]; } @@ -47,15 +47,15 @@ export class Configuration { * Select the correct accept content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} accepts - the array of content types that are available for selection. + * @param {Array} accepts - the array of content types that are available for selection. * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderAccept(accepts: string[]): string { - if (accepts.length == 0) { + selectHeaderAccept(accepts: Array): string { + if (accepts.length === 0) { return undefined; } - let type = accepts.find(x => this.isJsonMime(x)); + const type = accepts.find(x => this.isJsonMime(x)); if (type === undefined) { return accepts[0]; } @@ -72,7 +72,7 @@ export class Configuration { * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) * @return {boolean} True if the given MIME is JSON, false otherwise. */ - public isJsonMime(mime: string): boolean { + isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); } diff --git a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts index 4435de468a2..8d12d2f3463 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -50,7 +50,7 @@ export class PetService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -213,22 +213,22 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -271,17 +271,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -323,17 +323,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -376,17 +376,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -416,22 +416,22 @@ export class PetService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -468,22 +468,22 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -524,17 +524,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -597,16 +597,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'multipart/form-data' ]; diff --git a/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts index 3eb043313ff..6181038bff7 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -49,7 +49,7 @@ export class StoreService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -134,17 +134,17 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -169,21 +169,21 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -212,17 +212,17 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -251,20 +251,20 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts index 7fd15126b81..e2c69037190 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -49,7 +49,7 @@ export class UserService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -200,20 +200,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -244,20 +244,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -288,20 +288,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -332,17 +332,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -371,17 +371,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -422,17 +422,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -458,17 +458,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -501,20 +501,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v2/default/configuration.ts b/samples/client/petstore/typescript-angular-v2/default/configuration.ts index d486fc9f97d..a8a63d5ae1c 100644 --- a/samples/client/petstore/typescript-angular-v2/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v2/default/configuration.ts @@ -28,15 +28,15 @@ export class Configuration { * Select the correct content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} contentTypes - the array of content types that are available for selection + * @param {Array} contentTypes - the array of content types that are available for selection * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderContentType (contentTypes: string[]): string { - if (contentTypes.length == 0) { + selectHeaderContentType(contentTypes: Array): string { + if (contentTypes.length === 0) { return undefined; } - let type = contentTypes.find(x => this.isJsonMime(x)); + const type = contentTypes.find(x => this.isJsonMime(x)); if (type === undefined) { return contentTypes[0]; } @@ -47,15 +47,15 @@ export class Configuration { * Select the correct accept content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} accepts - the array of content types that are available for selection. + * @param {Array} accepts - the array of content types that are available for selection. * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderAccept(accepts: string[]): string { - if (accepts.length == 0) { + selectHeaderAccept(accepts: Array): string { + if (accepts.length === 0) { return undefined; } - let type = accepts.find(x => this.isJsonMime(x)); + const type = accepts.find(x => this.isJsonMime(x)); if (type === undefined) { return accepts[0]; } @@ -72,7 +72,7 @@ export class Configuration { * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) * @return {boolean} True if the given MIME is JSON, false otherwise. */ - public isJsonMime(mime: string): boolean { + isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts index 4435de468a2..8d12d2f3463 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -50,7 +50,7 @@ export class PetService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -213,22 +213,22 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -271,17 +271,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -323,17 +323,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -376,17 +376,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -416,22 +416,22 @@ export class PetService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -468,22 +468,22 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -524,17 +524,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -597,16 +597,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'multipart/form-data' ]; diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts index 3eb043313ff..6181038bff7 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -49,7 +49,7 @@ export class StoreService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -134,17 +134,17 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -169,21 +169,21 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -212,17 +212,17 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -251,20 +251,20 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts index 7fd15126b81..e2c69037190 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -49,7 +49,7 @@ export class UserService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -200,20 +200,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -244,20 +244,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -288,20 +288,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -332,17 +332,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -371,17 +371,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -422,17 +422,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -458,17 +458,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -501,20 +501,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/configuration.ts b/samples/client/petstore/typescript-angular-v2/npm/configuration.ts index d486fc9f97d..a8a63d5ae1c 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/configuration.ts @@ -28,15 +28,15 @@ export class Configuration { * Select the correct content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} contentTypes - the array of content types that are available for selection + * @param {Array} contentTypes - the array of content types that are available for selection * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderContentType (contentTypes: string[]): string { - if (contentTypes.length == 0) { + selectHeaderContentType(contentTypes: Array): string { + if (contentTypes.length === 0) { return undefined; } - let type = contentTypes.find(x => this.isJsonMime(x)); + const type = contentTypes.find(x => this.isJsonMime(x)); if (type === undefined) { return contentTypes[0]; } @@ -47,15 +47,15 @@ export class Configuration { * Select the correct accept content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} accepts - the array of content types that are available for selection. + * @param {Array} accepts - the array of content types that are available for selection. * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderAccept(accepts: string[]): string { - if (accepts.length == 0) { + selectHeaderAccept(accepts: Array): string { + if (accepts.length === 0) { return undefined; } - let type = accepts.find(x => this.isJsonMime(x)); + const type = accepts.find(x => this.isJsonMime(x)); if (type === undefined) { return accepts[0]; } @@ -72,7 +72,7 @@ export class Configuration { * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) * @return {boolean} True if the given MIME is JSON, false otherwise. */ - public isJsonMime(mime: string): boolean { + isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts index 8f606901d00..ec90ca2ab9d 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -51,7 +51,7 @@ export class PetService implements PetServiceInterface { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -214,22 +214,22 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -272,17 +272,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -324,17 +324,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -377,17 +377,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -417,22 +417,22 @@ export class PetService implements PetServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -469,22 +469,22 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -525,17 +525,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -598,16 +598,16 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'multipart/form-data' ]; diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts index 30d37ccf381..e0fec5a936e 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -50,7 +50,7 @@ export class StoreService implements StoreServiceInterface { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -135,17 +135,17 @@ export class StoreService implements StoreServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -170,21 +170,21 @@ export class StoreService implements StoreServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -213,17 +213,17 @@ export class StoreService implements StoreServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -252,20 +252,20 @@ export class StoreService implements StoreServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts index 17b1d6311bd..413d7528692 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -50,7 +50,7 @@ export class UserService implements UserServiceInterface { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -201,20 +201,20 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -245,20 +245,20 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -289,20 +289,20 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -333,17 +333,17 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -372,17 +372,17 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -423,17 +423,17 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -459,17 +459,17 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -502,20 +502,20 @@ export class UserService implements UserServiceInterface { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts index d486fc9f97d..a8a63d5ae1c 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts @@ -28,15 +28,15 @@ export class Configuration { * Select the correct content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} contentTypes - the array of content types that are available for selection + * @param {Array} contentTypes - the array of content types that are available for selection * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderContentType (contentTypes: string[]): string { - if (contentTypes.length == 0) { + selectHeaderContentType(contentTypes: Array): string { + if (contentTypes.length === 0) { return undefined; } - let type = contentTypes.find(x => this.isJsonMime(x)); + const type = contentTypes.find(x => this.isJsonMime(x)); if (type === undefined) { return contentTypes[0]; } @@ -47,15 +47,15 @@ export class Configuration { * Select the correct accept content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} accepts - the array of content types that are available for selection. + * @param {Array} accepts - the array of content types that are available for selection. * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderAccept(accepts: string[]): string { - if (accepts.length == 0) { + selectHeaderAccept(accepts: Array): string { + if (accepts.length === 0) { return undefined; } - let type = accepts.find(x => this.isJsonMime(x)); + const type = accepts.find(x => this.isJsonMime(x)); if (type === undefined) { return accepts[0]; } @@ -72,7 +72,7 @@ export class Configuration { * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) * @return {boolean} True if the given MIME is JSON, false otherwise. */ - public isJsonMime(mime: string): boolean { + isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); } diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts index e6dbfc38628..911a6f93aed 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; @@ -48,7 +48,7 @@ export class PetService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -78,23 +78,23 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/pet`, @@ -131,17 +131,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, @@ -178,17 +178,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/pet/findByStatus`, @@ -226,17 +226,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/pet/findByTags`, @@ -261,22 +261,22 @@ export class PetService { let headers = this.defaultHeaders; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers = headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers = headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, @@ -308,23 +308,23 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.put(`${this.basePath}/pet`, @@ -359,17 +359,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -423,16 +423,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'multipart/form-data' ]; diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts index e381873818a..b0db2e99171 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; @@ -47,7 +47,7 @@ export class StoreService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -69,17 +69,17 @@ export class StoreService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, @@ -99,21 +99,21 @@ export class StoreService { let headers = this.defaultHeaders; // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers = headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers = headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/store/inventory`, @@ -137,17 +137,17 @@ export class StoreService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, @@ -171,21 +171,21 @@ export class StoreService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/store/order`, diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts index 55fb2bb500b..f0568c8b178 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; @@ -47,7 +47,7 @@ export class UserService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -69,21 +69,21 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/user`, @@ -108,21 +108,21 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/user/createWithArray`, @@ -147,21 +147,21 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/user/createWithList`, @@ -186,17 +186,17 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, @@ -220,17 +220,17 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, @@ -266,17 +266,17 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/user/login`, @@ -297,17 +297,17 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get(`${this.basePath}/user/logout`, @@ -335,21 +335,21 @@ export class UserService { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts b/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts index d486fc9f97d..a8a63d5ae1c 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts @@ -28,15 +28,15 @@ export class Configuration { * Select the correct content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} contentTypes - the array of content types that are available for selection + * @param {Array} contentTypes - the array of content types that are available for selection * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderContentType (contentTypes: string[]): string { - if (contentTypes.length == 0) { + selectHeaderContentType(contentTypes: Array): string { + if (contentTypes.length === 0) { return undefined; } - let type = contentTypes.find(x => this.isJsonMime(x)); + const type = contentTypes.find(x => this.isJsonMime(x)); if (type === undefined) { return contentTypes[0]; } @@ -47,15 +47,15 @@ export class Configuration { * Select the correct accept content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} accepts - the array of content types that are available for selection. + * @param {Array} accepts - the array of content types that are available for selection. * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderAccept(accepts: string[]): string { - if (accepts.length == 0) { + selectHeaderAccept(accepts: Array): string { + if (accepts.length === 0) { return undefined; } - let type = accepts.find(x => this.isJsonMime(x)); + const type = accepts.find(x => this.isJsonMime(x)); if (type === undefined) { return accepts[0]; } @@ -72,7 +72,7 @@ export class Configuration { * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) * @return {boolean} True if the given MIME is JSON, false otherwise. */ - public isJsonMime(mime: string): boolean { + isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts index 4435de468a2..8d12d2f3463 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -50,7 +50,7 @@ export class PetService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -213,22 +213,22 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -271,17 +271,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -323,17 +323,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -376,17 +376,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -416,22 +416,22 @@ export class PetService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -468,22 +468,22 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -524,17 +524,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -597,16 +597,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'multipart/form-data' ]; diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts index 3eb043313ff..6181038bff7 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -49,7 +49,7 @@ export class StoreService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -134,17 +134,17 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -169,21 +169,21 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // authentication (api_key) required - if (this.configuration.apiKeys["api_key"]) { - headers.set('api_key', this.configuration.apiKeys["api_key"]); + if (this.configuration.apiKeys['api_key']) { + headers.set('api_key', this.configuration.apiKeys['api_key']); } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -212,17 +212,17 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -251,20 +251,20 @@ export class StoreService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts index 7fd15126b81..e2c69037190 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts @@ -9,7 +9,7 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -/* tslint:disable:no-unused-variable member-ordering */ +/* tslint:disable:no-unused-variable member-ordering import-spacing*/ import { Inject, Injectable, Optional } from '@angular/core'; import { Http, Headers, URLSearchParams } from '@angular/http'; @@ -49,7 +49,7 @@ export class UserService { */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; - for (let consume of consumes) { + for (const consume of consumes) { if (form === consume) { return true; } @@ -200,20 +200,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -244,20 +244,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -288,20 +288,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -332,17 +332,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -371,17 +371,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -422,17 +422,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -458,17 +458,17 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -501,20 +501,20 @@ export class UserService { let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + const httpHeaderAcceptSelected: string = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { + const httpContentTypeSelected: string = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { headers.set('Content-Type', httpContentTypeSelected); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/configuration.ts b/samples/client/petstore/typescript-angular-v4/npm/configuration.ts index d486fc9f97d..a8a63d5ae1c 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/configuration.ts @@ -28,15 +28,15 @@ export class Configuration { * Select the correct content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} contentTypes - the array of content types that are available for selection + * @param {Array} contentTypes - the array of content types that are available for selection * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderContentType (contentTypes: string[]): string { - if (contentTypes.length == 0) { + selectHeaderContentType(contentTypes: Array): string { + if (contentTypes.length === 0) { return undefined; } - let type = contentTypes.find(x => this.isJsonMime(x)); + const type = contentTypes.find(x => this.isJsonMime(x)); if (type === undefined) { return contentTypes[0]; } @@ -47,15 +47,15 @@ export class Configuration { * Select the correct accept content-type to use for a request. * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. * If no content type is found return the first found type if the contentTypes is not empty - * @param {string[]} accepts - the array of content types that are available for selection. + * @param {Array} accepts - the array of content types that are available for selection. * @returns {string} the selected content-type or undefined if no selection could be made. */ - public selectHeaderAccept(accepts: string[]): string { - if (accepts.length == 0) { + selectHeaderAccept(accepts: Array): string { + if (accepts.length === 0) { return undefined; } - let type = accepts.find(x => this.isJsonMime(x)); + const type = accepts.find(x => this.isJsonMime(x)); if (type === undefined) { return accepts[0]; } @@ -72,7 +72,7 @@ export class Configuration { * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) * @return {boolean} True if the given MIME is JSON, false otherwise. */ - public isJsonMime(mime: string): boolean { + isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); }