[TypeScript][Node] async promises and imports (#2452)

* async promises and imports

* Sample regen

* Correct licence info

* update samples
This commit is contained in:
Kevin Turner 2019-03-21 14:27:38 +00:00 committed by William Cheng
parent 77545df80d
commit 2f8e4fe32b
9 changed files with 151 additions and 57 deletions

View File

@ -1,16 +1,26 @@
{{>licenseInfo}} {{>licenseInfo}}
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
{{^supportsES6}}
import Promise = require('bluebird');
{{/supportsES6}}
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
{{#imports}} {{#imports}}
import { {{classname}} } from '../{{filename}}'; import { {{classname}} } from '../{{filename}}';
{{/imports}} {{/imports}}
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
import { HttpBasicAuth } from '../model/models';
{{/isBasic}}
{{#isApiKey}}
import { ApiKeyAuth } from '../model/models';
{{/isApiKey}}
{{#isOAuth}}
import { OAuth } from '../model/models';
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
let defaultBasePath = '{{{basePath}}}'; let defaultBasePath = '{{{basePath}}}';
@ -127,7 +137,7 @@ export class {{classname}} {
* @param {{paramName}} {{description}} * @param {{paramName}} {{description}}
{{/allParams}} {{/allParams}}
*/ */
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { public async {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}} const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}}; .replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};

View File

@ -12,13 +12,14 @@
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
import { ApiResponse } from '../model/apiResponse'; import { ApiResponse } from '../model/apiResponse';
import { Pet } from '../model/pet'; import { Pet } from '../model/pet';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
import { OAuth } from '../model/models';
import { ApiKeyAuth } from '../model/models';
let defaultBasePath = 'http://petstore.swagger.io/v2'; let defaultBasePath = 'http://petstore.swagger.io/v2';
@ -83,7 +84,7 @@ export class PetApi {
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public addPet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async addPet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet'; const localVarPath = this.basePath + '/pet';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -139,7 +140,7 @@ export class PetApi {
* @param petId Pet id to delete * @param petId Pet id to delete
* @param apiKey * @param apiKey
*/ */
public deletePet (petId: number, apiKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async deletePet (petId: number, apiKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}' const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -195,7 +196,7 @@ export class PetApi {
* @summary Finds Pets by status * @summary Finds Pets by status
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
*/ */
public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> { public async findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByStatus'; const localVarPath = this.basePath + '/pet/findByStatus';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -254,7 +255,7 @@ export class PetApi {
* @summary Finds Pets by tags * @summary Finds Pets by tags
* @param tags Tags to filter by * @param tags Tags to filter by
*/ */
public findPetsByTags (tags: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> { public async findPetsByTags (tags: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByTags'; const localVarPath = this.basePath + '/pet/findByTags';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -313,7 +314,7 @@ export class PetApi {
* @summary Find pet by ID * @summary Find pet by ID
* @param petId ID of pet to return * @param petId ID of pet to return
*/ */
public getPetById (petId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Pet; }> { public async getPetById (petId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Pet; }> {
const localVarPath = this.basePath + '/pet/{petId}' const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -369,7 +370,7 @@ export class PetApi {
* @summary Update an existing pet * @summary Update an existing pet
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public updatePet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async updatePet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet'; const localVarPath = this.basePath + '/pet';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -426,7 +427,7 @@ export class PetApi {
* @param name Updated name of the pet * @param name Updated name of the pet
* @param status Updated status of the pet * @param status Updated status of the pet
*/ */
public updatePetWithForm (petId: number, name?: string, status?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async updatePetWithForm (petId: number, name?: string, status?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}' const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -491,7 +492,7 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server * @param additionalMetadata Additional data to pass to server
* @param file file to upload * @param file file to upload
*/ */
public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> { public async uploadFile (petId: number, additionalMetadata?: string, file?: Buffer, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> {
const localVarPath = this.basePath + '/pet/{petId}/uploadImage' const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};

View File

@ -12,12 +12,12 @@
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
import { Order } from '../model/order'; import { Order } from '../model/order';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
import { ApiKeyAuth } from '../model/models';
let defaultBasePath = 'http://petstore.swagger.io/v2'; let defaultBasePath = 'http://petstore.swagger.io/v2';
@ -77,7 +77,7 @@ export class StoreApi {
* @summary Delete purchase order by ID * @summary Delete purchase order by ID
* @param orderId ID of the order that needs to be deleted * @param orderId ID of the order that needs to be deleted
*/ */
public deleteOrder (orderId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async deleteOrder (orderId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/store/order/{orderId}' const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -129,7 +129,7 @@ export class StoreApi {
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
* @summary Returns pet inventories by status * @summary Returns pet inventories by status
*/ */
public getInventory (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { public async getInventory (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> {
const localVarPath = this.basePath + '/store/inventory'; const localVarPath = this.basePath + '/store/inventory';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -179,7 +179,7 @@ export class StoreApi {
* @summary Find purchase order by ID * @summary Find purchase order by ID
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
*/ */
public getOrderById (orderId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> { public async getOrderById (orderId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order/{orderId}' const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -233,7 +233,7 @@ export class StoreApi {
* @summary Place an order for a pet * @summary Place an order for a pet
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
*/ */
public placeOrder (body: Order, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> { public async placeOrder (body: Order, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order'; const localVarPath = this.basePath + '/store/order';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);

View File

@ -12,12 +12,11 @@
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
import { User } from '../model/user'; import { User } from '../model/user';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
let defaultBasePath = 'http://petstore.swagger.io/v2'; let defaultBasePath = 'http://petstore.swagger.io/v2';
@ -75,7 +74,7 @@ export class UserApi {
* @summary Create user * @summary Create user
* @param body Created user object * @param body Created user object
*/ */
public createUser (body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async createUser (body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user'; const localVarPath = this.basePath + '/user';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -128,7 +127,7 @@ export class UserApi {
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithArrayInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async createUsersWithArrayInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/createWithArray'; const localVarPath = this.basePath + '/user/createWithArray';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -181,7 +180,7 @@ export class UserApi {
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithListInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async createUsersWithListInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/createWithList'; const localVarPath = this.basePath + '/user/createWithList';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -234,7 +233,7 @@ export class UserApi {
* @summary Delete user * @summary Delete user
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
*/ */
public deleteUser (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async deleteUser (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}' const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username))); .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -287,7 +286,7 @@ export class UserApi {
* @summary Get user by user name * @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing. * @param username The name that needs to be fetched. Use user1 for testing.
*/ */
public getUserByName (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: User; }> { public async getUserByName (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: User; }> {
const localVarPath = this.basePath + '/user/{username}' const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username))); .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -342,7 +341,7 @@ export class UserApi {
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
*/ */
public loginUser (username: string, password: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: string; }> { public async loginUser (username: string, password: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: string; }> {
const localVarPath = this.basePath + '/user/login'; const localVarPath = this.basePath + '/user/login';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -407,7 +406,7 @@ export class UserApi {
* *
* @summary Logs out current logged in user session * @summary Logs out current logged in user session
*/ */
public logoutUser (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async logoutUser (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/logout'; const localVarPath = this.basePath + '/user/logout';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -455,7 +454,7 @@ export class UserApi {
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
*/ */
public updateUser (username: string, body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async updateUser (username: string, body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}' const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username))); .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};

View File

@ -0,0 +1,42 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export class InlineObject {
/**
* Updated name of the pet
*/
'name'?: string;
/**
* Updated status of the pet
*/
'status'?: string;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "name",
"baseName": "name",
"type": "string"
},
{
"name": "status",
"baseName": "status",
"type": "string"
} ];
static getAttributeTypeMap() {
return InlineObject.attributeTypeMap;
}
}

View File

@ -0,0 +1,42 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export class InlineObject1 {
/**
* Additional data to pass to server
*/
'additionalMetadata'?: string;
/**
* file to upload
*/
'file'?: Buffer;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "additionalMetadata",
"baseName": "additionalMetadata",
"type": "string"
},
{
"name": "file",
"baseName": "file",
"type": "Buffer"
} ];
static getAttributeTypeMap() {
return InlineObject1.attributeTypeMap;
}
}

View File

@ -12,13 +12,14 @@
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
import { ApiResponse } from '../model/apiResponse'; import { ApiResponse } from '../model/apiResponse';
import { Pet } from '../model/pet'; import { Pet } from '../model/pet';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
import { OAuth } from '../model/models';
import { ApiKeyAuth } from '../model/models';
let defaultBasePath = 'http://petstore.swagger.io/v2'; let defaultBasePath = 'http://petstore.swagger.io/v2';
@ -83,7 +84,7 @@ export class PetApi {
* @summary Add a new pet to the store * @summary Add a new pet to the store
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public addPet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async addPet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet'; const localVarPath = this.basePath + '/pet';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -139,7 +140,7 @@ export class PetApi {
* @param petId Pet id to delete * @param petId Pet id to delete
* @param apiKey * @param apiKey
*/ */
public deletePet (petId: number, apiKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async deletePet (petId: number, apiKey?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}' const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -195,7 +196,7 @@ export class PetApi {
* @summary Finds Pets by status * @summary Finds Pets by status
* @param status Status values that need to be considered for filter * @param status Status values that need to be considered for filter
*/ */
public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> { public async findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByStatus'; const localVarPath = this.basePath + '/pet/findByStatus';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -254,7 +255,7 @@ export class PetApi {
* @summary Finds Pets by tags * @summary Finds Pets by tags
* @param tags Tags to filter by * @param tags Tags to filter by
*/ */
public findPetsByTags (tags: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> { public async findPetsByTags (tags: Array<string>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByTags'; const localVarPath = this.basePath + '/pet/findByTags';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -313,7 +314,7 @@ export class PetApi {
* @summary Find pet by ID * @summary Find pet by ID
* @param petId ID of pet to return * @param petId ID of pet to return
*/ */
public getPetById (petId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Pet; }> { public async getPetById (petId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Pet; }> {
const localVarPath = this.basePath + '/pet/{petId}' const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -369,7 +370,7 @@ export class PetApi {
* @summary Update an existing pet * @summary Update an existing pet
* @param body Pet object that needs to be added to the store * @param body Pet object that needs to be added to the store
*/ */
public updatePet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async updatePet (body: Pet, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet'; const localVarPath = this.basePath + '/pet';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -426,7 +427,7 @@ export class PetApi {
* @param name Updated name of the pet * @param name Updated name of the pet
* @param status Updated status of the pet * @param status Updated status of the pet
*/ */
public updatePetWithForm (petId: number, name?: string, status?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async updatePetWithForm (petId: number, name?: string, status?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}' const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -491,7 +492,7 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server * @param additionalMetadata Additional data to pass to server
* @param file file to upload * @param file file to upload
*/ */
public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> { public async uploadFile (petId: number, additionalMetadata?: string, file?: Buffer, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> {
const localVarPath = this.basePath + '/pet/{petId}/uploadImage' const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); .replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};

View File

@ -12,12 +12,12 @@
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
import { Order } from '../model/order'; import { Order } from '../model/order';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
import { ApiKeyAuth } from '../model/models';
let defaultBasePath = 'http://petstore.swagger.io/v2'; let defaultBasePath = 'http://petstore.swagger.io/v2';
@ -77,7 +77,7 @@ export class StoreApi {
* @summary Delete purchase order by ID * @summary Delete purchase order by ID
* @param orderId ID of the order that needs to be deleted * @param orderId ID of the order that needs to be deleted
*/ */
public deleteOrder (orderId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async deleteOrder (orderId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/store/order/{orderId}' const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -129,7 +129,7 @@ export class StoreApi {
* Returns a map of status codes to quantities * Returns a map of status codes to quantities
* @summary Returns pet inventories by status * @summary Returns pet inventories by status
*/ */
public getInventory (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { public async getInventory (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> {
const localVarPath = this.basePath + '/store/inventory'; const localVarPath = this.basePath + '/store/inventory';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -179,7 +179,7 @@ export class StoreApi {
* @summary Find purchase order by ID * @summary Find purchase order by ID
* @param orderId ID of pet that needs to be fetched * @param orderId ID of pet that needs to be fetched
*/ */
public getOrderById (orderId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> { public async getOrderById (orderId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order/{orderId}' const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -233,7 +233,7 @@ export class StoreApi {
* @summary Place an order for a pet * @summary Place an order for a pet
* @param body order placed for purchasing the pet * @param body order placed for purchasing the pet
*/ */
public placeOrder (body: Order, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> { public async placeOrder (body: Order, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order'; const localVarPath = this.basePath + '/store/order';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);

View File

@ -12,12 +12,11 @@
import localVarRequest = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird');
/* tslint:disable:no-unused-locals */ /* tslint:disable:no-unused-locals */
import { User } from '../model/user'; import { User } from '../model/user';
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models';
let defaultBasePath = 'http://petstore.swagger.io/v2'; let defaultBasePath = 'http://petstore.swagger.io/v2';
@ -75,7 +74,7 @@ export class UserApi {
* @summary Create user * @summary Create user
* @param body Created user object * @param body Created user object
*/ */
public createUser (body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async createUser (body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user'; const localVarPath = this.basePath + '/user';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -128,7 +127,7 @@ export class UserApi {
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithArrayInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async createUsersWithArrayInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/createWithArray'; const localVarPath = this.basePath + '/user/createWithArray';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -181,7 +180,7 @@ export class UserApi {
* @summary Creates list of users with given input array * @summary Creates list of users with given input array
* @param body List of user object * @param body List of user object
*/ */
public createUsersWithListInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async createUsersWithListInput (body: Array<User>, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/createWithList'; const localVarPath = this.basePath + '/user/createWithList';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -234,7 +233,7 @@ export class UserApi {
* @summary Delete user * @summary Delete user
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
*/ */
public deleteUser (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async deleteUser (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}' const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username))); .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -287,7 +286,7 @@ export class UserApi {
* @summary Get user by user name * @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing. * @param username The name that needs to be fetched. Use user1 for testing.
*/ */
public getUserByName (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: User; }> { public async getUserByName (username: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: User; }> {
const localVarPath = this.basePath + '/user/{username}' const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username))); .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
@ -342,7 +341,7 @@ export class UserApi {
* @param username The user name for login * @param username The user name for login
* @param password The password for login in clear text * @param password The password for login in clear text
*/ */
public loginUser (username: string, password: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: string; }> { public async loginUser (username: string, password: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: string; }> {
const localVarPath = this.basePath + '/user/login'; const localVarPath = this.basePath + '/user/login';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -407,7 +406,7 @@ export class UserApi {
* *
* @summary Logs out current logged in user session * @summary Logs out current logged in user session
*/ */
public logoutUser (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async logoutUser (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/logout'; const localVarPath = this.basePath + '/user/logout';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -455,7 +454,7 @@ export class UserApi {
* @param username name that need to be deleted * @param username name that need to be deleted
* @param body Updated user object * @param body Updated user object
*/ */
public updateUser (username: string, body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { public async updateUser (username: string, body: User, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}' const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username))); .replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};