forked from loafle/openapi-generator-original
[typescript] Default auth method support and optional param object when all params optional (#11321)
* add default auth * private * default when optional params and fix types * build samples * remove extra space * re-add space before default empty * switch to default authentication method support in config * generated samples * null check chaining * generate samples * remove extra spaces * regen samples * formatting fixes * more samples * remove from abstract methods * samples * add default to inversify as well * samples again * exclude inversify * samples once more * samples
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi{{extensionForDeno}}';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi{{extensionForDeno}}';
|
||||
import {Configuration} from '../configuration{{extensionForDeno}}';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{extensionForDeno}}';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{extensionForDeno}}';
|
||||
{{#platforms}}
|
||||
{{#node}}
|
||||
import * as FormData from "form-data";
|
||||
@@ -11,6 +11,7 @@ import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer{{extensionForDeno}}';
|
||||
import {ApiException} from './exception{{extensionForDeno}}';
|
||||
import {canConsumeForm, isCodeInRange} from '../util{{extensionForDeno}}';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
{{#useInversify}}
|
||||
import { injectable } from "inversify";
|
||||
@@ -151,15 +152,22 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory {
|
||||
{{/bodyParam}}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
{{/hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["{{name}}"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
{{/authMethods}}
|
||||
|
||||
{{^useInversify}}
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
{{/useInversify}}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,9 @@ export class {{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication
|
||||
{{/authMethods}}
|
||||
|
||||
export type AuthMethods = {
|
||||
{{^useInversify}}
|
||||
"default"?: SecurityAuthentication,
|
||||
{{/useInversify}}
|
||||
{{#authMethods}}
|
||||
"{{name}}"?: SecurityAuthentication{{^-last}},{{/-last}}
|
||||
{{/authMethods}}
|
||||
@@ -114,6 +117,9 @@ export type AuthMethods = {
|
||||
{{#useInversify}}
|
||||
|
||||
export const authMethodServices = {
|
||||
{{^useInversify}}
|
||||
"default"?: SecurityAuthentication,
|
||||
{{/useInversify}}
|
||||
{{#authMethods}}
|
||||
"{{name}}": {{#lambda.pascalcase}}{{name}}{{/lambda.pascalcase}}Authentication{{^-last}},{{/-last}}
|
||||
{{/authMethods}}
|
||||
@@ -126,6 +132,9 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
|
||||
export type OAuth2Configuration = { accessToken: string };
|
||||
|
||||
export type AuthMethodsConfiguration = {
|
||||
{{^useInversify}}
|
||||
"default"?: SecurityAuthentication,
|
||||
{{/useInversify}}
|
||||
{{#authMethods}}
|
||||
"{{name}}"?: {{#isApiKey}}ApiKeyConfiguration{{/isApiKey}}{{#isBasicBasic}}HttpBasicConfiguration{{/isBasicBasic}}{{#isBasicBearer}}HttpBearerConfiguration{{/isBasicBearer}}{{#isOAuth}}OAuth2Configuration{{/isOAuth}}{{^-last}},{{/-last}}
|
||||
{{/authMethods}}
|
||||
@@ -141,6 +150,9 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
|
||||
if (!config) {
|
||||
return authMethods;
|
||||
}
|
||||
{{^useInversify}}
|
||||
authMethods["default"] = config["default"]
|
||||
{{/useInversify}}
|
||||
|
||||
{{#authMethods}}
|
||||
if (config["{{name}}"]) {
|
||||
|
||||
@@ -47,7 +47,7 @@ export class Object{{classname}} {
|
||||
{{/summary}}
|
||||
* @param param the request object
|
||||
*/
|
||||
public {{nickname}}(param: {{classname}}{{operationIdCamelCase}}Request, options?: Configuration): {{#useRxJS}}Observable{{/useRxJS}}{{^useRxJS}}Promise{{/useRxJS}}<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
||||
public {{nickname}}(param: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, options?: Configuration): {{#useRxJS}}Observable{{/useRxJS}}{{^useRxJS}}Promise{{/useRxJS}}<{{{returnType}}}{{^returnType}}void{{/returnType}}> {
|
||||
return this.api.{{nickname}}({{#allParams}}param.{{paramName}}, {{/allParams}} options){{^useRxJS}}.toPromise(){{/useRxJS}};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { Cat } from '../models/Cat';
|
||||
@@ -44,6 +45,11 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -74,6 +80,11 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -104,6 +115,11 @@ export class DefaultApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ export interface TokenProvider {
|
||||
|
||||
|
||||
export type AuthMethods = {
|
||||
"default"?: SecurityAuthentication,
|
||||
}
|
||||
|
||||
export type ApiKeyConfiguration = string;
|
||||
@@ -32,6 +33,7 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
|
||||
export type OAuth2Configuration = { accessToken: string };
|
||||
|
||||
export type AuthMethodsConfiguration = {
|
||||
"default"?: SecurityAuthentication,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,6 +46,7 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
|
||||
if (!config) {
|
||||
return authMethods;
|
||||
}
|
||||
authMethods["default"] = config["default"]
|
||||
|
||||
return authMethods;
|
||||
}
|
||||
@@ -50,21 +50,21 @@ export class ObjectDefaultApi {
|
||||
/**
|
||||
* @param param the request object
|
||||
*/
|
||||
public filePost(param: DefaultApiFilePostRequest, options?: Configuration): Promise<void> {
|
||||
public filePost(param: DefaultApiFilePostRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.filePost(param.inlineObject, options).toPromise();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param param the request object
|
||||
*/
|
||||
public petsFilteredPatch(param: DefaultApiPetsFilteredPatchRequest, options?: Configuration): Promise<void> {
|
||||
public petsFilteredPatch(param: DefaultApiPetsFilteredPatchRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.petsFilteredPatch(param.petByAgePetByType, options).toPromise();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param param the request object
|
||||
*/
|
||||
public petsPatch(param: DefaultApiPetsPatchRequest, options?: Configuration): Promise<void> {
|
||||
public petsPatch(param: DefaultApiPetsPatchRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.petsPatch(param.catDog, options).toPromise();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { ApiResponse } from '../models/ApiResponse';
|
||||
@@ -51,11 +52,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -88,11 +94,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", ""));
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -125,11 +136,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -162,11 +178,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -195,11 +216,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -239,11 +265,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -304,11 +335,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -371,11 +407,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { Order } from '../models/Order';
|
||||
@@ -39,6 +40,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -58,11 +64,16 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -91,6 +102,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -127,6 +143,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { User } from '../models/User';
|
||||
@@ -49,11 +50,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -91,11 +97,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -133,11 +144,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -166,11 +182,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -198,6 +219,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -240,6 +266,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -258,11 +289,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -309,11 +345,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -66,6 +66,7 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication {
|
||||
|
||||
|
||||
export type AuthMethods = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: SecurityAuthentication,
|
||||
"petstore_auth"?: SecurityAuthentication
|
||||
}
|
||||
@@ -76,6 +77,7 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
|
||||
export type OAuth2Configuration = { accessToken: string };
|
||||
|
||||
export type AuthMethodsConfiguration = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: ApiKeyConfiguration,
|
||||
"petstore_auth"?: OAuth2Configuration
|
||||
}
|
||||
@@ -90,6 +92,7 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
|
||||
if (!config) {
|
||||
return authMethods;
|
||||
}
|
||||
authMethods["default"] = config["default"]
|
||||
|
||||
if (config["api_key"]) {
|
||||
authMethods["api_key"] = new ApiKeyAuthentication(
|
||||
|
||||
@@ -244,7 +244,7 @@ export class ObjectStoreApi {
|
||||
* Returns pet inventories by status
|
||||
* @param param the request object
|
||||
*/
|
||||
public getInventory(param: StoreApiGetInventoryRequest, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
return this.api.getInventory( options).toPromise();
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export class ObjectUserApi {
|
||||
* Logs out current logged in user session
|
||||
* @param param the request object
|
||||
*/
|
||||
public logoutUser(param: UserApiLogoutUserRequest, options?: Configuration): Promise<void> {
|
||||
public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.logoutUser( options).toPromise();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi.ts';
|
||||
import {Configuration} from '../configuration.ts';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer.ts';
|
||||
import {ApiException} from './exception.ts';
|
||||
import {canConsumeForm, isCodeInRange} from '../util.ts';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { ApiResponse } from '../models/ApiResponse.ts';
|
||||
@@ -49,11 +50,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -86,11 +92,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", ""));
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -123,11 +134,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -160,11 +176,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -193,11 +214,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -237,11 +263,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -302,11 +333,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -369,11 +405,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi.ts';
|
||||
import {Configuration} from '../configuration.ts';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer.ts';
|
||||
import {ApiException} from './exception.ts';
|
||||
import {canConsumeForm, isCodeInRange} from '../util.ts';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { Order } from '../models/Order.ts';
|
||||
@@ -37,6 +38,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -56,11 +62,16 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -89,6 +100,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -125,6 +141,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi.ts';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi.ts';
|
||||
import {Configuration} from '../configuration.ts';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http.ts';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer.ts';
|
||||
import {ApiException} from './exception.ts';
|
||||
import {canConsumeForm, isCodeInRange} from '../util.ts';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { User } from '../models/User.ts';
|
||||
@@ -47,11 +48,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -89,11 +95,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -131,11 +142,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -164,11 +180,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -196,6 +217,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -238,6 +264,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -256,11 +287,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -307,11 +343,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -64,6 +64,7 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication {
|
||||
|
||||
|
||||
export type AuthMethods = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: SecurityAuthentication,
|
||||
"petstore_auth"?: SecurityAuthentication
|
||||
}
|
||||
@@ -74,6 +75,7 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
|
||||
export type OAuth2Configuration = { accessToken: string };
|
||||
|
||||
export type AuthMethodsConfiguration = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: ApiKeyConfiguration,
|
||||
"petstore_auth"?: OAuth2Configuration
|
||||
}
|
||||
@@ -88,6 +90,7 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
|
||||
if (!config) {
|
||||
return authMethods;
|
||||
}
|
||||
authMethods["default"] = config["default"]
|
||||
|
||||
if (config["api_key"]) {
|
||||
authMethods["api_key"] = new ApiKeyAuthentication(
|
||||
|
||||
@@ -244,7 +244,7 @@ export class ObjectStoreApi {
|
||||
* Returns pet inventories by status
|
||||
* @param param the request object
|
||||
*/
|
||||
public getInventory(param: StoreApiGetInventoryRequest, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
return this.api.getInventory( options).toPromise();
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export class ObjectUserApi {
|
||||
* Logs out current logged in user session
|
||||
* @param param the request object
|
||||
*/
|
||||
public logoutUser(param: UserApiLogoutUserRequest, options?: Configuration): Promise<void> {
|
||||
public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.logoutUser( options).toPromise();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
import { injectable } from "inversify";
|
||||
|
||||
@@ -53,12 +54,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -90,12 +92,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", ""));
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -127,12 +130,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -164,12 +168,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -197,12 +202,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -241,12 +247,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -306,12 +313,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -373,12 +381,13 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
import { injectable } from "inversify";
|
||||
|
||||
@@ -41,6 +42,7 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -60,12 +62,13 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -93,6 +96,7 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -129,6 +133,7 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
import { injectable } from "inversify";
|
||||
|
||||
@@ -51,12 +52,13 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -93,12 +95,13 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -135,12 +138,13 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -168,12 +172,13 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -200,6 +205,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -242,6 +248,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -260,12 +267,13 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -311,12 +319,13 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ export class ObjectStoreApi {
|
||||
* Returns pet inventories by status
|
||||
* @param param the request object
|
||||
*/
|
||||
public getInventory(param: StoreApiGetInventoryRequest, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
return this.api.getInventory( options).toPromise();
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export class ObjectUserApi {
|
||||
* Logs out current logged in user session
|
||||
* @param param the request object
|
||||
*/
|
||||
public logoutUser(param: UserApiLogoutUserRequest, options?: Configuration): Promise<void> {
|
||||
public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.logoutUser( options).toPromise();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { ApiResponse } from '../models/ApiResponse';
|
||||
@@ -49,11 +50,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -86,11 +92,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", ""));
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -123,11 +134,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -160,11 +176,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -193,11 +214,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -237,11 +263,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -302,11 +333,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -369,11 +405,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { Order } from '../models/Order';
|
||||
@@ -37,6 +38,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -56,11 +62,16 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -89,6 +100,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -125,6 +141,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { User } from '../models/User';
|
||||
@@ -47,11 +48,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -89,11 +95,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -131,11 +142,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -164,11 +180,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -196,6 +217,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -238,6 +264,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -256,11 +287,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -307,11 +343,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -64,6 +64,7 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication {
|
||||
|
||||
|
||||
export type AuthMethods = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: SecurityAuthentication,
|
||||
"petstore_auth"?: SecurityAuthentication
|
||||
}
|
||||
@@ -74,6 +75,7 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
|
||||
export type OAuth2Configuration = { accessToken: string };
|
||||
|
||||
export type AuthMethodsConfiguration = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: ApiKeyConfiguration,
|
||||
"petstore_auth"?: OAuth2Configuration
|
||||
}
|
||||
@@ -88,6 +90,7 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
|
||||
if (!config) {
|
||||
return authMethods;
|
||||
}
|
||||
authMethods["default"] = config["default"]
|
||||
|
||||
if (config["api_key"]) {
|
||||
authMethods["api_key"] = new ApiKeyAuthentication(
|
||||
|
||||
@@ -244,7 +244,7 @@ export class ObjectStoreApi {
|
||||
* Returns pet inventories by status
|
||||
* @param param the request object
|
||||
*/
|
||||
public getInventory(param: StoreApiGetInventoryRequest, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
return this.api.getInventory( options).toPromise();
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export class ObjectUserApi {
|
||||
* Logs out current logged in user session
|
||||
* @param param the request object
|
||||
*/
|
||||
public logoutUser(param: UserApiLogoutUserRequest, options?: Configuration): Promise<void> {
|
||||
public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.logoutUser( options).toPromise();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { ApiResponse } from '../models/ApiResponse';
|
||||
@@ -51,11 +52,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -88,11 +94,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", ""));
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -125,11 +136,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -162,11 +178,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -195,11 +216,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -239,11 +265,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -304,11 +335,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -371,11 +407,16 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Content-Type", contentType);
|
||||
}
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["petstore_auth"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { Order } from '../models/Order';
|
||||
@@ -39,6 +40,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -58,11 +64,16 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -91,6 +102,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -127,6 +143,11 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseAPIRequestFactory, RequiredError } from './baseapi';
|
||||
import {BaseAPIRequestFactory, RequiredError} from './baseapi';
|
||||
import {Configuration} from '../configuration';
|
||||
import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http';
|
||||
import * as FormData from "form-data";
|
||||
import { URLSearchParams } from 'url';
|
||||
import {ObjectSerializer} from '../models/ObjectSerializer';
|
||||
import {ApiException} from './exception';
|
||||
import {canConsumeForm, isCodeInRange} from '../util';
|
||||
import {SecurityAuthentication} from '../auth/auth';
|
||||
|
||||
|
||||
import { User } from '../models/User';
|
||||
@@ -49,11 +50,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -91,11 +97,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -133,11 +144,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -166,11 +182,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -198,6 +219,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -240,6 +266,11 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
}
|
||||
@@ -258,11 +289,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
|
||||
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
@@ -309,11 +345,16 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
);
|
||||
requestContext.setBody(serializedBody);
|
||||
|
||||
let authMethod = null;
|
||||
let authMethod: SecurityAuthentication | undefined;
|
||||
// Apply auth methods
|
||||
authMethod = _config.authMethods["api_key"]
|
||||
if (authMethod) {
|
||||
await authMethod.applySecurityAuthentication(requestContext);
|
||||
if (authMethod?.applySecurityAuthentication) {
|
||||
await authMethod?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
|
||||
if (defaultAuth?.applySecurityAuthentication) {
|
||||
await defaultAuth?.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
|
||||
@@ -66,6 +66,7 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication {
|
||||
|
||||
|
||||
export type AuthMethods = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: SecurityAuthentication,
|
||||
"petstore_auth"?: SecurityAuthentication
|
||||
}
|
||||
@@ -76,6 +77,7 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider };
|
||||
export type OAuth2Configuration = { accessToken: string };
|
||||
|
||||
export type AuthMethodsConfiguration = {
|
||||
"default"?: SecurityAuthentication,
|
||||
"api_key"?: ApiKeyConfiguration,
|
||||
"petstore_auth"?: OAuth2Configuration
|
||||
}
|
||||
@@ -90,6 +92,7 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
|
||||
if (!config) {
|
||||
return authMethods;
|
||||
}
|
||||
authMethods["default"] = config["default"]
|
||||
|
||||
if (config["api_key"]) {
|
||||
authMethods["api_key"] = new ApiKeyAuthentication(
|
||||
|
||||
@@ -244,7 +244,7 @@ export class ObjectStoreApi {
|
||||
* Returns pet inventories by status
|
||||
* @param param the request object
|
||||
*/
|
||||
public getInventory(param: StoreApiGetInventoryRequest, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> {
|
||||
return this.api.getInventory( options).toPromise();
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export class ObjectUserApi {
|
||||
* Logs out current logged in user session
|
||||
* @param param the request object
|
||||
*/
|
||||
public logoutUser(param: UserApiLogoutUserRequest, options?: Configuration): Promise<void> {
|
||||
public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise<void> {
|
||||
return this.api.logoutUser( options).toPromise();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user