From 6146129bdc3993ee7b2eedabbc476e21bf8fdd49 Mon Sep 17 00:00:00 2001 From: Robert Schuh Date: Wed, 23 Aug 2023 11:25:27 +0200 Subject: [PATCH] [typescript] add http info calls to access headers (#16260) * [typescript] add http info calls to access headers * [typescript] add http info calls to access headers * [typescript] add http info calls to access headers * [typescript] add http info calls to access headers * [typescript] add http info calls to access headers --------- Co-authored-by: Robert Schuh --- .../resources/typescript/api/api.mustache | 12 +- .../resources/typescript/http/http.mustache | 11 + .../typescript/services/api.mustache | 4 +- .../typescript/types/ObjectParamAPI.mustache | 15 +- .../typescript/types/ObservableAPI.mustache | 21 +- .../typescript/types/PromiseAPI.mustache | 18 +- .../with-unique-items/apis/DefaultApi.ts | 8 +- .../builds/with-unique-items/http/http.ts | 11 + .../with-unique-items/types/ObjectParamAPI.ts | 9 +- .../with-unique-items/types/ObservableAPI.ts | 12 +- .../with-unique-items/types/PromiseAPI.ts | 9 +- .../typescript/builds/browser/apis/PetApi.ts | 46 +-- .../builds/browser/apis/StoreApi.ts | 24 +- .../typescript/builds/browser/apis/UserApi.ts | 38 +-- .../typescript/builds/browser/http/http.ts | 11 + .../builds/browser/types/ObjectParamAPI.ts | 182 +++++++++++- .../builds/browser/types/ObservableAPI.ts | 267 +++++++++++++++--- .../builds/browser/types/PromiseAPI.ts | 207 +++++++++++++- .../composed-schemas/apis/DefaultApi.ts | 20 +- .../builds/composed-schemas/http/http.ts | 11 + .../composed-schemas/types/ObjectParamAPI.ts | 23 +- .../composed-schemas/types/ObservableAPI.ts | 35 ++- .../composed-schemas/types/PromiseAPI.ts | 26 +- .../typescript/builds/default/apis/PetApi.ts | 46 +-- .../builds/default/apis/StoreApi.ts | 24 +- .../typescript/builds/default/apis/UserApi.ts | 38 +-- .../typescript/builds/default/http/http.ts | 11 + .../builds/default/types/ObjectParamAPI.ts | 182 +++++++++++- .../builds/default/types/ObservableAPI.ts | 267 +++++++++++++++--- .../builds/default/types/PromiseAPI.ts | 207 +++++++++++++- .../typescript/builds/deno/apis/PetApi.ts | 46 +-- .../typescript/builds/deno/apis/StoreApi.ts | 24 +- .../typescript/builds/deno/apis/UserApi.ts | 38 +-- .../typescript/builds/deno/http/http.ts | 11 + .../builds/deno/types/ObjectParamAPI.ts | 182 +++++++++++- .../builds/deno/types/ObservableAPI.ts | 267 +++++++++++++++--- .../builds/deno/types/PromiseAPI.ts | 207 +++++++++++++- .../builds/inversify/apis/PetApi.service.ts | 18 +- .../builds/inversify/apis/PetApi.ts | 46 +-- .../builds/inversify/apis/StoreApi.service.ts | 10 +- .../builds/inversify/apis/StoreApi.ts | 24 +- .../builds/inversify/apis/UserApi.service.ts | 18 +- .../builds/inversify/apis/UserApi.ts | 38 +-- .../typescript/builds/inversify/http/http.ts | 11 + .../builds/inversify/types/ObjectParamAPI.ts | 182 +++++++++++- .../builds/inversify/types/ObservableAPI.ts | 267 +++++++++++++++--- .../builds/inversify/types/PromiseAPI.ts | 207 +++++++++++++- .../typescript/builds/jquery/apis/PetApi.ts | 46 +-- .../typescript/builds/jquery/apis/StoreApi.ts | 24 +- .../typescript/builds/jquery/apis/UserApi.ts | 38 +-- .../typescript/builds/jquery/http/http.ts | 11 + .../builds/jquery/types/ObjectParamAPI.ts | 182 +++++++++++- .../builds/jquery/types/ObservableAPI.ts | 267 +++++++++++++++--- .../builds/jquery/types/PromiseAPI.ts | 207 +++++++++++++- .../builds/object_params/apis/PetApi.ts | 46 +-- .../builds/object_params/apis/StoreApi.ts | 24 +- .../builds/object_params/apis/UserApi.ts | 38 +-- .../builds/object_params/http/http.ts | 11 + .../object_params/types/ObjectParamAPI.ts | 182 +++++++++++- .../object_params/types/ObservableAPI.ts | 267 +++++++++++++++--- .../builds/object_params/types/PromiseAPI.ts | 207 +++++++++++++- 61 files changed, 4295 insertions(+), 646 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache index 1770f54dfa25..7e763409ab3f 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi{{importFileExtension}}'; import {Configuration} from '../configuration{{importFileExtension}}'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{importFileExtension}}'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http{{importFileExtension}}'; {{#platforms}} {{#node}} import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data"; @@ -190,7 +190,7 @@ export class {{classname}}ResponseProcessor { * @params response Response returned by the server for a request to {{nickname}} * @throws ApiException if the response code was not in [200, 299] */ - public async {{nickname}}(response: ResponseContext): Promise<{{{returnType}}} {{^returnType}}void{{/returnType}}> { + public async {{nickname}}WithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); {{#responses}} if (isCodeInRange("{{code}}", response.httpStatusCode)) { @@ -205,7 +205,7 @@ export class {{classname}}ResponseProcessor { ) as {{{dataType}}}; {{/isBinary}} {{#is2xx}} - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); {{/is2xx}} {{^is2xx}} throw new ApiException<{{{dataType}}}>(response.httpStatusCode, "{{message}}", body, response.headers); @@ -213,7 +213,7 @@ export class {{classname}}ResponseProcessor { {{/dataType}} {{^dataType}} {{#is2xx}} - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); {{/is2xx}} {{^is2xx}} throw new ApiException(response.httpStatusCode, "{{message}}", undefined, response.headers); @@ -234,10 +234,10 @@ export class {{classname}}ResponseProcessor { "{{{returnType}}}", "{{returnFormat}}" ) as {{{returnType}}}; {{/isBinary}} - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); {{/returnType}} {{^returnType}} - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); {{/returnType}} } diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 0ecca57cd86f..2d28a40190d0 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -308,3 +308,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/modules/openapi-generator/src/main/resources/typescript/services/api.mustache b/modules/openapi-generator/src/main/resources/typescript/services/api.mustache index 24d254d74a82..6a79d552bc43 100644 --- a/modules/openapi-generator/src/main/resources/typescript/services/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/services/api.mustache @@ -1,5 +1,5 @@ import type { Configuration } from "../configuration"; -import type { HttpFile, RequestContext, ResponseContext } from "../http/http"; +import type { HttpFile, RequestContext, ResponseContext, HttpInfo } from "../http/http"; {{#imports}} import { {{classname}} } from "{{filename}}"; @@ -16,7 +16,7 @@ export abstract class Abstract{{classname}}RequestFactory { export abstract class Abstract{{classname}}ResponseProcessor { {{#operation}} - public abstract {{nickname}}(response: ResponseContext): Promise<{{{returnType}}} {{^returnType}}void{{/returnType}}>; + public abstract {{nickname}}WithHttpInfo(response: ResponseContext): Promise>; {{/operation}} } diff --git a/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache b/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache index 0b6fde74ce66..a96427725012 100644 --- a/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/types/ObjectParamAPI.mustache @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http{{importFileExtension}}'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http{{importFileExtension}}'; import { Configuration} from '../configuration{{importFileExtension}}' {{#useRxJS}} import { Observable } from 'rxjs'; @@ -37,6 +37,19 @@ export class Object{{classname}} { } {{#operation}} + /** + {{#notes}} + * {{¬es}} + {{/notes}} + {{#summary}} + * {{&summary}} + {{/summary}} + * @param param the request object + */ + public {{nickname}}WithHttpInfo(param: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, options?: Configuration): {{#useRxJS}}Observable{{/useRxJS}}{{^useRxJS}}Promise{{/useRxJS}}> { + return this.api.{{nickname}}WithHttpInfo({{#allParams}}param.{{paramName}}, {{/allParams}} options){{^useRxJS}}.toPromise(){{/useRxJS}}; + } + /** {{#notes}} * {{¬es}} diff --git a/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache b/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache index 038e9a5bc4f8..ebdd2f932b63 100644 --- a/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/types/ObservableAPI.mustache @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http{{importFileExtension}}'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http{{importFileExtension}}'; import { Configuration} from '../configuration{{importFileExtension}}' import { Observable, of, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{importFileExtension}}'{{/useRxJS}}; import {mergeMap, map} from {{#useRxJS}}'rxjs/operators'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{importFileExtension}}'{{/useRxJS}}; @@ -61,7 +61,7 @@ export class Observable{{classname}} { * @param {{paramName}} {{description}} {{/allParams}} */ - public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}_options?: Configuration): Observable<{{{returnType}}}{{^returnType}}void{{/returnType}}> { + public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}_options); // build promise chain @@ -76,10 +76,25 @@ export class Observable{{classname}} { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.{{nickname}}(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.{{nickname}}WithHttpInfo(rsp))); })); } + /** + {{#notes}} + * {{¬es}} + {{/notes}} + {{#summary}} + * {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{paramName}} {{description}} + {{/allParams}} + */ + public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}_options?: Configuration): Observable<{{{returnType}}}{{^returnType}}void{{/returnType}}> { + return this.{{nickname}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}_options).pipe(map((apiResponse: HttpInfo<{{{returnType}}}{{^returnType}}void{{/returnType}}>) => apiResponse.data)); + } + {{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache b/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache index 85d43fab9b3d..4afcfa2df019 100644 --- a/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/types/PromiseAPI.mustache @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http{{importFileExtension}}'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http{{importFileExtension}}'; import { Configuration} from '../configuration{{importFileExtension}}' {{#useInversify}} import { injectable, inject, optional } from "inversify"; @@ -40,6 +40,22 @@ export class Promise{{classname}} { } {{#operation}} + /** + {{#notes}} + * {{¬es}} + {{/notes}} + {{#summary}} + * {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{paramName}} {{description}} + {{/allParams}} + */ + public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}_options?: Configuration): Promise> { + const result = this.api.{{nickname}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}_options); + return result.toPromise(); + } + /** {{#notes}} * {{¬es}} diff --git a/samples/client/others/typescript/builds/with-unique-items/apis/DefaultApi.ts b/samples/client/others/typescript/builds/with-unique-items/apis/DefaultApi.ts index 537b79f07893..db62475226d0 100644 --- a/samples/client/others/typescript/builds/with-unique-items/apis/DefaultApi.ts +++ b/samples/client/others/typescript/builds/with-unique-items/apis/DefaultApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -48,14 +48,14 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to uniqueItems * @throws ApiException if the response code was not in [200, 299] */ - public async uniqueItems(response: ResponseContext): Promise { + public async uniqueItemsWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Response = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Response", "" ) as Response; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -64,7 +64,7 @@ export class DefaultApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Response", "" ) as Response; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index e8da8b355da9..4f24155ea4fe 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/client/others/typescript/builds/with-unique-items/types/ObjectParamAPI.ts b/samples/client/others/typescript/builds/with-unique-items/types/ObjectParamAPI.ts index fa8ba7a0a9b9..2c5db71a9382 100644 --- a/samples/client/others/typescript/builds/with-unique-items/types/ObjectParamAPI.ts +++ b/samples/client/others/typescript/builds/with-unique-items/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Response } from '../models/Response'; @@ -16,6 +16,13 @@ export class ObjectDefaultApi { this.api = new ObservableDefaultApi(configuration, requestFactory, responseProcessor); } + /** + * @param param the request object + */ + public uniqueItemsWithHttpInfo(param: DefaultApiUniqueItemsRequest = {}, options?: Configuration): Promise> { + return this.api.uniqueItemsWithHttpInfo( options).toPromise(); + } + /** * @param param the request object */ diff --git a/samples/client/others/typescript/builds/with-unique-items/types/ObservableAPI.ts b/samples/client/others/typescript/builds/with-unique-items/types/ObservableAPI.ts index 683cd89061d1..aae68dc233e3 100644 --- a/samples/client/others/typescript/builds/with-unique-items/types/ObservableAPI.ts +++ b/samples/client/others/typescript/builds/with-unique-items/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -22,7 +22,7 @@ export class ObservableDefaultApi { /** */ - public uniqueItems(_options?: Configuration): Observable { + public uniqueItemsWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uniqueItems(_options); // build promise chain @@ -37,8 +37,14 @@ export class ObservableDefaultApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uniqueItems(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uniqueItemsWithHttpInfo(rsp))); })); } + /** + */ + public uniqueItems(_options?: Configuration): Observable { + return this.uniqueItemsWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/client/others/typescript/builds/with-unique-items/types/PromiseAPI.ts b/samples/client/others/typescript/builds/with-unique-items/types/PromiseAPI.ts index d0e502467ec1..a133e29a6f4d 100644 --- a/samples/client/others/typescript/builds/with-unique-items/types/PromiseAPI.ts +++ b/samples/client/others/typescript/builds/with-unique-items/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Response } from '../models/Response'; @@ -16,6 +16,13 @@ export class PromiseDefaultApi { this.api = new ObservableDefaultApi(configuration, requestFactory, responseProcessor); } + /** + */ + public uniqueItemsWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.uniqueItemsWithHttpInfo(_options); + return result.toPromise(); + } + /** */ public uniqueItems(_options?: Configuration): Promise { diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts index 514291812d2b..b8a08514c5c6 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/PetApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -436,14 +436,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise { + public async addPetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -455,7 +455,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -468,7 +468,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to deletePet * @throws ApiException if the response code was not in [200, 299] */ - public async deletePet(response: ResponseContext): Promise< void> { + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); @@ -476,7 +476,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -489,14 +489,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByStatus * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByStatus(response: ResponseContext): Promise > { + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); @@ -508,7 +508,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -521,14 +521,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByTags * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByTags(response: ResponseContext): Promise > { + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); @@ -540,7 +540,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -553,14 +553,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to getPetById * @throws ApiException if the response code was not in [200, 299] */ - public async getPetById(response: ResponseContext): Promise { + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -575,7 +575,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -588,14 +588,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise { + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -613,7 +613,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -626,7 +626,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePetWithForm * @throws ApiException if the response code was not in [200, 299] */ - public async updatePetWithForm(response: ResponseContext): Promise< void> { + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -634,7 +634,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -647,14 +647,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to uploadFile * @throws ApiException if the response code was not in [200, 299] */ - public async uploadFile(response: ResponseContext): Promise { + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ApiResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -663,7 +663,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts index 31cf3aa1f55e..6474ad8a3044 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/StoreApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -162,7 +162,7 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to deleteOrder * @throws ApiException if the response code was not in [200, 299] */ - public async deleteOrder(response: ResponseContext): Promise< void> { + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -173,7 +173,7 @@ export class StoreApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -186,14 +186,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getInventory * @throws ApiException if the response code was not in [200, 299] */ - public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: number; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -202,7 +202,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -215,14 +215,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getOrderById * @throws ApiException if the response code was not in [200, 299] */ - public async getOrderById(response: ResponseContext): Promise { + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -237,7 +237,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -250,14 +250,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to placeOrder * @throws ApiException if the response code was not in [200, 299] */ - public async placeOrder(response: ResponseContext): Promise { + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); @@ -269,7 +269,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts index 0331c7117d56..70aee8ce5e2f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/apis/UserApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -374,7 +374,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUser * @throws ApiException if the response code was not in [200, 299] */ - public async createUser(response: ResponseContext): Promise< void> { + public async createUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -382,7 +382,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -395,7 +395,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithArrayInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -403,7 +403,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -416,7 +416,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithListInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithListInput(response: ResponseContext): Promise< void> { + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -424,7 +424,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -437,7 +437,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise< void> { + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -448,7 +448,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -461,14 +461,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to getUserByName * @throws ApiException if the response code was not in [200, 299] */ - public async getUserByName(response: ResponseContext): Promise { + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -483,7 +483,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -496,14 +496,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to loginUser * @throws ApiException if the response code was not in [200, 299] */ - public async loginUser(response: ResponseContext): Promise { + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); @@ -515,7 +515,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -528,7 +528,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to logoutUser * @throws ApiException if the response code was not in [200, 299] */ - public async logoutUser(response: ResponseContext): Promise< void> { + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -536,7 +536,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -549,7 +549,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise< void> { + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); @@ -560,7 +560,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index e8da8b355da9..4f24155ea4fe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts index 41dfaebdde1d..e3fe52eef28f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -120,6 +120,15 @@ export class ObjectPetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Add a new pet to the store @@ -129,6 +138,15 @@ export class ObjectPetApi { return this.api.addPet(param.pet, options).toPromise(); } + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + /** * * Deletes a pet @@ -138,6 +156,15 @@ export class ObjectPetApi { return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -147,6 +174,15 @@ export class ObjectPetApi { return this.api.findPetsByStatus(param.status, options).toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -156,6 +192,15 @@ export class ObjectPetApi { return this.api.findPetsByTags(param.tags, options).toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -165,6 +210,15 @@ export class ObjectPetApi { return this.api.getPetById(param.petId, options).toPromise(); } + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Update an existing pet @@ -174,6 +228,15 @@ export class ObjectPetApi { return this.api.updatePet(param.pet, options).toPromise(); } + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + /** * * Updates a pet in the store with form data @@ -183,6 +246,15 @@ export class ObjectPetApi { return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); } + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + /** * * uploads an image @@ -234,6 +306,15 @@ export class ObjectStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -243,6 +324,15 @@ export class ObjectStoreApi { return this.api.deleteOrder(param.orderId, options).toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -252,6 +342,15 @@ export class ObjectStoreApi { return this.api.getInventory( options).toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -261,6 +360,15 @@ export class ObjectStoreApi { return this.api.getOrderById(param.orderId, options).toPromise(); } + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + /** * * Place an order for a pet @@ -360,6 +468,15 @@ export class ObjectUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -369,6 +486,15 @@ export class ObjectUserApi { return this.api.createUser(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -378,6 +504,15 @@ export class ObjectUserApi { return this.api.createUsersWithArrayInput(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -387,6 +522,15 @@ export class ObjectUserApi { return this.api.createUsersWithListInput(param.user, options).toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -396,6 +540,15 @@ export class ObjectUserApi { return this.api.deleteUser(param.username, options).toPromise(); } + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + /** * * Get user by user name @@ -405,6 +558,15 @@ export class ObjectUserApi { return this.api.getUserByName(param.username, options).toPromise(); } + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + /** * * Logs user into the system @@ -414,6 +576,15 @@ export class ObjectUserApi { return this.api.loginUser(param.username, param.password, options).toPromise(); } + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + /** * * Logs out current logged in user session @@ -423,6 +594,15 @@ export class ObjectUserApi { return this.api.logoutUser( options).toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts index 5e9397ea69f6..9ab72e5e78f5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -30,7 +30,7 @@ export class ObservablePetApi { * Add a new pet to the store * @param pet Pet object that needs to be added to the store */ - public addPet(pet: Pet, _options?: Configuration): Observable { + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.addPet(pet, _options); // build promise chain @@ -45,17 +45,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); })); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Deletes a pet * @param petId Pet id to delete * @param apiKey */ - public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); // build promise chain @@ -70,16 +79,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); })); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); // build promise chain @@ -94,16 +113,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); })); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); // build promise chain @@ -118,16 +146,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); })); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Returns a single pet * Find pet by ID * @param petId ID of pet to return */ - public getPetById(petId: number, _options?: Configuration): Observable { + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getPetById(petId, _options); // build promise chain @@ -142,16 +179,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); })); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Update an existing pet * @param pet Pet object that needs to be added to the store */ - public updatePet(pet: Pet, _options?: Configuration): Observable { + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePet(pet, _options); // build promise chain @@ -166,10 +212,19 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); })); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Updates a pet in the store with form data @@ -177,7 +232,7 @@ export class ObservablePetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); // build promise chain @@ -192,10 +247,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); })); } + /** + * + * Updates a pet in the store with form data + * @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 updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * uploads an image @@ -203,7 +269,7 @@ export class ObservablePetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); // build promise chain @@ -218,10 +284,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); })); } + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; @@ -245,7 +322,7 @@ export class ObservableStoreApi { * Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ - public deleteOrder(orderId: string, _options?: Configuration): Observable { + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); // build promise chain @@ -260,15 +337,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status */ - public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getInventory(_options); // build promise chain @@ -283,16 +369,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); })); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: number, _options?: Configuration): Observable { + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); // build promise chain @@ -307,16 +401,25 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Place an order for a pet * @param order order placed for purchasing the pet */ - public placeOrder(order: Order, _options?: Configuration): Observable { + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.placeOrder(order, _options); // build promise chain @@ -331,10 +434,19 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); })); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; @@ -358,7 +470,7 @@ export class ObservableUserApi { * Create user * @param user Created user object */ - public createUser(user: User, _options?: Configuration): Observable { + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUser(user, _options); // build promise chain @@ -373,16 +485,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Creates list of users with given input array * @param user List of user object */ - public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); // build promise chain @@ -397,7 +518,7 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); })); } @@ -406,7 +527,16 @@ export class ObservableUserApi { * Creates list of users with given input array * @param user List of user object */ - public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); // build promise chain @@ -421,16 +551,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); })); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Delete user * @param username The name that needs to be deleted */ - public deleteUser(username: string, _options?: Configuration): Observable { + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteUser(username, _options); // build promise chain @@ -445,16 +584,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ - public getUserByName(username: string, _options?: Configuration): Observable { + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getUserByName(username, _options); // build promise chain @@ -469,17 +617,26 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); })); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username: string, password: string, _options?: Configuration): Observable { + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.loginUser(username, password, _options); // build promise chain @@ -494,15 +651,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); })); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs out current logged in user session */ - public logoutUser(_options?: Configuration): Observable { + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.logoutUser(_options); // build promise chain @@ -517,17 +684,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); })); } + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Updated user * @param username name that need to be deleted * @param user Updated user object */ - public updateUser(username: string, user: User, _options?: Configuration): Observable { + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updateUser(username, user, _options); // build promise chain @@ -542,8 +717,18 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts index c86ac4a84f38..189962536f95 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -21,6 +21,16 @@ export class PromisePetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Add a new pet to the store @@ -31,6 +41,17 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + /** * * Deletes a pet @@ -42,6 +63,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -52,6 +83,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -62,6 +103,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -72,6 +123,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Update an existing pet @@ -82,6 +143,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Updates a pet in the store with form data + * @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, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + /** * * Updates a pet in the store with form data @@ -94,6 +167,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * uploads an image + * @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?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + /** * * uploads an image @@ -125,6 +210,16 @@ export class PromiseStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -135,6 +230,15 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -144,6 +248,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -154,6 +268,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + /** * * Place an order for a pet @@ -183,6 +307,16 @@ export class PromiseUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -193,6 +327,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -203,6 +347,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -213,6 +367,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -223,6 +387,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * * Get user by user name @@ -233,6 +407,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + /** * * Logs user into the system @@ -244,6 +429,15 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + /** * * Logs out current logged in user session @@ -253,6 +447,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts index 9f7c82dfb4ad..6cb63372a676 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/apis/DefaultApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -133,10 +133,10 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to filePost * @throws ApiException if the response code was not in [200, 299] */ - public async filePost(response: ResponseContext): Promise { + public async filePostWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -145,7 +145,7 @@ export class DefaultApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -158,10 +158,10 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to petsFilteredPatch * @throws ApiException if the response code was not in [200, 299] */ - public async petsFilteredPatch(response: ResponseContext): Promise { + public async petsFilteredPatchWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -170,7 +170,7 @@ export class DefaultApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -183,10 +183,10 @@ export class DefaultApiResponseProcessor { * @params response Response returned by the server for a request to petsPatch * @throws ApiException if the response code was not in [200, 299] */ - public async petsPatch(response: ResponseContext): Promise { + public async petsPatchWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -195,7 +195,7 @@ export class DefaultApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index e8da8b355da9..4f24155ea4fe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts index b034e0e6d50c..0ec652e36598 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Cat } from '../models/Cat'; @@ -46,6 +46,13 @@ export class ObjectDefaultApi { this.api = new ObservableDefaultApi(configuration, requestFactory, responseProcessor); } + /** + * @param param the request object + */ + public filePostWithHttpInfo(param: DefaultApiFilePostRequest = {}, options?: Configuration): Promise> { + return this.api.filePostWithHttpInfo(param.filePostRequest, options).toPromise(); + } + /** * @param param the request object */ @@ -53,6 +60,13 @@ export class ObjectDefaultApi { return this.api.filePost(param.filePostRequest, options).toPromise(); } + /** + * @param param the request object + */ + public petsFilteredPatchWithHttpInfo(param: DefaultApiPetsFilteredPatchRequest = {}, options?: Configuration): Promise> { + return this.api.petsFilteredPatchWithHttpInfo(param.petsFilteredPatchRequest, options).toPromise(); + } + /** * @param param the request object */ @@ -60,6 +74,13 @@ export class ObjectDefaultApi { return this.api.petsFilteredPatch(param.petsFilteredPatchRequest, options).toPromise(); } + /** + * @param param the request object + */ + public petsPatchWithHttpInfo(param: DefaultApiPetsPatchRequest = {}, options?: Configuration): Promise> { + return this.api.petsPatchWithHttpInfo(param.petsPatchRequest, options).toPromise(); + } + /** * @param param the request object */ diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts index e7148ec22559..38acb40771a5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -29,7 +29,7 @@ export class ObservableDefaultApi { /** * @param filePostRequest */ - public filePost(filePostRequest?: FilePostRequest, _options?: Configuration): Observable { + public filePostWithHttpInfo(filePostRequest?: FilePostRequest, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.filePost(filePostRequest, _options); // build promise chain @@ -44,14 +44,21 @@ export class ObservableDefaultApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.filePost(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.filePostWithHttpInfo(rsp))); })); } + /** + * @param filePostRequest + */ + public filePost(filePostRequest?: FilePostRequest, _options?: Configuration): Observable { + return this.filePostWithHttpInfo(filePostRequest, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * @param petsFilteredPatchRequest */ - public petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Observable { + public petsFilteredPatchWithHttpInfo(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.petsFilteredPatch(petsFilteredPatchRequest, _options); // build promise chain @@ -66,14 +73,21 @@ export class ObservableDefaultApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.petsFilteredPatch(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.petsFilteredPatchWithHttpInfo(rsp))); })); } + /** + * @param petsFilteredPatchRequest + */ + public petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Observable { + return this.petsFilteredPatchWithHttpInfo(petsFilteredPatchRequest, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * @param petsPatchRequest */ - public petsPatch(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Observable { + public petsPatchWithHttpInfo(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.petsPatch(petsPatchRequest, _options); // build promise chain @@ -88,8 +102,15 @@ export class ObservableDefaultApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.petsPatch(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.petsPatchWithHttpInfo(rsp))); })); } + /** + * @param petsPatchRequest + */ + public petsPatch(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Observable { + return this.petsPatchWithHttpInfo(petsPatchRequest, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts index 252c55ff3a30..e311d2ffb60f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Cat } from '../models/Cat'; @@ -22,6 +22,14 @@ export class PromiseDefaultApi { this.api = new ObservableDefaultApi(configuration, requestFactory, responseProcessor); } + /** + * @param filePostRequest + */ + public filePostWithHttpInfo(filePostRequest?: FilePostRequest, _options?: Configuration): Promise> { + const result = this.api.filePostWithHttpInfo(filePostRequest, _options); + return result.toPromise(); + } + /** * @param filePostRequest */ @@ -30,6 +38,14 @@ export class PromiseDefaultApi { return result.toPromise(); } + /** + * @param petsFilteredPatchRequest + */ + public petsFilteredPatchWithHttpInfo(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Promise> { + const result = this.api.petsFilteredPatchWithHttpInfo(petsFilteredPatchRequest, _options); + return result.toPromise(); + } + /** * @param petsFilteredPatchRequest */ @@ -38,6 +54,14 @@ export class PromiseDefaultApi { return result.toPromise(); } + /** + * @param petsPatchRequest + */ + public petsPatchWithHttpInfo(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Promise> { + const result = this.api.petsPatchWithHttpInfo(petsPatchRequest, _options); + return result.toPromise(); + } + /** * @param petsPatchRequest */ diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts index 5b3d37fe35a1..02f9d230affe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -438,14 +438,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise { + public async addPetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -457,7 +457,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -470,7 +470,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to deletePet * @throws ApiException if the response code was not in [200, 299] */ - public async deletePet(response: ResponseContext): Promise< void> { + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); @@ -478,7 +478,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -491,14 +491,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByStatus * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByStatus(response: ResponseContext): Promise > { + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); @@ -510,7 +510,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -523,14 +523,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByTags * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByTags(response: ResponseContext): Promise > { + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); @@ -542,7 +542,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -555,14 +555,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to getPetById * @throws ApiException if the response code was not in [200, 299] */ - public async getPetById(response: ResponseContext): Promise { + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -577,7 +577,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -590,14 +590,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise { + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -615,7 +615,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -628,7 +628,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePetWithForm * @throws ApiException if the response code was not in [200, 299] */ - public async updatePetWithForm(response: ResponseContext): Promise< void> { + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -636,7 +636,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -649,14 +649,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to uploadFile * @throws ApiException if the response code was not in [200, 299] */ - public async uploadFile(response: ResponseContext): Promise { + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ApiResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -665,7 +665,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts index 3bb0a2de754e..f4861af0df0c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -164,7 +164,7 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to deleteOrder * @throws ApiException if the response code was not in [200, 299] */ - public async deleteOrder(response: ResponseContext): Promise< void> { + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -175,7 +175,7 @@ export class StoreApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -188,14 +188,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getInventory * @throws ApiException if the response code was not in [200, 299] */ - public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: number; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -204,7 +204,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -217,14 +217,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getOrderById * @throws ApiException if the response code was not in [200, 299] */ - public async getOrderById(response: ResponseContext): Promise { + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -239,7 +239,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -252,14 +252,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to placeOrder * @throws ApiException if the response code was not in [200, 299] */ - public async placeOrder(response: ResponseContext): Promise { + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); @@ -271,7 +271,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts index 352b499b3785..b8f2c3313e26 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -376,7 +376,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUser * @throws ApiException if the response code was not in [200, 299] */ - public async createUser(response: ResponseContext): Promise< void> { + public async createUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -384,7 +384,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -397,7 +397,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithArrayInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -405,7 +405,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -418,7 +418,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithListInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithListInput(response: ResponseContext): Promise< void> { + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -426,7 +426,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -439,7 +439,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise< void> { + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -450,7 +450,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -463,14 +463,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to getUserByName * @throws ApiException if the response code was not in [200, 299] */ - public async getUserByName(response: ResponseContext): Promise { + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -485,7 +485,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -498,14 +498,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to loginUser * @throws ApiException if the response code was not in [200, 299] */ - public async loginUser(response: ResponseContext): Promise { + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); @@ -517,7 +517,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -530,7 +530,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to logoutUser * @throws ApiException if the response code was not in [200, 299] */ - public async logoutUser(response: ResponseContext): Promise< void> { + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -538,7 +538,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -551,7 +551,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise< void> { + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); @@ -562,7 +562,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index af0075aeba6f..77fb4a789dbb 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -234,3 +234,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/default/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/default/types/ObjectParamAPI.ts index 41dfaebdde1d..e3fe52eef28f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -120,6 +120,15 @@ export class ObjectPetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Add a new pet to the store @@ -129,6 +138,15 @@ export class ObjectPetApi { return this.api.addPet(param.pet, options).toPromise(); } + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + /** * * Deletes a pet @@ -138,6 +156,15 @@ export class ObjectPetApi { return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -147,6 +174,15 @@ export class ObjectPetApi { return this.api.findPetsByStatus(param.status, options).toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -156,6 +192,15 @@ export class ObjectPetApi { return this.api.findPetsByTags(param.tags, options).toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -165,6 +210,15 @@ export class ObjectPetApi { return this.api.getPetById(param.petId, options).toPromise(); } + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Update an existing pet @@ -174,6 +228,15 @@ export class ObjectPetApi { return this.api.updatePet(param.pet, options).toPromise(); } + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + /** * * Updates a pet in the store with form data @@ -183,6 +246,15 @@ export class ObjectPetApi { return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); } + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + /** * * uploads an image @@ -234,6 +306,15 @@ export class ObjectStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -243,6 +324,15 @@ export class ObjectStoreApi { return this.api.deleteOrder(param.orderId, options).toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -252,6 +342,15 @@ export class ObjectStoreApi { return this.api.getInventory( options).toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -261,6 +360,15 @@ export class ObjectStoreApi { return this.api.getOrderById(param.orderId, options).toPromise(); } + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + /** * * Place an order for a pet @@ -360,6 +468,15 @@ export class ObjectUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -369,6 +486,15 @@ export class ObjectUserApi { return this.api.createUser(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -378,6 +504,15 @@ export class ObjectUserApi { return this.api.createUsersWithArrayInput(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -387,6 +522,15 @@ export class ObjectUserApi { return this.api.createUsersWithListInput(param.user, options).toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -396,6 +540,15 @@ export class ObjectUserApi { return this.api.deleteUser(param.username, options).toPromise(); } + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + /** * * Get user by user name @@ -405,6 +558,15 @@ export class ObjectUserApi { return this.api.getUserByName(param.username, options).toPromise(); } + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + /** * * Logs user into the system @@ -414,6 +576,15 @@ export class ObjectUserApi { return this.api.loginUser(param.username, param.password, options).toPromise(); } + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + /** * * Logs out current logged in user session @@ -423,6 +594,15 @@ export class ObjectUserApi { return this.api.logoutUser( options).toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts index 5e9397ea69f6..9ab72e5e78f5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -30,7 +30,7 @@ export class ObservablePetApi { * Add a new pet to the store * @param pet Pet object that needs to be added to the store */ - public addPet(pet: Pet, _options?: Configuration): Observable { + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.addPet(pet, _options); // build promise chain @@ -45,17 +45,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); })); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Deletes a pet * @param petId Pet id to delete * @param apiKey */ - public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); // build promise chain @@ -70,16 +79,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); })); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); // build promise chain @@ -94,16 +113,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); })); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); // build promise chain @@ -118,16 +146,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); })); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Returns a single pet * Find pet by ID * @param petId ID of pet to return */ - public getPetById(petId: number, _options?: Configuration): Observable { + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getPetById(petId, _options); // build promise chain @@ -142,16 +179,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); })); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Update an existing pet * @param pet Pet object that needs to be added to the store */ - public updatePet(pet: Pet, _options?: Configuration): Observable { + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePet(pet, _options); // build promise chain @@ -166,10 +212,19 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); })); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Updates a pet in the store with form data @@ -177,7 +232,7 @@ export class ObservablePetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); // build promise chain @@ -192,10 +247,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); })); } + /** + * + * Updates a pet in the store with form data + * @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 updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * uploads an image @@ -203,7 +269,7 @@ export class ObservablePetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); // build promise chain @@ -218,10 +284,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); })); } + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; @@ -245,7 +322,7 @@ export class ObservableStoreApi { * Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ - public deleteOrder(orderId: string, _options?: Configuration): Observable { + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); // build promise chain @@ -260,15 +337,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status */ - public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getInventory(_options); // build promise chain @@ -283,16 +369,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); })); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: number, _options?: Configuration): Observable { + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); // build promise chain @@ -307,16 +401,25 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Place an order for a pet * @param order order placed for purchasing the pet */ - public placeOrder(order: Order, _options?: Configuration): Observable { + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.placeOrder(order, _options); // build promise chain @@ -331,10 +434,19 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); })); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; @@ -358,7 +470,7 @@ export class ObservableUserApi { * Create user * @param user Created user object */ - public createUser(user: User, _options?: Configuration): Observable { + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUser(user, _options); // build promise chain @@ -373,16 +485,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Creates list of users with given input array * @param user List of user object */ - public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); // build promise chain @@ -397,7 +518,7 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); })); } @@ -406,7 +527,16 @@ export class ObservableUserApi { * Creates list of users with given input array * @param user List of user object */ - public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); // build promise chain @@ -421,16 +551,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); })); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Delete user * @param username The name that needs to be deleted */ - public deleteUser(username: string, _options?: Configuration): Observable { + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteUser(username, _options); // build promise chain @@ -445,16 +584,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ - public getUserByName(username: string, _options?: Configuration): Observable { + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getUserByName(username, _options); // build promise chain @@ -469,17 +617,26 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); })); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username: string, password: string, _options?: Configuration): Observable { + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.loginUser(username, password, _options); // build promise chain @@ -494,15 +651,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); })); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs out current logged in user session */ - public logoutUser(_options?: Configuration): Observable { + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.logoutUser(_options); // build promise chain @@ -517,17 +684,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); })); } + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Updated user * @param username name that need to be deleted * @param user Updated user object */ - public updateUser(username: string, user: User, _options?: Configuration): Observable { + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updateUser(username, user, _options); // build promise chain @@ -542,8 +717,18 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts index c86ac4a84f38..189962536f95 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -21,6 +21,16 @@ export class PromisePetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Add a new pet to the store @@ -31,6 +41,17 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + /** * * Deletes a pet @@ -42,6 +63,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -52,6 +83,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -62,6 +103,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -72,6 +123,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Update an existing pet @@ -82,6 +143,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Updates a pet in the store with form data + * @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, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + /** * * Updates a pet in the store with form data @@ -94,6 +167,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * uploads an image + * @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?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + /** * * uploads an image @@ -125,6 +210,16 @@ export class PromiseStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -135,6 +230,15 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -144,6 +248,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -154,6 +268,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + /** * * Place an order for a pet @@ -183,6 +307,16 @@ export class PromiseUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -193,6 +327,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -203,6 +347,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -213,6 +367,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -223,6 +387,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * * Get user by user name @@ -233,6 +407,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + /** * * Logs user into the system @@ -244,6 +429,15 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + /** * * Logs out current logged in user session @@ -253,6 +447,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts index 8c2c2bf98b76..4e3e8d09e837 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/PetApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; import {ObjectSerializer} from '../models/ObjectSerializer.ts'; import {ApiException} from './exception.ts'; import {canConsumeForm, isCodeInRange} from '../util.ts'; @@ -436,14 +436,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise { + public async addPetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -455,7 +455,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -468,7 +468,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to deletePet * @throws ApiException if the response code was not in [200, 299] */ - public async deletePet(response: ResponseContext): Promise< void> { + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); @@ -476,7 +476,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -489,14 +489,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByStatus * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByStatus(response: ResponseContext): Promise > { + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); @@ -508,7 +508,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -521,14 +521,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByTags * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByTags(response: ResponseContext): Promise > { + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); @@ -540,7 +540,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -553,14 +553,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to getPetById * @throws ApiException if the response code was not in [200, 299] */ - public async getPetById(response: ResponseContext): Promise { + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -575,7 +575,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -588,14 +588,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise { + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -613,7 +613,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -626,7 +626,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePetWithForm * @throws ApiException if the response code was not in [200, 299] */ - public async updatePetWithForm(response: ResponseContext): Promise< void> { + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -634,7 +634,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -647,14 +647,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to uploadFile * @throws ApiException if the response code was not in [200, 299] */ - public async uploadFile(response: ResponseContext): Promise { + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ApiResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -663,7 +663,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts index 99e2f62d65e3..a4eab6982ce6 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/StoreApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; import {ObjectSerializer} from '../models/ObjectSerializer.ts'; import {ApiException} from './exception.ts'; import {canConsumeForm, isCodeInRange} from '../util.ts'; @@ -162,7 +162,7 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to deleteOrder * @throws ApiException if the response code was not in [200, 299] */ - public async deleteOrder(response: ResponseContext): Promise< void> { + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -173,7 +173,7 @@ export class StoreApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -186,14 +186,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getInventory * @throws ApiException if the response code was not in [200, 299] */ - public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: number; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -202,7 +202,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -215,14 +215,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getOrderById * @throws ApiException if the response code was not in [200, 299] */ - public async getOrderById(response: ResponseContext): Promise { + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -237,7 +237,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -250,14 +250,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to placeOrder * @throws ApiException if the response code was not in [200, 299] */ - public async placeOrder(response: ResponseContext): Promise { + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); @@ -269,7 +269,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts index cf96436616ef..ed456958be92 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/apis/UserApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi.ts'; import {Configuration} from '../configuration.ts'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http.ts'; import {ObjectSerializer} from '../models/ObjectSerializer.ts'; import {ApiException} from './exception.ts'; import {canConsumeForm, isCodeInRange} from '../util.ts'; @@ -374,7 +374,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUser * @throws ApiException if the response code was not in [200, 299] */ - public async createUser(response: ResponseContext): Promise< void> { + public async createUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -382,7 +382,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -395,7 +395,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithArrayInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -403,7 +403,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -416,7 +416,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithListInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithListInput(response: ResponseContext): Promise< void> { + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -424,7 +424,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -437,7 +437,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise< void> { + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -448,7 +448,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -461,14 +461,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to getUserByName * @throws ApiException if the response code was not in [200, 299] */ - public async getUserByName(response: ResponseContext): Promise { + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -483,7 +483,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -496,14 +496,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to loginUser * @throws ApiException if the response code was not in [200, 299] */ - public async loginUser(response: ResponseContext): Promise { + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); @@ -515,7 +515,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -528,7 +528,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to logoutUser * @throws ApiException if the response code was not in [200, 299] */ - public async logoutUser(response: ResponseContext): Promise< void> { + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -536,7 +536,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -549,7 +549,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise< void> { + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); @@ -560,7 +560,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index 97a04c3e2079..29fc7c39f619 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -225,3 +225,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts index e499b3bc620c..cbdcc3963530 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http.ts'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; import { Configuration} from '../configuration.ts' import { ApiResponse } from '../models/ApiResponse.ts'; @@ -120,6 +120,15 @@ export class ObjectPetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Add a new pet to the store @@ -129,6 +138,15 @@ export class ObjectPetApi { return this.api.addPet(param.pet, options).toPromise(); } + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + /** * * Deletes a pet @@ -138,6 +156,15 @@ export class ObjectPetApi { return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -147,6 +174,15 @@ export class ObjectPetApi { return this.api.findPetsByStatus(param.status, options).toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -156,6 +192,15 @@ export class ObjectPetApi { return this.api.findPetsByTags(param.tags, options).toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -165,6 +210,15 @@ export class ObjectPetApi { return this.api.getPetById(param.petId, options).toPromise(); } + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Update an existing pet @@ -174,6 +228,15 @@ export class ObjectPetApi { return this.api.updatePet(param.pet, options).toPromise(); } + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + /** * * Updates a pet in the store with form data @@ -183,6 +246,15 @@ export class ObjectPetApi { return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); } + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + /** * * uploads an image @@ -234,6 +306,15 @@ export class ObjectStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -243,6 +324,15 @@ export class ObjectStoreApi { return this.api.deleteOrder(param.orderId, options).toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -252,6 +342,15 @@ export class ObjectStoreApi { return this.api.getInventory( options).toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -261,6 +360,15 @@ export class ObjectStoreApi { return this.api.getOrderById(param.orderId, options).toPromise(); } + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + /** * * Place an order for a pet @@ -360,6 +468,15 @@ export class ObjectUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -369,6 +486,15 @@ export class ObjectUserApi { return this.api.createUser(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -378,6 +504,15 @@ export class ObjectUserApi { return this.api.createUsersWithArrayInput(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -387,6 +522,15 @@ export class ObjectUserApi { return this.api.createUsersWithListInput(param.user, options).toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -396,6 +540,15 @@ export class ObjectUserApi { return this.api.deleteUser(param.username, options).toPromise(); } + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + /** * * Get user by user name @@ -405,6 +558,15 @@ export class ObjectUserApi { return this.api.getUserByName(param.username, options).toPromise(); } + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + /** * * Logs user into the system @@ -414,6 +576,15 @@ export class ObjectUserApi { return this.api.loginUser(param.username, param.password, options).toPromise(); } + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + /** * * Logs out current logged in user session @@ -423,6 +594,15 @@ export class ObjectUserApi { return this.api.logoutUser( options).toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts index 1857aba9f385..d53d48a913e4 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http.ts'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; import { Configuration} from '../configuration.ts' import { Observable, of, from } from '../rxjsStub.ts'; import {mergeMap, map} from '../rxjsStub.ts'; @@ -30,7 +30,7 @@ export class ObservablePetApi { * Add a new pet to the store * @param pet Pet object that needs to be added to the store */ - public addPet(pet: Pet, _options?: Configuration): Observable { + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.addPet(pet, _options); // build promise chain @@ -45,17 +45,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); })); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Deletes a pet * @param petId Pet id to delete * @param apiKey */ - public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); // build promise chain @@ -70,16 +79,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); })); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); // build promise chain @@ -94,16 +113,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); })); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); // build promise chain @@ -118,16 +146,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); })); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Returns a single pet * Find pet by ID * @param petId ID of pet to return */ - public getPetById(petId: number, _options?: Configuration): Observable { + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getPetById(petId, _options); // build promise chain @@ -142,16 +179,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); })); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Update an existing pet * @param pet Pet object that needs to be added to the store */ - public updatePet(pet: Pet, _options?: Configuration): Observable { + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePet(pet, _options); // build promise chain @@ -166,10 +212,19 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); })); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Updates a pet in the store with form data @@ -177,7 +232,7 @@ export class ObservablePetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); // build promise chain @@ -192,10 +247,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); })); } + /** + * + * Updates a pet in the store with form data + * @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 updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * uploads an image @@ -203,7 +269,7 @@ export class ObservablePetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); // build promise chain @@ -218,10 +284,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); })); } + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi.ts"; @@ -245,7 +322,7 @@ export class ObservableStoreApi { * Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ - public deleteOrder(orderId: string, _options?: Configuration): Observable { + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); // build promise chain @@ -260,15 +337,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status */ - public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getInventory(_options); // build promise chain @@ -283,16 +369,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); })); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: number, _options?: Configuration): Observable { + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); // build promise chain @@ -307,16 +401,25 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Place an order for a pet * @param order order placed for purchasing the pet */ - public placeOrder(order: Order, _options?: Configuration): Observable { + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.placeOrder(order, _options); // build promise chain @@ -331,10 +434,19 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); })); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi.ts"; @@ -358,7 +470,7 @@ export class ObservableUserApi { * Create user * @param user Created user object */ - public createUser(user: User, _options?: Configuration): Observable { + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUser(user, _options); // build promise chain @@ -373,16 +485,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Creates list of users with given input array * @param user List of user object */ - public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); // build promise chain @@ -397,7 +518,7 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); })); } @@ -406,7 +527,16 @@ export class ObservableUserApi { * Creates list of users with given input array * @param user List of user object */ - public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); // build promise chain @@ -421,16 +551,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); })); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Delete user * @param username The name that needs to be deleted */ - public deleteUser(username: string, _options?: Configuration): Observable { + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteUser(username, _options); // build promise chain @@ -445,16 +584,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ - public getUserByName(username: string, _options?: Configuration): Observable { + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getUserByName(username, _options); // build promise chain @@ -469,17 +617,26 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); })); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username: string, password: string, _options?: Configuration): Observable { + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.loginUser(username, password, _options); // build promise chain @@ -494,15 +651,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); })); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs out current logged in user session */ - public logoutUser(_options?: Configuration): Observable { + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.logoutUser(_options); // build promise chain @@ -517,17 +684,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); })); } + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Updated user * @param username name that need to be deleted * @param user Updated user object */ - public updateUser(username: string, user: User, _options?: Configuration): Observable { + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updateUser(username, user, _options); // build promise chain @@ -542,8 +717,18 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts index 087bc60cbe7f..a226b8d34825 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http.ts'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http.ts'; import { Configuration} from '../configuration.ts' import { ApiResponse } from '../models/ApiResponse.ts'; @@ -21,6 +21,16 @@ export class PromisePetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Add a new pet to the store @@ -31,6 +41,17 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + /** * * Deletes a pet @@ -42,6 +63,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -52,6 +83,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -62,6 +103,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -72,6 +123,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Update an existing pet @@ -82,6 +143,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Updates a pet in the store with form data + * @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, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + /** * * Updates a pet in the store with form data @@ -94,6 +167,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * uploads an image + * @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?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + /** * * uploads an image @@ -125,6 +210,16 @@ export class PromiseStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -135,6 +230,15 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -144,6 +248,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -154,6 +268,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + /** * * Place an order for a pet @@ -183,6 +307,16 @@ export class PromiseUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -193,6 +327,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -203,6 +347,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -213,6 +367,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -223,6 +387,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * * Get user by user name @@ -233,6 +407,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + /** * * Logs user into the system @@ -244,6 +429,15 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + /** * * Logs out current logged in user session @@ -253,6 +447,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.service.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.service.ts index e96ab5e14824..50570c98cafe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.service.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.service.ts @@ -1,5 +1,5 @@ import type { Configuration } from "../configuration"; -import type { HttpFile, RequestContext, ResponseContext } from "../http/http"; +import type { HttpFile, RequestContext, ResponseContext, HttpInfo } from "../http/http"; import { ApiResponse } from "../models/ApiResponse"; import { Pet } from "../models/Pet"; @@ -25,20 +25,20 @@ export abstract class AbstractPetApiRequestFactory { export abstract class AbstractPetApiResponseProcessor { - public abstract addPet(response: ResponseContext): Promise; + public abstract addPetWithHttpInfo(response: ResponseContext): Promise>; - public abstract deletePet(response: ResponseContext): Promise< void>; + public abstract deletePetWithHttpInfo(response: ResponseContext): Promise>; - public abstract findPetsByStatus(response: ResponseContext): Promise >; + public abstract findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >>; - public abstract findPetsByTags(response: ResponseContext): Promise >; + public abstract findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >>; - public abstract getPetById(response: ResponseContext): Promise; + public abstract getPetByIdWithHttpInfo(response: ResponseContext): Promise>; - public abstract updatePet(response: ResponseContext): Promise; + public abstract updatePetWithHttpInfo(response: ResponseContext): Promise>; - public abstract updatePetWithForm(response: ResponseContext): Promise< void>; + public abstract updatePetWithFormWithHttpInfo(response: ResponseContext): Promise>; - public abstract uploadFile(response: ResponseContext): Promise; + public abstract uploadFileWithHttpInfo(response: ResponseContext): Promise>; } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts index 93928166fcdc..f1a6e270e0b2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -409,14 +409,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise { + public async addPetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -428,7 +428,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -441,7 +441,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to deletePet * @throws ApiException if the response code was not in [200, 299] */ - public async deletePet(response: ResponseContext): Promise< void> { + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); @@ -449,7 +449,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -462,14 +462,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByStatus * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByStatus(response: ResponseContext): Promise > { + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); @@ -481,7 +481,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -494,14 +494,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByTags * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByTags(response: ResponseContext): Promise > { + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); @@ -513,7 +513,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -526,14 +526,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to getPetById * @throws ApiException if the response code was not in [200, 299] */ - public async getPetById(response: ResponseContext): Promise { + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -548,7 +548,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -561,14 +561,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise { + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -586,7 +586,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -599,7 +599,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePetWithForm * @throws ApiException if the response code was not in [200, 299] */ - public async updatePetWithForm(response: ResponseContext): Promise< void> { + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -607,7 +607,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -620,14 +620,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to uploadFile * @throws ApiException if the response code was not in [200, 299] */ - public async uploadFile(response: ResponseContext): Promise { + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ApiResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -636,7 +636,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.service.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.service.ts index b2e61032a7f6..ab64970f2098 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.service.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.service.ts @@ -1,5 +1,5 @@ import type { Configuration } from "../configuration"; -import type { HttpFile, RequestContext, ResponseContext } from "../http/http"; +import type { HttpFile, RequestContext, ResponseContext, HttpInfo } from "../http/http"; import { Order } from "../models/Order"; @@ -16,12 +16,12 @@ export abstract class AbstractStoreApiRequestFactory { export abstract class AbstractStoreApiResponseProcessor { - public abstract deleteOrder(response: ResponseContext): Promise< void>; + public abstract deleteOrderWithHttpInfo(response: ResponseContext): Promise>; - public abstract getInventory(response: ResponseContext): Promise<{ [key: string]: number; } >; + public abstract getInventoryWithHttpInfo(response: ResponseContext): Promise>; - public abstract getOrderById(response: ResponseContext): Promise; + public abstract getOrderByIdWithHttpInfo(response: ResponseContext): Promise>; - public abstract placeOrder(response: ResponseContext): Promise; + public abstract placeOrderWithHttpInfo(response: ResponseContext): Promise>; } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts index 7537e2b4eccc..40898f29d80d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -151,7 +151,7 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to deleteOrder * @throws ApiException if the response code was not in [200, 299] */ - public async deleteOrder(response: ResponseContext): Promise< void> { + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -162,7 +162,7 @@ export class StoreApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -175,14 +175,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getInventory * @throws ApiException if the response code was not in [200, 299] */ - public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: number; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -191,7 +191,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -204,14 +204,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getOrderById * @throws ApiException if the response code was not in [200, 299] */ - public async getOrderById(response: ResponseContext): Promise { + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -226,7 +226,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -239,14 +239,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to placeOrder * @throws ApiException if the response code was not in [200, 299] */ - public async placeOrder(response: ResponseContext): Promise { + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); @@ -258,7 +258,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.service.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.service.ts index 0ea540fef877..7fb217eea850 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.service.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.service.ts @@ -1,5 +1,5 @@ import type { Configuration } from "../configuration"; -import type { HttpFile, RequestContext, ResponseContext } from "../http/http"; +import type { HttpFile, RequestContext, ResponseContext, HttpInfo } from "../http/http"; import { User } from "../models/User"; @@ -24,20 +24,20 @@ export abstract class AbstractUserApiRequestFactory { export abstract class AbstractUserApiResponseProcessor { - public abstract createUser(response: ResponseContext): Promise< void>; + public abstract createUserWithHttpInfo(response: ResponseContext): Promise>; - public abstract createUsersWithArrayInput(response: ResponseContext): Promise< void>; + public abstract createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise>; - public abstract createUsersWithListInput(response: ResponseContext): Promise< void>; + public abstract createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise>; - public abstract deleteUser(response: ResponseContext): Promise< void>; + public abstract deleteUserWithHttpInfo(response: ResponseContext): Promise>; - public abstract getUserByName(response: ResponseContext): Promise; + public abstract getUserByNameWithHttpInfo(response: ResponseContext): Promise>; - public abstract loginUser(response: ResponseContext): Promise; + public abstract loginUserWithHttpInfo(response: ResponseContext): Promise>; - public abstract logoutUser(response: ResponseContext): Promise< void>; + public abstract logoutUserWithHttpInfo(response: ResponseContext): Promise>; - public abstract updateUser(response: ResponseContext): Promise< void>; + public abstract updateUserWithHttpInfo(response: ResponseContext): Promise>; } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts index 9f81f5e77f07..766707c7b9b8 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -347,7 +347,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUser * @throws ApiException if the response code was not in [200, 299] */ - public async createUser(response: ResponseContext): Promise< void> { + public async createUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -355,7 +355,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -368,7 +368,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithArrayInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -376,7 +376,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -389,7 +389,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithListInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithListInput(response: ResponseContext): Promise< void> { + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -397,7 +397,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -410,7 +410,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise< void> { + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -421,7 +421,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -434,14 +434,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to getUserByName * @throws ApiException if the response code was not in [200, 299] */ - public async getUserByName(response: ResponseContext): Promise { + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -456,7 +456,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -469,14 +469,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to loginUser * @throws ApiException if the response code was not in [200, 299] */ - public async loginUser(response: ResponseContext): Promise { + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); @@ -488,7 +488,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -501,7 +501,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to logoutUser * @throws ApiException if the response code was not in [200, 299] */ - public async logoutUser(response: ResponseContext): Promise< void> { + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -509,7 +509,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -522,7 +522,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise< void> { + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); @@ -533,7 +533,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index af0075aeba6f..77fb4a789dbb 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -234,3 +234,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObjectParamAPI.ts index 41dfaebdde1d..e3fe52eef28f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -120,6 +120,15 @@ export class ObjectPetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Add a new pet to the store @@ -129,6 +138,15 @@ export class ObjectPetApi { return this.api.addPet(param.pet, options).toPromise(); } + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + /** * * Deletes a pet @@ -138,6 +156,15 @@ export class ObjectPetApi { return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -147,6 +174,15 @@ export class ObjectPetApi { return this.api.findPetsByStatus(param.status, options).toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -156,6 +192,15 @@ export class ObjectPetApi { return this.api.findPetsByTags(param.tags, options).toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -165,6 +210,15 @@ export class ObjectPetApi { return this.api.getPetById(param.petId, options).toPromise(); } + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Update an existing pet @@ -174,6 +228,15 @@ export class ObjectPetApi { return this.api.updatePet(param.pet, options).toPromise(); } + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + /** * * Updates a pet in the store with form data @@ -183,6 +246,15 @@ export class ObjectPetApi { return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); } + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + /** * * uploads an image @@ -234,6 +306,15 @@ export class ObjectStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -243,6 +324,15 @@ export class ObjectStoreApi { return this.api.deleteOrder(param.orderId, options).toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -252,6 +342,15 @@ export class ObjectStoreApi { return this.api.getInventory( options).toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -261,6 +360,15 @@ export class ObjectStoreApi { return this.api.getOrderById(param.orderId, options).toPromise(); } + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + /** * * Place an order for a pet @@ -360,6 +468,15 @@ export class ObjectUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -369,6 +486,15 @@ export class ObjectUserApi { return this.api.createUser(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -378,6 +504,15 @@ export class ObjectUserApi { return this.api.createUsersWithArrayInput(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -387,6 +522,15 @@ export class ObjectUserApi { return this.api.createUsersWithListInput(param.user, options).toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -396,6 +540,15 @@ export class ObjectUserApi { return this.api.deleteUser(param.username, options).toPromise(); } + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + /** * * Get user by user name @@ -405,6 +558,15 @@ export class ObjectUserApi { return this.api.getUserByName(param.username, options).toPromise(); } + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + /** * * Logs user into the system @@ -414,6 +576,15 @@ export class ObjectUserApi { return this.api.loginUser(param.username, param.password, options).toPromise(); } + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + /** * * Logs out current logged in user session @@ -423,6 +594,15 @@ export class ObjectUserApi { return this.api.logoutUser( options).toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts index c3c1dc415160..0c2454ff98ba 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -35,7 +35,7 @@ export class ObservablePetApi { * Add a new pet to the store * @param pet Pet object that needs to be added to the store */ - public addPet(pet: Pet, _options?: Configuration): Observable { + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.addPet(pet, _options); // build promise chain @@ -50,17 +50,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); })); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Deletes a pet * @param petId Pet id to delete * @param apiKey */ - public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); // build promise chain @@ -75,16 +84,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); })); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); // build promise chain @@ -99,16 +118,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); })); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); // build promise chain @@ -123,16 +151,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); })); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Returns a single pet * Find pet by ID * @param petId ID of pet to return */ - public getPetById(petId: number, _options?: Configuration): Observable { + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getPetById(petId, _options); // build promise chain @@ -147,16 +184,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); })); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Update an existing pet * @param pet Pet object that needs to be added to the store */ - public updatePet(pet: Pet, _options?: Configuration): Observable { + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePet(pet, _options); // build promise chain @@ -171,10 +217,19 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); })); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Updates a pet in the store with form data @@ -182,7 +237,7 @@ export class ObservablePetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); // build promise chain @@ -197,10 +252,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); })); } + /** + * + * Updates a pet in the store with form data + * @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 updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * uploads an image @@ -208,7 +274,7 @@ export class ObservablePetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); // build promise chain @@ -223,10 +289,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); })); } + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; @@ -253,7 +330,7 @@ export class ObservableStoreApi { * Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ - public deleteOrder(orderId: string, _options?: Configuration): Observable { + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); // build promise chain @@ -268,15 +345,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status */ - public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getInventory(_options); // build promise chain @@ -291,16 +377,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); })); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: number, _options?: Configuration): Observable { + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); // build promise chain @@ -315,16 +409,25 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Place an order for a pet * @param order order placed for purchasing the pet */ - public placeOrder(order: Order, _options?: Configuration): Observable { + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.placeOrder(order, _options); // build promise chain @@ -339,10 +442,19 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); })); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; @@ -369,7 +481,7 @@ export class ObservableUserApi { * Create user * @param user Created user object */ - public createUser(user: User, _options?: Configuration): Observable { + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUser(user, _options); // build promise chain @@ -384,16 +496,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Creates list of users with given input array * @param user List of user object */ - public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); // build promise chain @@ -408,7 +529,7 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); })); } @@ -417,7 +538,16 @@ export class ObservableUserApi { * Creates list of users with given input array * @param user List of user object */ - public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); // build promise chain @@ -432,16 +562,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); })); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Delete user * @param username The name that needs to be deleted */ - public deleteUser(username: string, _options?: Configuration): Observable { + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteUser(username, _options); // build promise chain @@ -456,16 +595,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ - public getUserByName(username: string, _options?: Configuration): Observable { + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getUserByName(username, _options); // build promise chain @@ -480,17 +628,26 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); })); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username: string, password: string, _options?: Configuration): Observable { + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.loginUser(username, password, _options); // build promise chain @@ -505,15 +662,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); })); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs out current logged in user session */ - public logoutUser(_options?: Configuration): Observable { + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.logoutUser(_options); // build promise chain @@ -528,17 +695,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); })); } + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Updated user * @param username name that need to be deleted * @param user Updated user object */ - public updateUser(username: string, user: User, _options?: Configuration): Observable { + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updateUser(username, user, _options); // build promise chain @@ -553,8 +728,18 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts index d1ade068256a..a210e0a05d49 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { injectable, inject, optional } from "inversify"; import { AbstractConfiguration } from "../services/configuration"; @@ -26,6 +26,16 @@ export class PromisePetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Add a new pet to the store @@ -36,6 +46,17 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + /** * * Deletes a pet @@ -47,6 +68,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -57,6 +88,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -67,6 +108,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -77,6 +128,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Update an existing pet @@ -87,6 +148,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Updates a pet in the store with form data + * @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, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + /** * * Updates a pet in the store with form data @@ -99,6 +172,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * uploads an image + * @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?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + /** * * uploads an image @@ -133,6 +218,16 @@ export class PromiseStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -143,6 +238,15 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -152,6 +256,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -162,6 +276,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + /** * * Place an order for a pet @@ -194,6 +318,16 @@ export class PromiseUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -204,6 +338,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -214,6 +358,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -224,6 +378,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -234,6 +398,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * * Get user by user name @@ -244,6 +418,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + /** * * Logs user into the system @@ -255,6 +440,15 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + /** * * Logs out current logged in user session @@ -264,6 +458,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts index 514291812d2b..b8a08514c5c6 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/PetApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -436,14 +436,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise { + public async addPetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -455,7 +455,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -468,7 +468,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to deletePet * @throws ApiException if the response code was not in [200, 299] */ - public async deletePet(response: ResponseContext): Promise< void> { + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); @@ -476,7 +476,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -489,14 +489,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByStatus * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByStatus(response: ResponseContext): Promise > { + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); @@ -508,7 +508,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -521,14 +521,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByTags * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByTags(response: ResponseContext): Promise > { + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); @@ -540,7 +540,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -553,14 +553,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to getPetById * @throws ApiException if the response code was not in [200, 299] */ - public async getPetById(response: ResponseContext): Promise { + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -575,7 +575,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -588,14 +588,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise { + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -613,7 +613,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -626,7 +626,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePetWithForm * @throws ApiException if the response code was not in [200, 299] */ - public async updatePetWithForm(response: ResponseContext): Promise< void> { + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -634,7 +634,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -647,14 +647,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to uploadFile * @throws ApiException if the response code was not in [200, 299] */ - public async uploadFile(response: ResponseContext): Promise { + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ApiResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -663,7 +663,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts index 31cf3aa1f55e..6474ad8a3044 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/StoreApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -162,7 +162,7 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to deleteOrder * @throws ApiException if the response code was not in [200, 299] */ - public async deleteOrder(response: ResponseContext): Promise< void> { + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -173,7 +173,7 @@ export class StoreApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -186,14 +186,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getInventory * @throws ApiException if the response code was not in [200, 299] */ - public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: number; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -202,7 +202,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -215,14 +215,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getOrderById * @throws ApiException if the response code was not in [200, 299] */ - public async getOrderById(response: ResponseContext): Promise { + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -237,7 +237,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -250,14 +250,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to placeOrder * @throws ApiException if the response code was not in [200, 299] */ - public async placeOrder(response: ResponseContext): Promise { + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); @@ -269,7 +269,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts index 0331c7117d56..70aee8ce5e2f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/apis/UserApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; @@ -374,7 +374,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUser * @throws ApiException if the response code was not in [200, 299] */ - public async createUser(response: ResponseContext): Promise< void> { + public async createUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -382,7 +382,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -395,7 +395,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithArrayInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -403,7 +403,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -416,7 +416,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithListInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithListInput(response: ResponseContext): Promise< void> { + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -424,7 +424,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -437,7 +437,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise< void> { + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -448,7 +448,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -461,14 +461,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to getUserByName * @throws ApiException if the response code was not in [200, 299] */ - public async getUserByName(response: ResponseContext): Promise { + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -483,7 +483,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -496,14 +496,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to loginUser * @throws ApiException if the response code was not in [200, 299] */ - public async loginUser(response: ResponseContext): Promise { + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); @@ -515,7 +515,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -528,7 +528,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to logoutUser * @throws ApiException if the response code was not in [200, 299] */ - public async logoutUser(response: ResponseContext): Promise< void> { + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -536,7 +536,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -549,7 +549,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise< void> { + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); @@ -560,7 +560,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index 81f327aa1eef..a433d76ffa2a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObjectParamAPI.ts index 41dfaebdde1d..e3fe52eef28f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -120,6 +120,15 @@ export class ObjectPetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Add a new pet to the store @@ -129,6 +138,15 @@ export class ObjectPetApi { return this.api.addPet(param.pet, options).toPromise(); } + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + /** * * Deletes a pet @@ -138,6 +156,15 @@ export class ObjectPetApi { return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -147,6 +174,15 @@ export class ObjectPetApi { return this.api.findPetsByStatus(param.status, options).toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -156,6 +192,15 @@ export class ObjectPetApi { return this.api.findPetsByTags(param.tags, options).toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -165,6 +210,15 @@ export class ObjectPetApi { return this.api.getPetById(param.petId, options).toPromise(); } + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Update an existing pet @@ -174,6 +228,15 @@ export class ObjectPetApi { return this.api.updatePet(param.pet, options).toPromise(); } + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + /** * * Updates a pet in the store with form data @@ -183,6 +246,15 @@ export class ObjectPetApi { return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); } + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + /** * * uploads an image @@ -234,6 +306,15 @@ export class ObjectStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -243,6 +324,15 @@ export class ObjectStoreApi { return this.api.deleteOrder(param.orderId, options).toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -252,6 +342,15 @@ export class ObjectStoreApi { return this.api.getInventory( options).toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -261,6 +360,15 @@ export class ObjectStoreApi { return this.api.getOrderById(param.orderId, options).toPromise(); } + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + /** * * Place an order for a pet @@ -360,6 +468,15 @@ export class ObjectUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -369,6 +486,15 @@ export class ObjectUserApi { return this.api.createUser(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -378,6 +504,15 @@ export class ObjectUserApi { return this.api.createUsersWithArrayInput(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -387,6 +522,15 @@ export class ObjectUserApi { return this.api.createUsersWithListInput(param.user, options).toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -396,6 +540,15 @@ export class ObjectUserApi { return this.api.deleteUser(param.username, options).toPromise(); } + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + /** * * Get user by user name @@ -405,6 +558,15 @@ export class ObjectUserApi { return this.api.getUserByName(param.username, options).toPromise(); } + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + /** * * Logs user into the system @@ -414,6 +576,15 @@ export class ObjectUserApi { return this.api.loginUser(param.username, param.password, options).toPromise(); } + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + /** * * Logs out current logged in user session @@ -423,6 +594,15 @@ export class ObjectUserApi { return this.api.logoutUser( options).toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts index 5e9397ea69f6..9ab72e5e78f5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -30,7 +30,7 @@ export class ObservablePetApi { * Add a new pet to the store * @param pet Pet object that needs to be added to the store */ - public addPet(pet: Pet, _options?: Configuration): Observable { + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.addPet(pet, _options); // build promise chain @@ -45,17 +45,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); })); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Deletes a pet * @param petId Pet id to delete * @param apiKey */ - public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); // build promise chain @@ -70,16 +79,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); })); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); // build promise chain @@ -94,16 +113,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); })); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); // build promise chain @@ -118,16 +146,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); })); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Returns a single pet * Find pet by ID * @param petId ID of pet to return */ - public getPetById(petId: number, _options?: Configuration): Observable { + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getPetById(petId, _options); // build promise chain @@ -142,16 +179,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); })); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Update an existing pet * @param pet Pet object that needs to be added to the store */ - public updatePet(pet: Pet, _options?: Configuration): Observable { + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePet(pet, _options); // build promise chain @@ -166,10 +212,19 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); })); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Updates a pet in the store with form data @@ -177,7 +232,7 @@ export class ObservablePetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); // build promise chain @@ -192,10 +247,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); })); } + /** + * + * Updates a pet in the store with form data + * @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 updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * uploads an image @@ -203,7 +269,7 @@ export class ObservablePetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); // build promise chain @@ -218,10 +284,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); })); } + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; @@ -245,7 +322,7 @@ export class ObservableStoreApi { * Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ - public deleteOrder(orderId: string, _options?: Configuration): Observable { + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); // build promise chain @@ -260,15 +337,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status */ - public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getInventory(_options); // build promise chain @@ -283,16 +369,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); })); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: number, _options?: Configuration): Observable { + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); // build promise chain @@ -307,16 +401,25 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Place an order for a pet * @param order order placed for purchasing the pet */ - public placeOrder(order: Order, _options?: Configuration): Observable { + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.placeOrder(order, _options); // build promise chain @@ -331,10 +434,19 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); })); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; @@ -358,7 +470,7 @@ export class ObservableUserApi { * Create user * @param user Created user object */ - public createUser(user: User, _options?: Configuration): Observable { + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUser(user, _options); // build promise chain @@ -373,16 +485,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Creates list of users with given input array * @param user List of user object */ - public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); // build promise chain @@ -397,7 +518,7 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); })); } @@ -406,7 +527,16 @@ export class ObservableUserApi { * Creates list of users with given input array * @param user List of user object */ - public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); // build promise chain @@ -421,16 +551,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); })); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Delete user * @param username The name that needs to be deleted */ - public deleteUser(username: string, _options?: Configuration): Observable { + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteUser(username, _options); // build promise chain @@ -445,16 +584,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ - public getUserByName(username: string, _options?: Configuration): Observable { + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getUserByName(username, _options); // build promise chain @@ -469,17 +617,26 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); })); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username: string, password: string, _options?: Configuration): Observable { + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.loginUser(username, password, _options); // build promise chain @@ -494,15 +651,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); })); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs out current logged in user session */ - public logoutUser(_options?: Configuration): Observable { + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.logoutUser(_options); // build promise chain @@ -517,17 +684,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); })); } + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Updated user * @param username name that need to be deleted * @param user Updated user object */ - public updateUser(username: string, user: User, _options?: Configuration): Observable { + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updateUser(username, user, _options); // build promise chain @@ -542,8 +717,18 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts index c86ac4a84f38..189962536f95 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -21,6 +21,16 @@ export class PromisePetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Add a new pet to the store @@ -31,6 +41,17 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + /** * * Deletes a pet @@ -42,6 +63,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -52,6 +83,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -62,6 +103,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -72,6 +123,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Update an existing pet @@ -82,6 +143,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Updates a pet in the store with form data + * @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, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + /** * * Updates a pet in the store with form data @@ -94,6 +167,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * uploads an image + * @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?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + /** * * uploads an image @@ -125,6 +210,16 @@ export class PromiseStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -135,6 +230,15 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -144,6 +248,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -154,6 +268,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + /** * * Place an order for a pet @@ -183,6 +307,16 @@ export class PromiseUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -193,6 +327,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -203,6 +347,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -213,6 +367,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -223,6 +387,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * * Get user by user name @@ -233,6 +407,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + /** * * Logs user into the system @@ -244,6 +429,15 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + /** * * Logs out current logged in user session @@ -253,6 +447,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts index 5b3d37fe35a1..02f9d230affe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -438,14 +438,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to addPet * @throws ApiException if the response code was not in [200, 299] */ - public async addPet(response: ResponseContext): Promise { + public async addPetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -457,7 +457,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -470,7 +470,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to deletePet * @throws ApiException if the response code was not in [200, 299] */ - public async deletePet(response: ResponseContext): Promise< void> { + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); @@ -478,7 +478,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -491,14 +491,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByStatus * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByStatus(response: ResponseContext): Promise > { + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); @@ -510,7 +510,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -523,14 +523,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to findPetsByTags * @throws ApiException if the response code was not in [200, 299] */ - public async findPetsByTags(response: ResponseContext): Promise > { + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); @@ -542,7 +542,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -555,14 +555,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to getPetById * @throws ApiException if the response code was not in [200, 299] */ - public async getPetById(response: ResponseContext): Promise { + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -577,7 +577,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -590,14 +590,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePet * @throws ApiException if the response code was not in [200, 299] */ - public async updatePet(response: ResponseContext): Promise { + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Pet = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -615,7 +615,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Pet", "" ) as Pet; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -628,7 +628,7 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to updatePetWithForm * @throws ApiException if the response code was not in [200, 299] */ - public async updatePetWithForm(response: ResponseContext): Promise< void> { + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("405", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); @@ -636,7 +636,7 @@ export class PetApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -649,14 +649,14 @@ export class PetApiResponseProcessor { * @params response Response returned by the server for a request to uploadFile * @throws ApiException if the response code was not in [200, 299] */ - public async uploadFile(response: ResponseContext): Promise { + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: ApiResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -665,7 +665,7 @@ export class PetApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "ApiResponse", "" ) as ApiResponse; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts index 3bb0a2de754e..f4861af0df0c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -164,7 +164,7 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to deleteOrder * @throws ApiException if the response code was not in [200, 299] */ - public async deleteOrder(response: ResponseContext): Promise< void> { + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -175,7 +175,7 @@ export class StoreApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -188,14 +188,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getInventory * @throws ApiException if the response code was not in [200, 299] */ - public async getInventory(response: ResponseContext): Promise<{ [key: string]: number; } > { + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: { [key: string]: number; } = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } // Work around for missing responses in specification, e.g. for petstore.yaml @@ -204,7 +204,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "{ [key: string]: number; }", "int32" ) as { [key: string]: number; }; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -217,14 +217,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to getOrderById * @throws ApiException if the response code was not in [200, 299] */ - public async getOrderById(response: ResponseContext): Promise { + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); @@ -239,7 +239,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -252,14 +252,14 @@ export class StoreApiResponseProcessor { * @params response Response returned by the server for a request to placeOrder * @throws ApiException if the response code was not in [200, 299] */ - public async placeOrder(response: ResponseContext): Promise { + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Order = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); @@ -271,7 +271,7 @@ export class StoreApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "Order", "" ) as Order; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts index 352b499b3785..b8f2c3313e26 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts @@ -1,7 +1,7 @@ // TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; -import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; @@ -376,7 +376,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUser * @throws ApiException if the response code was not in [200, 299] */ - public async createUser(response: ResponseContext): Promise< void> { + public async createUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -384,7 +384,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -397,7 +397,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithArrayInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithArrayInput(response: ResponseContext): Promise< void> { + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -405,7 +405,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -418,7 +418,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to createUsersWithListInput * @throws ApiException if the response code was not in [200, 299] */ - public async createUsersWithListInput(response: ResponseContext): Promise< void> { + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -426,7 +426,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -439,7 +439,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to deleteUser * @throws ApiException if the response code was not in [200, 299] */ - public async deleteUser(response: ResponseContext): Promise< void> { + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -450,7 +450,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -463,14 +463,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to getUserByName * @throws ApiException if the response code was not in [200, 299] */ - public async getUserByName(response: ResponseContext): Promise { + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: User = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); @@ -485,7 +485,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "User", "" ) as User; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -498,14 +498,14 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to loginUser * @throws ApiException if the response code was not in [200, 299] */ - public async loginUser(response: ResponseContext): Promise { + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: string = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); @@ -517,7 +517,7 @@ export class UserApiResponseProcessor { ObjectSerializer.parse(await response.body.text(), contentType), "string", "" ) as string; - return body; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -530,7 +530,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to logoutUser * @throws ApiException if the response code was not in [200, 299] */ - public async logoutUser(response: ResponseContext): Promise< void> { + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("0", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); @@ -538,7 +538,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); @@ -551,7 +551,7 @@ export class UserApiResponseProcessor { * @params response Response returned by the server for a request to updateUser * @throws ApiException if the response code was not in [200, 299] */ - public async updateUser(response: ResponseContext): Promise< void> { + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("400", response.httpStatusCode)) { throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); @@ -562,7 +562,7 @@ export class UserApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - return; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index af0075aeba6f..77fb4a789dbb 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -234,3 +234,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib } } } + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObjectParamAPI.ts index 41dfaebdde1d..e3fe52eef28f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObjectParamAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObjectParamAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -120,6 +120,15 @@ export class ObjectPetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Add a new pet to the store @@ -129,6 +138,15 @@ export class ObjectPetApi { return this.api.addPet(param.pet, options).toPromise(); } + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + /** * * Deletes a pet @@ -138,6 +156,15 @@ export class ObjectPetApi { return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -147,6 +174,15 @@ export class ObjectPetApi { return this.api.findPetsByStatus(param.status, options).toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -156,6 +192,15 @@ export class ObjectPetApi { return this.api.findPetsByTags(param.tags, options).toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -165,6 +210,15 @@ export class ObjectPetApi { return this.api.getPetById(param.petId, options).toPromise(); } + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + /** * * Update an existing pet @@ -174,6 +228,15 @@ export class ObjectPetApi { return this.api.updatePet(param.pet, options).toPromise(); } + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + /** * * Updates a pet in the store with form data @@ -183,6 +246,15 @@ export class ObjectPetApi { return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); } + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + /** * * uploads an image @@ -234,6 +306,15 @@ export class ObjectStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -243,6 +324,15 @@ export class ObjectStoreApi { return this.api.deleteOrder(param.orderId, options).toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -252,6 +342,15 @@ export class ObjectStoreApi { return this.api.getInventory( options).toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -261,6 +360,15 @@ export class ObjectStoreApi { return this.api.getOrderById(param.orderId, options).toPromise(); } + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + /** * * Place an order for a pet @@ -360,6 +468,15 @@ export class ObjectUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -369,6 +486,15 @@ export class ObjectUserApi { return this.api.createUser(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -378,6 +504,15 @@ export class ObjectUserApi { return this.api.createUsersWithArrayInput(param.user, options).toPromise(); } + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + /** * * Creates list of users with given input array @@ -387,6 +522,15 @@ export class ObjectUserApi { return this.api.createUsersWithListInput(param.user, options).toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -396,6 +540,15 @@ export class ObjectUserApi { return this.api.deleteUser(param.username, options).toPromise(); } + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + /** * * Get user by user name @@ -405,6 +558,15 @@ export class ObjectUserApi { return this.api.getUserByName(param.username, options).toPromise(); } + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + /** * * Logs user into the system @@ -414,6 +576,15 @@ export class ObjectUserApi { return this.api.loginUser(param.username, param.password, options).toPromise(); } + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + /** * * Logs out current logged in user session @@ -423,6 +594,15 @@ export class ObjectUserApi { return this.api.logoutUser( options).toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + /** * This can only be done by the logged in user. * Updated user diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObservableAPI.ts index 5e9397ea69f6..9ab72e5e78f5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObservableAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/types/ObservableAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; @@ -30,7 +30,7 @@ export class ObservablePetApi { * Add a new pet to the store * @param pet Pet object that needs to be added to the store */ - public addPet(pet: Pet, _options?: Configuration): Observable { + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.addPet(pet, _options); // build promise chain @@ -45,17 +45,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); })); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Deletes a pet * @param petId Pet id to delete * @param apiKey */ - public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); // build promise chain @@ -70,16 +79,26 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); })); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); // build promise chain @@ -94,16 +113,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatus(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); })); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags * @param tags Tags to filter by */ - public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Observable>> { const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); // build promise chain @@ -118,16 +146,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTags(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); })); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Array, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + /** * Returns a single pet * Find pet by ID * @param petId ID of pet to return */ - public getPetById(petId: number, _options?: Configuration): Observable { + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getPetById(petId, _options); // build promise chain @@ -142,16 +179,25 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); })); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Update an existing pet * @param pet Pet object that needs to be added to the store */ - public updatePet(pet: Pet, _options?: Configuration): Observable { + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePet(pet, _options); // build promise chain @@ -166,10 +212,19 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePet(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); })); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Updates a pet in the store with form data @@ -177,7 +232,7 @@ export class ObservablePetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); // build promise chain @@ -192,10 +247,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithForm(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); })); } + /** + * + * Updates a pet in the store with form data + * @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 updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * uploads an image @@ -203,7 +269,7 @@ export class ObservablePetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); // build promise chain @@ -218,10 +284,21 @@ export class ObservablePetApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFile(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); })); } + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; @@ -245,7 +322,7 @@ export class ObservableStoreApi { * Delete purchase order by ID * @param orderId ID of the order that needs to be deleted */ - public deleteOrder(orderId: string, _options?: Configuration): Observable { + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); // build promise chain @@ -260,15 +337,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status */ - public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getInventory(_options); // build promise chain @@ -283,16 +369,24 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventory(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); })); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: number, _options?: Configuration): Observable { + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); // build promise chain @@ -307,16 +401,25 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderById(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); })); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Place an order for a pet * @param order order placed for purchasing the pet */ - public placeOrder(order: Order, _options?: Configuration): Observable { + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.placeOrder(order, _options); // build promise chain @@ -331,10 +434,19 @@ export class ObservableStoreApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrder(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); })); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; @@ -358,7 +470,7 @@ export class ObservableUserApi { * Create user * @param user Created user object */ - public createUser(user: User, _options?: Configuration): Observable { + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUser(user, _options); // build promise chain @@ -373,16 +485,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Creates list of users with given input array * @param user List of user object */ - public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); // build promise chain @@ -397,7 +518,7 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); })); } @@ -406,7 +527,16 @@ export class ObservableUserApi { * Creates list of users with given input array * @param user List of user object */ - public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); // build promise chain @@ -421,16 +551,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInput(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); })); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Delete user * @param username The name that needs to be deleted */ - public deleteUser(username: string, _options?: Configuration): Observable { + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.deleteUser(username, _options); // build promise chain @@ -445,16 +584,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Get user by user name * @param username The name that needs to be fetched. Use user1 for testing. */ - public getUserByName(username: string, _options?: Configuration): Observable { + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.getUserByName(username, _options); // build promise chain @@ -469,17 +617,26 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByName(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); })); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs user into the system * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username: string, password: string, _options?: Configuration): Observable { + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.loginUser(username, password, _options); // build promise chain @@ -494,15 +651,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); })); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * * Logs out current logged in user session */ - public logoutUser(_options?: Configuration): Observable { + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.logoutUser(_options); // build promise chain @@ -517,17 +684,25 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); })); } + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + /** * This can only be done by the logged in user. * Updated user * @param username name that need to be deleted * @param user Updated user object */ - public updateUser(username: string, user: User, _options?: Configuration): Observable { + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { const requestContextPromise = this.requestFactory.updateUser(username, user, _options); // build promise chain @@ -542,8 +717,18 @@ export class ObservableUserApi { for (let middleware of this.configuration.middleware) { middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); } - return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUser(rsp))); + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); })); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/types/PromiseAPI.ts index c86ac4a84f38..189962536f95 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/types/PromiseAPI.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/types/PromiseAPI.ts @@ -1,4 +1,4 @@ -import { ResponseContext, RequestContext, HttpFile } from '../http/http'; +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; import { Configuration} from '../configuration' import { ApiResponse } from '../models/ApiResponse'; @@ -21,6 +21,16 @@ export class PromisePetApi { this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); } + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Add a new pet to the store @@ -31,6 +41,17 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + /** * * Deletes a pet @@ -42,6 +63,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + /** * Multiple status values can be provided with comma separated strings * Finds Pets by status @@ -52,6 +83,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Array, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags @@ -62,6 +103,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + /** * Returns a single pet * Find pet by ID @@ -72,6 +123,16 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + /** * * Update an existing pet @@ -82,6 +143,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * Updates a pet in the store with form data + * @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, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + /** * * Updates a pet in the store with form data @@ -94,6 +167,18 @@ export class PromisePetApi { return result.toPromise(); } + /** + * + * uploads an image + * @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?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + /** * * uploads an image @@ -125,6 +210,16 @@ export class PromiseStoreApi { this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); } + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID @@ -135,6 +230,15 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + /** * Returns a map of status codes to quantities * Returns pet inventories by status @@ -144,6 +248,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions * Find purchase order by ID @@ -154,6 +268,16 @@ export class PromiseStoreApi { return result.toPromise(); } + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + /** * * Place an order for a pet @@ -183,6 +307,16 @@ export class PromiseUserApi { this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); } + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Create user @@ -193,6 +327,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -203,6 +347,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + /** * * Creates list of users with given input array @@ -213,6 +367,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Delete user @@ -223,6 +387,16 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + /** * * Get user by user name @@ -233,6 +407,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + /** * * Logs user into the system @@ -244,6 +429,15 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + /** * * Logs out current logged in user session @@ -253,6 +447,17 @@ export class PromiseUserApi { return result.toPromise(); } + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + /** * This can only be done by the logged in user. * Updated user