Typescript+Axios: Separate model and api classfiles and package (#2005)

* Typescript 3.2

* Typescript spread operator

* Add vendor extension to the operation

* Remove url.URLSearchParams

* Generate form data in API

* Make axios scripts executable

* Reran generator

* Generate sample code

* Codegen having the model and api extra flag

* Revert to 2.4 Typescript

* COLLECTION_FORMAT.{{collectionFormat}} everywhere for consistency

* Consistency on the CollectionFormats, comment on the vendor extension

* Throw exception if api and model packages are not given

* Templates splitting api and models

* Post process the operations in the the process

* Beginning to get the axios tests up

* Ensure-up-to-date doesnt include TS/Axios tests

* Docs update for Typescript/Axios

* Merge master

* Api tests re-run

* Add windows bat file
This commit is contained in:
Michael van Niekerk 2019-03-05 10:44:33 +02:00 committed by William Cheng
parent cc1fe6eebf
commit caf404d857
47 changed files with 3768 additions and 1330 deletions

View File

@ -2,5 +2,6 @@
./bin/typescript-axios-petstore-target-es6.sh ./bin/typescript-axios-petstore-target-es6.sh
./bin/typescript-axios-petstore-with-npm-version.sh ./bin/typescript-axios-petstore-with-npm-version.sh
./bin/typescript-axios-petstore-with-npm-version-and-separate-models-and-api.sh
./bin/typescript-axios-petstore-interfaces.sh ./bin/typescript-axios-petstore-interfaces.sh
./bin/typescript-axios-petstore.sh ./bin/typescript-axios-petstore.sh

View File

@ -0,0 +1,9 @@
{
"npmName": "@swagger/typescript-axios-petstore",
"npmVersion": "1.0.0",
"npmRepository": "https://skimdb.npmjs.com/registry",
"snapshot": false,
"withSeparateModelsAndApi": true,
"modelPackage": "model.some.levels.deep",
"apiPackage": "api.another.level"
}

View File

@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -c bin/typescript-axios-petstore-with-npm-version-and-separate-models-and-api.json -o samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -31,6 +31,7 @@ declare -a scripts=("./bin/openapi3/ruby-client-petstore.sh"
"./bin/php-ze-ph-petstore-server.sh" "./bin/php-ze-ph-petstore-server.sh"
"./bin/openapi3/php-petstore.sh" "./bin/openapi3/php-petstore.sh"
"./bin/typescript-angular-petstore-all.sh" "./bin/typescript-angular-petstore-all.sh"
"./bin/typescript-axios-petstore-all.sh"
"./bin/typescript-fetch-petstore-all.sh" "./bin/typescript-fetch-petstore-all.sh"
"./bin/typescript-node-petstore-all.sh" "./bin/typescript-node-petstore-all.sh"
"./bin/typescript-inversify-petstore.sh" "./bin/typescript-inversify-petstore.sh"

View File

@ -0,0 +1,12 @@
@ECHO OFF
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
If Not Exist %executable% (
mvn clean package
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-axios -c bin\typescript-axios-petstore-with-npm-version-and-separate-models-and-api.json -o samples\client\petstore\typescript-axios\builds\with-npm-version-and-separate-models-and-api
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -18,3 +18,4 @@ sidebar_label: typescript-axios
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null| |npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|withSeparateModelsAndApi|Put the model and api in separate folders and in separate classes| |false|

View File

@ -20,6 +20,7 @@ package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.parser.util.SchemaTypeUtil; import io.swagger.v3.parser.util.SchemaTypeUtil;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenOperation;
@ -36,11 +37,14 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
public static final String NPM_REPOSITORY = "npmRepository"; public static final String NPM_REPOSITORY = "npmRepository";
public static final String SNAPSHOT = "snapshot"; public static final String SNAPSHOT = "snapshot";
public static final String WITH_INTERFACES = "withInterfaces"; public static final String WITH_INTERFACES = "withInterfaces";
public static final String SEPARATE_MODELS_AND_API = "withSeparateModelsAndApi";
protected String npmName = null; protected String npmName = null;
protected String npmVersion = "1.0.0"; protected String npmVersion = "1.0.0";
protected String npmRepository = null; protected String npmRepository = null;
private String tsModelPackage = "";
public TypeScriptAxiosClientCodegen() { public TypeScriptAxiosClientCodegen() {
super(); super();
@ -56,6 +60,7 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
this.cliOptions.add(new CliOption(SEPARATE_MODELS_AND_API, "Put the model and api in separate folders and in separate classes", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString()));
} }
@Override @Override
@ -92,19 +97,57 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
this.npmRepository = npmRepository; this.npmRepository = npmRepository;
} }
private static String getRelativeToRoot(String path) {
StringBuilder sb = new StringBuilder();
int slashCount = path.split("/").length;
if (slashCount == 0) {
sb.append("./");
} else {
for (int i = 0; i < slashCount; ++i) {
sb.append("../");
}
}
return sb.toString();
}
@Override @Override
public void processOpts() { public void processOpts() {
super.processOpts(); super.processOpts();
tsModelPackage = modelPackage.replaceAll("\\.", "/");
String tsApiPackage = apiPackage.replaceAll("\\.", "/");
String modelRelativeToRoot = getRelativeToRoot(tsModelPackage);
String apiRelativeToRoot = getRelativeToRoot(tsApiPackage);
additionalProperties.put("tsModelPackage", tsModelPackage);
additionalProperties.put("tsApiPackage", tsApiPackage);
additionalProperties.put("apiRelativeToRoot", apiRelativeToRoot);
additionalProperties.put("modelRelativeToRoot", modelRelativeToRoot);
supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts")); supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts"));
supportingFiles.add(new SupportingFile("baseApi.mustache", "", "base.ts"));
supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts")); supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts"));
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts")); supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts"));
supportingFiles.add(new SupportingFile("custom.d.mustache", "", "custom.d.ts")); supportingFiles.add(new SupportingFile("custom.d.mustache", "", "custom.d.ts"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
boolean separateModelsAndApi = (boolean)additionalProperties.getOrDefault(SEPARATE_MODELS_AND_API, false);
if (separateModelsAndApi) {
modelTemplateFiles.put("model.mustache", ".ts");
apiTemplateFiles.put("apiInner.mustache", ".ts");
supportingFiles.add(new SupportingFile("modelIndex.mustache", tsModelPackage, "index.ts"));
}
if (additionalProperties.containsKey(NPM_NAME)) { if (additionalProperties.containsKey(NPM_NAME)) {
addNpmPackageGeneration(); addNpmPackageGeneration();
} }
boolean emptyModelOrApi = separateModelsAndApi && StringUtils.isAnyBlank(modelPackage, apiPackage);
if (emptyModelOrApi) {
throw new RuntimeException("apiPackage and modelPackage must be defined");
}
} }
@Override @Override
@ -128,8 +171,8 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
@Override @Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
objs = super.postProcessOperationsWithModels(objs, allModels); objs = super.postProcessOperationsWithModels(objs, allModels);
Map<String, Object> vals = (Map<String, Object>) objs.get("operations"); Map<String, Object> vals = (Map<String, Object>) objs.getOrDefault("operations", new HashMap<>());
List<CodegenOperation> operations = (List<CodegenOperation>) vals.get("operation"); List<CodegenOperation> operations = (List<CodegenOperation>) vals.getOrDefault("operation", new ArrayList<>());
/* /*
Filter all the operations that are multipart/form-data operations and set the vendor extension flag Filter all the operations that are multipart/form-data operations and set the vendor extension flag
'multipartFormData' for the template to work with. 'multipartFormData' for the template to work with.
@ -147,6 +190,37 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege
addImport(codegenModel, codegenModel.additionalPropertiesType); addImport(codegenModel, codegenModel.additionalPropertiesType);
} }
@Override
@SuppressWarnings("unchecked")
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
Map<String, Object> ret = super.postProcessModels(objs);
// Deduce the model file name in kebab case
List<Map<String, Object>> models = (List<Map<String, Object>>) ret.get("models");
for (Map<String, Object> m : models) {
CodegenModel model = (CodegenModel) m.get("model");
model.classFilename = model.classname.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);
}
// Apply the model file name to the imports as well
for (Map<String, String> m : (List<Map<String, String>>) ret.get("imports")) {
String javaImport = m.get("import").substring(modelPackage.length() + 1);
String tsImport = tsModelPackage + "/" + javaImport;
m.put("tsImport", tsImport);
m.put("class", javaImport);
m.put("filename", javaImport.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT));
}
return ret;
}
@Override
public String toModelFilename(String name) {
return super.toModelFilename(name).replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);
}
@Override
public String toApiFilename(String name) {
return super.toApiFilename(name).replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);
}
private void addNpmPackageGeneration() { private void addNpmPackageGeneration() {
if (additionalProperties.containsKey(NPM_NAME)) { if (additionalProperties.containsKey(NPM_NAME)) {
this.setNpmName(additionalProperties.get(NPM_NAME).toString()); this.setNpmName(additionalProperties.get(NPM_NAME).toString());

View File

@ -2,352 +2,19 @@
/// <reference path="./custom.d.ts" /> /// <reference path="./custom.d.ts" />
{{>licenseInfo}} {{>licenseInfo}}
import * as url from "url"; {{^withSeparateModelsAndApi}}
import { Configuration } from "./configuration"; import * as url from 'url';
import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
{{#models}} {{#models}}
{{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}{{/model}} {{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}{{/model}}
{{/models}} {{/models}}
{{#apiInfo}}{{#apis}}{{#operations}} {{#apiInfo}}{{#apis}}
/** {{>apiInner}}
* {{classname}} - axios parameter creator{{#description}} {{/apis}}{{/apiInfo}}
* {{&description}}{{/description}} {{/withSeparateModelsAndApi}}{{#withSeparateModelsAndApi}}
* @export {{#apiInfo}}{{#apis}}{{#operations}}export * from './{{apiPackage}}/{{classFilename}}';
*/
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
return {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: any = {}): RequestArgs {
{{#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}}.');
}
{{/required}}
{{/allParams}}
const localVarPath = `{{{path}}}`{{#pathParams}}
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}FormData(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
{{#authMethods}}
// authentication {{name}} required
{{#isApiKey}}
{{#isKeyInHeader}}
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? configuration.apiKey("{{keyParamName}}")
: configuration.apiKey;
localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue;
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? configuration.apiKey("{{keyParamName}}")
: configuration.apiKey;
localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue;
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isBasic}}
// http basic authentication required
if (configuration && (configuration.username || configuration.password)) {
localVarHeaderParameter["Authorization"] = "Basic " + btoa(configuration.username + ":" + configuration.password);
}
{{/isBasic}}
{{#isOAuth}}
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
{{/isOAuth}}
{{/authMethods}}
{{#queryParams}}
{{#isListContainer}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
localVarQueryParameter['{{baseName}}'] = {{paramName}};
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
{{/isCollectionFormatMulti}}
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) {
{{#isDateTime}}
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString();
{{/isDateTime}}
{{^isDateTime}}
{{#isDate}}
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString();
{{/isDate}}
{{^isDate}}
localVarQueryParameter['{{baseName}}'] = {{paramName}};
{{/isDate}}
{{/isDateTime}}
}
{{/isListContainer}}
{{/queryParams}}
{{#headerParams}}
{{#isListContainer}}
if ({{paramName}}) {
localVarHeaderParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined && {{paramName}} !== null) {
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
}
{{/isListContainer}}
{{/headerParams}}
{{#vendorExtensions}}
{{#formParams}}
{{#isListContainer}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{paramName}}.forEach((element) => {
localVarFormParams.append('{{baseName}}', element as any);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}{{^multipartFormData}}
localVarFormParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}{{#multipartFormData}}
localVarFormParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}
{{/isCollectionFormatMulti}}
}{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) { {{^multipartFormData}}
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}
}
{{/isListContainer}}
{{/formParams}}{{/vendorExtensions}}
{{#hasFormParams}}{{#multipartFormData}}
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
{{/hasFormParams}}
{{#bodyParam}}
{{^consumes}}
localVarHeaderParameter['Content-Type'] = 'application/json';
{{/consumes}}
{{#consumes.0}}
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
{{/consumes.0}}
{{/bodyParam}}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
{{#hasFormParams}}
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
{{/hasFormParams}}
{{#bodyParam}}
const needsSerialization = (<any>"{{dataType}}" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify({{paramName}} || {}) : ({{paramName}} || "");
{{/bodyParam}}
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
{{/operation}}
}
};
/**
* {{classname}} - functional programming interface{{#description}}
* {{{description}}}{{/description}}
* @export
*/
export const {{classname}}Fp = function(configuration?: Configuration) {
return {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> {
const localVarAxiosArgs = {{classname}}AxiosParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
{{/operation}}
}
};
/**
* {{classname}} - factory interface{{#description}}
* {{&description}}{{/description}}
* @export
*/
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) {
return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(axios, basePath);
},
{{/operation}}
};
};
{{#withInterfaces}}
/**
* {{classname}} - interface{{#description}}
* {{&description}}{{/description}}
* @export
* @interface {{classname}}
*/
export interface {{classname}}Interface {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof {{classname}}Interface
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>;
{{/operation}}
}
{{/withInterfaces}}
/**
* {{classname}} - object-oriented interface{{#description}}
* {{{description}}}{{/description}}
* @export
* @class {{classname}}
* @extends {BaseAPI}
*/
{{#withInterfaces}}
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
{{/withInterfaces}}
{{^withInterfaces}}
export class {{classname}} extends BaseAPI {
{{/withInterfaces}}
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof {{classname}}
*/
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) {
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.axios, this.basePath);
}
{{/operation}}
}
{{/operations}}{{/apis}}{{/apiInfo}} {{/operations}}{{/apis}}{{/apiInfo}}
{{/withSeparateModelsAndApi}}

View File

@ -0,0 +1,305 @@
{{#withSeparateModelsAndApi}}
// tslint:disable
/// <reference path="{{apiRelativeToRoot}}custom.d.ts" />
{{>licenseInfo}}
import * as url from 'url';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { Configuration } from '{{apiRelativeToRoot}}configuration';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
{{#imports}}import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';
{{/imports}}
{{/withSeparateModelsAndApi}}
{{^withSeparateModelsAndApi}}
{{/withSeparateModelsAndApi}}
{{#operations}}
/**
* {{classname}} - axios parameter creator{{#description}}
* {{&description}}{{/description}}
* @export
*/
export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) {
return {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: any = {}): RequestArgs {
{{#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}}.');
}
{{/required}}
{{/allParams}}
const localVarPath = `{{{path}}}`{{#pathParams}}
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}}
const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}FormData(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}}
{{#authMethods}}
// authentication {{name}} required
{{#isApiKey}}
{{#isKeyInHeader}}
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? configuration.apiKey("{{keyParamName}}")
: configuration.apiKey;
localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue;
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? configuration.apiKey("{{keyParamName}}")
: configuration.apiKey;
localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue;
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isBasic}}
// http basic authentication required
if (configuration && (configuration.username || configuration.password)) {
localVarHeaderParameter["Authorization"] = "Basic " + btoa(configuration.username + ":" + configuration.password);
}
{{/isBasic}}
{{#isOAuth}}
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
{{/isOAuth}}
{{/authMethods}}
{{#queryParams}}
{{#isListContainer}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
localVarQueryParameter['{{baseName}}'] = {{paramName}};
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
{{/isCollectionFormatMulti}}
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) {
{{#isDateTime}}
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString();
{{/isDateTime}}
{{^isDateTime}}
{{#isDate}}
localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString();
{{/isDate}}
{{^isDate}}
localVarQueryParameter['{{baseName}}'] = {{paramName}};
{{/isDate}}
{{/isDateTime}}
}
{{/isListContainer}}
{{/queryParams}}
{{#headerParams}}
{{#isListContainer}}
if ({{paramName}}) {
localVarHeaderParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}});
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined && {{paramName}} !== null) {
localVarHeaderParameter['{{baseName}}'] = String({{paramName}});
}
{{/isListContainer}}
{{/headerParams}}
{{#vendorExtensions}}
{{#formParams}}
{{#isListContainer}}
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{paramName}}.forEach((element) => {
localVarFormParams.append('{{baseName}}', element as any);
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}{{^multipartFormData}}
localVarFormParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}{{#multipartFormData}}
localVarFormParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}
{{/isCollectionFormatMulti}}
}{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) { {{^multipartFormData}}
localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}
localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}
}
{{/isListContainer}}
{{/formParams}}{{/vendorExtensions}}
{{#hasFormParams}}{{#multipartFormData}}
localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}}
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}}
{{/hasFormParams}}
{{#bodyParam}}
{{^consumes}}
localVarHeaderParameter['Content-Type'] = 'application/json';
{{/consumes}}
{{#consumes.0}}
localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}';
{{/consumes.0}}
{{/bodyParam}}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
{{#hasFormParams}}
localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}};
{{/hasFormParams}}
{{#bodyParam}}
const needsSerialization = (<any>"{{dataType}}" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify({{paramName}} || {}) : ({{paramName}} || "");
{{/bodyParam}}
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
{{/operation}}
}
};
/**
* {{classname}} - functional programming interface{{#description}}
* {{{description}}}{{/description}}
* @export
*/
export const {{classname}}Fp = function(configuration?: Configuration) {
return {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> {
const localVarAxiosArgs = {{classname}}AxiosParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
{{/operation}}
}
};
/**
* {{classname}} - factory interface{{#description}}
* {{&description}}{{/description}}
* @export
*/
export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) {
return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(axios, basePath);
},
{{/operation}}
};
};
{{#withInterfaces}}
/**
* {{classname}} - interface{{#description}}
* {{&description}}{{/description}}
* @export
* @interface {{classname}}
*/
export interface {{classname}}Interface {
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof {{classname}}Interface
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>;
{{/operation}}
}
{{/withInterfaces}}
/**
* {{classname}} - object-oriented interface{{#description}}
* {{{description}}}{{/description}}
* @export
* @class {{classname}}
* @extends {BaseAPI}
*/
{{#withInterfaces}}
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
{{/withInterfaces}}
{{^withInterfaces}}
export class {{classname}} extends BaseAPI {
{{/withInterfaces}}
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof {{classname}}
*/
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) {
return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.axios, this.basePath);
}
{{/operation}}
}
{{/operations}}

View File

@ -0,0 +1,58 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
{{>licenseInfo}}
import { Configuration } from "./configuration";
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View File

@ -0,0 +1,9 @@
// tslint:disable
/// <reference path="{{modelRelativeToRoot}}custom.d.ts" />
{{>licenseInfo}}
{{#withSeparateModelsAndApi}}{{#imports}}
import { {{class}} } from './{{filename}}';{{/imports}}{{/withSeparateModelsAndApi}}
{{#models}}{{#model}}
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}
{{/model}}{{/models}}

View File

@ -0,0 +1,2 @@
{{#models}}{{#model}}export * from './{{classFilename}}';{{/model}}
{{/models}}

View File

@ -13,61 +13,10 @@
*/ */
import * as url from "url"; import * as url from 'url';
import { Configuration } from "./configuration"; import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
/** /**
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
@ -321,14 +270,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options: any = {}): RequestArgs { addPet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -357,7 +306,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -549,14 +498,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options: any = {}): RequestArgs { updatePet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -585,7 +534,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -716,15 +665,15 @@ export const PetApiFp = function(configuration?: Configuration) {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { addPet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -739,7 +688,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -753,7 +702,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -767,7 +716,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -781,21 +730,21 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updatePet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -811,7 +760,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -827,7 +776,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -842,12 +791,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any) { addPet(body: Pet, options?: any) {
return PetApiFp(configuration).addPet(pet, options)(axios, basePath); return PetApiFp(configuration).addPet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -893,12 +842,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any) { updatePet(body: Pet, options?: any) {
return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); return PetApiFp(configuration).updatePet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -937,13 +886,13 @@ export class PetApi extends BaseAPI {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public addPet(pet: Pet, options?: any) { public addPet(body: Pet, options?: any) {
return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).addPet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -998,13 +947,13 @@ export class PetApi extends BaseAPI {
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public updatePet(pet: Pet, options?: any) { public updatePet(body: Pet, options?: any) {
return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).updatePet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1037,6 +986,7 @@ export class PetApi extends BaseAPI {
} }
/** /**
* StoreApi - axios parameter creator * StoreApi - axios parameter creator
* @export * @export
@ -1150,14 +1100,14 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options: any = {}): RequestArgs { placeOrder(body: Order, options: any = {}): RequestArgs {
// verify required parameter 'order' is not null or undefined // verify required parameter 'body' is not null or undefined
if (order === null || order === undefined) { if (body === null || body === undefined) {
throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
} }
const localVarPath = `/store/order`; const localVarPath = `/store/order`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1177,7 +1127,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1204,7 +1154,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1217,7 +1167,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1231,21 +1181,21 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> { placeOrder(body: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1289,12 +1239,12 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any) { placeOrder(body: Order, options?: any) {
return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); return StoreApiFp(configuration).placeOrder(body, options)(axios, basePath);
}, },
}; };
}; };
@ -1344,17 +1294,18 @@ export class StoreApi extends BaseAPI {
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof StoreApi * @memberof StoreApi
*/ */
public placeOrder(order: Order, options?: any) { public placeOrder(body: Order, options?: any) {
return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); return StoreApiFp(this.configuration).placeOrder(body, options)(this.axios, this.basePath);
} }
} }
/** /**
* UserApi - axios parameter creator * UserApi - axios parameter creator
* @export * @export
@ -1364,14 +1315,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options: any = {}): RequestArgs { createUser(body: User, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
} }
const localVarPath = `/user`; const localVarPath = `/user`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1391,7 +1342,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1401,14 +1352,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithArrayInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.');
} }
const localVarPath = `/user/createWithArray`; const localVarPath = `/user/createWithArray`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1428,7 +1379,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1438,14 +1389,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithListInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.');
} }
const localVarPath = `/user/createWithList`; const localVarPath = `/user/createWithList`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1465,7 +1416,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1618,18 +1569,18 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options: any = {}): RequestArgs { updateUser(username: string, body: User, options: any = {}): RequestArgs {
// verify required parameter 'username' is not null or undefined // verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.');
} }
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
} }
const localVarPath = `/user/{username}` const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username))); .replace(`{${"username"}}`, encodeURIComponent(String(username)));
@ -1650,7 +1601,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1669,43 +1620,43 @@ export const UserApiFp = function(configuration?: Configuration) {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUser(body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithArrayInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithListInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1719,7 +1670,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1733,7 +1684,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1748,7 +1699,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1761,22 +1712,22 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updateUser(username: string, body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1791,32 +1742,32 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any) { createUser(body: User, options?: any) {
return UserApiFp(configuration).createUser(user, options)(axios, basePath); return UserApiFp(configuration).createUser(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any) { createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithArrayInput(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any) { createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithListInput(body, options)(axios, basePath);
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -1862,12 +1813,12 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any) { updateUser(username: string, body: User, options?: any) {
return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); return UserApiFp(configuration).updateUser(username, body, options)(axios, basePath);
}, },
}; };
}; };
@ -1882,37 +1833,37 @@ export class UserApi extends BaseAPI {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUser(user: User, options?: any) { public createUser(body: User, options?: any) {
return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUser(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithArrayInput(user: Array<User>, options?: any) { public createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithListInput(user: Array<User>, options?: any) { public createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithListInput(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1967,14 +1918,15 @@ export class UserApi extends BaseAPI {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public updateUser(username: string, user: User, options?: any) { public updateUser(username: string, body: User, options?: any) {
return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).updateUser(username, body, options)(this.axios, this.basePath);
} }
} }

View File

@ -0,0 +1,69 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View File

@ -13,61 +13,10 @@
*/ */
import * as url from "url"; import * as url from 'url';
import { Configuration } from "./configuration"; import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
/** /**
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
@ -321,14 +270,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options: any = {}): RequestArgs { addPet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -357,7 +306,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -549,14 +498,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options: any = {}): RequestArgs { updatePet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -585,7 +534,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -716,15 +665,15 @@ export const PetApiFp = function(configuration?: Configuration) {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { addPet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -739,7 +688,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -753,7 +702,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -767,7 +716,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -781,21 +730,21 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updatePet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -811,7 +760,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -827,7 +776,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -842,12 +791,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any) { addPet(body: Pet, options?: any) {
return PetApiFp(configuration).addPet(pet, options)(axios, basePath); return PetApiFp(configuration).addPet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -893,12 +842,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any) { updatePet(body: Pet, options?: any) {
return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); return PetApiFp(configuration).updatePet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -937,13 +886,13 @@ export class PetApi extends BaseAPI {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public addPet(pet: Pet, options?: any) { public addPet(body: Pet, options?: any) {
return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).addPet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -998,13 +947,13 @@ export class PetApi extends BaseAPI {
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public updatePet(pet: Pet, options?: any) { public updatePet(body: Pet, options?: any) {
return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).updatePet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1037,6 +986,7 @@ export class PetApi extends BaseAPI {
} }
/** /**
* StoreApi - axios parameter creator * StoreApi - axios parameter creator
* @export * @export
@ -1150,14 +1100,14 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options: any = {}): RequestArgs { placeOrder(body: Order, options: any = {}): RequestArgs {
// verify required parameter 'order' is not null or undefined // verify required parameter 'body' is not null or undefined
if (order === null || order === undefined) { if (body === null || body === undefined) {
throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
} }
const localVarPath = `/store/order`; const localVarPath = `/store/order`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1177,7 +1127,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1204,7 +1154,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1217,7 +1167,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1231,21 +1181,21 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> { placeOrder(body: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1289,12 +1239,12 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any) { placeOrder(body: Order, options?: any) {
return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); return StoreApiFp(configuration).placeOrder(body, options)(axios, basePath);
}, },
}; };
}; };
@ -1344,17 +1294,18 @@ export class StoreApi extends BaseAPI {
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof StoreApi * @memberof StoreApi
*/ */
public placeOrder(order: Order, options?: any) { public placeOrder(body: Order, options?: any) {
return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); return StoreApiFp(this.configuration).placeOrder(body, options)(this.axios, this.basePath);
} }
} }
/** /**
* UserApi - axios parameter creator * UserApi - axios parameter creator
* @export * @export
@ -1364,14 +1315,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options: any = {}): RequestArgs { createUser(body: User, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
} }
const localVarPath = `/user`; const localVarPath = `/user`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1391,7 +1342,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1401,14 +1352,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithArrayInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.');
} }
const localVarPath = `/user/createWithArray`; const localVarPath = `/user/createWithArray`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1428,7 +1379,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1438,14 +1389,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithListInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.');
} }
const localVarPath = `/user/createWithList`; const localVarPath = `/user/createWithList`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1465,7 +1416,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1618,18 +1569,18 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options: any = {}): RequestArgs { updateUser(username: string, body: User, options: any = {}): RequestArgs {
// verify required parameter 'username' is not null or undefined // verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.');
} }
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
} }
const localVarPath = `/user/{username}` const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username))); .replace(`{${"username"}}`, encodeURIComponent(String(username)));
@ -1650,7 +1601,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1669,43 +1620,43 @@ export const UserApiFp = function(configuration?: Configuration) {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUser(body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithArrayInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithListInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1719,7 +1670,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1733,7 +1684,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1748,7 +1699,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1761,22 +1712,22 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updateUser(username: string, body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1791,32 +1742,32 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any) { createUser(body: User, options?: any) {
return UserApiFp(configuration).createUser(user, options)(axios, basePath); return UserApiFp(configuration).createUser(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any) { createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithArrayInput(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any) { createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithListInput(body, options)(axios, basePath);
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -1862,12 +1813,12 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any) { updateUser(username: string, body: User, options?: any) {
return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); return UserApiFp(configuration).updateUser(username, body, options)(axios, basePath);
}, },
}; };
}; };
@ -1882,37 +1833,37 @@ export class UserApi extends BaseAPI {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUser(user: User, options?: any) { public createUser(body: User, options?: any) {
return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUser(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithArrayInput(user: Array<User>, options?: any) { public createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithListInput(user: Array<User>, options?: any) { public createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithListInput(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1967,14 +1918,15 @@ export class UserApi extends BaseAPI {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public updateUser(username: string, user: User, options?: any) { public updateUser(username: string, body: User, options?: any) {
return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).updateUser(username, body, options)(this.axios, this.basePath);
} }
} }

View File

@ -0,0 +1,69 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View File

@ -13,61 +13,10 @@
*/ */
import * as url from "url"; import * as url from 'url';
import { Configuration } from "./configuration"; import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
/** /**
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
@ -321,14 +270,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options: any = {}): RequestArgs { addPet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -357,7 +306,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -549,14 +498,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options: any = {}): RequestArgs { updatePet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -585,7 +534,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -716,15 +665,15 @@ export const PetApiFp = function(configuration?: Configuration) {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { addPet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -739,7 +688,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -753,7 +702,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -767,7 +716,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -781,21 +730,21 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updatePet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -811,7 +760,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -827,7 +776,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -842,12 +791,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any) { addPet(body: Pet, options?: any) {
return PetApiFp(configuration).addPet(pet, options)(axios, basePath); return PetApiFp(configuration).addPet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -893,12 +842,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any) { updatePet(body: Pet, options?: any) {
return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); return PetApiFp(configuration).updatePet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -936,12 +885,12 @@ export interface PetApiInterface {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApiInterface * @memberof PetApiInterface
*/ */
addPet(pet: Pet, options?: any): AxiosPromise<{}>; addPet(body: Pet, options?: any): AxiosPromise<{}>;
/** /**
* *
@ -987,12 +936,12 @@ export interface PetApiInterface {
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApiInterface * @memberof PetApiInterface
*/ */
updatePet(pet: Pet, options?: any): AxiosPromise<{}>; updatePet(body: Pet, options?: any): AxiosPromise<{}>;
/** /**
* *
@ -1030,13 +979,13 @@ export class PetApi extends BaseAPI implements PetApiInterface {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public addPet(pet: Pet, options?: any) { public addPet(body: Pet, options?: any) {
return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).addPet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1091,13 +1040,13 @@ export class PetApi extends BaseAPI implements PetApiInterface {
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public updatePet(pet: Pet, options?: any) { public updatePet(body: Pet, options?: any) {
return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).updatePet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1130,6 +1079,7 @@ export class PetApi extends BaseAPI implements PetApiInterface {
} }
/** /**
* StoreApi - axios parameter creator * StoreApi - axios parameter creator
* @export * @export
@ -1243,14 +1193,14 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options: any = {}): RequestArgs { placeOrder(body: Order, options: any = {}): RequestArgs {
// verify required parameter 'order' is not null or undefined // verify required parameter 'body' is not null or undefined
if (order === null || order === undefined) { if (body === null || body === undefined) {
throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
} }
const localVarPath = `/store/order`; const localVarPath = `/store/order`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1270,7 +1220,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1297,7 +1247,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1310,7 +1260,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1324,21 +1274,21 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> { placeOrder(body: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1382,12 +1332,12 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any) { placeOrder(body: Order, options?: any) {
return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); return StoreApiFp(configuration).placeOrder(body, options)(axios, basePath);
}, },
}; };
}; };
@ -1430,12 +1380,12 @@ export interface StoreApiInterface {
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof StoreApiInterface * @memberof StoreApiInterface
*/ */
placeOrder(order: Order, options?: any): AxiosPromise<Order>; placeOrder(body: Order, options?: any): AxiosPromise<Order>;
} }
@ -1484,17 +1434,18 @@ export class StoreApi extends BaseAPI implements StoreApiInterface {
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof StoreApi * @memberof StoreApi
*/ */
public placeOrder(order: Order, options?: any) { public placeOrder(body: Order, options?: any) {
return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); return StoreApiFp(this.configuration).placeOrder(body, options)(this.axios, this.basePath);
} }
} }
/** /**
* UserApi - axios parameter creator * UserApi - axios parameter creator
* @export * @export
@ -1504,14 +1455,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options: any = {}): RequestArgs { createUser(body: User, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
} }
const localVarPath = `/user`; const localVarPath = `/user`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1531,7 +1482,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1541,14 +1492,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithArrayInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.');
} }
const localVarPath = `/user/createWithArray`; const localVarPath = `/user/createWithArray`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1568,7 +1519,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1578,14 +1529,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithListInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.');
} }
const localVarPath = `/user/createWithList`; const localVarPath = `/user/createWithList`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1605,7 +1556,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1758,18 +1709,18 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options: any = {}): RequestArgs { updateUser(username: string, body: User, options: any = {}): RequestArgs {
// verify required parameter 'username' is not null or undefined // verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.');
} }
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
} }
const localVarPath = `/user/{username}` const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username))); .replace(`{${"username"}}`, encodeURIComponent(String(username)));
@ -1790,7 +1741,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1809,43 +1760,43 @@ export const UserApiFp = function(configuration?: Configuration) {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUser(body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithArrayInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithListInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1859,7 +1810,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1873,7 +1824,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1888,7 +1839,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1901,22 +1852,22 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updateUser(username: string, body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1931,32 +1882,32 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any) { createUser(body: User, options?: any) {
return UserApiFp(configuration).createUser(user, options)(axios, basePath); return UserApiFp(configuration).createUser(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any) { createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithArrayInput(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any) { createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithListInput(body, options)(axios, basePath);
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -2002,12 +1953,12 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any) { updateUser(username: string, body: User, options?: any) {
return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); return UserApiFp(configuration).updateUser(username, body, options)(axios, basePath);
}, },
}; };
}; };
@ -2021,32 +1972,32 @@ export interface UserApiInterface {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApiInterface * @memberof UserApiInterface
*/ */
createUser(user: User, options?: any): AxiosPromise<{}>; createUser(body: User, options?: any): AxiosPromise<{}>;
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApiInterface * @memberof UserApiInterface
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any): AxiosPromise<{}>; createUsersWithArrayInput(body: Array<User>, options?: any): AxiosPromise<{}>;
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApiInterface * @memberof UserApiInterface
*/ */
createUsersWithListInput(user: Array<User>, options?: any): AxiosPromise<{}>; createUsersWithListInput(body: Array<User>, options?: any): AxiosPromise<{}>;
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -2092,12 +2043,12 @@ export interface UserApiInterface {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApiInterface * @memberof UserApiInterface
*/ */
updateUser(username: string, user: User, options?: any): AxiosPromise<{}>; updateUser(username: string, body: User, options?: any): AxiosPromise<{}>;
} }
@ -2111,37 +2062,37 @@ export class UserApi extends BaseAPI implements UserApiInterface {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUser(user: User, options?: any) { public createUser(body: User, options?: any) {
return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUser(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithArrayInput(user: Array<User>, options?: any) { public createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithListInput(user: Array<User>, options?: any) { public createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithListInput(body, options)(this.axios, this.basePath);
} }
/** /**
@ -2196,14 +2147,15 @@ export class UserApi extends BaseAPI implements UserApiInterface {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public updateUser(username: string, user: User, options?: any) { public updateUser(username: string, body: User, options?: any) {
return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).updateUser(username, body, options)(this.axios, this.basePath);
} }
} }

View File

@ -0,0 +1,69 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View File

@ -0,0 +1,3 @@
wwwroot/*.js
node_modules
typings

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,45 @@
## @swagger/typescript-axios-petstore@1.0.0
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
Environment
* Node.js
* Webpack
* Browserify
Language level
* ES5 - you must have a Promises/A+ library installed
* ES6
Module system
* CommonJS
* ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
### Building
To build and compile the typescript sources to javascript use:
```
npm install
npm run build
```
### Publishing
First build the package then run ```npm publish```
### Consuming
navigate to the folder of your consuming project and run one of the following commands.
_published:_
```
npm install @swagger/typescript-axios-petstore@1.0.0 --save
```
_unPublished (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save

View File

@ -0,0 +1,20 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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.
*/
export * from './api.another.level/pet-api';
export * from './api.another.level/store-api';
export * from './api.another.level/user-api';

View File

@ -0,0 +1,746 @@
// tslint:disable
/// <reference path="../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 * as url from 'url';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { Configuration } from '../../../configuration';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
import { ApiResponse } from '../../../model/some/levels/deep';
import { Pet } from '../../../model/some/levels/deep';
/**
* PetApi - axios parameter creator
* @export
*/
export const PetApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Add a new pet to the store
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addPet(body: Pet, options: any = {}): 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.');
}
const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Deletes a pet
* @param {number} petId Pet id to delete
* @param {string} [apiKey]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deletePet(petId: number, apiKey?: string, options: any = {}): 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.');
}
const localVarPath = `/pet/{petId}`
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
if (apiKey !== undefined && apiKey !== null) {
localVarHeaderParameter['api_key'] = String(apiKey);
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): 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.');
}
const localVarPath = `/pet/findByStatus`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
if (status) {
localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv);
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param {Array<string>} tags Tags to filter by
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByTags(tags: Array<string>, options: any = {}): 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.');
}
const localVarPath = `/pet/findByTags`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
if (tags) {
localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv);
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns a single pet
* @summary Find pet by ID
* @param {number} petId ID of pet to return
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPetById(petId: number, options: any = {}): 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.');
}
const localVarPath = `/pet/{petId}`
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? configuration.apiKey("api_key")
: configuration.apiKey;
localVarHeaderParameter["api_key"] = localVarApiKeyValue;
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Update an existing pet
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updatePet(body: Pet, options: any = {}): 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.');
}
const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Updates a pet in the store with form data
* @param {number} petId ID of pet that needs to be updated
* @param {string} [name] Updated name of the pet
* @param {string} [status] Updated status of the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updatePetWithForm(petId: number, name?: string, status?: string, options: any = {}): 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.');
}
const localVarPath = `/pet/{petId}`
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const localVarFormParams = new URLSearchParams();
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
if (name !== undefined) {
localVarFormParams.set('name', name as any);
}
if (status !== undefined) {
localVarFormParams.set('status', status as any);
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
localVarRequestOptions.data = localVarFormParams.toString();
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary uploads an image
* @param {number} petId ID of pet to update
* @param {string} [additionalMetadata] Additional data to pass to server
* @param {any} [file] file to upload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
uploadFile(petId: number, additionalMetadata?: string, file?: any, options: any = {}): 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.');
}
const localVarPath = `/pet/{petId}/uploadImage`
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
const localVarFormParams = new FormData();
// authentication petstore_auth required
// oauth required
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"])
: configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
if (additionalMetadata !== undefined) {
localVarFormParams.append('additionalMetadata', additionalMetadata as any);
}
if (file !== undefined) {
localVarFormParams.append('file', file as any);
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
localVarRequestOptions.data = localVarFormParams;
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* PetApi - functional programming interface
* @export
*/
export const PetApiFp = function(configuration?: Configuration) {
return {
/**
*
* @summary Add a new pet to the store
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addPet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Deletes a pet
* @param {number} petId Pet id to delete
* @param {string} [apiKey]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deletePet(petId: number, apiKey?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param {Array<string>} tags Tags to filter by
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByTags(tags: Array<string>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Pet>> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* Returns a single pet
* @summary Find pet by ID
* @param {number} petId ID of pet to return
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPetById(petId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Pet> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Update an existing pet
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updatePet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Updates a pet in the store with form data
* @param {number} petId ID of pet that needs to be updated
* @param {string} [name] Updated name of the pet
* @param {string} [status] Updated status of the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary uploads an image
* @param {number} petId ID of pet to update
* @param {string} [additionalMetadata] Additional data to pass to server
* @param {any} [file] file to upload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponse> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* PetApi - factory interface
* @export
*/
export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
*
* @summary Add a new pet to the store
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addPet(body: Pet, options?: any) {
return PetApiFp(configuration).addPet(body, options)(axios, basePath);
},
/**
*
* @summary Deletes a pet
* @param {number} petId Pet id to delete
* @param {string} [apiKey]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deletePet(petId: number, apiKey?: string, options?: any) {
return PetApiFp(configuration).deletePet(petId, apiKey, options)(axios, basePath);
},
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) {
return PetApiFp(configuration).findPetsByStatus(status, options)(axios, basePath);
},
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param {Array<string>} tags Tags to filter by
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findPetsByTags(tags: Array<string>, options?: any) {
return PetApiFp(configuration).findPetsByTags(tags, options)(axios, basePath);
},
/**
* Returns a single pet
* @summary Find pet by ID
* @param {number} petId ID of pet to return
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPetById(petId: number, options?: any) {
return PetApiFp(configuration).getPetById(petId, options)(axios, basePath);
},
/**
*
* @summary Update an existing pet
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updatePet(body: Pet, options?: any) {
return PetApiFp(configuration).updatePet(body, options)(axios, basePath);
},
/**
*
* @summary Updates a pet in the store with form data
* @param {number} petId ID of pet that needs to be updated
* @param {string} [name] Updated name of the pet
* @param {string} [status] Updated status of the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updatePetWithForm(petId: number, name?: string, status?: string, options?: any) {
return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(axios, basePath);
},
/**
*
* @summary uploads an image
* @param {number} petId ID of pet to update
* @param {string} [additionalMetadata] Additional data to pass to server
* @param {any} [file] file to upload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) {
return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(axios, basePath);
},
};
};
/**
* PetApi - object-oriented interface
* @export
* @class PetApi
* @extends {BaseAPI}
*/
export class PetApi extends BaseAPI {
/**
*
* @summary Add a new pet to the store
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public addPet(body: Pet, options?: any) {
return PetApiFp(this.configuration).addPet(body, options)(this.axios, this.basePath);
}
/**
*
* @summary Deletes a pet
* @param {number} petId Pet id to delete
* @param {string} [apiKey]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public deletePet(petId: number, apiKey?: string, options?: any) {
return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.axios, this.basePath);
}
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) {
return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.axios, this.basePath);
}
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param {Array<string>} tags Tags to filter by
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public findPetsByTags(tags: Array<string>, options?: any) {
return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.axios, this.basePath);
}
/**
* Returns a single pet
* @summary Find pet by ID
* @param {number} petId ID of pet to return
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public getPetById(petId: number, options?: any) {
return PetApiFp(this.configuration).getPetById(petId, options)(this.axios, this.basePath);
}
/**
*
* @summary Update an existing pet
* @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public updatePet(body: Pet, options?: any) {
return PetApiFp(this.configuration).updatePet(body, options)(this.axios, this.basePath);
}
/**
*
* @summary Updates a pet in the store with form data
* @param {number} petId ID of pet that needs to be updated
* @param {string} [name] Updated name of the pet
* @param {string} [status] Updated status of the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) {
return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.axios, this.basePath);
}
/**
*
* @summary uploads an image
* @param {number} petId ID of pet to update
* @param {string} [additionalMetadata] Additional data to pass to server
* @param {any} [file] file to upload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PetApi
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) {
return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.axios, this.basePath);
}
}

View File

@ -0,0 +1,338 @@
// tslint:disable
/// <reference path="../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 * as url from 'url';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { Configuration } from '../../../configuration';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
import { Order } from '../../../model/some/levels/deep';
/**
* StoreApi - axios parameter creator
* @export
*/
export const StoreApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
* @param {string} orderId ID of the order that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrder(orderId: string, options: any = {}): 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.');
}
const localVarPath = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getInventory(options: any = {}): RequestArgs {
const localVarPath = `/store/inventory`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_key required
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? configuration.apiKey("api_key")
: configuration.apiKey;
localVarHeaderParameter["api_key"] = localVarApiKeyValue;
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @summary Find purchase order by ID
* @param {number} orderId ID of pet that needs to be fetched
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getOrderById(orderId: number, options: any = {}): 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.');
}
const localVarPath = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Place an order for a pet
* @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
placeOrder(body: Order, options: any = {}): 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.');
}
const localVarPath = `/store/order`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* StoreApi - functional programming interface
* @export
*/
export const StoreApiFp = function(configuration?: Configuration) {
return {
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
* @param {string} orderId ID of the order that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrder(orderId: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getInventory(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @summary Find purchase order by ID
* @param {number} orderId ID of pet that needs to be fetched
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getOrderById(orderId: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Place an order for a pet
* @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
placeOrder(body: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* StoreApi - factory interface
* @export
*/
export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
* @param {string} orderId ID of the order that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrder(orderId: string, options?: any) {
return StoreApiFp(configuration).deleteOrder(orderId, options)(axios, basePath);
},
/**
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getInventory(options?: any) {
return StoreApiFp(configuration).getInventory(options)(axios, basePath);
},
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @summary Find purchase order by ID
* @param {number} orderId ID of pet that needs to be fetched
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getOrderById(orderId: number, options?: any) {
return StoreApiFp(configuration).getOrderById(orderId, options)(axios, basePath);
},
/**
*
* @summary Place an order for a pet
* @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
placeOrder(body: Order, options?: any) {
return StoreApiFp(configuration).placeOrder(body, options)(axios, basePath);
},
};
};
/**
* StoreApi - object-oriented interface
* @export
* @class StoreApi
* @extends {BaseAPI}
*/
export class StoreApi extends BaseAPI {
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
* @param {string} orderId ID of the order that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StoreApi
*/
public deleteOrder(orderId: string, options?: any) {
return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.axios, this.basePath);
}
/**
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StoreApi
*/
public getInventory(options?: any) {
return StoreApiFp(this.configuration).getInventory(options)(this.axios, this.basePath);
}
/**
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @summary Find purchase order by ID
* @param {number} orderId ID of pet that needs to be fetched
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StoreApi
*/
public getOrderById(orderId: number, options?: any) {
return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.axios, this.basePath);
}
/**
*
* @summary Place an order for a pet
* @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StoreApi
*/
public placeOrder(body: Order, options?: any) {
return StoreApiFp(this.configuration).placeOrder(body, options)(this.axios, this.basePath);
}
}

View File

@ -0,0 +1,643 @@
// tslint:disable
/// <reference path="../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 * as url from 'url';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { Configuration } from '../../../configuration';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../../../base';
import { User } from '../../../model/some/levels/deep';
/**
* UserApi - axios parameter creator
* @export
*/
export const UserApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* This can only be done by the logged in user.
* @summary Create user
* @param {User} body Created user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUser(body: User, options: any = {}): 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.');
}
const localVarPath = `/user`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUsersWithArrayInput(body: Array<User>, options: any = {}): 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.');
}
const localVarPath = `/user/createWithArray`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUsersWithListInput(body: Array<User>, options: any = {}): 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.');
}
const localVarPath = `/user/createWithList`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* This can only be done by the logged in user.
* @summary Delete user
* @param {string} username The name that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUser(username: string, options: any = {}): 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.');
}
const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get user by user name
* @param {string} username The name that needs to be fetched. Use user1 for testing.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getUserByName(username: string, options: any = {}): 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.');
}
const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Logs user into the system
* @param {string} username The user name for login
* @param {string} password The password for login in clear text
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
loginUser(username: string, password: string, options: any = {}): 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.');
}
// 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.');
}
const localVarPath = `/user/login`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
if (username !== undefined) {
localVarQueryParameter['username'] = username;
}
if (password !== undefined) {
localVarQueryParameter['password'] = password;
}
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Logs out current logged in user session
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
logoutUser(options: any = {}): RequestArgs {
const localVarPath = `/user/logout`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* This can only be done by the logged in user.
* @summary Updated user
* @param {string} username name that need to be deleted
* @param {User} body Updated user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateUser(username: string, body: User, options: any = {}): 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.');
}
// 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.');
}
const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* UserApi - functional programming interface
* @export
*/
export const UserApiFp = function(configuration?: Configuration) {
return {
/**
* This can only be done by the logged in user.
* @summary Create user
* @param {User} body Created user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUser(body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUsersWithArrayInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUsersWithListInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* This can only be done by the logged in user.
* @summary Delete user
* @param {string} username The name that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUser(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Get user by user name
* @param {string} username The name that needs to be fetched. Use user1 for testing.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getUserByName(username: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<User> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Logs user into the system
* @param {string} username The user name for login
* @param {string} password The password for login in clear text
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
loginUser(username: string, password: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<string> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Logs out current logged in user session
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
logoutUser(options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* This can only be done by the logged in user.
* @summary Updated user
* @param {string} username name that need to be deleted
* @param {User} body Updated user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateUser(username: string, body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* UserApi - factory interface
* @export
*/
export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* This can only be done by the logged in user.
* @summary Create user
* @param {User} body Created user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUser(body: User, options?: any) {
return UserApiFp(configuration).createUser(body, options)(axios, basePath);
},
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithArrayInput(body, options)(axios, basePath);
},
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithListInput(body, options)(axios, basePath);
},
/**
* This can only be done by the logged in user.
* @summary Delete user
* @param {string} username The name that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUser(username: string, options?: any) {
return UserApiFp(configuration).deleteUser(username, options)(axios, basePath);
},
/**
*
* @summary Get user by user name
* @param {string} username The name that needs to be fetched. Use user1 for testing.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getUserByName(username: string, options?: any) {
return UserApiFp(configuration).getUserByName(username, options)(axios, basePath);
},
/**
*
* @summary Logs user into the system
* @param {string} username The user name for login
* @param {string} password The password for login in clear text
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
loginUser(username: string, password: string, options?: any) {
return UserApiFp(configuration).loginUser(username, password, options)(axios, basePath);
},
/**
*
* @summary Logs out current logged in user session
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
logoutUser(options?: any) {
return UserApiFp(configuration).logoutUser(options)(axios, basePath);
},
/**
* This can only be done by the logged in user.
* @summary Updated user
* @param {string} username name that need to be deleted
* @param {User} body Updated user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateUser(username: string, body: User, options?: any) {
return UserApiFp(configuration).updateUser(username, body, options)(axios, basePath);
},
};
};
/**
* UserApi - object-oriented interface
* @export
* @class UserApi
* @extends {BaseAPI}
*/
export class UserApi extends BaseAPI {
/**
* This can only be done by the logged in user.
* @summary Create user
* @param {User} body Created user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public createUser(body: User, options?: any) {
return UserApiFp(this.configuration).createUser(body, options)(this.axios, this.basePath);
}
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.axios, this.basePath);
}
/**
*
* @summary Creates list of users with given input array
* @param {Array<User>} body List of user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithListInput(body, options)(this.axios, this.basePath);
}
/**
* This can only be done by the logged in user.
* @summary Delete user
* @param {string} username The name that needs to be deleted
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public deleteUser(username: string, options?: any) {
return UserApiFp(this.configuration).deleteUser(username, options)(this.axios, this.basePath);
}
/**
*
* @summary Get user by user name
* @param {string} username The name that needs to be fetched. Use user1 for testing.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public getUserByName(username: string, options?: any) {
return UserApiFp(this.configuration).getUserByName(username, options)(this.axios, this.basePath);
}
/**
*
* @summary Logs user into the system
* @param {string} username The user name for login
* @param {string} password The password for login in clear text
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public loginUser(username: string, password: string, options?: any) {
return UserApiFp(this.configuration).loginUser(username, password, options)(this.axios, this.basePath);
}
/**
*
* @summary Logs out current logged in user session
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public logoutUser(options?: any) {
return UserApiFp(this.configuration).logoutUser(options)(this.axios, this.basePath);
}
/**
* This can only be done by the logged in user.
* @summary Updated user
* @param {string} username name that need to be deleted
* @param {User} body Updated user object
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof UserApi
*/
public updateUser(username: string, body: User, options?: any) {
return UserApiFp(this.configuration).updateUser(username, body, options)(this.axios, this.basePath);
}
}

View File

@ -0,0 +1,69 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View File

@ -0,0 +1,74 @@
// tslint: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.
*
* OpenAPI spec version: 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.
*/
export interface ConfigurationParameters {
apiKey?: string | ((name: string) => string);
username?: string;
password?: string;
accessToken?: string | ((name: string, scopes?: string[]) => string);
basePath?: string;
baseOptions?: any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | ((name: string) => string);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?: string | ((name: string, scopes?: string[]) => string);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* base options for axios calls
*
* @type {any}
* @memberof Configuration
*/
baseOptions?: any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
}
}

View File

@ -0,0 +1 @@
declare module 'url';

View File

@ -0,0 +1,51 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,16 @@
// tslint: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.
*
* OpenAPI spec version: 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.
*/
export * from "./api";
export * from "./configuration";

View File

@ -0,0 +1,44 @@
// tslint:disable
/// <reference path="../../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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.
*/
/**
* Describes the result of uploading an image resource
* @export
* @interface ApiResponse
*/
export interface ApiResponse {
/**
*
* @type {number}
* @memberof ApiResponse
*/
code?: number;
/**
*
* @type {string}
* @memberof ApiResponse
*/
type?: string;
/**
*
* @type {string}
* @memberof ApiResponse
*/
message?: string;
}

View File

@ -0,0 +1,38 @@
// tslint:disable
/// <reference path="../../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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.
*/
/**
* A category for a pet
* @export
* @interface Category
*/
export interface Category {
/**
*
* @type {number}
* @memberof Category
*/
id?: number;
/**
*
* @type {string}
* @memberof Category
*/
name?: string;
}

View File

@ -0,0 +1,6 @@
export * from './api-response';
export * from './category';
export * from './order';
export * from './pet';
export * from './tag';
export * from './user';

View File

@ -0,0 +1,78 @@
// tslint:disable
/// <reference path="../../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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.
*/
/**
* An order for a pets from the pet store
* @export
* @interface Order
*/
export interface Order {
/**
*
* @type {number}
* @memberof Order
*/
id?: number;
/**
*
* @type {number}
* @memberof Order
*/
petId?: number;
/**
*
* @type {number}
* @memberof Order
*/
quantity?: number;
/**
*
* @type {Date}
* @memberof Order
*/
shipDate?: Date;
/**
* Order Status
* @type {string}
* @memberof Order
*/
status?: Order.StatusEnum;
/**
*
* @type {boolean}
* @memberof Order
*/
complete?: boolean;
}
/**
* @export
* @namespace Order
*/
export namespace Order {
/**
* @export
* @enum {string}
*/
export enum StatusEnum {
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}

View File

@ -0,0 +1,80 @@
// tslint:disable
/// <reference path="../../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 { Category } from './category';
import { Tag } from './tag';
/**
* A pet for sale in the pet store
* @export
* @interface Pet
*/
export interface Pet {
/**
*
* @type {number}
* @memberof Pet
*/
id?: number;
/**
*
* @type {Category}
* @memberof Pet
*/
category?: Category;
/**
*
* @type {string}
* @memberof Pet
*/
name: string;
/**
*
* @type {Array<string>}
* @memberof Pet
*/
photoUrls: Array<string>;
/**
*
* @type {Array<Tag>}
* @memberof Pet
*/
tags?: Array<Tag>;
/**
* pet status in the store
* @type {string}
* @memberof Pet
*/
status?: Pet.StatusEnum;
}
/**
* @export
* @namespace Pet
*/
export namespace Pet {
/**
* @export
* @enum {string}
*/
export enum StatusEnum {
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

View File

@ -0,0 +1,38 @@
// tslint:disable
/// <reference path="../../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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.
*/
/**
* A tag for a pet
* @export
* @interface Tag
*/
export interface Tag {
/**
*
* @type {number}
* @memberof Tag
*/
id?: number;
/**
*
* @type {string}
* @memberof Tag
*/
name?: string;
}

View File

@ -0,0 +1,74 @@
// tslint:disable
/// <reference path="../../../../custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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.
*/
/**
* A User who is purchasing from the pet store
* @export
* @interface User
*/
export interface User {
/**
*
* @type {number}
* @memberof User
*/
id?: number;
/**
*
* @type {string}
* @memberof User
*/
username?: string;
/**
*
* @type {string}
* @memberof User
*/
firstName?: string;
/**
*
* @type {string}
* @memberof User
*/
lastName?: string;
/**
*
* @type {string}
* @memberof User
*/
email?: string;
/**
*
* @type {string}
* @memberof User
*/
password?: string;
/**
*
* @type {string}
* @memberof User
*/
phone?: string;
/**
* User Status
* @type {number}
* @memberof User
*/
userStatus?: number;
}

View File

@ -0,0 +1,32 @@
{
"name": "@swagger/typescript-axios-petstore",
"version": "1.0.0",
"description": "OpenAPI client for @swagger/typescript-axios-petstore",
"author": "OpenAPI-Generator Contributors",
"keywords": [
"axios",
"typescript",
"openapi-client",
"openapi-generator",
"@swagger/typescript-axios-petstore"
],
"license": "Unlicense",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts" : {
"build": "tsc --outDir dist/",
"prepublishOnly": "npm run build"
},
"dependencies": {
"axios": "^0.18.0"
},
"peerDependencies": {
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.4"
},
"publishConfig":{
"registry":"https://skimdb.npmjs.com/registry"
}
}

View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"declaration": true,
"target": "es5",
"module": "commonjs",
"noImplicitAny": true,
"outDir": "dist",
"rootDir": ".",
"lib": [
"es6",
"dom"
]
},
"exclude": [
"dist",
"node_modules"
]
}

View File

@ -13,61 +13,10 @@
*/ */
import * as url from "url"; import * as url from 'url';
import { Configuration } from "./configuration"; import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
/** /**
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
@ -321,14 +270,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options: any = {}): RequestArgs { addPet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -357,7 +306,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -549,14 +498,14 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options: any = {}): RequestArgs { updatePet(body: Pet, options: any = {}): RequestArgs {
// verify required parameter 'pet' is not null or undefined // verify required parameter 'body' is not null or undefined
if (pet === null || pet === undefined) { if (body === null || body === undefined) {
throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.');
} }
const localVarPath = `/pet`; const localVarPath = `/pet`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -585,7 +534,7 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -716,15 +665,15 @@ export const PetApiFp = function(configuration?: Configuration) {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { addPet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -739,7 +688,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -753,7 +702,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -767,7 +716,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -781,21 +730,21 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updatePet(body: Pet, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -811,7 +760,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -827,7 +776,7 @@ export const PetApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -842,12 +791,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
addPet(pet: Pet, options?: any) { addPet(body: Pet, options?: any) {
return PetApiFp(configuration).addPet(pet, options)(axios, basePath); return PetApiFp(configuration).addPet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -893,12 +842,12 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?:
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updatePet(pet: Pet, options?: any) { updatePet(body: Pet, options?: any) {
return PetApiFp(configuration).updatePet(pet, options)(axios, basePath); return PetApiFp(configuration).updatePet(body, options)(axios, basePath);
}, },
/** /**
* *
@ -937,13 +886,13 @@ export class PetApi extends BaseAPI {
/** /**
* *
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public addPet(pet: Pet, options?: any) { public addPet(body: Pet, options?: any) {
return PetApiFp(this.configuration).addPet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).addPet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -998,13 +947,13 @@ export class PetApi extends BaseAPI {
/** /**
* *
* @summary Update an existing pet * @summary Update an existing pet
* @param {Pet} pet Pet object that needs to be added to the store * @param {Pet} body Pet object that needs to be added to the store
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof PetApi * @memberof PetApi
*/ */
public updatePet(pet: Pet, options?: any) { public updatePet(body: Pet, options?: any) {
return PetApiFp(this.configuration).updatePet(pet, options)(this.axios, this.basePath); return PetApiFp(this.configuration).updatePet(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1037,6 +986,7 @@ export class PetApi extends BaseAPI {
} }
/** /**
* StoreApi - axios parameter creator * StoreApi - axios parameter creator
* @export * @export
@ -1150,14 +1100,14 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options: any = {}): RequestArgs { placeOrder(body: Order, options: any = {}): RequestArgs {
// verify required parameter 'order' is not null or undefined // verify required parameter 'body' is not null or undefined
if (order === null || order === undefined) { if (body === null || body === undefined) {
throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.');
} }
const localVarPath = `/store/order`; const localVarPath = `/store/order`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1177,7 +1127,7 @@ export const StoreApiAxiosParamCreator = function (configuration?: Configuration
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1204,7 +1154,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1217,7 +1167,7 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1231,21 +1181,21 @@ export const StoreApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> { placeOrder(body: Order, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Order> {
const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1289,12 +1239,12 @@ export const StoreApiFactory = function (configuration?: Configuration, basePath
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
placeOrder(order: Order, options?: any) { placeOrder(body: Order, options?: any) {
return StoreApiFp(configuration).placeOrder(order, options)(axios, basePath); return StoreApiFp(configuration).placeOrder(body, options)(axios, basePath);
}, },
}; };
}; };
@ -1344,17 +1294,18 @@ export class StoreApi extends BaseAPI {
/** /**
* *
* @summary Place an order for a pet * @summary Place an order for a pet
* @param {Order} order order placed for purchasing the pet * @param {Order} body order placed for purchasing the pet
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof StoreApi * @memberof StoreApi
*/ */
public placeOrder(order: Order, options?: any) { public placeOrder(body: Order, options?: any) {
return StoreApiFp(this.configuration).placeOrder(order, options)(this.axios, this.basePath); return StoreApiFp(this.configuration).placeOrder(body, options)(this.axios, this.basePath);
} }
} }
/** /**
* UserApi - axios parameter creator * UserApi - axios parameter creator
* @export * @export
@ -1364,14 +1315,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options: any = {}): RequestArgs { createUser(body: User, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.');
} }
const localVarPath = `/user`; const localVarPath = `/user`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1391,7 +1342,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1401,14 +1352,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithArrayInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.');
} }
const localVarPath = `/user/createWithArray`; const localVarPath = `/user/createWithArray`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1428,7 +1379,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1438,14 +1389,14 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options: any = {}): RequestArgs { createUsersWithListInput(body: Array<User>, options: any = {}): RequestArgs {
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.');
} }
const localVarPath = `/user/createWithList`; const localVarPath = `/user/createWithList`;
const localVarUrlObj = url.parse(localVarPath, true); const localVarUrlObj = url.parse(localVarPath, true);
@ -1465,7 +1416,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1618,18 +1569,18 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options: any = {}): RequestArgs { updateUser(username: string, body: User, options: any = {}): RequestArgs {
// verify required parameter 'username' is not null or undefined // verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) { if (username === null || username === undefined) {
throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.');
} }
// verify required parameter 'user' is not null or undefined // verify required parameter 'body' is not null or undefined
if (user === null || user === undefined) { if (body === null || body === undefined) {
throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
} }
const localVarPath = `/user/{username}` const localVarPath = `/user/{username}`
.replace(`{${"username"}}`, encodeURIComponent(String(username))); .replace(`{${"username"}}`, encodeURIComponent(String(username)));
@ -1650,7 +1601,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
delete localVarUrlObj.search; delete localVarUrlObj.search;
localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (<any>"User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body || {}) : (body || "");
return { return {
url: url.format(localVarUrlObj), url: url.format(localVarUrlObj),
@ -1669,43 +1620,43 @@ export const UserApiFp = function(configuration?: Configuration) {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUser(body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithArrayInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { createUsersWithListInput(body: Array<User>, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1719,7 +1670,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1733,7 +1684,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1748,7 +1699,7 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
@ -1761,22 +1712,22 @@ export const UserApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> { updateUser(username: string, body: User, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response> {
const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
} }
@ -1791,32 +1742,32 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUser(user: User, options?: any) { createUser(body: User, options?: any) {
return UserApiFp(configuration).createUser(user, options)(axios, basePath); return UserApiFp(configuration).createUser(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithArrayInput(user: Array<User>, options?: any) { createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithArrayInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithArrayInput(body, options)(axios, basePath);
}, },
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
createUsersWithListInput(user: Array<User>, options?: any) { createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(configuration).createUsersWithListInput(user, options)(axios, basePath); return UserApiFp(configuration).createUsersWithListInput(body, options)(axios, basePath);
}, },
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -1862,12 +1813,12 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
updateUser(username: string, user: User, options?: any) { updateUser(username: string, body: User, options?: any) {
return UserApiFp(configuration).updateUser(username, user, options)(axios, basePath); return UserApiFp(configuration).updateUser(username, body, options)(axios, basePath);
}, },
}; };
}; };
@ -1882,37 +1833,37 @@ export class UserApi extends BaseAPI {
/** /**
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Create user * @summary Create user
* @param {User} user Created user object * @param {User} body Created user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUser(user: User, options?: any) { public createUser(body: User, options?: any) {
return UserApiFp(this.configuration).createUser(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUser(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithArrayInput(user: Array<User>, options?: any) { public createUsersWithArrayInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.axios, this.basePath);
} }
/** /**
* *
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param {Array<User>} user List of user object * @param {Array<User>} body List of user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public createUsersWithListInput(user: Array<User>, options?: any) { public createUsersWithListInput(body: Array<User>, options?: any) {
return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).createUsersWithListInput(body, options)(this.axios, this.basePath);
} }
/** /**
@ -1967,14 +1918,15 @@ export class UserApi extends BaseAPI {
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @summary Updated user * @summary Updated user
* @param {string} username name that need to be deleted * @param {string} username name that need to be deleted
* @param {User} user Updated user object * @param {User} body Updated user object
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof UserApi * @memberof UserApi
*/ */
public updateUser(username: string, user: User, options?: any) { public updateUser(username: string, body: User, options?: any) {
return UserApiFp(this.configuration).updateUser(username, user, options)(this.axios, this.basePath); return UserApiFp(this.configuration).updateUser(username, body, options)(this.axios, this.basePath);
} }
} }

View File

@ -0,0 +1,69 @@
// tslint:disable
/// <reference path="./custom.d.ts" />
/**
* 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.
*
* OpenAPI spec version: 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 globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View File

@ -1,78 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore");
var axios_1 = require("axios");
describe("PetApi", function () {
function runSuite(description, requestOptions, customAxiosInstance) {
describe(description, function () {
var api;
var fixture = createTestFixture();
beforeEach(function () {
api = new typescript_axios_petstore_1.PetApi(undefined, undefined, customAxiosInstance);
});
it("should add and delete Pet", function () {
return api.addPet(fixture, requestOptions).then(function () { });
});
it("should get Pet by ID", function () {
return api
.getPetById(fixture.id, requestOptions)
.then(function (result) {
return chai_1.expect(result.data).to.deep.equal(fixture);
});
});
it("should update Pet by ID", function () {
return api
.getPetById(fixture.id, requestOptions)
.then(function (response) {
var result = response.data;
result.name = "newname";
return api.updatePet(result, requestOptions).then(function () {
return api
.getPetById(fixture.id, requestOptions)
.then(function (response) {
return chai_1.expect(response.data.name).to.deep.equal("newname");
});
});
});
});
it("should delete Pet", function () {
return api.deletePet(fixture.id, requestOptions);
});
it("should not contain deleted Pet", function () {
return api.getPetById(fixture.id, requestOptions).then(function (result) {
return chai_1.expect(result.data).to.not.exist;
}, function (err) {
return chai_1.expect(err).to.exist;
});
});
});
}
runSuite("without custom request options");
runSuite("with custom request options", {
credentials: "include",
mode: "cors"
});
runSuite("without custom axios instance");
runSuite("with custom axios instance", {}, axios_1.default);
runSuite("with custom request options and custom axios instance", {
credentials: "include",
mode: "cors"
}, axios_1.default);
});
function createTestFixture(ts) {
if (ts === void 0) { ts = Date.now(); }
var category = {
id: ts,
name: "category" + ts
};
var pet = {
id: ts,
name: "pet" + ts,
category: category,
photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"],
status: typescript_axios_petstore_1.Pet.StatusEnum.Available,
tags: []
};
return pet;
}

View File

@ -1,94 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore");
var typescript_axios_petstore_2 = require("@swagger/typescript-axios-petstore");
var axios_1 = require("axios");
var config;
before(function () {
config = new typescript_axios_petstore_2.Configuration();
config.accessToken = "foobar";
config.apiKey = function (securityName) {
// for multiple apiKey security
if (securityName === "api_key") {
return "foobar";
}
return;
};
config.username = "foo";
config.password = "bar";
});
describe("PetApiFactory", function () {
function runSuite(description, requestOptions, customAxiosInstance) {
describe(description, function () {
var fixture = createTestFixture();
it("should add and delete Pet", function () {
return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance)
.addPet(fixture, requestOptions)
.then(function () { });
});
it("should get Pet by ID", function () {
return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance)
.getPetById(fixture.id, requestOptions)
.then(function (result) {
return chai_1.expect(result.data).to.deep.equal(fixture);
});
});
it("should update Pet by ID", function () {
return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance)
.getPetById(fixture.id, requestOptions)
.then(function (result) {
result.data.name = "newname";
return typescript_axios_petstore_1.PetApiFactory(config)
.updatePet(result.data, requestOptions)
.then(function () {
return typescript_axios_petstore_1.PetApiFactory(config)
.getPetById(fixture.id, requestOptions)
.then(function (result) {
return chai_1.expect(result.data.name).to.deep.equal("newname");
});
});
});
});
it("should delete Pet", function () {
return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance).deletePet(fixture.id, requestOptions);
});
it("should not contain deleted Pet", function () {
return typescript_axios_petstore_1.PetApiFactory(config, undefined, customAxiosInstance)
.getPetById(fixture.id, requestOptions)
.then(function (result) {
return chai_1.expect(result.data).to.not.exist;
}, function (err) {
return chai_1.expect(err).to.exist;
});
});
});
}
runSuite("without custom request options");
runSuite("with custom request options", {
credentials: "include",
mode: "cors"
});
runSuite("without custom axios instance");
runSuite("with custom axios instance", {}, axios_1.default);
runSuite("with custom request options and custom axios instance", {
credentials: "include",
mode: "cors"
}, axios_1.default);
});
function createTestFixture(ts) {
if (ts === void 0) { ts = Date.now(); }
var category = {
id: ts,
name: "category" + ts
};
var pet = {
id: ts,
name: "pet" + ts,
category: category,
photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"],
status: typescript_axios_petstore_1.Pet.StatusEnum.Available,
tags: []
};
return pet;
}

View File

@ -1,33 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore");
var axios_1 = require("axios");
describe("StoreApi", function () {
function runSuite(description, requestOptions, customAxiosInstance) {
describe(description, function () {
var api;
beforeEach(function () {
api = new typescript_axios_petstore_1.StoreApi(undefined, undefined, customAxiosInstance);
});
it("should get inventory", function () {
return api
.getInventory(requestOptions)
.then(function (result) {
chai_1.expect(Object.keys(result)).to.not.be.empty;
});
});
});
}
runSuite("without custom request options");
runSuite("with custom request options", {
credentials: "include",
mode: "cors"
});
runSuite("without custom axios instance");
runSuite("with custom axios instance", {}, axios_1.default);
runSuite("with custom request options and custom axios instance", {
credentials: "include",
mode: "cors"
}, axios_1.default);
});

View File

@ -1,44 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore");
var typescript_axios_petstore_2 = require("@swagger/typescript-axios-petstore");
var axios_1 = require("axios");
var config;
before(function () {
config = new typescript_axios_petstore_2.Configuration();
config.accessToken = "foobar";
config.apiKey = function (securityName) {
// for multiple apiKey security
if (securityName === "api_key") {
return "foobar";
}
return;
};
config.username = "foo";
config.password = "bar";
});
describe("StoreApiFactory", function () {
function runSuite(description, requestOptions, customAxiosInstance) {
describe(description, function () {
it("should get inventory", function () {
return typescript_axios_petstore_1.StoreApiFactory(config, undefined, customAxiosInstance)
.getInventory(requestOptions)
.then(function (result) {
chai_1.expect(Object.keys(result.data)).to.not.be.empty;
});
});
});
}
runSuite("without custom request options");
runSuite("with custom request options", {
credentials: "include",
mode: "cors"
});
runSuite("without custom axios instance");
runSuite("with custom axios instance", {}, axios_1.default);
runSuite("with custom request options and custom axios instance", {
credentials: "include",
mode: "cors"
}, axios_1.default);
});

View File

@ -1,6 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./PetApi");
require("./StoreApi");
require("./PetApiFactory");
require("./StoreApiFactory");