forked from loafle/openapi-generator-original
Move changes to samples to source code. Build, run, test.
This commit is contained in:
parent
abf28797a4
commit
449e74b873
@ -5,8 +5,10 @@
|
||||
"repository": "{{gitUserId}}/{{gitRepoId}}",
|
||||
"main": "api.js",
|
||||
"scripts": {
|
||||
"postinstall": "typings install",
|
||||
"clean": "rm -Rf node_modules/ typings/ *.js",
|
||||
"build": "typings install && tsc"
|
||||
"build": "tsc",
|
||||
"test": "npm run build && node client.js"
|
||||
},
|
||||
"author": "Swagger Codegen Contributors",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -10,9 +10,10 @@
|
||||
"noLib": false,
|
||||
"declaration": true
|
||||
},
|
||||
"files": [
|
||||
"api.ts",
|
||||
"typings/main.d.ts"
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"typings/browser",
|
||||
"typings/browser.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"bluebird": "registry:dt/bluebird#2.0.0+20160319051630",
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
|
||||
"node": "registry:dt/node#4.0.0+20160423143914"
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "registry:npm/bluebird#3.3.4+20160515010139",
|
||||
"request": "registry:npm/request#2.69.0+20160304121250"
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import request = require('request');
|
||||
import http = require('http');
|
||||
import Promise = require('bluebird');
|
||||
export declare class Category {
|
||||
'id': number;
|
||||
'name': string;
|
||||
@ -78,12 +79,14 @@ export declare enum PetApiApiKeys {
|
||||
export declare class PetApi {
|
||||
protected basePath: string;
|
||||
protected defaultHeaders: any;
|
||||
protected _useQuerystring: boolean;
|
||||
protected authentications: {
|
||||
'default': Authentication;
|
||||
'petstore_auth': OAuth;
|
||||
'api_key': ApiKeyAuth;
|
||||
};
|
||||
constructor(basePath?: string);
|
||||
useQuerystring: boolean;
|
||||
setApiKey(key: PetApiApiKeys, value: string): void;
|
||||
accessToken: string;
|
||||
private extendObj<T1, T2>(objA, objB);
|
||||
@ -126,12 +129,14 @@ export declare enum StoreApiApiKeys {
|
||||
export declare class StoreApi {
|
||||
protected basePath: string;
|
||||
protected defaultHeaders: any;
|
||||
protected _useQuerystring: boolean;
|
||||
protected authentications: {
|
||||
'default': Authentication;
|
||||
'petstore_auth': OAuth;
|
||||
'api_key': ApiKeyAuth;
|
||||
};
|
||||
constructor(basePath?: string);
|
||||
useQuerystring: boolean;
|
||||
setApiKey(key: StoreApiApiKeys, value: string): void;
|
||||
accessToken: string;
|
||||
private extendObj<T1, T2>(objA, objB);
|
||||
@ -160,12 +165,14 @@ export declare enum UserApiApiKeys {
|
||||
export declare class UserApi {
|
||||
protected basePath: string;
|
||||
protected defaultHeaders: any;
|
||||
protected _useQuerystring: boolean;
|
||||
protected authentications: {
|
||||
'default': Authentication;
|
||||
'petstore_auth': OAuth;
|
||||
'api_key': ApiKeyAuth;
|
||||
};
|
||||
constructor(basePath?: string);
|
||||
useQuerystring: boolean;
|
||||
setApiKey(key: UserApiApiKeys, value: string): void;
|
||||
accessToken: string;
|
||||
private extendObj<T1, T2>(objA, objB);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import request = require('request');
|
||||
import http = require('http');
|
||||
import promise = require('bluebird');
|
||||
import Promise = require('bluebird');
|
||||
|
||||
let defaultBasePath = 'http://petstore.swagger.io/v2';
|
||||
|
||||
@ -128,11 +128,12 @@ export enum PetApiApiKeys {
|
||||
export class PetApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
protected authentications = {
|
||||
'default': <Authentication>new VoidAuth(),
|
||||
'api_key': new ApiKeyAuth('header', 'api_key'),
|
||||
'petstore_auth': new OAuth(),
|
||||
'api_key': new ApiKeyAuth('header', 'api_key'),
|
||||
}
|
||||
|
||||
constructor(basePath?: string);
|
||||
@ -148,6 +149,10 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
|
||||
set useQuerystring(value: boolean) {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
public setApiKey(key: PetApiApiKeys, value: string) {
|
||||
this.authentications[PetApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -177,12 +182,12 @@ export class PetApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -198,18 +203,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Deletes a pet
|
||||
@ -234,12 +240,12 @@ export class PetApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'DELETE',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -254,18 +260,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Finds Pets by status
|
||||
@ -285,12 +292,12 @@ export class PetApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Array<Pet>; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -305,18 +312,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: Array<Pet>; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
@ -336,12 +344,12 @@ export class PetApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Array<Pet>; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -356,18 +364,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: Array<Pet>; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Find pet by ID
|
||||
@ -389,19 +398,19 @@ export class PetApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Pet; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
if (Object.keys(formParams).length) {
|
||||
@ -411,18 +420,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: Pet; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Update an existing pet
|
||||
@ -438,12 +448,12 @@ export class PetApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'PUT',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -459,18 +469,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
@ -502,12 +513,12 @@ export class PetApi {
|
||||
formParams['status'] = status;
|
||||
}
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -522,18 +533,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
@ -566,12 +578,12 @@ export class PetApi {
|
||||
}
|
||||
useFormData = true;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -586,18 +598,19 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
export enum StoreApiApiKeys {
|
||||
@ -607,11 +620,12 @@ export enum StoreApiApiKeys {
|
||||
export class StoreApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
protected authentications = {
|
||||
'default': <Authentication>new VoidAuth(),
|
||||
'api_key': new ApiKeyAuth('header', 'api_key'),
|
||||
'petstore_auth': new OAuth(),
|
||||
'api_key': new ApiKeyAuth('header', 'api_key'),
|
||||
}
|
||||
|
||||
constructor(basePath?: string);
|
||||
@ -627,6 +641,10 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
|
||||
set useQuerystring(value: boolean) {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
public setApiKey(key: StoreApiApiKeys, value: string) {
|
||||
this.authentications[StoreApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -662,12 +680,12 @@ export class StoreApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'DELETE',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -680,18 +698,19 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
@ -706,12 +725,12 @@ export class StoreApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: { [key: string]: number; }; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -726,18 +745,19 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
@ -759,12 +779,12 @@ export class StoreApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -777,18 +797,19 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Place an order for a pet
|
||||
@ -804,12 +825,12 @@ export class StoreApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -823,18 +844,19 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
export enum UserApiApiKeys {
|
||||
@ -844,11 +866,12 @@ export enum UserApiApiKeys {
|
||||
export class UserApi {
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
protected _useQuerystring : boolean = false;
|
||||
|
||||
protected authentications = {
|
||||
'default': <Authentication>new VoidAuth(),
|
||||
'api_key': new ApiKeyAuth('header', 'api_key'),
|
||||
'petstore_auth': new OAuth(),
|
||||
'api_key': new ApiKeyAuth('header', 'api_key'),
|
||||
}
|
||||
|
||||
constructor(basePath?: string);
|
||||
@ -864,6 +887,10 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
|
||||
set useQuerystring(value: boolean) {
|
||||
this._useQuerystring = value;
|
||||
}
|
||||
|
||||
public setApiKey(key: UserApiApiKeys, value: string) {
|
||||
this.authentications[UserApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
@ -893,12 +920,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -912,18 +939,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@ -939,12 +967,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -958,18 +986,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
@ -985,12 +1014,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -1004,18 +1033,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Delete user
|
||||
@ -1037,12 +1067,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'DELETE',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -1055,18 +1085,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Get user by user name
|
||||
@ -1088,12 +1119,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: User; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -1106,18 +1137,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: User; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Logs user into the system
|
||||
@ -1142,12 +1174,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: string; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -1160,18 +1192,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body: string; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
@ -1186,12 +1219,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'GET',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
};
|
||||
|
||||
@ -1204,18 +1237,19 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
* Updated user
|
||||
@ -1238,12 +1272,12 @@ export class UserApi {
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
let requestOptions: request.Options = {
|
||||
method: 'PUT',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: body,
|
||||
};
|
||||
@ -1257,17 +1291,18 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
localVarDeferred.resolve({ response: response, body: body });
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
localVarDeferred.reject({ response: response, body: body });
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@swagger/angular2-typescript-petstore",
|
||||
"version": "0.0.1-SNAPSHOT.201605191812",
|
||||
"version": "0.0.1-SNAPSHOT.201605241654",
|
||||
"description": "NodeJS client for @swagger/angular2-typescript-petstore",
|
||||
"repository": "GIT_USER_ID/GIT_REPO_ID",
|
||||
"main": "api.js",
|
||||
|
@ -7,4 +7,4 @@
|
||||
"bluebird": "registry:npm/bluebird#3.3.4+20160515010139",
|
||||
"request": "registry:npm/request#2.69.0+20160304121250"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user