[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 <robert.schuh@valtech.com>
This commit is contained in:
Robert Schuh
2023-08-23 11:25:27 +02:00
committed by GitHub
parent 3e95001939
commit 6146129bdc
61 changed files with 4295 additions and 646 deletions

View File

@@ -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<HttpInfo<{{{returnType}}} {{^returnType}}void{{/returnType}}>> {
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<undefined>(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}}
}

View File

@@ -308,3 +308,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<{{{returnType}}} {{^returnType}}void{{/returnType}}>>;
{{/operation}}
}

View File

@@ -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}}
* {{&notes}}
{{/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}}<HttpInfo<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
return this.api.{{nickname}}WithHttpInfo({{#allParams}}param.{{paramName}}, {{/allParams}} options){{^useRxJS}}.toPromise(){{/useRxJS}};
}
/**
{{#notes}}
* {{&notes}}

View File

@@ -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<HttpInfo<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
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}}
* {{&notes}}
{{/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}}

View File

@@ -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}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{paramName}} {{description}}
{{/allParams}}
*/
public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}_options?: Configuration): Promise<HttpInfo<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
const result = this.api.{{nickname}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}_options);
return result.toPromise();
}
/**
{{#notes}}
* {{&notes}}

View File

@@ -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<Response > {
public async uniqueItemsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Response >> {
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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Response>> {
return this.api.uniqueItemsWithHttpInfo( options).toPromise();
}
/**
* @param param the request object
*/

View File

@@ -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<Response> {
public uniqueItemsWithHttpInfo(_options?: Configuration): Observable<HttpInfo<Response>> {
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<Response> {
return this.uniqueItemsWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<Response>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Response>> {
const result = this.api.uniqueItemsWithHttpInfo(_options);
return result.toPromise();
}
/**
*/
public uniqueItems(_options?: Configuration): Promise<Response> {

View File

@@ -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<Pet > {
public async addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<Array<Pet> > {
public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
@@ -508,7 +508,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Blob | undefined>(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<Array<Pet> > {
public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
@@ -540,7 +540,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Blob | undefined>(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<Pet > {
public async getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<Pet > {
public async updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<ApiResponse > {
public async uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >> {
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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo<{ [key: string]: number; } >> {
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<string | Blob | undefined>(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<Order > {
public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Blob | undefined>(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<Order > {
public async placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<User > {
public async getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >> {
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<undefined>(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<string | Blob | undefined>(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<string > {
public async loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet> {
public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => apiResponse.data));
}
/**
*
* Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable<void> {
public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<Array<Pet>> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => 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<string>, _options?: Configuration): Observable<Array<Pet>> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => apiResponse.data));
}
/**
* Returns a single pet
* Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, _options?: Configuration): Observable<Pet> {
public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<Pet> {
public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<void> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<ApiResponse> {
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable<HttpInfo<ApiResponse>> {
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<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo<ApiResponse>) => 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<void> {
public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<HttpInfo<{ [key: string]: number; }>> {
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<Order> {
public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<Order>) => apiResponse.data));
}
/**
*
* Place an order for a pet
* @param order order placed for purchasing the pet
*/
public placeOrder(order: Order, _options?: Configuration): Observable<Order> {
public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo<Order>) => 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<void> {
public createUserWithHttpInfo(user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithListInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<User> {
public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<User>> {
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<User> {
return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<User>) => 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<string> {
public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable<HttpInfo<string>> {
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<string> {
return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo<string>) => apiResponse.data));
}
/**
*
* Logs out current logged in user session
*/
public logoutUser(_options?: Configuration): Observable<void> {
public logoutUserWithHttpInfo(_options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Promise<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.updateUserWithHttpInfo(username, user, _options);
return result.toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<void > {
public async filePostWithHttpInfo(response: ResponseContext): Promise<HttpInfo<void >> {
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<string | Blob | undefined>(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<void > {
public async petsFilteredPatchWithHttpInfo(response: ResponseContext): Promise<HttpInfo<void >> {
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<string | Blob | undefined>(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<void > {
public async petsPatchWithHttpInfo(response: ResponseContext): Promise<HttpInfo<void >> {
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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.petsPatchWithHttpInfo(param.petsPatchRequest, options).toPromise();
}
/**
* @param param the request object
*/

View File

@@ -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<void> {
public filePostWithHttpInfo(filePostRequest?: FilePostRequest, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.filePostWithHttpInfo(filePostRequest, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
* @param petsFilteredPatchRequest
*/
public petsFilteredPatch(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Observable<void> {
public petsFilteredPatchWithHttpInfo(petsFilteredPatchRequest?: PetsFilteredPatchRequest, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.petsFilteredPatchWithHttpInfo(petsFilteredPatchRequest, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
* @param petsPatchRequest
*/
public petsPatch(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Observable<void> {
public petsPatchWithHttpInfo(petsPatchRequest?: PetsPatchRequest, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.petsPatchWithHttpInfo(petsPatchRequest, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.petsPatchWithHttpInfo(petsPatchRequest, _options);
return result.toPromise();
}
/**
* @param petsPatchRequest
*/

View File

@@ -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<Pet > {
public async addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<Array<Pet> > {
public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
@@ -510,7 +510,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Buffer | undefined>(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<Array<Pet> > {
public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
@@ -542,7 +542,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Buffer | undefined>(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<Pet > {
public async getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<Pet > {
public async updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<ApiResponse > {
public async uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >> {
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo<{ [key: string]: number; } >> {
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<string | Buffer | undefined>(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<Order > {
public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Buffer | undefined>(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<Order > {
public async placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<User > {
public async getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >> {
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<undefined>(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<string | Buffer | undefined>(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<string > {
public async loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -234,3 +234,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet> {
public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => apiResponse.data));
}
/**
*
* Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable<void> {
public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<Array<Pet>> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => 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<string>, _options?: Configuration): Observable<Array<Pet>> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => apiResponse.data));
}
/**
* Returns a single pet
* Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, _options?: Configuration): Observable<Pet> {
public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<Pet> {
public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<void> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<ApiResponse> {
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable<HttpInfo<ApiResponse>> {
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<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo<ApiResponse>) => 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<void> {
public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<HttpInfo<{ [key: string]: number; }>> {
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<Order> {
public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<Order>) => apiResponse.data));
}
/**
*
* Place an order for a pet
* @param order order placed for purchasing the pet
*/
public placeOrder(order: Order, _options?: Configuration): Observable<Order> {
public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo<Order>) => 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<void> {
public createUserWithHttpInfo(user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithListInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<User> {
public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<User>> {
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<User> {
return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<User>) => 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<string> {
public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable<HttpInfo<string>> {
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<string> {
return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo<string>) => apiResponse.data));
}
/**
*
* Logs out current logged in user session
*/
public logoutUser(_options?: Configuration): Observable<void> {
public logoutUserWithHttpInfo(_options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Promise<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.updateUserWithHttpInfo(username, user, _options);
return result.toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet > {
public async addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<Array<Pet> > {
public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
@@ -508,7 +508,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Blob | undefined>(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<Array<Pet> > {
public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
@@ -540,7 +540,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Blob | undefined>(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<Pet > {
public async getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<Pet > {
public async updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<ApiResponse > {
public async uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >> {
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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo<{ [key: string]: number; } >> {
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<string | Blob | undefined>(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<Order > {
public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Blob | undefined>(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<Order > {
public async placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<User > {
public async getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >> {
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<undefined>(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<string | Blob | undefined>(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<string > {
public async loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -225,3 +225,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet> {
public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => apiResponse.data));
}
/**
*
* Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable<void> {
public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<Array<Pet>> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => 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<string>, _options?: Configuration): Observable<Array<Pet>> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => apiResponse.data));
}
/**
* Returns a single pet
* Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, _options?: Configuration): Observable<Pet> {
public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<Pet> {
public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<void> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<ApiResponse> {
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable<HttpInfo<ApiResponse>> {
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<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo<ApiResponse>) => 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<void> {
public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<HttpInfo<{ [key: string]: number; }>> {
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<Order> {
public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<Order>) => apiResponse.data));
}
/**
*
* Place an order for a pet
* @param order order placed for purchasing the pet
*/
public placeOrder(order: Order, _options?: Configuration): Observable<Order> {
public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo<Order>) => 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<void> {
public createUserWithHttpInfo(user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithListInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<User> {
public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<User>> {
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<User> {
return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<User>) => 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<string> {
public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable<HttpInfo<string>> {
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<string> {
return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo<string>) => apiResponse.data));
}
/**
*
* Logs out current logged in user session
*/
public logoutUser(_options?: Configuration): Observable<void> {
public logoutUserWithHttpInfo(_options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Promise<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.updateUserWithHttpInfo(username, user, _options);
return result.toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet >;
public abstract addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >>;
public abstract deletePet(response: ResponseContext): Promise< void>;
public abstract deletePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
public abstract findPetsByStatus(response: ResponseContext): Promise<Array<Pet> >;
public abstract findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >>;
public abstract findPetsByTags(response: ResponseContext): Promise<Array<Pet> >;
public abstract findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >>;
public abstract getPetById(response: ResponseContext): Promise<Pet >;
public abstract getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >>;
public abstract updatePet(response: ResponseContext): Promise<Pet >;
public abstract updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >>;
public abstract updatePetWithForm(response: ResponseContext): Promise< void>;
public abstract updatePetWithFormWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
public abstract uploadFile(response: ResponseContext): Promise<ApiResponse >;
public abstract uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >>;
}

View File

@@ -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<Pet > {
public async addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<Array<Pet> > {
public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
@@ -481,7 +481,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Buffer | undefined>(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<Array<Pet> > {
public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
@@ -513,7 +513,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Buffer | undefined>(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<Pet > {
public async getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<Pet > {
public async updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<ApiResponse > {
public async uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >> {
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>>;
public abstract getInventory(response: ResponseContext): Promise<{ [key: string]: number; } >;
public abstract getInventoryWithHttpInfo(response: ResponseContext): Promise<HttpInfo<{ [key: string]: number; } >>;
public abstract getOrderById(response: ResponseContext): Promise<Order >;
public abstract getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >>;
public abstract placeOrder(response: ResponseContext): Promise<Order >;
public abstract placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >>;
}

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo<{ [key: string]: number; } >> {
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<string | Buffer | undefined>(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<Order > {
public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Buffer | undefined>(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<Order > {
public async placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>>;
public abstract createUsersWithArrayInput(response: ResponseContext): Promise< void>;
public abstract createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
public abstract createUsersWithListInput(response: ResponseContext): Promise< void>;
public abstract createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
public abstract deleteUser(response: ResponseContext): Promise< void>;
public abstract deleteUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
public abstract getUserByName(response: ResponseContext): Promise<User >;
public abstract getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >>;
public abstract loginUser(response: ResponseContext): Promise<string >;
public abstract loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >>;
public abstract logoutUser(response: ResponseContext): Promise< void>;
public abstract logoutUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
public abstract updateUser(response: ResponseContext): Promise< void>;
public abstract updateUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo< void>>;
}

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<User > {
public async getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >> {
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<undefined>(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<string | Buffer | undefined>(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<string > {
public async loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -234,3 +234,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet> {
public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => apiResponse.data));
}
/**
*
* Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable<void> {
public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<Array<Pet>> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => 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<string>, _options?: Configuration): Observable<Array<Pet>> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => apiResponse.data));
}
/**
* Returns a single pet
* Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, _options?: Configuration): Observable<Pet> {
public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<Pet> {
public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<void> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<ApiResponse> {
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable<HttpInfo<ApiResponse>> {
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<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo<ApiResponse>) => 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<void> {
public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<HttpInfo<{ [key: string]: number; }>> {
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<Order> {
public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<Order>) => apiResponse.data));
}
/**
*
* Place an order for a pet
* @param order order placed for purchasing the pet
*/
public placeOrder(order: Order, _options?: Configuration): Observable<Order> {
public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo<Order>) => 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<void> {
public createUserWithHttpInfo(user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithListInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<User> {
public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<User>> {
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<User> {
return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<User>) => 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<string> {
public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable<HttpInfo<string>> {
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<string> {
return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo<string>) => apiResponse.data));
}
/**
*
* Logs out current logged in user session
*/
public logoutUser(_options?: Configuration): Observable<void> {
public logoutUserWithHttpInfo(_options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Promise<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.updateUserWithHttpInfo(username, user, _options);
return result.toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet > {
public async addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<Array<Pet> > {
public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
@@ -508,7 +508,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Blob | undefined>(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<Array<Pet> > {
public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
@@ -540,7 +540,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Blob | undefined>(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<Pet > {
public async getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<Pet > {
public async updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<ApiResponse > {
public async uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >> {
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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo<{ [key: string]: number; } >> {
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<string | Blob | undefined>(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<Order > {
public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Blob | undefined>(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<Order > {
public async placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<User > {
public async getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >> {
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<undefined>(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<string | Blob | undefined>(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<string > {
public async loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >> {
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<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -237,3 +237,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet> {
public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => apiResponse.data));
}
/**
*
* Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable<void> {
public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<Array<Pet>> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => 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<string>, _options?: Configuration): Observable<Array<Pet>> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => apiResponse.data));
}
/**
* Returns a single pet
* Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, _options?: Configuration): Observable<Pet> {
public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<Pet> {
public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<void> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<ApiResponse> {
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable<HttpInfo<ApiResponse>> {
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<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo<ApiResponse>) => 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<void> {
public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<HttpInfo<{ [key: string]: number; }>> {
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<Order> {
public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<Order>) => apiResponse.data));
}
/**
*
* Place an order for a pet
* @param order order placed for purchasing the pet
*/
public placeOrder(order: Order, _options?: Configuration): Observable<Order> {
public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo<Order>) => 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<void> {
public createUserWithHttpInfo(user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithListInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<User> {
public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<User>> {
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<User> {
return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<User>) => 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<string> {
public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable<HttpInfo<string>> {
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<string> {
return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo<string>) => apiResponse.data));
}
/**
*
* Logs out current logged in user session
*/
public logoutUser(_options?: Configuration): Observable<void> {
public logoutUserWithHttpInfo(_options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Promise<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.updateUserWithHttpInfo(username, user, _options);
return result.toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet > {
public async addPetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<Array<Pet> > {
public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid status value", undefined, response.headers);
@@ -510,7 +510,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Buffer | undefined>(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<Array<Pet> > {
public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<Pet> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<Pet> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Invalid tag value", undefined, response.headers);
@@ -542,7 +542,7 @@ export class PetApiResponseProcessor {
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<Pet>", ""
) as Array<Pet>;
return body;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new ApiException<string | Buffer | undefined>(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<Pet > {
public async getPetByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<Pet > {
public async updatePetWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Pet >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("405", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<ApiResponse > {
public async uploadFileWithHttpInfo(response: ResponseContext): Promise<HttpInfo<ApiResponse >> {
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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo<{ [key: string]: number; } >> {
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<string | Buffer | undefined>(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<Order > {
public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Buffer | undefined>(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<Order > {
public async placeOrderWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Order >> {
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<undefined>(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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<User > {
public async getUserByNameWithHttpInfo(response: ResponseContext): Promise<HttpInfo<User >> {
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<undefined>(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<string | Buffer | undefined>(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<string > {
public async loginUserWithHttpInfo(response: ResponseContext): Promise<HttpInfo<string >> {
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<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("0", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(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<HttpInfo< void>> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("400", response.httpStatusCode)) {
throw new ApiException<undefined>(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<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);

View File

@@ -234,3 +234,14 @@ export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLib
}
}
}
export class HttpInfo<T> extends ResponseContext {
public constructor(
public httpStatusCode: number,
public headers: { [key: string]: string },
public body: ResponseBody,
public data: T,
) {
super(httpStatusCode, headers, body);
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user

View File

@@ -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<Pet> {
public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => apiResponse.data));
}
/**
*
* Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable<void> {
public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<Array<Pet>> {
public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<Array<Pet>> {
return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => 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<string>, _options?: Configuration): Observable<Array<Pet>> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, _options?: Configuration): Observable<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Observable<Array<Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo<Array<Pet>>) => apiResponse.data));
}
/**
* Returns a single pet
* Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, _options?: Configuration): Observable<Pet> {
public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<Pet> {
public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable<HttpInfo<Pet>> {
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<Pet> {
return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo<Pet>) => 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<void> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<ApiResponse> {
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable<HttpInfo<ApiResponse>> {
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<ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo<ApiResponse>) => 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<void> {
public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<HttpInfo<{ [key: string]: number; }>> {
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<Order> {
public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo<Order>) => apiResponse.data));
}
/**
*
* Place an order for a pet
* @param order order placed for purchasing the pet
*/
public placeOrder(order: Order, _options?: Configuration): Observable<Order> {
public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable<HttpInfo<Order>> {
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<Order> {
return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo<Order>) => 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<void> {
public createUserWithHttpInfo(user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
public createUsersWithArrayInput(user: Array<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
/**
*
* Creates list of users with given input array
* @param user List of user object
*/
public createUsersWithListInputWithHttpInfo(user: Array<User>, _options?: Configuration): Observable<HttpInfo<void>> {
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<User>, _options?: Configuration): Observable<void> {
return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<void>) => 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<User> {
public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable<HttpInfo<User>> {
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<User> {
return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo<User>) => 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<string> {
public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable<HttpInfo<string>> {
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<string> {
return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo<string>) => apiResponse.data));
}
/**
*
* Logs out current logged in user session
*/
public logoutUser(_options?: Configuration): Observable<void> {
public logoutUserWithHttpInfo(_options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<void>) => 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<void> {
public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable<HttpInfo<void>> {
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<void> {
return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo<void>) => apiResponse.data));
}
}

View File

@@ -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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<Array<Pet>>> {
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<string>, _options?: Configuration): Promise<HttpInfo<Array<Pet>>> {
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<HttpInfo<Pet>> {
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<HttpInfo<Pet>> {
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<HttpInfo<void>> {
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<HttpInfo<ApiResponse>> {
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<HttpInfo<void>> {
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<HttpInfo<{ [key: string]: number; }>> {
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<HttpInfo<Order>> {
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<HttpInfo<Order>> {
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<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<User>, _options?: Configuration): Promise<HttpInfo<void>> {
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<HttpInfo<void>> {
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<HttpInfo<User>> {
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<HttpInfo<string>> {
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<HttpInfo<void>> {
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<HttpInfo<void>> {
const result = this.api.updateUserWithHttpInfo(username, user, _options);
return result.toPromise();
}
/**
* This can only be done by the logged in user.
* Updated user