Add interfaces option (#7831)

[TypeScript][Fetch] Add interfaces option
This commit is contained in:
Jeremy Bohrer 2018-03-25 11:01:18 -04:00 committed by William Cheng
parent 40c30dd2f1
commit fc7e083467
20 changed files with 2594 additions and 132 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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%

View File

@ -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 class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
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

View File

@ -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,14 +302,14 @@ export const {{classname}}Factory = function (configuration?: Configuration, fet
};
};
{{#withInterfaces}}
/**
* {{classname}} - object-oriented interface{{#description}}
* {{{description}}}{{/description}}
* {{classname}} - interface{{#description}}
* {{&description}}{{/description}}
* @export
* @class {{classname}}
* @extends {BaseAPI}
* @interface {{classname}}
*/
export class {{classname}} extends BaseAPI {
export interface {{classname}}Interface {
{{#operation}}
/**
* {{&notes}}
@ -317,7 +317,39 @@ 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}
* @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}}
* @export
* @class {{classname}}
* @extends {BaseAPI}
*/
{{#withInterfaces}}
export class {{classname}} extends BaseAPI implements {{classname}}Interface {
{{/withInterfaces}}
{{^withInterfaces}}
export class {{classname}} extends BaseAPI {
{{/withInterfaces}}
{{#operation}}
/**
* {{&notes}}
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
* @throws {RequiredError}

View File

@ -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}};

View File

@ -33,6 +33,7 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider {
.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();
}

View File

@ -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 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param {string} [testCodeInjectEndRnNR] To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof FakeApi

View File

@ -210,13 +210,13 @@ export interface Pet {
name: string;
/**
*
* @type {Array&lt;string&gt;}
* @type {Array<string>}
* @memberof Pet
*/
photoUrls: Array<string>;
/**
*
* @type {Array&lt;Tag&gt;}
* @type {Array<Tag>}
* @memberof Pet
*/
tags?: Array<Tag>;
@ -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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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<string>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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<User>} 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<User>} 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

View File

@ -210,13 +210,13 @@ export interface Pet {
name: string;
/**
*
* @type {Array&lt;string&gt;}
* @type {Array<string>}
* @memberof Pet
*/
photoUrls: Array<string>;
/**
*
* @type {Array&lt;Tag&gt;}
* @type {Array<Tag>}
* @memberof Pet
*/
tags?: Array<Tag>;
@ -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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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<string>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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<User>} 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<User>} 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

View File

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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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;
}
}

View File

@ -0,0 +1,2 @@
declare module 'portable-fetch';
declare module 'url';

View File

@ -0,0 +1,51 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 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'

View File

@ -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";

View File

@ -210,13 +210,13 @@ export interface Pet {
name: string;
/**
*
* @type {Array&lt;string&gt;}
* @type {Array<string>}
* @memberof Pet
*/
photoUrls: Array<string>;
/**
*
* @type {Array&lt;Tag&gt;}
* @type {Array<Tag>}
* @memberof Pet
*/
tags?: Array<Tag>;
@ -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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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&lt;&#39;available&#39; | &#39;pending&#39; | &#39;sold&#39;&gt;} 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&lt;string&gt;} tags Tags to filter by
* @param {Array<string>} 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<string>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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&lt;User&gt;} body List of user object
* @param {Array<User>} 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&lt;User&gt;} body List of user object
* @param {Array<User>} body List of user object
* @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<User>} 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<User>} 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