From fc7e0834677424d1ec767c40ce352595311c42ce Mon Sep 17 00:00:00 2001 From: Jeremy Bohrer <35938078+tsiq-jeremy@users.noreply.github.com> Date: Sun, 25 Mar 2018 11:01:18 -0400 Subject: [PATCH] Add interfaces option (#7831) [TypeScript][Fetch] Add interfaces option --- bin/typescript-fetch-petstore-all.sh | 1 + bin/typescript-fetch-petstore-interfaces.sh | 31 + bin/windows/typescript-fetch-petstore-all.bat | 1 + .../typescript-fetch-petstore-interfaces.bat | 12 + .../TypeScriptFetchClientCodegen.java | 2 + .../resources/typescript-fetch/api.mustache | 40 +- .../typescript-fetch/modelGeneric.mustache | 2 +- .../TypeScriptFetchClientOptionsProvider.java | 1 + .../typescript-fetch/api.ts | 2 +- .../typescript-fetch/builds/default/api.ts | 84 +- .../typescript-fetch/builds/es6-target/api.ts | 84 +- .../builds/with-interfaces/.gitignore | 3 + .../with-interfaces/.swagger-codegen-ignore | 23 + .../with-interfaces/.swagger-codegen/VERSION | 1 + .../builds/with-interfaces/api.ts | 2220 +++++++++++++++++ .../builds/with-interfaces/configuration.ts | 66 + .../builds/with-interfaces/custom.d.ts | 2 + .../builds/with-interfaces/git_push.sh | 51 + .../builds/with-interfaces/index.ts | 16 + .../builds/with-npm-version/api.ts | 84 +- 20 files changed, 2594 insertions(+), 132 deletions(-) create mode 100755 bin/typescript-fetch-petstore-interfaces.sh create mode 100644 bin/windows/typescript-fetch-petstore-interfaces.bat create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen-ignore create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen/VERSION create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/api.ts create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/configuration.ts create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/custom.d.ts create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/git_push.sh create mode 100644 samples/client/petstore/typescript-fetch/builds/with-interfaces/index.ts diff --git a/bin/typescript-fetch-petstore-all.sh b/bin/typescript-fetch-petstore-all.sh index 6365b9032a6b..27cd5f104b0c 100755 --- a/bin/typescript-fetch-petstore-all.sh +++ b/bin/typescript-fetch-petstore-all.sh @@ -2,4 +2,5 @@ ./bin/typescript-fetch-petstore-target-es6.sh ./bin/typescript-fetch-petstore-with-npm-version.sh +./bin/typescript-fetch-petstore-interfaces.sh ./bin/typescript-fetch-petstore.sh diff --git a/bin/typescript-fetch-petstore-interfaces.sh b/bin/typescript-fetch-petstore-interfaces.sh new file mode 100755 index 000000000000..d3ddfa5c127f --- /dev/null +++ b/bin/typescript-fetch-petstore-interfaces.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +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/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn 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/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces -D withInterfaces=true" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/typescript-fetch-petstore-all.bat b/bin/windows/typescript-fetch-petstore-all.bat index ed41df84bb5c..69af38cf6a25 100644 --- a/bin/windows/typescript-fetch-petstore-all.bat +++ b/bin/windows/typescript-fetch-petstore-all.bat @@ -3,3 +3,4 @@ call bin\windows\typescript-fetch-petstore.bat call bin\windows\typescript-fetch-petstore-target-es6.bat call bin\windows\typescript-fetch-petstore-with-npm-version.bat +call bin\windows\typescript-fetch-petstore-interfaces.bat diff --git a/bin/windows/typescript-fetch-petstore-interfaces.bat b/bin/windows/typescript-fetch-petstore-interfaces.bat new file mode 100644 index 000000000000..c8d9179dafa0 --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-interfaces.bat @@ -0,0 +1,12 @@ +@ECHO OFF + +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -o samples\client\petstore\typescript-fetch\builds\with-interfaces -D withInterfaces=true + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java index 1a24e1db7e5f..0e89ec42be8e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java @@ -18,6 +18,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege public static final String NPM_VERSION = "npmVersion"; public static final String NPM_REPOSITORY = "npmRepository"; public static final String SNAPSHOT = "snapshot"; + public static final String WITH_INTERFACES = "withInterfaces"; protected String npmName = null; protected String npmVersion = "1.0.0"; @@ -37,6 +38,7 @@ public TypeScriptFetchClientCodegen() { this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); 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", BooleanProperty.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.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); } @Override diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache index 86d0cbe8dcae..d149d5ff2eee 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache @@ -85,7 +85,7 @@ export const {{classname}}FetchParamCreator = function (configuration?: Configur * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -255,7 +255,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -290,7 +290,7 @@ export const {{classname}}Factory = function (configuration?: Configuration, fet * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -302,6 +302,33 @@ export const {{classname}}Factory = function (configuration?: Configuration, fet }; }; +{{#withInterfaces}} +/** + * {{classname}} - interface{{#description}} + * {{&description}}{{/description}} + * @export + * @interface {{classname}} + */ +export interface {{classname}}Interface { +{{#operation}} + /** + * {{¬es}} + {{#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): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>; + +{{/operation}} +} + +{{/withInterfaces}} /** * {{classname}} - object-oriented interface{{#description}} * {{{description}}}{{/description}} @@ -309,7 +336,12 @@ export const {{classname}}Factory = function (configuration?: Configuration, fet * @class {{classname}} * @extends {BaseAPI} */ +{{#withInterfaces}} +export class {{classname}} extends BaseAPI implements {{classname}}Interface { +{{/withInterfaces}} +{{^withInterfaces}} export class {{classname}} extends BaseAPI { +{{/withInterfaces}} {{#operation}} /** * {{¬es}} @@ -317,7 +349,7 @@ export class {{classname}} extends BaseAPI { * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{=<% %>=}}{<%%dataType%%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} * @param {*} [options] Override http request option. * @throws {RequiredError} diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/modelGeneric.mustache index 4d8bd2f09a19..585b9825bfc7 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -11,7 +11,7 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{#vars}} /** * {{{description}}} - * @type {{=<% %>=}}{<%datatype%>}<%={{ }}=%> + * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> * @memberof {{classname}} */ {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java index 014a1b12cb72..2456b07b1689 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -33,6 +33,7 @@ public Map createOptions() { .put(TypeScriptFetchClientCodegen.NPM_VERSION, NMP_VERSION) .put(TypeScriptFetchClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .put(TypeScriptFetchClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) + .put(TypeScriptFetchClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .build(); } diff --git a/samples/client/petstore-security-test/typescript-fetch/api.ts b/samples/client/petstore-security-test/typescript-fetch/api.ts index 027bc9439100..d69e2ae751d1 100644 --- a/samples/client/petstore-security-test/typescript-fetch/api.ts +++ b/samples/client/petstore-security-test/typescript-fetch/api.ts @@ -191,7 +191,7 @@ export class FakeApi extends BaseAPI { /** * * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param {} [testCodeInjectEndRnNR] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [testCodeInjectEndRnNR] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FakeApi diff --git a/samples/client/petstore/typescript-fetch/builds/default/api.ts b/samples/client/petstore/typescript-fetch/builds/default/api.ts index 72e705621fa2..7b89d8a61f52 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/api.ts @@ -210,13 +210,13 @@ export interface Pet { name: string; /** * - * @type {Array<string>} + * @type {Array} * @memberof Pet */ photoUrls: Array; /** * - * @type {Array<Tag>} + * @type {Array} * @memberof Pet */ tags?: Array; @@ -414,7 +414,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -455,7 +455,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -726,7 +726,7 @@ export const PetApiFp = function(configuration?: Configuration) { /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -745,7 +745,7 @@ export const PetApiFp = function(configuration?: Configuration) { /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -874,7 +874,7 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -884,7 +884,7 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -948,7 +948,7 @@ export class PetApi extends BaseAPI { /** * * @summary Add a new pet to the store - * @param {} body 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. * @throws {RequiredError} * @memberof PetApi @@ -960,8 +960,8 @@ export class PetApi extends BaseAPI { /** * * @summary Deletes a pet - * @param {} petId Pet id to delete - * @param {} [apiKey] + * @param {number} petId Pet id to delete + * @param {string} [apiKey] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -973,7 +973,7 @@ export class PetApi extends BaseAPI { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {} status Status values that need to be considered for filter + * @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 @@ -985,7 +985,7 @@ export class PetApi extends BaseAPI { /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param {} tags Tags to filter by + * @param {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -997,7 +997,7 @@ export class PetApi extends BaseAPI { /** * Returns a single pet * @summary Find pet by ID - * @param {} petId ID of pet to return + * @param {number} petId ID of pet to return * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -1009,7 +1009,7 @@ export class PetApi extends BaseAPI { /** * * @summary Update an existing pet - * @param {} body 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. * @throws {RequiredError} * @memberof PetApi @@ -1021,9 +1021,9 @@ export class PetApi extends BaseAPI { /** * * @summary Updates a pet in the store with form data - * @param {} petId ID of pet that needs to be updated - * @param {} [name] Updated name of the pet - * @param {} [status] Updated status of the pet + * @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 @@ -1035,9 +1035,9 @@ export class PetApi extends BaseAPI { /** * * @summary uploads an image - * @param {} petId ID of pet to update - * @param {} [additionalMetadata] Additional data to pass to server - * @param {} [file] file to upload + * @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 @@ -1320,7 +1320,7 @@ 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 {} orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1343,7 +1343,7 @@ export class StoreApi extends BaseAPI { /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param {} orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1355,7 +1355,7 @@ export class StoreApi extends BaseAPI { /** * * @summary Place an order for a pet - * @param {} body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1407,7 +1407,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1439,7 +1439,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1500,7 +1500,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1659,7 +1659,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1678,7 +1678,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1716,7 +1716,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1812,7 +1812,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1822,7 +1822,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1842,7 +1842,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1893,7 +1893,7 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Create user - * @param {} body Created user object + * @param {User} body Created user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1905,7 +1905,7 @@ export class UserApi extends BaseAPI { /** * * @summary Creates list of users with given input array - * @param {} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1917,7 +1917,7 @@ export class UserApi extends BaseAPI { /** * * @summary Creates list of users with given input array - * @param {} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1929,7 +1929,7 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Delete user - * @param {} username The name that needs to be deleted + * @param {string} username The name that needs to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1941,7 +1941,7 @@ export class UserApi extends BaseAPI { /** * * @summary Get user by user name - * @param {} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1953,8 +1953,8 @@ export class UserApi extends BaseAPI { /** * * @summary Logs user into the system - * @param {} username The user name for login - * @param {} password The password for login in clear text + * @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 @@ -1977,8 +1977,8 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Updated user - * @param {} username name that need to be deleted - * @param {} body Updated user object + * @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 diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts index 72e705621fa2..7b89d8a61f52 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts @@ -210,13 +210,13 @@ export interface Pet { name: string; /** * - * @type {Array<string>} + * @type {Array} * @memberof Pet */ photoUrls: Array; /** * - * @type {Array<Tag>} + * @type {Array} * @memberof Pet */ tags?: Array; @@ -414,7 +414,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -455,7 +455,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -726,7 +726,7 @@ export const PetApiFp = function(configuration?: Configuration) { /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -745,7 +745,7 @@ export const PetApiFp = function(configuration?: Configuration) { /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -874,7 +874,7 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -884,7 +884,7 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -948,7 +948,7 @@ export class PetApi extends BaseAPI { /** * * @summary Add a new pet to the store - * @param {} body 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. * @throws {RequiredError} * @memberof PetApi @@ -960,8 +960,8 @@ export class PetApi extends BaseAPI { /** * * @summary Deletes a pet - * @param {} petId Pet id to delete - * @param {} [apiKey] + * @param {number} petId Pet id to delete + * @param {string} [apiKey] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -973,7 +973,7 @@ export class PetApi extends BaseAPI { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {} status Status values that need to be considered for filter + * @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 @@ -985,7 +985,7 @@ export class PetApi extends BaseAPI { /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param {} tags Tags to filter by + * @param {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -997,7 +997,7 @@ export class PetApi extends BaseAPI { /** * Returns a single pet * @summary Find pet by ID - * @param {} petId ID of pet to return + * @param {number} petId ID of pet to return * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -1009,7 +1009,7 @@ export class PetApi extends BaseAPI { /** * * @summary Update an existing pet - * @param {} body 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. * @throws {RequiredError} * @memberof PetApi @@ -1021,9 +1021,9 @@ export class PetApi extends BaseAPI { /** * * @summary Updates a pet in the store with form data - * @param {} petId ID of pet that needs to be updated - * @param {} [name] Updated name of the pet - * @param {} [status] Updated status of the pet + * @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 @@ -1035,9 +1035,9 @@ export class PetApi extends BaseAPI { /** * * @summary uploads an image - * @param {} petId ID of pet to update - * @param {} [additionalMetadata] Additional data to pass to server - * @param {} [file] file to upload + * @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 @@ -1320,7 +1320,7 @@ 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 {} orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1343,7 +1343,7 @@ export class StoreApi extends BaseAPI { /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param {} orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1355,7 +1355,7 @@ export class StoreApi extends BaseAPI { /** * * @summary Place an order for a pet - * @param {} body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1407,7 +1407,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1439,7 +1439,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1500,7 +1500,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1659,7 +1659,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1678,7 +1678,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1716,7 +1716,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1812,7 +1812,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1822,7 +1822,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1842,7 +1842,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1893,7 +1893,7 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Create user - * @param {} body Created user object + * @param {User} body Created user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1905,7 +1905,7 @@ export class UserApi extends BaseAPI { /** * * @summary Creates list of users with given input array - * @param {} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1917,7 +1917,7 @@ export class UserApi extends BaseAPI { /** * * @summary Creates list of users with given input array - * @param {} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1929,7 +1929,7 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Delete user - * @param {} username The name that needs to be deleted + * @param {string} username The name that needs to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1941,7 +1941,7 @@ export class UserApi extends BaseAPI { /** * * @summary Get user by user name - * @param {} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1953,8 +1953,8 @@ export class UserApi extends BaseAPI { /** * * @summary Logs user into the system - * @param {} username The user name for login - * @param {} password The password for login in clear text + * @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 @@ -1977,8 +1977,8 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Updated user - * @param {} username name that need to be deleted - * @param {} body Updated user object + * @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 diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore new file mode 100644 index 000000000000..35e2fb2b02ed --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore @@ -0,0 +1,3 @@ +wwwroot/*.js +node_modules +typings diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen-ignore b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# 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 Swagger Codgen 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 diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen/VERSION new file mode 100644 index 000000000000..855ff9501eb8 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/api.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/api.ts new file mode 100644 index 000000000000..9c9de6dd0125 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/api.ts @@ -0,0 +1,2220 @@ +/// +// tslint:disable +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +import * as url from "url"; +import * as portableFetch from "portable-fetch"; +import { Configuration } from "./configuration"; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface FetchAPI + */ +export interface FetchAPI { + (url: string, init?: any): Promise; +} + +/** + * + * @export + * @interface FetchArgs + */ +export interface FetchArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * 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; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * 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' + } +} + +/** + * 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} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array} + * @memberof Pet + */ + tags?: Array; + /** + * 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' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * 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; +} + + +/** + * PetApi - fetch parameter creator + * @export + */ +export const PetApiFetchParamCreator = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'GET' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options: any = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'GET' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'GET' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'PUT' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.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); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.body = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.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 (additionalMetadata !== undefined) { + localVarFormParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + localVarFormParams.set('file', file as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.body = localVarFormParams.toString(); + + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).addPet(body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).deletePet(petId, apiKey, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * 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): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByStatus(status, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByTags(tags, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).getPetById(petId, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).updatePet(body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).updatePetWithForm(petId, name, status, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = PetApiFetchParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * PetApi - factory interface + * @export + */ +export const PetApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + 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)(fetch, 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)(fetch, 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)(fetch, basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp(configuration).findPetsByTags(tags, options)(fetch, 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)(fetch, 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)(fetch, 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)(fetch, 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)(fetch, basePath); + }, + }; +}; + +/** + * PetApi - interface + * @export + * @interface PetApi + */ +export interface PetApiInterface { + /** + * + * @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 PetApiInterface + */ + addPet(body: Pet, options?: any): Promise<{}>; + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + deletePet(petId: number, apiKey?: string, options?: any): Promise<{}>; + + /** + * 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 PetApiInterface + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise>; + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + findPetsByTags(tags: Array, options?: any): Promise>; + + /** + * 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 PetApiInterface + */ + getPetById(petId: number, options?: any): Promise; + + /** + * + * @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 PetApiInterface + */ + updatePet(body: Pet, options?: any): Promise<{}>; + + /** + * + * @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 PetApiInterface + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<{}>; + + /** + * + * @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 PetApiInterface + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise; + +} + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI implements PetApiInterface { + /** + * + * @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.fetch, 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.fetch, 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.fetch, this.basePath); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.fetch, 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.fetch, 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.fetch, 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.fetch, 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.fetch, this.basePath); + } + +} + +/** + * StoreApi - fetch parameter creator + * @export + */ +export const StoreApiFetchParamCreator = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + const localVarPath = `/store/inventory`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, 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 = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = StoreApiFetchParamCreator(configuration).deleteOrder(orderId, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * 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): (fetch?: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { + const localVarFetchArgs = StoreApiFetchParamCreator(configuration).getInventory(options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = StoreApiFetchParamCreator(configuration).getOrderById(orderId, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = StoreApiFetchParamCreator(configuration).placeOrder(body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * StoreApi - factory interface + * @export + */ +export const StoreApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + 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)(fetch, 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)(fetch, 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)(fetch, 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)(fetch, basePath); + }, + }; +}; + +/** + * StoreApi - interface + * @export + * @interface StoreApi + */ +export interface StoreApiInterface { + /** + * 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 StoreApiInterface + */ + deleteOrder(orderId: string, options?: any): Promise<{}>; + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + getInventory(options?: any): Promise<{ [key: string]: number; }>; + + /** + * 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 StoreApiInterface + */ + getOrderById(orderId: number, options?: any): Promise; + + /** + * + * @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 StoreApiInterface + */ + placeOrder(body: Order, options?: any): Promise; + +} + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI implements StoreApiInterface { + /** + * 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.fetch, 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.fetch, 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.fetch, 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.fetch, this.basePath); + } + +} + +/** + * UserApi - fetch parameter creator + * @export + */ +export const UserApiFetchParamCreator = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options: any = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options: any = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'POST' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } + + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + const localVarPath = `/user/logout`; + const localVarUrlObj = url.parse(localVarPath, true); + const localVarRequestOptions = Object.assign({ method: 'GET' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, 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 = {}): FetchArgs { + // 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); + const localVarRequestOptions = Object.assign({ method: 'PUT' }, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).createUser(body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).createUsersWithArrayInput(body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).createUsersWithListInput(body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).deleteUser(username, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).getUserByName(username, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).loginUser(username, password, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).logoutUser(options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UserApiFetchParamCreator(configuration).updateUser(username, body, options); + return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * UserApi - factory interface + * @export + */ +export const UserApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + 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)(fetch, basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp(configuration).createUsersWithArrayInput(body, options)(fetch, basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any) { + return UserApiFp(configuration).createUsersWithListInput(body, options)(fetch, 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)(fetch, 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)(fetch, 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)(fetch, 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)(fetch, 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)(fetch, basePath); + }, + }; +}; + +/** + * UserApi - interface + * @export + * @interface UserApi + */ +export interface UserApiInterface { + /** + * 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 UserApiInterface + */ + createUser(body: User, options?: any): Promise<{}>; + + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUsersWithArrayInput(body: Array, options?: any): Promise<{}>; + + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUsersWithListInput(body: Array, options?: any): Promise<{}>; + + /** + * 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 UserApiInterface + */ + deleteUser(username: string, options?: any): Promise<{}>; + + /** + * + * @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 UserApiInterface + */ + getUserByName(username: string, options?: any): Promise; + + /** + * + * @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 UserApiInterface + */ + loginUser(username: string, password: string, options?: any): Promise; + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + logoutUser(options?: any): Promise<{}>; + + /** + * 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 UserApiInterface + */ + updateUser(username: string, body: User, options?: any): Promise<{}>; + +} + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI implements UserApiInterface { + /** + * 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.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithListInput(body, options)(this.fetch, 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.fetch, 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.fetch, 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.fetch, 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.fetch, 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.fetch, this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/configuration.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/configuration.ts new file mode 100644 index 000000000000..ca7b7e641b51 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/configuration.ts @@ -0,0 +1,66 @@ +// tslint:disable +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * 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; +} + +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; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/custom.d.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/custom.d.ts new file mode 100644 index 000000000000..9a5ceb3588a8 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/custom.d.ts @@ -0,0 +1,2 @@ +declare module 'portable-fetch'; +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/git_push.sh b/samples/client/petstore/typescript-fetch/builds/with-interfaces/git_push.sh new file mode 100644 index 000000000000..a1ff4c9bcba8 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/git_push.sh @@ -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 swagger-petstore-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' diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/index.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/index.ts new file mode 100644 index 000000000000..052a883aaaa9 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/index.ts @@ -0,0 +1,16 @@ +// tslint:disable +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts index 72e705621fa2..7b89d8a61f52 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts @@ -210,13 +210,13 @@ export interface Pet { name: string; /** * - * @type {Array<string>} + * @type {Array} * @memberof Pet */ photoUrls: Array; /** * - * @type {Array<Tag>} + * @type {Array} * @memberof Pet */ tags?: Array; @@ -414,7 +414,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -455,7 +455,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -726,7 +726,7 @@ export const PetApiFp = function(configuration?: Configuration) { /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -745,7 +745,7 @@ export const PetApiFp = function(configuration?: Configuration) { /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -874,7 +874,7 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * 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 {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -884,7 +884,7 @@ export const PetApiFactory = function (configuration?: Configuration, fetch?: Fe /** * 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 {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -948,7 +948,7 @@ export class PetApi extends BaseAPI { /** * * @summary Add a new pet to the store - * @param {} body 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. * @throws {RequiredError} * @memberof PetApi @@ -960,8 +960,8 @@ export class PetApi extends BaseAPI { /** * * @summary Deletes a pet - * @param {} petId Pet id to delete - * @param {} [apiKey] + * @param {number} petId Pet id to delete + * @param {string} [apiKey] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -973,7 +973,7 @@ export class PetApi extends BaseAPI { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param {} status Status values that need to be considered for filter + * @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 @@ -985,7 +985,7 @@ export class PetApi extends BaseAPI { /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param {} tags Tags to filter by + * @param {Array} tags Tags to filter by * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -997,7 +997,7 @@ export class PetApi extends BaseAPI { /** * Returns a single pet * @summary Find pet by ID - * @param {} petId ID of pet to return + * @param {number} petId ID of pet to return * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi @@ -1009,7 +1009,7 @@ export class PetApi extends BaseAPI { /** * * @summary Update an existing pet - * @param {} body 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. * @throws {RequiredError} * @memberof PetApi @@ -1021,9 +1021,9 @@ export class PetApi extends BaseAPI { /** * * @summary Updates a pet in the store with form data - * @param {} petId ID of pet that needs to be updated - * @param {} [name] Updated name of the pet - * @param {} [status] Updated status of the pet + * @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 @@ -1035,9 +1035,9 @@ export class PetApi extends BaseAPI { /** * * @summary uploads an image - * @param {} petId ID of pet to update - * @param {} [additionalMetadata] Additional data to pass to server - * @param {} [file] file to upload + * @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 @@ -1320,7 +1320,7 @@ 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 {} orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1343,7 +1343,7 @@ export class StoreApi extends BaseAPI { /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param {} orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1355,7 +1355,7 @@ export class StoreApi extends BaseAPI { /** * * @summary Place an order for a pet - * @param {} body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StoreApi @@ -1407,7 +1407,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1439,7 +1439,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1500,7 +1500,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1659,7 +1659,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1678,7 +1678,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1716,7 +1716,7 @@ export const UserApiFp = function(configuration?: Configuration) { /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1812,7 +1812,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1822,7 +1822,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Creates list of users with given input array - * @param {Array<User>} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1842,7 +1842,7 @@ export const UserApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary Get user by user name - * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1893,7 +1893,7 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Create user - * @param {} body Created user object + * @param {User} body Created user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1905,7 +1905,7 @@ export class UserApi extends BaseAPI { /** * * @summary Creates list of users with given input array - * @param {} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1917,7 +1917,7 @@ export class UserApi extends BaseAPI { /** * * @summary Creates list of users with given input array - * @param {} body List of user object + * @param {Array} body List of user object * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1929,7 +1929,7 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Delete user - * @param {} username The name that needs to be deleted + * @param {string} username The name that needs to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1941,7 +1941,7 @@ export class UserApi extends BaseAPI { /** * * @summary Get user by user name - * @param {} username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi @@ -1953,8 +1953,8 @@ export class UserApi extends BaseAPI { /** * * @summary Logs user into the system - * @param {} username The user name for login - * @param {} password The password for login in clear text + * @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 @@ -1977,8 +1977,8 @@ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Updated user - * @param {} username name that need to be deleted - * @param {} body Updated user object + * @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