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 81723479952..8d032b76164 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 @@ -3,12 +3,15 @@ import { Inject, Injectable, Optional } from '@angular/core'; {{#useHttpClient}} -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; {{/useHttpClient}} {{^useHttpClient}} import { Http, Headers, URLSearchParams } from '@angular/http'; import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http'; import { Response, ResponseContentType } from '@angular/http'; +import { CustomQueryEncoderHelper } from '../encoder'; {{/useHttpClient}} import { Observable } from 'rxjs/Observable'; @@ -20,12 +23,6 @@ import { {{classname}} } from '../{{filename}}'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -{{#useHttpClient}} -import { CustomHttpUrlEncodingCodec } from '../encoder'; -{{/useHttpClient}} -{{^useHttpClient}} -import { CustomQueryEncoderHelper } from '../encoder'; -{{/useHttpClient}} {{#withInterfaces}} import { {{classname}}Interface } from './{{classname}}Interface'; {{/withInterfaces}} @@ -74,8 +71,8 @@ export class {{classname}} { } {{^useHttpClient}} -{{! not sure why we used to generate a second method here rather than inlining those few lines of code, - but let's keep it for now for the sake of backwards compatiblity. }} +{{! Before HttpClient implementation or method overloading we relied on 2 functions, 1 to return the straight body as json + and another to get the full response.}} {{#operation}} /** * {{¬es}} @@ -109,8 +106,18 @@ export class {{classname}} { * {{summary}} * {{notes}} {{#allParams}}* @param {{paramName}} {{description}} - {{/allParams}}*/ - public {{nickname}}{{^useHttpClient}}WithHttpInfo{{/useHttpClient}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{^useHttpClient}}{{#hasParams}}, {{/hasParams}}extraHttpRequestParams?: RequestOptionsArgs{{/useHttpClient}}): Observable<{{#useHttpClient}}{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}{}{{/returnType}}{{/useHttpClient}}{{^useHttpClient}}Response{{/useHttpClient}}> { + {{/allParams}}{{#useHttpClient}}* @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.{{/useHttpClient}} + */ + {{#useHttpClient}} + 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 { + {{/useHttpClient}} + {{^useHttpClient}} + public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: RequestOptionsArgs): Observable { + {{/useHttpClient}} {{#allParams}} {{#required}} if ({{paramName}} === null || {{paramName}} === undefined) { @@ -151,7 +158,7 @@ export class {{classname}} { {{/isListContainer}} {{/queryParams}} -{{/hasQueryParams}} +{{/hasQueryParams}} let headers = {{#useHttpClient}}this.defaultHeaders;{{/useHttpClient}}{{^useHttpClient}}new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845{{/useHttpClient}} {{#headerParams}} {{#isListContainer}} @@ -282,17 +289,19 @@ export class {{classname}} { {{/hasFormParams}} {{#useHttpClient}} - return this.httpClient.{{httpMethod}}{{^isResponseFile}}{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}} + return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}} {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}} { {{#hasQueryParams}} params: queryParameters, {{/hasQueryParams}} - headers: headers, {{#isResponseFile}} responseType: "blob", {{/isResponseFile}} withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); {{/useHttpClient}} @@ -320,7 +329,7 @@ export class {{classname}} { } return this.http.request(`${this.basePath}{{{path}}}`, requestOptions); -{{/useHttpClient}} +{{/useHttpClient}} } {{/operation}}} 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 24a32f0c3b0..3f5b8fd227e 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -24,7 +25,6 @@ import { Pet } from '../model/pet'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -196,6 +196,7 @@ export class PetService { * Add a new pet to the store * * @param body Pet object that needs to be added to the store + */ public addPetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -251,6 +252,7 @@ export class PetService { * * @param petId Pet id to delete * @param apiKey + */ public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -301,6 +303,7 @@ export class PetService { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter + */ public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { @@ -354,6 +357,7 @@ export class PetService { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by + */ public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (tags === null || tags === undefined) { @@ -407,6 +411,7 @@ export class PetService { * Find pet by ID * Returns a single pet * @param petId ID of pet to return + */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -451,6 +456,7 @@ export class PetService { * Update an existing pet * * @param body Pet object that needs to be added to the store + */ public updatePetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -507,6 +513,7 @@ export class PetService { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet + */ public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -580,6 +587,7 @@ export class PetService { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload + */ public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { 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 6b3914e7125..5c4d7ee5954 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { Order } from '../model/order'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -125,6 +125,7 @@ export class StoreService { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted + */ public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -163,6 +164,7 @@ export class StoreService { /** * Returns pet inventories by status * Returns a map of status codes to quantities + */ public getInventoryWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -203,6 +205,7 @@ export class StoreService { * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched + */ public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -242,6 +245,7 @@ export class StoreService { * Place an order for a pet * * @param body order placed for purchasing the pet + */ public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { 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 a951e64a84d..fe2b4f7b6e7 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { User } from '../model/user'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -191,6 +191,7 @@ export class UserService { * Create user * This can only be done by the logged in user. * @param body Created user object + */ public createUserWithHttpInfo(body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -235,6 +236,7 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -279,6 +281,7 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -323,6 +326,7 @@ export class UserService { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted + */ public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -362,6 +366,7 @@ export class UserService { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. + */ public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -402,6 +407,7 @@ export class UserService { * * @param username The user name for login * @param password The password for login in clear text + */ public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -452,6 +458,7 @@ export class UserService { /** * Logs out current logged in user session * + */ public logoutUserWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -489,6 +496,7 @@ export class UserService { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object + */ public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { 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 24a32f0c3b0..3f5b8fd227e 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -24,7 +25,6 @@ import { Pet } from '../model/pet'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -196,6 +196,7 @@ export class PetService { * Add a new pet to the store * * @param body Pet object that needs to be added to the store + */ public addPetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -251,6 +252,7 @@ export class PetService { * * @param petId Pet id to delete * @param apiKey + */ public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -301,6 +303,7 @@ export class PetService { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter + */ public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { @@ -354,6 +357,7 @@ export class PetService { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by + */ public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (tags === null || tags === undefined) { @@ -407,6 +411,7 @@ export class PetService { * Find pet by ID * Returns a single pet * @param petId ID of pet to return + */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -451,6 +456,7 @@ export class PetService { * Update an existing pet * * @param body Pet object that needs to be added to the store + */ public updatePetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -507,6 +513,7 @@ export class PetService { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet + */ public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -580,6 +587,7 @@ export class PetService { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload + */ public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { 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 6b3914e7125..5c4d7ee5954 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { Order } from '../model/order'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -125,6 +125,7 @@ export class StoreService { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted + */ public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -163,6 +164,7 @@ export class StoreService { /** * Returns pet inventories by status * Returns a map of status codes to quantities + */ public getInventoryWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -203,6 +205,7 @@ export class StoreService { * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched + */ public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -242,6 +245,7 @@ export class StoreService { * Place an order for a pet * * @param body order placed for purchasing the pet + */ public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { 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 a951e64a84d..fe2b4f7b6e7 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { User } from '../model/user'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -191,6 +191,7 @@ export class UserService { * Create user * This can only be done by the logged in user. * @param body Created user object + */ public createUserWithHttpInfo(body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -235,6 +236,7 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -279,6 +281,7 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -323,6 +326,7 @@ export class UserService { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted + */ public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -362,6 +366,7 @@ export class UserService { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. + */ public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -402,6 +407,7 @@ export class UserService { * * @param username The user name for login * @param password The password for login in clear text + */ public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -452,6 +458,7 @@ export class UserService { /** * Logs out current logged in user session * + */ public logoutUserWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -489,6 +496,7 @@ export class UserService { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object + */ public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { 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 4d4f9321745..5f5d730060c 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -24,7 +25,6 @@ import { Pet } from '../model/pet'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; import { PetServiceInterface } from './PetServiceInterface'; @@ -197,6 +197,7 @@ export class PetService implements PetServiceInterface { * Add a new pet to the store * * @param body Pet object that needs to be added to the store + */ public addPetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -252,6 +253,7 @@ export class PetService implements PetServiceInterface { * * @param petId Pet id to delete * @param apiKey + */ public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -302,6 +304,7 @@ export class PetService implements PetServiceInterface { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter + */ public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { @@ -355,6 +358,7 @@ export class PetService implements PetServiceInterface { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by + */ public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (tags === null || tags === undefined) { @@ -408,6 +412,7 @@ export class PetService implements PetServiceInterface { * Find pet by ID * Returns a single pet * @param petId ID of pet to return + */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -452,6 +457,7 @@ export class PetService implements PetServiceInterface { * Update an existing pet * * @param body Pet object that needs to be added to the store + */ public updatePetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -508,6 +514,7 @@ export class PetService implements PetServiceInterface { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet + */ public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -581,6 +588,7 @@ export class PetService implements PetServiceInterface { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload + */ public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { 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 fa02068e811..185de6d5e09 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { Order } from '../model/order'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; import { StoreServiceInterface } from './StoreServiceInterface'; @@ -126,6 +126,7 @@ export class StoreService implements StoreServiceInterface { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted + */ public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -164,6 +165,7 @@ export class StoreService implements StoreServiceInterface { /** * Returns pet inventories by status * Returns a map of status codes to quantities + */ public getInventoryWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -204,6 +206,7 @@ export class StoreService implements StoreServiceInterface { * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched + */ public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -243,6 +246,7 @@ export class StoreService implements StoreServiceInterface { * Place an order for a pet * * @param body order placed for purchasing the pet + */ public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { 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 e8455496cfa..ccbb653e9ef 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { User } from '../model/user'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; import { UserServiceInterface } from './UserServiceInterface'; @@ -192,6 +192,7 @@ export class UserService implements UserServiceInterface { * Create user * This can only be done by the logged in user. * @param body Created user object + */ public createUserWithHttpInfo(body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -236,6 +237,7 @@ export class UserService implements UserServiceInterface { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -280,6 +282,7 @@ export class UserService implements UserServiceInterface { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -324,6 +327,7 @@ export class UserService implements UserServiceInterface { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted + */ public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -363,6 +367,7 @@ export class UserService implements UserServiceInterface { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. + */ public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -403,6 +408,7 @@ export class UserService implements UserServiceInterface { * * @param username The user name for login * @param password The password for login in clear text + */ public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -453,6 +459,7 @@ export class UserService implements UserServiceInterface { /** * Logs out current logged in user session * + */ public logoutUserWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -490,6 +497,7 @@ export class UserService implements UserServiceInterface { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object + */ public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { 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 467ad5529bc..687f5995c9b 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 @@ -12,7 +12,9 @@ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -22,7 +24,6 @@ import { Pet } from '../model/pet'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; @Injectable() @@ -61,8 +62,13 @@ export class PetService { * Add a new pet to the store * * @param body Pet object that needs to be added to the store + * @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 addPet(body: Pet): Observable<{}> { + 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 { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addPet.'); } @@ -100,8 +106,10 @@ export class PetService { return this.httpClient.post(`${this.basePath}/pet`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -111,8 +119,13 @@ export class PetService { * * @param petId Pet id to delete * @param apiKey + * @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 deletePet(petId: number, apiKey?: string): Observable<{}> { + 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 { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling deletePet.'); } @@ -146,8 +159,10 @@ export class PetService { return this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -156,8 +171,13 @@ export class PetService { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter + * @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 findPetsByStatus(status: Array): Observable> { + 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 { if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } @@ -191,11 +211,13 @@ export class PetService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/pet/findByStatus`, + return this.httpClient.get>(`${this.basePath}/pet/findByStatus`, { params: queryParameters, - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -204,8 +226,13 @@ export class PetService { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by + * @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 findPetsByTags(tags: Array): Observable> { + 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 { if (tags === null || tags === undefined) { throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); } @@ -239,11 +266,13 @@ export class PetService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/pet/findByTags`, + return this.httpClient.get>(`${this.basePath}/pet/findByTags`, { params: queryParameters, - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -252,8 +281,13 @@ export class PetService { * Find pet by ID * Returns a single pet * @param petId ID of pet to return + * @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 getPetById(petId: number): Observable { + 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 { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling getPetById.'); } @@ -279,10 +313,12 @@ export class PetService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, + return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -291,8 +327,13 @@ export class PetService { * Update an existing pet * * @param body Pet object that needs to be added to the store + * @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 updatePet(body: Pet): Observable<{}> { + 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 { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updatePet.'); } @@ -330,8 +371,10 @@ export class PetService { return this.httpClient.put(`${this.basePath}/pet`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -342,8 +385,13 @@ export class PetService { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet + * @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 updatePetWithForm(petId: number, name?: string, status?: string): Observable<{}> { + 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 { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); } @@ -394,8 +442,10 @@ export class PetService { return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, convertFormParamsToString ? formParams.toString() : formParams, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -406,8 +456,13 @@ export class PetService { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload + * @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 uploadFile(petId: number, additionalMetadata?: string, file?: Blob): Observable { + 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 { if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); } @@ -457,11 +512,13 @@ export class PetService { formParams = formParams.append('file', file) || formParams; } - return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, + return this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, convertFormParamsToString ? formParams.toString() : formParams, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } 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 74e035bc575..bb17d74e4f2 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 @@ -12,7 +12,9 @@ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -21,7 +23,6 @@ import { Order } from '../model/order'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; @Injectable() @@ -60,8 +61,13 @@ export class StoreService { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted + * @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 deleteOrder(orderId: string): Observable<{}> { + 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 { if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); } @@ -84,8 +90,10 @@ export class StoreService { return this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -93,8 +101,13 @@ export class StoreService { /** * Returns pet inventories by status * Returns a map of status codes to quantities + * @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 getInventory(): Observable<{ [key: string]: number; }> { + 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 { let headers = this.defaultHeaders; @@ -116,10 +129,12 @@ export class StoreService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/store/inventory`, + return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -128,8 +143,13 @@ export class StoreService { * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched + * @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 getOrderById(orderId: number): Observable { + 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 { if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); } @@ -150,10 +170,12 @@ export class StoreService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, + return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -162,8 +184,13 @@ export class StoreService { * Place an order for a pet * * @param body order placed for purchasing the pet + * @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 placeOrder(body: Order): Observable { + 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 { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling placeOrder.'); } @@ -188,11 +215,13 @@ export class StoreService { headers = headers.set("Content-Type", httpContentTypeSelected); } - return this.httpClient.post(`${this.basePath}/store/order`, + return this.httpClient.post(`${this.basePath}/store/order`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } 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 9c60e1f8c19..1a237e81a41 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 @@ -12,7 +12,9 @@ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -21,7 +23,6 @@ import { User } from '../model/user'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; @Injectable() @@ -60,8 +61,13 @@ export class UserService { * Create user * This can only be done by the logged in user. * @param body Created user object + * @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 createUser(body: User): Observable<{}> { + 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 { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUser.'); } @@ -89,8 +95,10 @@ export class UserService { return this.httpClient.post(`${this.basePath}/user`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -99,8 +107,13 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + * @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 createUsersWithArrayInput(body: Array): Observable<{}> { + 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 { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); } @@ -128,8 +141,10 @@ export class UserService { return this.httpClient.post(`${this.basePath}/user/createWithArray`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -138,8 +153,13 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + * @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 createUsersWithListInput(body: Array): Observable<{}> { + 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 { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); } @@ -167,8 +187,10 @@ export class UserService { return this.httpClient.post(`${this.basePath}/user/createWithList`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -177,8 +199,13 @@ export class UserService { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted + * @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 deleteUser(username: string): Observable<{}> { + 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 { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling deleteUser.'); } @@ -201,8 +228,10 @@ export class UserService { return this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -211,8 +240,13 @@ export class UserService { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. + * @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 getUserByName(username: string): Observable { + 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 { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling getUserByName.'); } @@ -233,10 +267,12 @@ export class UserService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, + return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -246,8 +282,13 @@ export class UserService { * * @param username The user name for login * @param password The password for login in clear text + * @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 loginUser(username: string, password: string): Observable { + 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 { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling loginUser.'); } @@ -279,11 +320,13 @@ export class UserService { let consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/user/login`, + return this.httpClient.get(`${this.basePath}/user/login`, { params: queryParameters, - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -291,8 +334,13 @@ export class UserService { /** * Logs out current logged in user session * + * @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 logoutUser(): Observable<{}> { + 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 { let headers = this.defaultHeaders; @@ -312,8 +360,10 @@ export class UserService { return this.httpClient.get(`${this.basePath}/user/logout`, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } @@ -323,8 +373,13 @@ export class UserService { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object + * @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 updateUser(username: string, body: User): Observable<{}> { + 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 { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } @@ -355,8 +410,10 @@ export class UserService { return this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, body, { - headers: headers, withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress } ); } 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 24a32f0c3b0..3f5b8fd227e 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -24,7 +25,6 @@ import { Pet } from '../model/pet'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -196,6 +196,7 @@ export class PetService { * Add a new pet to the store * * @param body Pet object that needs to be added to the store + */ public addPetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -251,6 +252,7 @@ export class PetService { * * @param petId Pet id to delete * @param apiKey + */ public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -301,6 +303,7 @@ export class PetService { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter + */ public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (status === null || status === undefined) { @@ -354,6 +357,7 @@ export class PetService { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by + */ public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (tags === null || tags === undefined) { @@ -407,6 +411,7 @@ export class PetService { * Find pet by ID * Returns a single pet * @param petId ID of pet to return + */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -451,6 +456,7 @@ export class PetService { * Update an existing pet * * @param body Pet object that needs to be added to the store + */ public updatePetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -507,6 +513,7 @@ export class PetService { * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet + */ public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { @@ -580,6 +587,7 @@ export class PetService { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param file file to upload + */ public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (petId === null || petId === undefined) { 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 6b3914e7125..5c4d7ee5954 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { Order } from '../model/order'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -125,6 +125,7 @@ export class StoreService { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted + */ public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -163,6 +164,7 @@ export class StoreService { /** * Returns pet inventories by status * Returns a map of status codes to quantities + */ public getInventoryWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -203,6 +205,7 @@ export class StoreService { * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched + */ public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (orderId === null || orderId === undefined) { @@ -242,6 +245,7 @@ export class StoreService { * Place an order for a pet * * @param body order placed for purchasing the pet + */ public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { 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 a951e64a84d..fe2b4f7b6e7 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 @@ -15,6 +15,7 @@ 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 { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; @@ -23,7 +24,6 @@ import { User } from '../model/user'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; -import { CustomQueryEncoderHelper } from '../encoder'; @Injectable() @@ -191,6 +191,7 @@ export class UserService { * Create user * This can only be done by the logged in user. * @param body Created user object + */ public createUserWithHttpInfo(body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -235,6 +236,7 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -279,6 +281,7 @@ export class UserService { * Creates list of users with given input array * * @param body List of user object + */ public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (body === null || body === undefined) { @@ -323,6 +326,7 @@ export class UserService { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted + */ public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -362,6 +366,7 @@ export class UserService { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. + */ public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -402,6 +407,7 @@ export class UserService { * * @param username The user name for login * @param password The password for login in clear text + */ public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) { @@ -452,6 +458,7 @@ export class UserService { /** * Logs out current logged in user session * + */ public logoutUserWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable { @@ -489,6 +496,7 @@ export class UserService { * This can only be done by the logged in user. * @param username name that need to be deleted * @param body Updated user object + */ public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable { if (username === null || username === undefined) {