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("baseApi.mustache", "", "base.ts"));
|
||||
supportingFiles.add(new SupportingFile("common.mustache", "", "common.ts"));
|
||||
supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts"));
|
||||
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts"));
|
||||
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';
|
||||
// Some imports not used depending on template conditions
|
||||
// @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';
|
||||
|
||||
{{#models}}
|
||||
|
@ -7,6 +7,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
||||
import { Configuration } from '{{apiRelativeToRoot}}configuration';
|
||||
// Some imports not used depending on template conditions
|
||||
// @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';
|
||||
{{#imports}}
|
||||
// @ts-ignore
|
||||
@ -39,15 +41,13 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
// verify required parameter '{{paramName}}' is not null or undefined
|
||||
if ({{paramName}} === null || {{paramName}} === undefined) {
|
||||
throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
|
||||
}
|
||||
assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}})
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
const localVarPath = `{{{path}}}`{{#pathParams}}
|
||||
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -62,45 +62,23 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
||||
// authentication {{name}} required
|
||||
{{#isApiKey}}
|
||||
{{#isKeyInHeader}}
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey("{{keyParamName}}")
|
||||
: await configuration.apiKey;
|
||||
localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue;
|
||||
}
|
||||
await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration)
|
||||
{{/isKeyInHeader}}
|
||||
{{#isKeyInQuery}}
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey("{{keyParamName}}")
|
||||
: await configuration.apiKey;
|
||||
localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue;
|
||||
}
|
||||
await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration)
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasicBasic}}
|
||||
// http basic authentication required
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
localVarRequestOptions["auth"] = { username: configuration.username, password: configuration.password };
|
||||
}
|
||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
||||
{{/isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
// http bearer authentication required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const accessToken = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken()
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
{{/isBasicBearer}}
|
||||
{{#isOAuth}}
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration)
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
||||
@ -188,31 +166,18 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
||||
{{/consumes.0}}
|
||||
|
||||
{{/bodyParam}}
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
{{#hasFormParams}}
|
||||
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
|
||||
{{/hasFormParams}}
|
||||
{{#bodyParam}}
|
||||
const nonString = typeof {{paramName}} !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify({{paramName}} !== undefined ? {{paramName}} : {})
|
||||
: ({{paramName}} || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration)
|
||||
{{/bodyParam}}
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -226,6 +191,7 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur
|
||||
* @export
|
||||
*/
|
||||
export const {{classname}}Fp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration)
|
||||
return {
|
||||
{{#operation}}
|
||||
/**
|
||||
@ -240,11 +206,8 @@ export const {{classname}}Fp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
{{/operation}}
|
||||
}
|
||||
@ -256,6 +219,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) {
|
||||
* @export
|
||||
*/
|
||||
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = {{classname}}Fp(configuration)
|
||||
return {
|
||||
{{#operation}}
|
||||
/**
|
||||
@ -270,7 +234,7 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
{{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}}
|
||||
};
|
||||
|
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
|
@ -17,6 +17,8 @@ import { Configuration } from './configuration';
|
||||
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
||||
// Some imports not used depending on template conditions
|
||||
// @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';
|
||||
|
||||
/**
|
||||
@ -196,7 +198,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
filePost: async (inlineObject?: InlineObject, options: any = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/file`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -210,26 +212,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof inlineObject !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(inlineObject !== undefined ? inlineObject : {})
|
||||
: (inlineObject || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -242,7 +231,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
petsFilteredPatch: async (petByAgePetByType?: PetByAge | PetByType, options: any = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/pets-filtered`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -256,26 +245,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof petByAgePetByType !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(petByAgePetByType !== undefined ? petByAgePetByType : {})
|
||||
: (petByAgePetByType || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(petByAgePetByType, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -288,7 +264,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
petsPatch: async (catDog?: Cat | Dog, options: any = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/pets`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -302,26 +278,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof catDog !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(catDog !== undefined ? catDog : {})
|
||||
: (catDog || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(catDog, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -333,6 +296,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
|
||||
* @export
|
||||
*/
|
||||
export const DefaultApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
@ -341,11 +305,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async filePost(inlineObject?: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).filePost(inlineObject, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.filePost(inlineObject, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -354,11 +315,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async petsFilteredPatch(petByAgePetByType?: PetByAge | PetByType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsFilteredPatch(petByAgePetByType, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.petsFilteredPatch(petByAgePetByType, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -367,11 +325,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async petsPatch(catDog?: Cat | Dog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).petsPatch(catDog, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.petsPatch(catDog, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -381,6 +336,7 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
||||
* @export
|
||||
*/
|
||||
export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = DefaultApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
@ -389,7 +345,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
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/user-api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
|
@ -17,6 +17,8 @@ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
||||
import { Configuration } from '../../../configuration';
|
||||
// Some imports not used depending on template conditions
|
||||
// @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';
|
||||
// @ts-ignore
|
||||
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> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.');
|
||||
}
|
||||
assertParamExists('addPet', 'body', body)
|
||||
const localVarPath = `/pet`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -54,37 +54,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -98,13 +80,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'petId' is not null or undefined
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.');
|
||||
}
|
||||
assertParamExists('deletePet', 'petId', petId)
|
||||
const localVarPath = `/pet/{petId}`
|
||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -116,12 +96,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
if (apiKey !== undefined && apiKey !== null) {
|
||||
localVarHeaderParameter['api_key'] = String(apiKey);
|
||||
@ -129,19 +104,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -154,12 +122,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'status' is not null or undefined
|
||||
if (status === null || status === undefined) {
|
||||
throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.');
|
||||
}
|
||||
assertParamExists('findPetsByStatus', 'status', status)
|
||||
const localVarPath = `/pet/findByStatus`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -171,12 +137,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
if (status) {
|
||||
localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv);
|
||||
@ -184,19 +145,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -209,12 +163,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
findPetsByTags: async (tags: Array<string>, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'tags' is not null or undefined
|
||||
if (tags === null || tags === undefined) {
|
||||
throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.');
|
||||
}
|
||||
assertParamExists('findPetsByTags', 'tags', tags)
|
||||
const localVarPath = `/pet/findByTags`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -226,12 +178,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
if (tags) {
|
||||
localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv);
|
||||
@ -239,19 +186,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -264,13 +204,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
getPetById: async (petId: number, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'petId' is not null or undefined
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.');
|
||||
}
|
||||
assertParamExists('getPetById', 'petId', petId)
|
||||
const localVarPath = `/pet/{petId}`
|
||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -281,28 +219,16 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication api_key required
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey("api_key")
|
||||
: await configuration.apiKey;
|
||||
localVarHeaderParameter["api_key"] = localVarApiKeyValue;
|
||||
}
|
||||
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -315,12 +241,10 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
updatePet: async (body: Pet, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.');
|
||||
}
|
||||
assertParamExists('updatePet', 'body', body)
|
||||
const localVarPath = `/pet`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -332,37 +256,19 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -377,13 +283,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'petId' is not null or undefined
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.');
|
||||
}
|
||||
assertParamExists('updatePetWithForm', 'petId', petId)
|
||||
const localVarPath = `/pet/{petId}`
|
||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -396,12 +300,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
|
||||
if (name !== undefined) {
|
||||
@ -415,20 +314,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
localVarRequestOptions.data = localVarFormParams.toString();
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -443,13 +335,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'petId' is not null or undefined
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.');
|
||||
}
|
||||
assertParamExists('uploadFile', 'petId', petId)
|
||||
const localVarPath = `/pet/{petId}/uploadImage`
|
||||
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -462,12 +352,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
// authentication petstore_auth required
|
||||
// oauth required
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
|
||||
: await configuration.accessToken;
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration)
|
||||
|
||||
|
||||
if (additionalMetadata !== undefined) {
|
||||
@ -481,20 +366,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
localVarRequestOptions.data = localVarFormParams;
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -506,6 +384,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
* @export
|
||||
*/
|
||||
export const PetApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
@ -515,11 +394,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async addPet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).addPet(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -530,11 +406,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
@ -544,11 +417,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
async findPetsByTags(tags: Array<string>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>>> {
|
||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* Returns a single pet
|
||||
@ -572,11 +439,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Pet>> {
|
||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).getPetById(petId, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -586,11 +450,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updatePet(body: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await PetApiAxiosParamCreator(configuration).updatePet(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -602,11 +463,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -618,11 +476,8 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -632,6 +487,7 @@ export const PetApiFp = function(configuration?: Configuration) {
|
||||
* @export
|
||||
*/
|
||||
export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = PetApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
@ -641,7 +497,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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
|
||||
@ -662,7 +518,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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.
|
||||
@ -672,7 +528,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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
|
||||
@ -682,7 +538,7 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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';
|
||||
// Some imports not used depending on template conditions
|
||||
// @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';
|
||||
// @ts-ignore
|
||||
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> => {
|
||||
// verify required parameter 'orderId' is not null or undefined
|
||||
if (orderId === null || orderId === undefined) {
|
||||
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.');
|
||||
}
|
||||
assertParamExists('deleteOrder', 'orderId', orderId)
|
||||
const localVarPath = `/store/order/{orderId}`
|
||||
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -53,19 +53,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -78,7 +71,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
getInventory: async (options: any = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/store/inventory`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -89,28 +82,16 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication api_key required
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey("api_key")
|
||||
: await configuration.apiKey;
|
||||
localVarHeaderParameter["api_key"] = localVarApiKeyValue;
|
||||
}
|
||||
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -123,13 +104,11 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
*/
|
||||
getOrderById: async (orderId: number, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'orderId' is not null or undefined
|
||||
if (orderId === null || orderId === undefined) {
|
||||
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.');
|
||||
}
|
||||
assertParamExists('getOrderById', 'orderId', orderId)
|
||||
const localVarPath = `/store/order/{orderId}`
|
||||
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -141,19 +120,12 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -166,12 +138,10 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
*/
|
||||
placeOrder: async (body: Order, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
|
||||
}
|
||||
assertParamExists('placeOrder', 'body', body)
|
||||
const localVarPath = `/store/order`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -185,26 +155,13 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -216,6 +173,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
|
||||
* @export
|
||||
*/
|
||||
export const StoreApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* Returns a map of status codes to quantities
|
||||
@ -238,11 +193,8 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> {
|
||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getInventory(options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
|
||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -266,11 +215,8 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async placeOrder(body: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order>> {
|
||||
const localVarAxiosArgs = await StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -280,6 +226,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
|
||||
* @export
|
||||
*/
|
||||
export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = StoreApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
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
|
||||
@ -298,7 +245,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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
|
||||
@ -308,7 +255,7 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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';
|
||||
// Some imports not used depending on template conditions
|
||||
// @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';
|
||||
// @ts-ignore
|
||||
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> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
|
||||
}
|
||||
assertParamExists('createUser', 'body', body)
|
||||
const localVarPath = `/user`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -54,26 +54,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -86,12 +73,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
createUsersWithArrayInput: async (body: Array<User>, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.');
|
||||
}
|
||||
assertParamExists('createUsersWithArrayInput', 'body', body)
|
||||
const localVarPath = `/user/createWithArray`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -105,26 +90,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -137,12 +109,10 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
createUsersWithListInput: async (body: Array<User>, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.');
|
||||
}
|
||||
assertParamExists('createUsersWithListInput', 'body', body)
|
||||
const localVarPath = `/user/createWithList`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -156,26 +126,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -188,13 +145,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
deleteUser: async (username: string, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'username' is not null or undefined
|
||||
if (username === null || username === undefined) {
|
||||
throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.');
|
||||
}
|
||||
assertParamExists('deleteUser', 'username', username)
|
||||
const localVarPath = `/user/{username}`
|
||||
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -206,19 +161,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -231,13 +179,11 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
getUserByName: async (username: string, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'username' is not null or undefined
|
||||
if (username === null || username === undefined) {
|
||||
throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.');
|
||||
}
|
||||
assertParamExists('getUserByName', 'username', username)
|
||||
const localVarPath = `/user/{username}`
|
||||
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -249,19 +195,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -275,16 +214,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
loginUser: async (username: string, password: string, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'username' is not null or undefined
|
||||
if (username === null || username === undefined) {
|
||||
throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.');
|
||||
}
|
||||
assertParamExists('loginUser', 'username', username)
|
||||
// verify required parameter 'password' is not null or undefined
|
||||
if (password === null || password === undefined) {
|
||||
throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.');
|
||||
}
|
||||
assertParamExists('loginUser', 'password', password)
|
||||
const localVarPath = `/user/login`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -304,19 +239,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -329,7 +257,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
logoutUser: async (options: any = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/user/logout`;
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -341,19 +269,12 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -367,17 +288,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
*/
|
||||
updateUser: async (username: string, body: User, options: any = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'username' is not null or undefined
|
||||
if (username === null || username === undefined) {
|
||||
throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.');
|
||||
}
|
||||
assertParamExists('updateUser', 'username', username)
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
|
||||
}
|
||||
assertParamExists('updateUser', 'body', body)
|
||||
const localVarPath = `/user/{username}`
|
||||
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
|
||||
// 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;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
@ -391,26 +308,13 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
const queryParameters = new URLSearchParams(localVarUrlObj.search);
|
||||
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();
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const nonString = typeof body !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
localVarRequestOptions.data = needsSerialization
|
||||
? JSON.stringify(body !== undefined ? body : {})
|
||||
: (body || "");
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
@ -422,6 +326,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
* @export
|
||||
*/
|
||||
export const UserApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
@ -431,11 +336,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createUser(body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUser(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -445,11 +347,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createUsersWithArrayInput(body: Array<User>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -459,11 +358,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createUsersWithListInput(body: Array<User>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
@ -473,11 +369,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).deleteUser(username, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -487,11 +380,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<User>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).getUserByName(username, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -502,11 +392,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -515,11 +402,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).logoutUser(options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
@ -530,11 +414,8 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updateUser(username: string, body: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...localVarAxiosArgs.options, url: (configuration?.basePath || basePath) + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, body, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -544,6 +425,7 @@ export const UserApiFp = function(configuration?: Configuration) {
|
||||
* @export
|
||||
*/
|
||||
export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = UserApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
@ -553,7 +435,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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.
|
||||
@ -583,7 +465,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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.
|
||||
@ -624,7 +506,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
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
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
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