From 6cf8b0d75f352ccfa084e721c48377ce941091c0 Mon Sep 17 00:00:00 2001 From: Kevin Brey Date: Fri, 5 Jan 2018 00:50:48 -0600 Subject: [PATCH 1/2] style(typescript-angular): conform to tslint rules --- .../typescript-angular/api.module.mustache | 2 +- .../typescript-angular/api.service.mustache | 53 ++++++++++--------- .../typescript-angular/configuration.mustache | 14 ++--- .../typescript-angular/index.mustache | 2 +- .../typescript-angular/variables.mustache | 2 +- 5 files changed, 39 insertions(+), 34 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache index f4ae7435980..d892851df20 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache @@ -27,7 +27,7 @@ export class ApiModule { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ] - } + }; } constructor( @Optional() @SkipSelf() parentModule: ApiModule) { 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 c8c8df6c0d6..975c7e51d0a 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,20 +1,25 @@ {{>licenseInfo}} /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; +import { Inject, Injectable, Optional } from '@angular/core'; {{#useHttpClient}} -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent +} from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; {{/useHttpClient}} {{^useHttpClient}} -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; {{/useHttpClient}} -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; {{^useHttpClient}} import '../rxjs-operators'; {{/useHttpClient}} @@ -23,10 +28,10 @@ import '../rxjs-operators'; import { {{classname}} } from '../{{filename}}'; {{/imports}} -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; {{#withInterfaces}} -import { {{classname}}Interface } from './{{classname}}Interface'; +import { {{classname}}Interface } from './{{classname}}Interface'; {{/withInterfaces}} {{#operations}} @@ -48,7 +53,7 @@ export class {{classname}} { public defaultHeaders = new {{#useHttpClient}}Http{{/useHttpClient}}Headers(); public configuration = new Configuration(); - constructor(protected {{#useHttpClient}}httpClient: HttpClient{{/useHttpClient}}{{^useHttpClient}}http: Http{{/useHttpClient}}, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected {{#useHttpClient}}httpClient: HttpClient{{/useHttpClient}}{{^useHttpClient}}http: Http{{/useHttpClient}}, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -64,7 +69,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; } @@ -115,7 +120,7 @@ export class {{classname}} { public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe?: 'body', reportProgress?: boolean): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>; public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe?: 'response', reportProgress?: boolean): Observable>; public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe?: 'events', reportProgress?: boolean): Observable>; - public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe: any = 'body', reportProgress: boolean = false ): Observable { + public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe: any = 'body', reportProgress: boolean = false): Observable { {{/useHttpClient}} {{^useHttpClient}} public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -130,7 +135,7 @@ export class {{classname}} { {{#hasQueryParams}} {{#useHttpClient}} - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); {{/useHttpClient}} {{^useHttpClient}} let queryParameters = new URLSearchParams('', new CustomQueryEncoderHelper()); @@ -208,35 +213,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = 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 | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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}} @@ -258,7 +263,7 @@ export class {{classname}} { formParams = new FormData(); } else { {{#useHttpClient}} - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); {{/useHttpClient}} {{^useHttpClient}} // TODO: this fails if a parameter is a file, the api can't consume "multipart/form-data" and a blob is passed. @@ -298,7 +303,7 @@ export class {{classname}} { params: queryParameters, {{/hasQueryParams}} {{#isResponseFile}} - responseType: "blob", + responseType: 'blob', {{/isResponseFile}} withCredentials: this.configuration.withCredentials, headers: headers, 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 2ee1824f5f7..8d150d652fa 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/configuration.mustache @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -31,12 +31,12 @@ export class Configuration { * @param {string[]} 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 | undefined { - if (contentTypes.length == 0) { + public selectHeaderContentType(contentTypes: string[]): string | undefined { + 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]; } @@ -51,11 +51,11 @@ export class Configuration { * @returns {string} the selected content-type or undefined if no selection could be made. */ public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { + 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]; } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache index c312b70fa3e..410623f1c9f 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/variables.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/variables.mustache index b3241fcebcd..4f195e7ba75 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/variables.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/variables.mustache @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; From a62fe329b1b1f9fa3a5609c03c244515998016d9 Mon Sep 17 00:00:00 2001 From: Kevin Brey Date: Fri, 5 Jan 2018 01:01:24 -0600 Subject: [PATCH 2/2] docs(typescript-angular): update samples --- .../.swagger-codegen/VERSION | 2 +- .../typescript-angular/api.module.ts | 19 ++- .../typescript-angular/api/fake.service.ts | 69 ++++++---- .../typescript-angular/configuration.ts | 57 +++++++- .../typescript-angular/git_push.sh | 2 +- .../typescript-angular/index.ts | 2 +- .../typescript-angular/model/modelReturn.ts | 26 ++++ .../typescript-angular/variables.ts | 2 +- .../.swagger-codegen/VERSION | 2 +- .../typescript-angular2/api.module.ts | 19 ++- .../typescript-angular2/api/fake.service.ts | 69 ++++++---- .../typescript-angular2/configuration.ts | 57 +++++++- .../typescript-angular2/git_push.sh | 2 +- .../typescript-angular2/index.ts | 2 +- .../typescript-angular2/model/modelReturn.ts | 26 ++++ .../typescript-angular2/variables.ts | 2 +- .../default/.swagger-codegen/VERSION | 2 +- .../default/api.module.ts | 2 +- .../default/api/pet.service.ts | 86 ++++++------ .../default/api/store.service.ts | 52 ++++---- .../default/api/user.service.ts | 90 ++++++------- .../default/configuration.ts | 14 +- .../typescript-angular-v2/default/index.ts | 2 +- .../default/model/apiResponse.ts | 21 +++ .../default/variables.ts | 2 +- .../npm/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v2/npm/api.module.ts | 2 +- .../npm/api/pet.service.ts | 86 ++++++------ .../npm/api/store.service.ts | 52 ++++---- .../npm/api/user.service.ts | 90 ++++++------- .../npm/configuration.ts | 14 +- .../typescript-angular-v2/npm/index.ts | 2 +- .../npm/model/apiResponse.ts | 21 +++ .../typescript-angular-v2/npm/variables.ts | 2 +- .../with-interfaces/.swagger-codegen/VERSION | 2 +- .../with-interfaces/api.module.ts | 2 +- .../with-interfaces/api/pet.service.ts | 88 ++++++------- .../with-interfaces/api/store.service.ts | 54 ++++---- .../with-interfaces/api/user.service.ts | 92 ++++++------- .../with-interfaces/configuration.ts | 14 +- .../with-interfaces/index.ts | 2 +- .../with-interfaces/model/category.ts | 20 +++ .../with-interfaces/model/order.ts | 35 +++++ .../with-interfaces/model/pet.ts | 37 ++++++ .../with-interfaces/model/tag.ts | 20 +++ .../with-interfaces/model/user.ts | 29 +++++ .../with-interfaces/variables.ts | 2 +- .../npm/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v4.3/npm/api.module.ts | 2 +- .../npm/api/pet.service.ts | 121 ++++++++--------- .../npm/api/store.service.ts | 69 +++++----- .../npm/api/user.service.ts | 123 +++++++++--------- .../npm/configuration.ts | 14 +- .../typescript-angular-v4.3/npm/index.ts | 2 +- .../typescript-angular-v4.3/npm/variables.ts | 2 +- .../npm/.swagger-codegen/VERSION | 2 +- .../typescript-angular-v4/npm/api.module.ts | 2 +- .../npm/api/pet.service.ts | 86 ++++++------ .../npm/api/store.service.ts | 52 ++++---- .../npm/api/user.service.ts | 90 ++++++------- .../npm/configuration.ts | 14 +- .../typescript-angular-v4/npm/index.ts | 2 +- .../typescript-angular-v4/npm/variables.ts | 2 +- 63 files changed, 1147 insertions(+), 735 deletions(-) create mode 100644 samples/client/petstore-security-test/typescript-angular/model/modelReturn.ts create mode 100644 samples/client/petstore-security-test/typescript-angular2/model/modelReturn.ts create mode 100644 samples/client/petstore/typescript-angular-v2/default/model/apiResponse.ts create mode 100644 samples/client/petstore/typescript-angular-v2/npm/model/apiResponse.ts create mode 100644 samples/client/petstore/typescript-angular-v2/with-interfaces/model/category.ts create mode 100644 samples/client/petstore/typescript-angular-v2/with-interfaces/model/order.ts create mode 100644 samples/client/petstore/typescript-angular-v2/with-interfaces/model/pet.ts create mode 100644 samples/client/petstore/typescript-angular-v2/with-interfaces/model/tag.ts create mode 100644 samples/client/petstore/typescript-angular-v2/with-interfaces/model/user.ts diff --git a/samples/client/petstore-security-test/typescript-angular/.swagger-codegen/VERSION b/samples/client/petstore-security-test/typescript-angular/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore-security-test/typescript-angular/.swagger-codegen/VERSION +++ b/samples/client/petstore-security-test/typescript-angular/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-angular/api.module.ts b/samples/client/petstore-security-test/typescript-angular/api.module.ts index c3bde487bc4..56fdad2d212 100644 --- a/samples/client/petstore-security-test/typescript-angular/api.module.ts +++ b/samples/client/petstore-security-test/typescript-angular/api.module.ts @@ -1,21 +1,28 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; +import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { HttpModule } from '@angular/http'; +import { HttpClientModule } from '@angular/common/http'; import { Configuration } from './configuration'; import { FakeService } from './api/fake.service'; @NgModule({ - imports: [ CommonModule, HttpModule ], + imports: [ CommonModule, HttpClientModule ], declarations: [], exports: [], - providers: [ FakeService ] + providers: [ + FakeService ] }) export class ApiModule { - public static forConfig(configurationFactory: () => Configuration): ModuleWithProviders { + public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { return { ngModule: ApiModule, - providers: [ {provide: Configuration, useFactory: configurationFactory}] + providers: [ { provide: Configuration, useFactory: configurationFactory } ] + }; + } + + constructor( @Optional() @SkipSelf() parentModule: ApiModule) { + if (parentModule) { + throw new Error('ApiModule is already loaded. Import your base AppModule only.'); } } } diff --git a/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts index ec51d332251..4d44ed21ea2 100644 --- a/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts @@ -9,19 +9,23 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent +} from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import { Observable } from 'rxjs/Observable'; -import '../rxjs-operators'; +import { Observable } from 'rxjs/Observable'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -31,7 +35,7 @@ export class FakeService { public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -47,7 +51,7 @@ export class FakeService { */ 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; } @@ -56,21 +60,36 @@ export class FakeService { } - /** * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param testCodeInjectEndRnNR To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. */ - public testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string): Observable<{}> { + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'body', reportProgress?: boolean): Observable; + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json', + '*_/ =end -- ' + ]; + const httpHeaderAcceptSelected: string | undefined = 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', '*_/ =end -- ' ]; + const canConsumeForm = this.canConsumeForm(consumes); let formParams: { append(param: string, value: any): void; }; @@ -79,20 +98,22 @@ export class FakeService { if (useForm) { formParams = new FormData(); } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); } - - - if (test code inject * ' " =end rn n r !== undefined) { - formParams = formParams.append('test code inject */ ' " =end -- \r\n \n \r', test code inject * ' " =end rn n r) || formParams; + if (testCodeInjectEndRnNR !== undefined) { + formParams = formParams.append('test code inject */ ' " =end -- \r\n \n \r', testCodeInjectEndRnNR) || formParams; } - return this.httpClient.put(`${this.basePath}/fake`, - convertFormParamsToString ? formParams.toString() : formParams, { - headers: headers, - withCredentials: this.configuration.withCredentials, - }); + return this.httpClient.put(`${this.basePath}/fake`, + convertFormParamsToString ? formParams.toString() : formParams, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } } diff --git a/samples/client/petstore-security-test/typescript-angular/configuration.ts b/samples/client/petstore-security-test/typescript-angular/configuration.ts index 005c3a26df3..8d150d652fa 100644 --- a/samples/client/petstore-security-test/typescript-angular/configuration.ts +++ b/samples/client/petstore-security-test/typescript-angular/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -23,4 +23,57 @@ export class Configuration { this.basePath = configurationParameters.basePath; this.withCredentials = configurationParameters.withCredentials; } + + /** + * 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 + * @returns {string} the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType(contentTypes: string[]): string | undefined { + if (contentTypes.length === 0) { + return undefined; + } + + const type = contentTypes.find(x => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; + } + + /** + * 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. + * @returns {string} the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length === 0) { + return undefined; + } + + const type = accepts.find(x => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) + * @return {boolean} True if the given MIME is JSON, false otherwise. + */ + public 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-security-test/typescript-angular/git_push.sh b/samples/client/petstore-security-test/typescript-angular/git_push.sh index ed374619b13..ae01b182ae9 100644 --- a/samples/client/petstore-security-test/typescript-angular/git_push.sh +++ b/samples/client/petstore-security-test/typescript-angular/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore-security-test/typescript-angular/index.ts b/samples/client/petstore-security-test/typescript-angular/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore-security-test/typescript-angular/index.ts +++ b/samples/client/petstore-security-test/typescript-angular/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore-security-test/typescript-angular/model/modelReturn.ts b/samples/client/petstore-security-test/typescript-angular/model/modelReturn.ts new file mode 100644 index 00000000000..e2360156a9d --- /dev/null +++ b/samples/client/petstore-security-test/typescript-angular/model/modelReturn.ts @@ -0,0 +1,26 @@ +/** + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- + * + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + + +/** + * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r + */ +export interface ModelReturn { + /** + * property description *_/ ' \" =end -- \\r\\n \\n \\r + */ + return?: number; + +} + + diff --git a/samples/client/petstore-security-test/typescript-angular/variables.ts b/samples/client/petstore-security-test/typescript-angular/variables.ts index 6fe58549f39..af365dcef19 100644 --- a/samples/client/petstore-security-test/typescript-angular/variables.ts +++ b/samples/client/petstore-security-test/typescript-angular/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; diff --git a/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION b/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION +++ b/samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-angular2/api.module.ts b/samples/client/petstore-security-test/typescript-angular2/api.module.ts index c3bde487bc4..56fdad2d212 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api.module.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api.module.ts @@ -1,21 +1,28 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; +import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { HttpModule } from '@angular/http'; +import { HttpClientModule } from '@angular/common/http'; import { Configuration } from './configuration'; import { FakeService } from './api/fake.service'; @NgModule({ - imports: [ CommonModule, HttpModule ], + imports: [ CommonModule, HttpClientModule ], declarations: [], exports: [], - providers: [ FakeService ] + providers: [ + FakeService ] }) export class ApiModule { - public static forConfig(configurationFactory: () => Configuration): ModuleWithProviders { + public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { return { ngModule: ApiModule, - providers: [ {provide: Configuration, useFactory: configurationFactory}] + providers: [ { provide: Configuration, useFactory: configurationFactory } ] + }; + } + + constructor( @Optional() @SkipSelf() parentModule: ApiModule) { + if (parentModule) { + throw new Error('ApiModule is already loaded. Import your base AppModule only.'); } } } diff --git a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts index ec51d332251..4d44ed21ea2 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts @@ -9,19 +9,23 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent +} from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import { Observable } from 'rxjs/Observable'; -import '../rxjs-operators'; +import { Observable } from 'rxjs/Observable'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -31,7 +35,7 @@ export class FakeService { public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -47,7 +51,7 @@ export class FakeService { */ 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; } @@ -56,21 +60,36 @@ export class FakeService { } - /** * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param testCodeInjectEndRnNR To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. */ - public testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string): Observable<{}> { + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'body', reportProgress?: boolean): Observable; + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json', + '*_/ =end -- ' + ]; + const httpHeaderAcceptSelected: string | undefined = 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', '*_/ =end -- ' ]; + const canConsumeForm = this.canConsumeForm(consumes); let formParams: { append(param: string, value: any): void; }; @@ -79,20 +98,22 @@ export class FakeService { if (useForm) { formParams = new FormData(); } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); } - - - if (test code inject * ' " =end rn n r !== undefined) { - formParams = formParams.append('test code inject */ ' " =end -- \r\n \n \r', test code inject * ' " =end rn n r) || formParams; + if (testCodeInjectEndRnNR !== undefined) { + formParams = formParams.append('test code inject */ ' " =end -- \r\n \n \r', testCodeInjectEndRnNR) || formParams; } - return this.httpClient.put(`${this.basePath}/fake`, - convertFormParamsToString ? formParams.toString() : formParams, { - headers: headers, - withCredentials: this.configuration.withCredentials, - }); + return this.httpClient.put(`${this.basePath}/fake`, + convertFormParamsToString ? formParams.toString() : formParams, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } } diff --git a/samples/client/petstore-security-test/typescript-angular2/configuration.ts b/samples/client/petstore-security-test/typescript-angular2/configuration.ts index 005c3a26df3..8d150d652fa 100644 --- a/samples/client/petstore-security-test/typescript-angular2/configuration.ts +++ b/samples/client/petstore-security-test/typescript-angular2/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -23,4 +23,57 @@ export class Configuration { this.basePath = configurationParameters.basePath; this.withCredentials = configurationParameters.withCredentials; } + + /** + * 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 + * @returns {string} the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType(contentTypes: string[]): string | undefined { + if (contentTypes.length === 0) { + return undefined; + } + + const type = contentTypes.find(x => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; + } + + /** + * 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. + * @returns {string} the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length === 0) { + return undefined; + } + + const type = accepts.find(x => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param {string} mime - MIME (Multipurpose Internet Mail Extensions) + * @return {boolean} True if the given MIME is JSON, false otherwise. + */ + public 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-security-test/typescript-angular2/git_push.sh b/samples/client/petstore-security-test/typescript-angular2/git_push.sh index ed374619b13..ae01b182ae9 100644 --- a/samples/client/petstore-security-test/typescript-angular2/git_push.sh +++ b/samples/client/petstore-security-test/typescript-angular2/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore-security-test/typescript-angular2/index.ts b/samples/client/petstore-security-test/typescript-angular2/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore-security-test/typescript-angular2/index.ts +++ b/samples/client/petstore-security-test/typescript-angular2/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore-security-test/typescript-angular2/model/modelReturn.ts b/samples/client/petstore-security-test/typescript-angular2/model/modelReturn.ts new file mode 100644 index 00000000000..e2360156a9d --- /dev/null +++ b/samples/client/petstore-security-test/typescript-angular2/model/modelReturn.ts @@ -0,0 +1,26 @@ +/** + * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- + * + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + + +/** + * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r + */ +export interface ModelReturn { + /** + * property description *_/ ' \" =end -- \\r\\n \\n \\r + */ + return?: number; + +} + + diff --git a/samples/client/petstore-security-test/typescript-angular2/variables.ts b/samples/client/petstore-security-test/typescript-angular2/variables.ts index 6fe58549f39..af365dcef19 100644 --- a/samples/client/petstore-security-test/typescript-angular2/variables.ts +++ b/samples/client/petstore-security-test/typescript-angular2/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; diff --git a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/default/api.module.ts b/samples/client/petstore/typescript-angular-v2/default/api.module.ts index 4b290cd5a49..a50bf948242 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api.module.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api.module.ts @@ -21,7 +21,7 @@ export class ApiModule { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ] - } + }; } constructor( @Optional() @SkipSelf() parentModule: ApiModule) { 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 3f5b8fd227e..529aa005c43 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 @@ -11,20 +11,20 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -34,7 +34,7 @@ export class PetService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -214,21 +214,21 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -273,17 +273,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -326,17 +326,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -380,17 +380,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -426,17 +426,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -474,21 +474,21 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -531,17 +531,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -605,16 +605,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 5c4d7ee5954..346d791ef4d 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 @@ -11,19 +11,19 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { Order } from '../model/order'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -33,7 +33,7 @@ export class StoreService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -135,17 +135,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -176,16 +176,16 @@ export class StoreService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -215,17 +215,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -255,19 +255,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 fe2b4f7b6e7..e0c4778d361 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 @@ -11,19 +11,19 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { User } from '../model/user'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -33,7 +33,7 @@ export class UserService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -201,19 +201,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -246,19 +246,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -291,19 +291,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -336,17 +336,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -428,17 +428,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -465,17 +465,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -509,19 +509,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 2ee1824f5f7..8d150d652fa 100644 --- a/samples/client/petstore/typescript-angular-v2/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v2/default/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -31,12 +31,12 @@ export class Configuration { * @param {string[]} 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 | undefined { - if (contentTypes.length == 0) { + public selectHeaderContentType(contentTypes: string[]): string | undefined { + 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]; } @@ -51,11 +51,11 @@ export class Configuration { * @returns {string} the selected content-type or undefined if no selection could be made. */ public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { + 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]; } diff --git a/samples/client/petstore/typescript-angular-v2/default/index.ts b/samples/client/petstore/typescript-angular-v2/default/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore/typescript-angular-v2/default/index.ts +++ b/samples/client/petstore/typescript-angular-v2/default/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore/typescript-angular-v2/default/model/apiResponse.ts b/samples/client/petstore/typescript-angular-v2/default/model/apiResponse.ts new file mode 100644 index 00000000000..eac4208f022 --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/default/model/apiResponse.ts @@ -0,0 +1,21 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + type?: string; + message?: string; +} diff --git a/samples/client/petstore/typescript-angular-v2/default/variables.ts b/samples/client/petstore/typescript-angular-v2/default/variables.ts index 29b7e5b1d71..ddebd041ab2 100644 --- a/samples/client/petstore/typescript-angular-v2/default/variables.ts +++ b/samples/client/petstore/typescript-angular-v2/default/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; diff --git a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/npm/api.module.ts b/samples/client/petstore/typescript-angular-v2/npm/api.module.ts index 4b290cd5a49..a50bf948242 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api.module.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api.module.ts @@ -21,7 +21,7 @@ export class ApiModule { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ] - } + }; } constructor( @Optional() @SkipSelf() parentModule: ApiModule) { 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 3f5b8fd227e..529aa005c43 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 @@ -11,20 +11,20 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -34,7 +34,7 @@ export class PetService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -214,21 +214,21 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -273,17 +273,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -326,17 +326,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -380,17 +380,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -426,17 +426,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -474,21 +474,21 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -531,17 +531,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -605,16 +605,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 5c4d7ee5954..346d791ef4d 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 @@ -11,19 +11,19 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { Order } from '../model/order'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -33,7 +33,7 @@ export class StoreService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -135,17 +135,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -176,16 +176,16 @@ export class StoreService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -215,17 +215,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -255,19 +255,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 fe2b4f7b6e7..e0c4778d361 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 @@ -11,19 +11,19 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { User } from '../model/user'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -33,7 +33,7 @@ export class UserService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -201,19 +201,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -246,19 +246,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -291,19 +291,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -336,17 +336,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -428,17 +428,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -465,17 +465,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -509,19 +509,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 2ee1824f5f7..8d150d652fa 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -31,12 +31,12 @@ export class Configuration { * @param {string[]} 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 | undefined { - if (contentTypes.length == 0) { + public selectHeaderContentType(contentTypes: string[]): string | undefined { + 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]; } @@ -51,11 +51,11 @@ export class Configuration { * @returns {string} the selected content-type or undefined if no selection could be made. */ public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { + 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]; } diff --git a/samples/client/petstore/typescript-angular-v2/npm/index.ts b/samples/client/petstore/typescript-angular-v2/npm/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/index.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore/typescript-angular-v2/npm/model/apiResponse.ts b/samples/client/petstore/typescript-angular-v2/npm/model/apiResponse.ts new file mode 100644 index 00000000000..eac4208f022 --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/npm/model/apiResponse.ts @@ -0,0 +1,21 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + type?: string; + message?: string; +} diff --git a/samples/client/petstore/typescript-angular-v2/npm/variables.ts b/samples/client/petstore/typescript-angular-v2/npm/variables.ts index 29b7e5b1d71..ddebd041ab2 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/variables.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api.module.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api.module.ts index 4b290cd5a49..a50bf948242 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api.module.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api.module.ts @@ -21,7 +21,7 @@ export class ApiModule { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ] - } + }; } constructor( @Optional() @SkipSelf() parentModule: ApiModule) { 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 5f5d730060c..7fd5131083a 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 @@ -11,21 +11,21 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { PetServiceInterface } from './PetServiceInterface'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { PetServiceInterface } from './PetServiceInterface'; @Injectable() @@ -35,7 +35,7 @@ export class PetService implements PetServiceInterface { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -215,21 +215,21 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -274,17 +274,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -327,17 +327,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -381,17 +381,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -427,17 +427,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -475,21 +475,21 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -532,17 +532,17 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -606,16 +606,16 @@ export class PetService implements PetServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 185de6d5e09..6cf9dca1cc8 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 @@ -11,20 +11,20 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { Order } from '../model/order'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { StoreServiceInterface } from './StoreServiceInterface'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { StoreServiceInterface } from './StoreServiceInterface'; @Injectable() @@ -34,7 +34,7 @@ export class StoreService implements StoreServiceInterface { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -136,17 +136,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -177,16 +177,16 @@ export class StoreService implements StoreServiceInterface { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -216,17 +216,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -256,19 +256,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 ccbb653e9ef..01cdd70d0c9 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 @@ -11,20 +11,20 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { User } from '../model/user'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { UserServiceInterface } from './UserServiceInterface'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { UserServiceInterface } from './UserServiceInterface'; @Injectable() @@ -34,7 +34,7 @@ export class UserService implements UserServiceInterface { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -202,19 +202,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -247,19 +247,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -292,19 +292,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -337,17 +337,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -429,17 +429,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -466,17 +466,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -510,19 +510,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 2ee1824f5f7..8d150d652fa 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -31,12 +31,12 @@ export class Configuration { * @param {string[]} 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 | undefined { - if (contentTypes.length == 0) { + public selectHeaderContentType(contentTypes: string[]): string | undefined { + 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]; } @@ -51,11 +51,11 @@ export class Configuration { * @returns {string} the selected content-type or undefined if no selection could be made. */ public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { + 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]; } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/index.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/index.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/model/category.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/category.ts new file mode 100644 index 00000000000..5040d1db915 --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/category.ts @@ -0,0 +1,20 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +/** + * A category for a pet + */ +export interface Category { + id?: number; + name?: string; +} diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/model/order.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/order.ts new file mode 100644 index 00000000000..33b60bb6e16 --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/order.ts @@ -0,0 +1,35 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +/** + * An order for a pets from the pet store + */ +export interface Order { + id?: number; + petId?: number; + quantity?: number; + shipDate?: Date; + /** + * Order Status + */ + status?: Order.StatusEnum; + complete?: boolean; +} +export namespace Order { + export type StatusEnum = 'placed' | 'approved' | 'delivered'; + export const StatusEnum = { + Placed: 'placed' as StatusEnum, + Approved: 'approved' as StatusEnum, + Delivered: 'delivered' as StatusEnum + } +} diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/model/pet.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/pet.ts new file mode 100644 index 00000000000..342ab5f8e75 --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/pet.ts @@ -0,0 +1,37 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { Category } from './category'; +import { Tag } from './tag'; + + +/** + * A pet for sale in the pet store + */ +export interface Pet { + id?: number; + category?: Category; + name: string; + photoUrls: Array; + tags?: Array; + /** + * pet status in the store + */ + status?: Pet.StatusEnum; +} +export namespace Pet { + export type StatusEnum = 'available' | 'pending' | 'sold'; + export const StatusEnum = { + Available: 'available' as StatusEnum, + Pending: 'pending' as StatusEnum, + Sold: 'sold' as StatusEnum + } +} diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/model/tag.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/tag.ts new file mode 100644 index 00000000000..c7524000357 --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/tag.ts @@ -0,0 +1,20 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +/** + * A tag for a pet + */ +export interface Tag { + id?: number; + name?: string; +} diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/model/user.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/user.ts new file mode 100644 index 00000000000..a0261a6f37d --- /dev/null +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/model/user.ts @@ -0,0 +1,29 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +/** + * A User who is purchasing from the pet store + */ +export interface User { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + /** + * User Status + */ + userStatus?: number; +} diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/variables.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/variables.ts index 29b7e5b1d71..ddebd041ab2 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/variables.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api.module.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api.module.ts index b18695a280a..27442128027 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api.module.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api.module.ts @@ -21,7 +21,7 @@ export class ApiModule { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ] - } + }; } constructor( @Optional() @SkipSelf() parentModule: ApiModule) { 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 40fb7221bd3..14497dc5b8a 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 @@ -11,18 +11,23 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs/Observable'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent +} from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; + +import { Observable } from 'rxjs/Observable'; import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -32,7 +37,7 @@ export class PetService { public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -48,7 +53,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; } @@ -67,7 +72,7 @@ export class PetService { public addPet(body: Pet, observe?: 'body', reportProgress?: boolean): Observable; public addPet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>; public addPet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>; - public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable { + public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addPet.'); } @@ -83,23 +88,23 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/pet`, @@ -124,7 +129,7 @@ export class PetService { public deletePet(petId: number, apiKey?: string, observe?: 'body', reportProgress?: boolean): Observable; public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean): Observable>; public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling deletePet.'); } @@ -143,17 +148,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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))}`, @@ -176,12 +181,12 @@ export class PetService { public findPetsByStatus(status: Array, observe?: 'body', reportProgress?: boolean): Observable>; public findPetsByStatus(status: Array, observe?: 'response', reportProgress?: boolean): Observable>>; public findPetsByStatus(status: Array, observe?: 'events', reportProgress?: boolean): Observable>>; - public findPetsByStatus(status: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + public findPetsByStatus(status: Array, observe: any = 'body', reportProgress: boolean = false): Observable { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (status) { queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); } @@ -197,17 +202,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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`, @@ -231,12 +236,12 @@ export class PetService { public findPetsByTags(tags: Array, observe?: 'body', reportProgress?: boolean): Observable>; public findPetsByTags(tags: Array, observe?: 'response', reportProgress?: boolean): Observable>>; public findPetsByTags(tags: Array, observe?: 'events', reportProgress?: boolean): Observable>>; - public findPetsByTags(tags: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + public findPetsByTags(tags: Array, observe: any = 'body', reportProgress: boolean = false): Observable { if (tags === null || tags === undefined) { throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); } - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (tags) { queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); } @@ -252,17 +257,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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`, @@ -286,7 +291,7 @@ export class PetService { public getPetById(petId: number, observe?: 'body', reportProgress?: boolean): Observable; public getPetById(petId: number, observe?: 'response', reportProgress?: boolean): Observable>; public getPetById(petId: number, observe?: 'events', reportProgress?: boolean): Observable>; - public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { + public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling getPetById.'); } @@ -299,17 +304,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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))}`, @@ -332,7 +337,7 @@ export class PetService { public updatePet(body: Pet, observe?: 'body', reportProgress?: boolean): Observable; public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>; public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>; - public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable { + public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updatePet.'); } @@ -348,23 +353,23 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.put(`${this.basePath}/pet`, @@ -390,7 +395,7 @@ export class PetService { public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'body', reportProgress?: boolean): Observable; public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean): Observable>; public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean): Observable>; - public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); } @@ -406,17 +411,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -428,7 +433,7 @@ export class PetService { if (useForm) { formParams = new FormData(); } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); } if (name !== undefined) { @@ -461,7 +466,7 @@ export class PetService { public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'body', reportProgress?: boolean): Observable; public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean): Observable>; public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean): Observable>; - public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false ): Observable { + public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false): Observable { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); } @@ -477,16 +482,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'multipart/form-data' ]; @@ -501,7 +506,7 @@ export class PetService { if (useForm) { formParams = new FormData(); } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); } if (additionalMetadata !== undefined) { 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 7c5364e471c..37aa23e8aaa 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 @@ -11,17 +11,22 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs/Observable'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent +} from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; + +import { Observable } from 'rxjs/Observable'; import { Order } from '../model/order'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -31,7 +36,7 @@ export class StoreService { public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -47,7 +52,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; } @@ -66,7 +71,7 @@ export class StoreService { public deleteOrder(orderId: string, observe?: 'body', reportProgress?: boolean): Observable; public deleteOrder(orderId: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteOrder(orderId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); } @@ -74,17 +79,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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))}`, @@ -106,7 +111,7 @@ export class StoreService { public getInventory(observe?: 'body', reportProgress?: boolean): Observable<{ [key: string]: number; }>; public getInventory(observe?: 'response', reportProgress?: boolean): Observable>; public getInventory(observe?: 'events', reportProgress?: boolean): Observable>; - public getInventory(observe: any = 'body', reportProgress: boolean = false ): Observable { + public getInventory(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; @@ -116,16 +121,16 @@ export class StoreService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`, @@ -148,7 +153,7 @@ export class StoreService { public getOrderById(orderId: number, observe?: 'body', reportProgress?: boolean): Observable; public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean): Observable>; public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean): Observable>; - public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { + public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); } @@ -156,17 +161,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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))}`, @@ -189,7 +194,7 @@ export class StoreService { public placeOrder(body: Order, observe?: 'body', reportProgress?: boolean): Observable; public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean): Observable>; public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean): Observable>; - public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false ): Observable { + public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling placeOrder.'); } @@ -197,21 +202,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + 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 edc7a4b4298..95bbc963763 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 @@ -11,17 +11,22 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs/Observable'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { + HttpClient, + HttpHeaders, + HttpParams, + HttpResponse, + HttpEvent +} from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; + +import { Observable } from 'rxjs/Observable'; import { User } from '../model/user'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -31,7 +36,7 @@ export class UserService { public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -47,7 +52,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; } @@ -66,7 +71,7 @@ export class UserService { public createUser(body: User, observe?: 'body', reportProgress?: boolean): Observable; public createUser(body: User, observe?: 'response', reportProgress?: boolean): Observable>; public createUser(body: User, observe?: 'events', reportProgress?: boolean): Observable>; - public createUser(body: User, observe: any = 'body', reportProgress: boolean = false ): Observable { + public createUser(body: User, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUser.'); } @@ -74,21 +79,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/user`, @@ -112,7 +117,7 @@ export class UserService { public createUsersWithArrayInput(body: Array, observe?: 'body', reportProgress?: boolean): Observable; public createUsersWithArrayInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; public createUsersWithArrayInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; - public createUsersWithArrayInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + public createUsersWithArrayInput(body: Array, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); } @@ -120,21 +125,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/user/createWithArray`, @@ -158,7 +163,7 @@ export class UserService { public createUsersWithListInput(body: Array, observe?: 'body', reportProgress?: boolean): Observable; public createUsersWithListInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; public createUsersWithListInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; - public createUsersWithListInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + public createUsersWithListInput(body: Array, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); } @@ -166,21 +171,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/user/createWithList`, @@ -204,7 +209,7 @@ export class UserService { public deleteUser(username: string, observe?: 'body', reportProgress?: boolean): Observable; public deleteUser(username: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteUser(username: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling deleteUser.'); } @@ -212,17 +217,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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))}`, @@ -245,7 +250,7 @@ export class UserService { public getUserByName(username: string, observe?: 'body', reportProgress?: boolean): Observable; public getUserByName(username: string, observe?: 'response', reportProgress?: boolean): Observable>; public getUserByName(username: string, observe?: 'events', reportProgress?: boolean): Observable>; - public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling getUserByName.'); } @@ -253,17 +258,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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))}`, @@ -287,7 +292,7 @@ export class UserService { public loginUser(username: string, password: string, observe?: 'body', reportProgress?: boolean): Observable; public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean): Observable>; public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean): Observable>; - public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling loginUser.'); } @@ -295,7 +300,7 @@ export class UserService { throw new Error('Required parameter password was null or undefined when calling loginUser.'); } - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (username !== undefined) { queryParameters = queryParameters.set('username', username); } @@ -306,17 +311,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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`, @@ -339,22 +344,22 @@ export class UserService { public logoutUser(observe?: 'body', reportProgress?: boolean): Observable; public logoutUser(observe?: 'response', reportProgress?: boolean): Observable>; public logoutUser(observe?: 'events', reportProgress?: boolean): Observable>; - public logoutUser(observe: any = 'body', reportProgress: boolean = false ): Observable { + public logoutUser(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + 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`, @@ -378,7 +383,7 @@ export class UserService { public updateUser(username: string, body: User, observe?: 'body', reportProgress?: boolean): Observable; public updateUser(username: string, body: User, observe?: 'response', reportProgress?: boolean): Observable>; public updateUser(username: string, body: User, observe?: 'events', reportProgress?: boolean): Observable>; - public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false ): Observable { + public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false): Observable { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } @@ -389,21 +394,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers = headers.set("Accept", httpHeaderAcceptSelected); + headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { - headers = headers.set("Content-Type", httpContentTypeSelected); + 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 2ee1824f5f7..8d150d652fa 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -31,12 +31,12 @@ export class Configuration { * @param {string[]} 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 | undefined { - if (contentTypes.length == 0) { + public selectHeaderContentType(contentTypes: string[]): string | undefined { + 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]; } @@ -51,11 +51,11 @@ export class Configuration { * @returns {string} the selected content-type or undefined if no selection could be made. */ public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { + 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]; } diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/index.ts b/samples/client/petstore/typescript-angular-v4.3/npm/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/index.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/variables.ts b/samples/client/petstore/typescript-angular-v4.3/npm/variables.ts index 6fe58549f39..af365dcef19 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/variables.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +}; diff --git a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION index f9f7450d135..cc6612c36e0 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.3.0 \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4/npm/api.module.ts b/samples/client/petstore/typescript-angular-v4/npm/api.module.ts index 4b290cd5a49..a50bf948242 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api.module.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api.module.ts @@ -21,7 +21,7 @@ export class ApiModule { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ] - } + }; } constructor( @Optional() @SkipSelf() parentModule: ApiModule) { 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 3f5b8fd227e..529aa005c43 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 @@ -11,20 +11,20 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { ApiResponse } from '../model/apiResponse'; import { Pet } from '../model/pet'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -34,7 +34,7 @@ export class PetService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -214,21 +214,21 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -273,17 +273,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -326,17 +326,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -380,17 +380,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -426,17 +426,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -474,21 +474,21 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/json', 'application/xml' ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -531,17 +531,17 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/xml', 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ 'application/x-www-form-urlencoded' ]; @@ -605,16 +605,16 @@ export class PetService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 5c4d7ee5954..346d791ef4d 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 @@ -11,19 +11,19 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { Order } from '../model/order'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -33,7 +33,7 @@ export class StoreService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -135,17 +135,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -176,16 +176,16 @@ export class StoreService { } // to determine the Accept header - let httpHeaderAccepts: string[] = [ + const httpHeaderAccepts: string[] = [ 'application/json' ]; - let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -215,17 +215,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -255,19 +255,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 fe2b4f7b6e7..e0c4778d361 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 @@ -11,19 +11,19 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { Http, Headers, URLSearchParams } from '@angular/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; -import { Response, ResponseContentType } from '@angular/http'; -import { CustomQueryEncoderHelper } from '../encoder'; +import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { User } from '../model/user'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() @@ -33,7 +33,7 @@ export class UserService { public defaultHeaders = new Headers(); public configuration = new Configuration(); - constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + constructor(protected http: Http, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -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; } @@ -201,19 +201,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -246,19 +246,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -291,19 +291,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers.set('Content-Type', httpContentTypeSelected); } @@ -336,17 +336,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + 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 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -428,17 +428,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -465,17 +465,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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -509,19 +509,19 @@ 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 | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { - headers.set("Accept", httpHeaderAcceptSelected); + headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - let consumes: string[] = [ + const consumes: string[] = [ ]; - let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 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 2ee1824f5f7..8d150d652fa 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/configuration.ts @@ -1,5 +1,5 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -8,7 +8,7 @@ export interface ConfigurationParameters { } export class Configuration { - apiKeys?: {[ key: string ]: string}; + apiKeys?: { [key: string ]: string }; username?: string; password?: string; accessToken?: string | (() => string); @@ -31,12 +31,12 @@ export class Configuration { * @param {string[]} 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 | undefined { - if (contentTypes.length == 0) { + public selectHeaderContentType(contentTypes: string[]): string | undefined { + 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]; } @@ -51,11 +51,11 @@ export class Configuration { * @returns {string} the selected content-type or undefined if no selection could be made. */ public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { + 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]; } diff --git a/samples/client/petstore/typescript-angular-v4/npm/index.ts b/samples/client/petstore/typescript-angular-v4/npm/index.ts index c312b70fa3e..410623f1c9f 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/index.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/samples/client/petstore/typescript-angular-v4/npm/variables.ts b/samples/client/petstore/typescript-angular-v4/npm/variables.ts index 6fe58549f39..af365dcef19 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/variables.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/variables.ts @@ -6,4 +6,4 @@ export const COLLECTION_FORMATS = { 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} +};