forked from loafle/openapi-generator-original
[typescript-axios] reduce file size (#8283)
* [typescript-axios] reduce file size * [typescript-axios] regenerate-samples
This commit is contained in:
parent
84813be309
commit
fb1b62816f
@ -104,6 +104,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
|
|||||||
|
|
||||||
supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts"));
|
supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts"));
|
||||||
supportingFiles.add(new SupportingFile("baseApi.mustache", "", "base.ts"));
|
supportingFiles.add(new SupportingFile("baseApi.mustache", "", "base.ts"));
|
||||||
|
supportingFiles.add(new SupportingFile("common.mustache", "", "common.ts"));
|
||||||
supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts"));
|
supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts"));
|
||||||
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts"));
|
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts"));
|
||||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||||
|
@ -7,6 +7,8 @@ import { Configuration } from './configuration';
|
|||||||
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
|
||||||
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
|
||||||
|
|
||||||
{{#models}}
|
{{#models}}
|
||||||
|
@ -7,6 +7,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
|||||||
import { Configuration } from '{{apiRelativeToRoot}}configuration';
|
import { Configuration } from '{{apiRelativeToRoot}}configuration';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common';
|
||||||
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
|
||||||
{{#imports}}
|
{{#imports}}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -39,15 +41,13 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
|||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
// verify required parameter '{{paramName}}' is not null or undefined
|
// verify required parameter '{{paramName}}' is not null or undefined
|
||||||
if ({{paramName}} === null || {{paramName}} === undefined) {
|
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
||||||
throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
|
|
||||||
}
|
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
const localVarPath = `{{{path}}}`{{#pathParams}}
|
||||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -62,45 +62,23 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
|||||||
// authentication {{name}} required
|
// authentication {{name}} required
|
||||||
{{#isApiKey}}
|
{{#isApiKey}}
|
||||||
{{#isKeyInHeader}}
|
{{#isKeyInHeader}}
|
||||||
if (configuration && configuration.apiKey) {
|
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
||||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
||||||
? await configuration.apiKey("{{keyParamName}}")
|
|
||||||
: await configuration.apiKey;
|
|
||||||
localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
{{/isKeyInHeader}}
|
{{/isKeyInHeader}}
|
||||||
{{#isKeyInQuery}}
|
{{#isKeyInQuery}}
|
||||||
if (configuration && configuration.apiKey) {
|
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
||||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
||||||
? await configuration.apiKey("{{keyParamName}}")
|
|
||||||
: await configuration.apiKey;
|
|
||||||
localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
{{/isKeyInQuery}}
|
{{/isKeyInQuery}}
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{#isBasicBasic}}
|
{{#isBasicBasic}}
|
||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if (configuration && (configuration.username || configuration.password)) {
|
setBasicAuthToObject(localVarRequestOptions, configuration)
|
||||||
localVarRequestOptions["auth"] = { username: configuration.username, password: configuration.password };
|
|
||||||
}
|
|
||||||
{{/isBasicBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isBasicBearer}}
|
{{#isBasicBearer}}
|
||||||
// http bearer authentication required
|
// http bearer authentication required
|
||||||
if (configuration && configuration.accessToken) {
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||||
const accessToken = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken()
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
||||||
}
|
|
||||||
{{/isBasicBearer}}
|
{{/isBasicBearer}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
{{/isOAuth}}
|
{{/isOAuth}}
|
||||||
|
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
@ -188,31 +166,18 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
|||||||
{{/consumes.0}}
|
{{/consumes.0}}
|
||||||
|
|
||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
{{#hasFormParams}}
|
{{#hasFormParams}}
|
||||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{#bodyParam}}
|
{{#bodyParam}}
|
||||||
const nonString = typeof {{paramName}} !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify({{paramName}} !== undefined ? {{paramName}} : {})
|
|
||||||
: ({{paramName}} || "");
|
|
||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -226,6 +191,7 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
export const {{classname}}Fp = function(configuration?: Configuration) {
|
||||||
|
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
||||||
return {
|
return {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
/**
|
/**
|
||||||
@ -240,11 +206,8 @@ export const {{classname}}Fp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> {
|
async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> {
|
||||||
const localVarAxiosArgs = await {{classname}}AxiosParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
@ -256,6 +219,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) {
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
|
const localVarFp = {{classname}}Fp(configuration)
|
||||||
return {
|
return {
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
/**
|
/**
|
||||||
@ -270,7 +234,7 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
|
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
|
||||||
return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath));
|
return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
};
|
};
|
||||||
|
120
modules/openapi-generator/src/main/resources/typescript-axios/common.mustache
vendored
Normal file
120
modules/openapi-generator/src/main/resources/typescript-axios/common.mustache
vendored
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
{{>licenseInfo}}
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
.npmignore
|
.npmignore
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
@ -17,6 +17,8 @@ import { Configuration } from './configuration';
|
|||||||
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
|
||||||
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,7 +198,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
filePost: async (inlineObject?: InlineObject, options: any = {}): Promise<RequestArgs> => {
|
filePost: async (inlineObject?: InlineObject, options: any = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/file`;
|
const localVarPath = `/file`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -210,26 +212,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof inlineObject !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(inlineObject !== undefined ? inlineObject : {})
|
|
||||||
: (inlineObject || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -242,7 +231,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
petsFilteredPatch: async (petByAgePetByType?: PetByAge | PetByType, options: any = {}): Promise<RequestArgs> => {
|
petsFilteredPatch: async (petByAgePetByType?: PetByAge | PetByType, options: any = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/pets-filtered`;
|
const localVarPath = `/pets-filtered`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -256,26 +245,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof petByAgePetByType !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(petByAgePetByType, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(petByAgePetByType !== undefined ? petByAgePetByType : {})
|
|
||||||
: (petByAgePetByType || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -288,7 +264,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
petsPatch: async (catDog?: Cat | Dog, options: any = {}): Promise<RequestArgs> => {
|
petsPatch: async (catDog?: Cat | Dog, options: any = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/pets`;
|
const localVarPath = `/pets`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -302,26 +278,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof catDog !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(catDog, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(catDog !== undefined ? catDog : {})
|
|
||||||
: (catDog || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -333,6 +296,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const DefaultApiFp = function(configuration?: Configuration) {
|
export const DefaultApiFp = function(configuration?: Configuration) {
|
||||||
|
const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -341,11 +305,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async filePost(inlineObject?: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async filePost(inlineObject?: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).filePost(inlineObject, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.filePost(inlineObject, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -354,11 +315,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsFilteredPatch(petByAgePetByType, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.petsFilteredPatch(petByAgePetByType, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -367,11 +325,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async petsPatch(catDog?: Cat | Dog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async petsPatch(catDog?: Cat | Dog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsPatch(catDog, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.petsPatch(catDog, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -381,6 +336,7 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
|
const localVarFp = DefaultApiFp(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -389,7 +345,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
filePost(inlineObject?: InlineObject, options?: any): AxiosPromise<void> {
|
filePost(inlineObject?: InlineObject, options?: any): AxiosPromise<void> {
|
||||||
return DefaultApiFp(configuration).filePost(inlineObject, options).then((request) => request(axios, basePath));
|
return localVarFp.filePost(inlineObject, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -398,7 +354,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): AxiosPromise<void> {
|
petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): AxiosPromise<void> {
|
||||||
return DefaultApiFp(configuration).petsFilteredPatch(petByAgePetByType, options).then((request) => request(axios, basePath));
|
return localVarFp.petsFilteredPatch(petByAgePetByType, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -407,7 +363,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
petsPatch(catDog?: Cat | Dog, options?: any): AxiosPromise<void> {
|
petsPatch(catDog?: Cat | Dog, options?: any): AxiosPromise<void> {
|
||||||
return DefaultApiFp(configuration).petsPatch(catDog, options).then((request) => request(axios, basePath));
|
return localVarFp.petsPatch(catDog, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* Example
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
.npmignore
|
.npmignore
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
README.md
|
README.md
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
.npmignore
|
.npmignore
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
.npmignore
|
.npmignore
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -6,6 +6,7 @@ api/another/level/pet-api.ts
|
|||||||
api/another/level/store-api.ts
|
api/another/level/store-api.ts
|
||||||
api/another/level/user-api.ts
|
api/another/level/user-api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
|||||||
import { Configuration } from '../../../configuration';
|
import { Configuration } from '../../../configuration';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../../common';
|
||||||
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { ApiResponse } from '../../../model/some/levels/deep';
|
import { ApiResponse } from '../../../model/some/levels/deep';
|
||||||
@ -37,12 +39,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
addPet: async (body: Pet, options: any = {}): Promise<RequestArgs> => {
|
addPet: async (body: Pet, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('addPet', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet`;
|
const localVarPath = `/pet`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -54,37 +54,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -98,13 +80,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise<RequestArgs> => {
|
deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'petId' is not null or undefined
|
// verify required parameter 'petId' is not null or undefined
|
||||||
if (petId === null || petId === undefined) {
|
assertParamExists('deletePet', 'petId', petId)
|
||||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet/{petId}`
|
const localVarPath = `/pet/{petId}`
|
||||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -116,12 +96,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (apiKey !== undefined && apiKey !== null) {
|
if (apiKey !== undefined && apiKey !== null) {
|
||||||
localVarHeaderParameter['api_key'] = String(apiKey);
|
localVarHeaderParameter['api_key'] = String(apiKey);
|
||||||
@ -129,19 +104,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -154,12 +122,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise<RequestArgs> => {
|
findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'status' is not null or undefined
|
// verify required parameter 'status' is not null or undefined
|
||||||
if (status === null || status === undefined) {
|
assertParamExists('findPetsByStatus', 'status', status)
|
||||||
throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet/findByStatus`;
|
const localVarPath = `/pet/findByStatus`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -171,12 +137,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv);
|
localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv);
|
||||||
@ -184,19 +145,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -209,12 +163,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
findPetsByTags: async (tags: Array<string>, options: any = {}): Promise<RequestArgs> => {
|
findPetsByTags: async (tags: Array<string>, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'tags' is not null or undefined
|
// verify required parameter 'tags' is not null or undefined
|
||||||
if (tags === null || tags === undefined) {
|
assertParamExists('findPetsByTags', 'tags', tags)
|
||||||
throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet/findByTags`;
|
const localVarPath = `/pet/findByTags`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -226,12 +178,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tags) {
|
if (tags) {
|
||||||
localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv);
|
localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv);
|
||||||
@ -239,19 +186,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -264,13 +204,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
getPetById: async (petId: number, options: any = {}): Promise<RequestArgs> => {
|
getPetById: async (petId: number, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'petId' is not null or undefined
|
// verify required parameter 'petId' is not null or undefined
|
||||||
if (petId === null || petId === undefined) {
|
assertParamExists('getPetById', 'petId', petId)
|
||||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet/{petId}`
|
const localVarPath = `/pet/{petId}`
|
||||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -281,28 +219,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
const localVarQueryParameter = {} as any;
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
// authentication api_key required
|
// authentication api_key required
|
||||||
if (configuration && configuration.apiKey) {
|
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration)
|
||||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
||||||
? await configuration.apiKey("api_key")
|
|
||||||
: await configuration.apiKey;
|
|
||||||
localVarHeaderParameter["api_key"] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -315,12 +241,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
updatePet: async (body: Pet, options: any = {}): Promise<RequestArgs> => {
|
updatePet: async (body: Pet, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('updatePet', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet`;
|
const localVarPath = `/pet`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -332,37 +256,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -377,13 +283,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise<RequestArgs> => {
|
updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'petId' is not null or undefined
|
// verify required parameter 'petId' is not null or undefined
|
||||||
if (petId === null || petId === undefined) {
|
assertParamExists('updatePetWithForm', 'petId', petId)
|
||||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet/{petId}`
|
const localVarPath = `/pet/{petId}`
|
||||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -396,12 +300,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (name !== undefined) {
|
if (name !== undefined) {
|
||||||
@ -415,20 +314,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';
|
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
localVarRequestOptions.data = localVarFormParams.toString();
|
localVarRequestOptions.data = localVarFormParams.toString();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -443,13 +335,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise<RequestArgs> => {
|
uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'petId' is not null or undefined
|
// verify required parameter 'petId' is not null or undefined
|
||||||
if (petId === null || petId === undefined) {
|
assertParamExists('uploadFile', 'petId', petId)
|
||||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/pet/{petId}/uploadImage`
|
const localVarPath = `/pet/{petId}/uploadImage`
|
||||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -462,12 +352,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
// authentication petstore_auth required
|
// authentication petstore_auth required
|
||||||
// oauth required
|
// oauth required
|
||||||
if (configuration && configuration.accessToken) {
|
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
||||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
|
||||||
: await configuration.accessToken;
|
|
||||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (additionalMetadata !== undefined) {
|
if (additionalMetadata !== undefined) {
|
||||||
@ -481,20 +366,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
localVarRequestOptions.data = localVarFormParams;
|
localVarRequestOptions.data = localVarFormParams;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -506,6 +384,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const PetApiFp = function(configuration?: Configuration) {
|
export const PetApiFp = function(configuration?: Configuration) {
|
||||||
|
const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -515,11 +394,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -530,11 +406,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Multiple status values can be provided with comma separated strings
|
* Multiple status values can be provided with comma separated strings
|
||||||
@ -544,11 +417,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>>> {
|
async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
@ -558,11 +428,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async findPetsByTags(tags: Array<string>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>>> {
|
async findPetsByTags(tags: Array<string>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns a single pet
|
* Returns a single pet
|
||||||
@ -572,11 +439,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Pet>> {
|
async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Pet>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -586,11 +450,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -602,11 +463,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -618,11 +476,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponse>> {
|
async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponse>> {
|
||||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -632,6 +487,7 @@ export const PetApiFp = function(configuration?: Configuration) {
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
|
const localVarFp = PetApiFp(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -641,7 +497,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
addPet(body: Pet, options?: any): AxiosPromise<void> {
|
addPet(body: Pet, options?: any): AxiosPromise<void> {
|
||||||
return PetApiFp(configuration).addPet(body, options).then((request) => request(axios, basePath));
|
return localVarFp.addPet(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -652,7 +508,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise<void> {
|
deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise<void> {
|
||||||
return PetApiFp(configuration).deletePet(petId, apiKey, options).then((request) => request(axios, basePath));
|
return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Multiple status values can be provided with comma separated strings
|
* Multiple status values can be provided with comma separated strings
|
||||||
@ -662,7 +518,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise<Array<Pet>> {
|
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise<Array<Pet>> {
|
||||||
return PetApiFp(configuration).findPetsByStatus(status, options).then((request) => request(axios, basePath));
|
return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
@ -672,7 +528,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
findPetsByTags(tags: Array<string>, options?: any): AxiosPromise<Array<Pet>> {
|
findPetsByTags(tags: Array<string>, options?: any): AxiosPromise<Array<Pet>> {
|
||||||
return PetApiFp(configuration).findPetsByTags(tags, options).then((request) => request(axios, basePath));
|
return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns a single pet
|
* Returns a single pet
|
||||||
@ -682,7 +538,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
getPetById(petId: number, options?: any): AxiosPromise<Pet> {
|
getPetById(petId: number, options?: any): AxiosPromise<Pet> {
|
||||||
return PetApiFp(configuration).getPetById(petId, options).then((request) => request(axios, basePath));
|
return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -692,7 +548,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
updatePet(body: Pet, options?: any): AxiosPromise<void> {
|
updatePet(body: Pet, options?: any): AxiosPromise<void> {
|
||||||
return PetApiFp(configuration).updatePet(body, options).then((request) => request(axios, basePath));
|
return localVarFp.updatePet(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -704,7 +560,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise<void> {
|
updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise<void> {
|
||||||
return PetApiFp(configuration).updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath));
|
return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -716,7 +572,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise<ApiResponse> {
|
uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise<ApiResponse> {
|
||||||
return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath));
|
return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
|||||||
import { Configuration } from '../../../configuration';
|
import { Configuration } from '../../../configuration';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../../common';
|
||||||
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Order } from '../../../model/some/levels/deep';
|
import { Order } from '../../../model/some/levels/deep';
|
||||||
@ -35,13 +37,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
*/
|
*/
|
||||||
deleteOrder: async (orderId: string, options: any = {}): Promise<RequestArgs> => {
|
deleteOrder: async (orderId: string, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'orderId' is not null or undefined
|
// verify required parameter 'orderId' is not null or undefined
|
||||||
if (orderId === null || orderId === undefined) {
|
assertParamExists('deleteOrder', 'orderId', orderId)
|
||||||
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/store/order/{orderId}`
|
const localVarPath = `/store/order/{orderId}`
|
||||||
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
|
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -53,19 +53,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -78,7 +71,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
getInventory: async (options: any = {}): Promise<RequestArgs> => {
|
getInventory: async (options: any = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/store/inventory`;
|
const localVarPath = `/store/inventory`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -89,28 +82,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
const localVarQueryParameter = {} as any;
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
// authentication api_key required
|
// authentication api_key required
|
||||||
if (configuration && configuration.apiKey) {
|
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration)
|
||||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
||||||
? await configuration.apiKey("api_key")
|
|
||||||
: await configuration.apiKey;
|
|
||||||
localVarHeaderParameter["api_key"] = localVarApiKeyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -123,13 +104,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
*/
|
*/
|
||||||
getOrderById: async (orderId: number, options: any = {}): Promise<RequestArgs> => {
|
getOrderById: async (orderId: number, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'orderId' is not null or undefined
|
// verify required parameter 'orderId' is not null or undefined
|
||||||
if (orderId === null || orderId === undefined) {
|
assertParamExists('getOrderById', 'orderId', orderId)
|
||||||
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/store/order/{orderId}`
|
const localVarPath = `/store/order/{orderId}`
|
||||||
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
|
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -141,19 +120,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -166,12 +138,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
*/
|
*/
|
||||||
placeOrder: async (body: Order, options: any = {}): Promise<RequestArgs> => {
|
placeOrder: async (body: Order, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('placeOrder', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/store/order`;
|
const localVarPath = `/store/order`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -185,26 +155,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -216,6 +173,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const StoreApiFp = function(configuration?: Configuration) {
|
export const StoreApiFp = function(configuration?: Configuration) {
|
||||||
|
const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
@ -225,11 +183,8 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns a map of status codes to quantities
|
* Returns a map of status codes to quantities
|
||||||
@ -238,11 +193,8 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> {
|
async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> {
|
||||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
@ -252,11 +204,8 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
|
async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
|
||||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -266,11 +215,8 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
|
async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
|
||||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -280,6 +226,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
|
const localVarFp = StoreApiFp(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
@ -289,7 +236,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
deleteOrder(orderId: string, options?: any): AxiosPromise<void> {
|
deleteOrder(orderId: string, options?: any): AxiosPromise<void> {
|
||||||
return StoreApiFp(configuration).deleteOrder(orderId, options).then((request) => request(axios, basePath));
|
return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns a map of status codes to quantities
|
* Returns a map of status codes to quantities
|
||||||
@ -298,7 +245,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> {
|
getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> {
|
||||||
return StoreApiFp(configuration).getInventory(options).then((request) => request(axios, basePath));
|
return localVarFp.getInventory(options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
@ -308,7 +255,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
getOrderById(orderId: number, options?: any): AxiosPromise<Order> {
|
getOrderById(orderId: number, options?: any): AxiosPromise<Order> {
|
||||||
return StoreApiFp(configuration).getOrderById(orderId, options).then((request) => request(axios, basePath));
|
return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -318,7 +265,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
placeOrder(body: Order, options?: any): AxiosPromise<Order> {
|
placeOrder(body: Order, options?: any): AxiosPromise<Order> {
|
||||||
return StoreApiFp(configuration).placeOrder(body, options).then((request) => request(axios, basePath));
|
return localVarFp.placeOrder(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
|||||||
import { Configuration } from '../../../configuration';
|
import { Configuration } from '../../../configuration';
|
||||||
// Some imports not used depending on template conditions
|
// Some imports not used depending on template conditions
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../../../common';
|
||||||
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { User } from '../../../model/some/levels/deep';
|
import { User } from '../../../model/some/levels/deep';
|
||||||
@ -35,12 +37,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
createUser: async (body: User, options: any = {}): Promise<RequestArgs> => {
|
createUser: async (body: User, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('createUser', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user`;
|
const localVarPath = `/user`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -54,26 +54,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -86,12 +73,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
createUsersWithArrayInput: async (body: Array<User>, options: any = {}): Promise<RequestArgs> => {
|
createUsersWithArrayInput: async (body: Array<User>, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('createUsersWithArrayInput', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user/createWithArray`;
|
const localVarPath = `/user/createWithArray`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -105,26 +90,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -137,12 +109,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
createUsersWithListInput: async (body: Array<User>, options: any = {}): Promise<RequestArgs> => {
|
createUsersWithListInput: async (body: Array<User>, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('createUsersWithListInput', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user/createWithList`;
|
const localVarPath = `/user/createWithList`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -156,26 +126,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -188,13 +145,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
deleteUser: async (username: string, options: any = {}): Promise<RequestArgs> => {
|
deleteUser: async (username: string, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'username' is not null or undefined
|
// verify required parameter 'username' is not null or undefined
|
||||||
if (username === null || username === undefined) {
|
assertParamExists('deleteUser', 'username', username)
|
||||||
throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user/{username}`
|
const localVarPath = `/user/{username}`
|
||||||
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -206,19 +161,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -231,13 +179,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
getUserByName: async (username: string, options: any = {}): Promise<RequestArgs> => {
|
getUserByName: async (username: string, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'username' is not null or undefined
|
// verify required parameter 'username' is not null or undefined
|
||||||
if (username === null || username === undefined) {
|
assertParamExists('getUserByName', 'username', username)
|
||||||
throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user/{username}`
|
const localVarPath = `/user/{username}`
|
||||||
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -249,19 +195,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -275,16 +214,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
loginUser: async (username: string, password: string, options: any = {}): Promise<RequestArgs> => {
|
loginUser: async (username: string, password: string, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'username' is not null or undefined
|
// verify required parameter 'username' is not null or undefined
|
||||||
if (username === null || username === undefined) {
|
assertParamExists('loginUser', 'username', username)
|
||||||
throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.');
|
|
||||||
}
|
|
||||||
// verify required parameter 'password' is not null or undefined
|
// verify required parameter 'password' is not null or undefined
|
||||||
if (password === null || password === undefined) {
|
assertParamExists('loginUser', 'password', password)
|
||||||
throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user/login`;
|
const localVarPath = `/user/login`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -304,19 +239,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -329,7 +257,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
logoutUser: async (options: any = {}): Promise<RequestArgs> => {
|
logoutUser: async (options: any = {}): Promise<RequestArgs> => {
|
||||||
const localVarPath = `/user/logout`;
|
const localVarPath = `/user/logout`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -341,19 +269,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -367,17 +288,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
*/
|
*/
|
||||||
updateUser: async (username: string, body: User, options: any = {}): Promise<RequestArgs> => {
|
updateUser: async (username: string, body: User, options: any = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'username' is not null or undefined
|
// verify required parameter 'username' is not null or undefined
|
||||||
if (username === null || username === undefined) {
|
assertParamExists('updateUser', 'username', username)
|
||||||
throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.');
|
|
||||||
}
|
|
||||||
// verify required parameter 'body' is not null or undefined
|
// verify required parameter 'body' is not null or undefined
|
||||||
if (body === null || body === undefined) {
|
assertParamExists('updateUser', 'body', body)
|
||||||
throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
|
|
||||||
}
|
|
||||||
const localVarPath = `/user/{username}`
|
const localVarPath = `/user/{username}`
|
||||||
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
if (configuration) {
|
if (configuration) {
|
||||||
baseOptions = configuration.baseOptions;
|
baseOptions = configuration.baseOptions;
|
||||||
@ -391,26 +308,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
|
|
||||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||||
for (const key in localVarQueryParameter) {
|
|
||||||
queryParameters.set(key, localVarQueryParameter[key]);
|
|
||||||
}
|
|
||||||
for (const key in options.query) {
|
|
||||||
queryParameters.set(key, options.query[key]);
|
|
||||||
}
|
|
||||||
localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString();
|
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
const nonString = typeof body !== 'string';
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
||||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
|
||||||
: nonString;
|
|
||||||
localVarRequestOptions.data = needsSerialization
|
|
||||||
? JSON.stringify(body !== undefined ? body : {})
|
|
||||||
: (body || "");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
url: toPathString(localVarUrlObj),
|
||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -422,6 +326,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const UserApiFp = function(configuration?: Configuration) {
|
export const UserApiFp = function(configuration?: Configuration) {
|
||||||
|
const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
@ -431,11 +336,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -445,11 +347,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async createUsersWithArrayInput(body: Array<User>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async createUsersWithArrayInput(body: Array<User>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -459,11 +358,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async createUsersWithListInput(body: Array<User>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async createUsersWithListInput(body: Array<User>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
@ -473,11 +369,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -487,11 +380,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<User>> {
|
async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<User>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -502,11 +392,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
|
async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -515,11 +402,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
@ -530,11 +414,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options);
|
||||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
|
||||||
return axios.request(axiosRequestArgs);
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -544,6 +425,7 @@ export const UserApiFp = function(configuration?: Configuration) {
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
|
const localVarFp = UserApiFp(configuration)
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
@ -553,7 +435,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
createUser(body: User, options?: any): AxiosPromise<void> {
|
createUser(body: User, options?: any): AxiosPromise<void> {
|
||||||
return UserApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath));
|
return localVarFp.createUser(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -563,7 +445,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
createUsersWithArrayInput(body: Array<User>, options?: any): AxiosPromise<void> {
|
createUsersWithArrayInput(body: Array<User>, options?: any): AxiosPromise<void> {
|
||||||
return UserApiFp(configuration).createUsersWithArrayInput(body, options).then((request) => request(axios, basePath));
|
return localVarFp.createUsersWithArrayInput(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -573,7 +455,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
createUsersWithListInput(body: Array<User>, options?: any): AxiosPromise<void> {
|
createUsersWithListInput(body: Array<User>, options?: any): AxiosPromise<void> {
|
||||||
return UserApiFp(configuration).createUsersWithListInput(body, options).then((request) => request(axios, basePath));
|
return localVarFp.createUsersWithListInput(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
@ -583,7 +465,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
deleteUser(username: string, options?: any): AxiosPromise<void> {
|
deleteUser(username: string, options?: any): AxiosPromise<void> {
|
||||||
return UserApiFp(configuration).deleteUser(username, options).then((request) => request(axios, basePath));
|
return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -593,7 +475,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
getUserByName(username: string, options?: any): AxiosPromise<User> {
|
getUserByName(username: string, options?: any): AxiosPromise<User> {
|
||||||
return UserApiFp(configuration).getUserByName(username, options).then((request) => request(axios, basePath));
|
return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -604,7 +486,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
loginUser(username: string, password: string, options?: any): AxiosPromise<string> {
|
loginUser(username: string, password: string, options?: any): AxiosPromise<string> {
|
||||||
return UserApiFp(configuration).loginUser(username, password, options).then((request) => request(axios, basePath));
|
return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -613,7 +495,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
logoutUser(options?: any): AxiosPromise<void> {
|
logoutUser(options?: any): AxiosPromise<void> {
|
||||||
return UserApiFp(configuration).logoutUser(options).then((request) => request(axios, basePath));
|
return localVarFp.logoutUser(options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* This can only be done by the logged in user.
|
* This can only be done by the logged in user.
|
||||||
@ -624,7 +506,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
|||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
updateUser(username: string, body: User, options?: any): AxiosPromise<void> {
|
updateUser(username: string, body: User, options?: any): AxiosPromise<void> {
|
||||||
return UserApiFp(configuration).updateUser(username, body, options).then((request) => request(axios, basePath));
|
return localVarFp.updateUser(username, body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
README.md
|
README.md
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
.npmignore
|
.npmignore
|
||||||
api.ts
|
api.ts
|
||||||
base.ts
|
base.ts
|
||||||
|
common.ts
|
||||||
configuration.ts
|
configuration.ts
|
||||||
git_push.sh
|
git_push.sh
|
||||||
index.ts
|
index.ts
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* OpenAPI Petstore
|
||||||
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
import { RequiredError, RequestArgs } from "./base";
|
||||||
|
import { AxiosInstance } from 'axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const DUMMY_BASE_URL = 'https://example.com'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||||
|
if (paramValue === null || paramValue === undefined) {
|
||||||
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.apiKey) {
|
||||||
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||||
|
? await configuration.apiKey(keyParamName)
|
||||||
|
: await configuration.apiKey;
|
||||||
|
object[keyParamName] = localVarApiKeyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && (configuration.username || configuration.password)) {
|
||||||
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken(name, scopes)
|
||||||
|
: await configuration.accessToken;
|
||||||
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||||
|
const searchParams = new URLSearchParams(url.search);
|
||||||
|
for (const object of objects) {
|
||||||
|
for (const key in object) {
|
||||||
|
searchParams.set(key, object[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url.search = searchParams.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||||
|
const nonString = typeof value !== 'string';
|
||||||
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||||
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||||
|
: nonString;
|
||||||
|
return needsSerialization
|
||||||
|
? JSON.stringify(value !== undefined ? value : {})
|
||||||
|
: (value || "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const toPathString = function (url: URL) {
|
||||||
|
return url.pathname + url.search + url.hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user