forked from loafle/openapi-generator-original
Merge branch 'wing328-bherila-typescript-es6-promises'
This commit is contained in:
commit
96f90106ec
3
.gitignore
vendored
3
.gitignore
vendored
@ -107,3 +107,6 @@ samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
|
||||
samples/client/petstore/python/.coverage
|
||||
samples/client/petstore/python/.projectile
|
||||
samples/client/petstore/python/.venv/
|
||||
|
||||
# ts
|
||||
samples/client/petstore/typescript-node/npm/node_modules
|
||||
|
@ -89,7 +89,7 @@ public class CodegenConstants {
|
||||
public static final String MODEL_NAME_SUFFIX_DESC = "Suffix that will be appended to all model names. Default is the empty string.";
|
||||
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES = "optionalEmitDefaultValues";
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES_DESC = "Set DataMember's EmitDefaultValue, default false.";
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES_DESC = "Set DataMember's EmitDefaultValue.";
|
||||
|
||||
public static final String GIT_USER_ID = "gitUserId";
|
||||
public static final String GIT_USER_ID_DESC = "Git user ID, e.g. swagger-api.";
|
||||
@ -103,4 +103,6 @@ public class CodegenConstants {
|
||||
public static final String HTTP_USER_AGENT = "httpUserAgent";
|
||||
public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{packageVersion}}/{language}'";
|
||||
|
||||
public static final String SUPPORTS_ES6 = "supportsES6";
|
||||
public static final String SUPPORTS_ES6_DESC = "Generate code that conforms to ES6.";
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
protected String modelPropertyNaming= "camelCase";
|
||||
protected Boolean supportsES6 = true;
|
||||
|
||||
public AbstractTypeScriptClientCodegen() {
|
||||
super();
|
||||
@ -63,16 +64,22 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
typeMapping.put("UUID", "string");
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.SUPPORTS_ES6, CodegenConstants.SUPPORTS_ES6_DESC).defaultValue("false"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) {
|
||||
setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ES6)) {
|
||||
setSupportsES6(Boolean.valueOf((String)additionalProperties.get(CodegenConstants.SUPPORTS_ES6)));
|
||||
additionalProperties.put("supportsES6", getSupportsES6());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -286,4 +293,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
public void setSupportsES6(Boolean value) {
|
||||
supportsES6 = value;
|
||||
}
|
||||
|
||||
public Boolean getSupportsES6() {
|
||||
return supportsES6;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
import request = require('request');
|
||||
import promise = require('bluebird');
|
||||
import http = require('http');
|
||||
{{^supportsES6}}
|
||||
import promise = require('bluebird');
|
||||
{{/supportsES6}}
|
||||
|
||||
let defaultBasePath = '{{basePath}}';
|
||||
|
||||
// ===============================================
|
||||
// This file is autogenerated - Please do not edit
|
||||
@ -22,7 +26,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
|
||||
* {{{description}}}
|
||||
*/
|
||||
{{/description}}
|
||||
"{{name}}": {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
|
||||
'{{name}}': {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
@ -31,7 +35,7 @@ export namespace {{classname}} {
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}}
|
||||
{{.}} = <any> '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}}
|
||||
{{datatypeWithEnum}}_{{.}} = <any> '{{.}}'{{^-last}},{{/-last}}{{/values}}{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
@ -105,7 +109,7 @@ export enum {{classname}}ApiKeys {
|
||||
}
|
||||
|
||||
export class {{classname}} {
|
||||
protected basePath = '{{basePath}}';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -182,7 +186,7 @@ export class {{classname}} {
|
||||
* {{notes}}
|
||||
{{#allParams}}* @param {{paramName}} {{description}}
|
||||
{{/allParams}}*/
|
||||
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
|
||||
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
|
||||
const localVarPath = this.basePath + '{{path}}'{{#pathParams}}
|
||||
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
|
||||
let queryParameters: any = {};
|
||||
@ -216,8 +220,9 @@ export class {{classname}} {
|
||||
{{/isFile}}
|
||||
|
||||
{{/formParams}}
|
||||
{{^supportsES6}}
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>();
|
||||
|
||||
{{/supportsES6}}
|
||||
let requestOptions: request.Options = {
|
||||
method: '{{httpMethod}}',
|
||||
qs: queryParameters,
|
||||
@ -227,7 +232,7 @@ export class {{classname}} {
|
||||
{{#bodyParam}}
|
||||
body: {{paramName}},
|
||||
{{/bodyParam}}
|
||||
}
|
||||
};
|
||||
|
||||
{{#authMethods}}
|
||||
this.authentications.{{name}}.applyToRequest(requestOptions);
|
||||
@ -242,7 +247,7 @@ export class {{classname}} {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
{{^supportsES6}}
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -254,8 +259,23 @@ export class {{classname}} {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
{{/supportsES6}}
|
||||
{{#supportsES6}}
|
||||
return new Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject({ response: response, body: body });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
{{/supportsES6}}
|
||||
}
|
||||
{{/operation}}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": false,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"target": "ES5",
|
||||
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
|
||||
"moduleResolution": "node",
|
||||
"removeComments": true,
|
||||
"sourceMap": true,
|
||||
|
@ -8,6 +8,7 @@ import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen;
|
||||
|
||||
public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider {
|
||||
public static final String SUPPORTS_ES6_VALUE = "false";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
private static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
||||
@ -26,6 +27,7 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider
|
||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
||||
.put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE)
|
||||
.put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME)
|
||||
.put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION)
|
||||
.put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString())
|
||||
|
@ -7,6 +7,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TypeScriptAngularClientOptionsProvider implements OptionsProvider {
|
||||
public static final String SUPPORTS_ES6_VALUE = "false";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
||||
@ -20,6 +21,7 @@ public class TypeScriptAngularClientOptionsProvider implements OptionsProvider {
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
||||
.build();
|
||||
|
@ -9,6 +9,7 @@ import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen;
|
||||
|
||||
|
||||
public class TypeScriptNodeClientOptionsProvider implements OptionsProvider {
|
||||
public static final String SUPPORTS_ES6_VALUE = "false";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
||||
@ -26,6 +27,7 @@ public class TypeScriptNodeClientOptionsProvider implements OptionsProvider {
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
||||
.put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME)
|
||||
|
@ -30,6 +30,8 @@ public class TypeScriptAngularClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ public class TypeScriptAngular2ClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ public class TypeScriptNodeClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setModelPropertyNaming(TypeScriptNodeClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SUPPORTS_ES6_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,13 @@
|
||||
"main": "api.js",
|
||||
"scripts": {
|
||||
"postinstall": "tsd reinstall --overwrite",
|
||||
"test": "tsc",
|
||||
"test": "tsc --target ES6 && node client.js",
|
||||
"clean": "rm -Rf node_modules/ typings/ *.js"
|
||||
},
|
||||
"author": "Mads M. Tandrup",
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
"request": "^2.60.0",
|
||||
"angular": "^1.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -5,11 +5,20 @@
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"angularjs/angular.d.ts": {
|
||||
"angularjs/angular.d.ts": {
|
||||
"commit": "f6c8ca47193fb67947944a3170912672ac3e908e"
|
||||
},
|
||||
"jquery/jquery.d.ts": {
|
||||
"commit": "f6c8ca47193fb67947944a3170912672ac3e908e"
|
||||
},
|
||||
"request/request.d.ts": {
|
||||
"commit": "f6c8ca47193fb67947944a3170912672ac3e908e"
|
||||
},
|
||||
"form-data/form-data.d.ts": {
|
||||
"commit": "f6c8ca47193fb67947944a3170912672ac3e908e"
|
||||
},
|
||||
"node/node.d.ts": {
|
||||
"commit": "f6c8ca47193fb67947944a3170912672ac3e908e"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1188
samples/client/petstore/typescript-node/default/api.js
Normal file
1188
samples/client/petstore/typescript-node/default/api.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,8 @@
|
||||
import request = require('request');
|
||||
import promise = require('bluebird');
|
||||
import http = require('http');
|
||||
import promise = require('bluebird');
|
||||
|
||||
let defaultBasePath = 'http://petstore.swagger.io/v2';
|
||||
|
||||
// ===============================================
|
||||
// This file is autogenerated - Please do not edit
|
||||
@ -9,65 +11,65 @@ import http = require('http');
|
||||
/* tslint:disable:no-unused-variable */
|
||||
|
||||
export class Category {
|
||||
"id": number;
|
||||
"name": string;
|
||||
'id': number;
|
||||
'name': string;
|
||||
}
|
||||
|
||||
export class Order {
|
||||
"id": number;
|
||||
"petId": number;
|
||||
"quantity": number;
|
||||
"shipDate": Date;
|
||||
'id': number;
|
||||
'petId': number;
|
||||
'quantity': number;
|
||||
'shipDate': Date;
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
"status": Order.StatusEnum;
|
||||
"complete": boolean;
|
||||
'status': Order.StatusEnum;
|
||||
'complete': boolean;
|
||||
}
|
||||
|
||||
export namespace Order {
|
||||
export enum StatusEnum {
|
||||
placed = <any> 'placed',
|
||||
approved = <any> 'approved',
|
||||
delivered = <any> 'delivered'
|
||||
StatusEnum_placed = <any> 'placed',
|
||||
StatusEnum_approved = <any> 'approved',
|
||||
StatusEnum_delivered = <any> 'delivered'
|
||||
}
|
||||
}
|
||||
export class Pet {
|
||||
"id": number;
|
||||
"category": Category;
|
||||
"name": string;
|
||||
"photoUrls": Array<string>;
|
||||
"tags": Array<Tag>;
|
||||
'id': number;
|
||||
'category': Category;
|
||||
'name': string;
|
||||
'photoUrls': Array<string>;
|
||||
'tags': Array<Tag>;
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
"status": Pet.StatusEnum;
|
||||
'status': Pet.StatusEnum;
|
||||
}
|
||||
|
||||
export namespace Pet {
|
||||
export enum StatusEnum {
|
||||
available = <any> 'available',
|
||||
pending = <any> 'pending',
|
||||
sold = <any> 'sold'
|
||||
StatusEnum_available = <any> 'available',
|
||||
StatusEnum_pending = <any> 'pending',
|
||||
StatusEnum_sold = <any> 'sold'
|
||||
}
|
||||
}
|
||||
export class Tag {
|
||||
"id": number;
|
||||
"name": string;
|
||||
'id': number;
|
||||
'name': string;
|
||||
}
|
||||
|
||||
export class User {
|
||||
"id": number;
|
||||
"username": string;
|
||||
"firstName": string;
|
||||
"lastName": string;
|
||||
"email": string;
|
||||
"password": string;
|
||||
"phone": string;
|
||||
'id': number;
|
||||
'username': string;
|
||||
'firstName': string;
|
||||
'lastName': string;
|
||||
'email': string;
|
||||
'password': string;
|
||||
'phone': string;
|
||||
/**
|
||||
* User Status
|
||||
*/
|
||||
"userStatus": number;
|
||||
'userStatus': number;
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +126,7 @@ export enum PetApiApiKeys {
|
||||
}
|
||||
|
||||
export class PetApi {
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -176,7 +178,6 @@ export class PetApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -184,7 +185,7 @@ export class PetApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -197,7 +198,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -209,7 +209,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -236,14 +235,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -256,7 +254,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -268,7 +265,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -290,14 +286,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -310,7 +305,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -322,7 +316,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -344,14 +337,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -364,7 +356,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -376,7 +367,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -400,14 +390,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
@ -422,7 +411,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -434,7 +422,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -452,7 +439,6 @@ export class PetApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'PUT',
|
||||
qs: queryParameters,
|
||||
@ -460,7 +446,7 @@ export class PetApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -473,7 +459,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -485,7 +470,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -519,14 +503,13 @@ export class PetApi {
|
||||
}
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -539,7 +522,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -551,7 +533,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -586,14 +567,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -606,7 +586,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -618,7 +597,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
@ -627,7 +605,7 @@ export enum StoreApiApiKeys {
|
||||
}
|
||||
|
||||
export class StoreApi {
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -685,14 +663,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -703,7 +680,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -715,7 +691,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -732,14 +707,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
@ -752,7 +726,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -764,7 +737,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -788,14 +760,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -806,7 +777,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -818,7 +788,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -836,7 +805,6 @@ export class StoreApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -844,7 +812,7 @@ export class StoreApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -855,7 +823,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -867,7 +834,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
@ -876,7 +842,7 @@ export enum UserApiApiKeys {
|
||||
}
|
||||
|
||||
export class UserApi {
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -928,7 +894,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -936,7 +901,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -947,7 +912,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -959,7 +923,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -977,7 +940,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -985,7 +947,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -996,7 +958,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1008,7 +969,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1026,7 +986,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -1034,7 +993,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1045,7 +1004,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1057,7 +1015,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1081,14 +1038,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1099,7 +1055,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1111,7 +1066,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1135,14 +1089,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1153,7 +1106,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1165,7 +1117,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1192,14 +1143,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1210,7 +1160,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1222,7 +1171,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1239,14 +1187,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1257,7 +1204,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1269,7 +1215,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1294,7 +1239,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'PUT',
|
||||
qs: queryParameters,
|
||||
@ -1302,7 +1246,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1313,7 +1257,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1325,7 +1268,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
|
204
samples/client/petstore/typescript-node/npm/api.d.ts
vendored
Normal file
204
samples/client/petstore/typescript-node/npm/api.d.ts
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
import request = require('request');
|
||||
import http = require('http');
|
||||
export declare class Category {
|
||||
'id': number;
|
||||
'name': string;
|
||||
}
|
||||
export declare class Order {
|
||||
'id': number;
|
||||
'petId': number;
|
||||
'quantity': number;
|
||||
'shipDate': Date;
|
||||
'status': Order.StatusEnum;
|
||||
'complete': boolean;
|
||||
}
|
||||
export declare namespace Order {
|
||||
enum StatusEnum {
|
||||
StatusEnum_placed,
|
||||
StatusEnum_approved,
|
||||
StatusEnum_delivered,
|
||||
}
|
||||
}
|
||||
export declare class Pet {
|
||||
'id': number;
|
||||
'category': Category;
|
||||
'name': string;
|
||||
'photoUrls': Array<string>;
|
||||
'tags': Array<Tag>;
|
||||
'status': Pet.StatusEnum;
|
||||
}
|
||||
export declare namespace Pet {
|
||||
enum StatusEnum {
|
||||
StatusEnum_available,
|
||||
StatusEnum_pending,
|
||||
StatusEnum_sold,
|
||||
}
|
||||
}
|
||||
export declare class Tag {
|
||||
'id': number;
|
||||
'name': string;
|
||||
}
|
||||
export declare class User {
|
||||
'id': number;
|
||||
'username': string;
|
||||
'firstName': string;
|
||||
'lastName': string;
|
||||
'email': string;
|
||||
'password': string;
|
||||
'phone': string;
|
||||
'userStatus': number;
|
||||
}
|
||||
export interface Authentication {
|
||||
applyToRequest(requestOptions: request.Options): void;
|
||||
}
|
||||
export declare class HttpBasicAuth implements Authentication {
|
||||
username: string;
|
||||
password: string;
|
||||
applyToRequest(requestOptions: request.Options): void;
|
||||
}
|
||||
export declare class ApiKeyAuth implements Authentication {
|
||||
private location;
|
||||
private paramName;
|
||||
apiKey: string;
|
||||
constructor(location: string, paramName: string);
|
||||
applyToRequest(requestOptions: request.Options): void;
|
||||
}
|
||||
export declare class OAuth implements Authentication {
|
||||
accessToken: string;
|
||||
applyToRequest(requestOptions: request.Options): void;
|
||||
}
|
||||
export declare class VoidAuth implements Authentication {
|
||||
username: string;
|
||||
password: string;
|
||||
applyToRequest(requestOptions: request.Options): void;
|
||||
}
|
||||
export declare enum PetApiApiKeys {
|
||||
api_key = 0,
|
||||
}
|
||||
export declare class PetApi {
|
||||
protected basePath: string;
|
||||
protected defaultHeaders: any;
|
||||
protected authentications: {
|
||||
'default': Authentication;
|
||||
'api_key': ApiKeyAuth;
|
||||
'petstore_auth': OAuth;
|
||||
};
|
||||
constructor(basePath?: string);
|
||||
setApiKey(key: PetApiApiKeys, value: string): void;
|
||||
accessToken: string;
|
||||
private extendObj<T1, T2>(objA, objB);
|
||||
addPet(body?: Pet): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
deletePet(petId: number, apiKey?: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
findPetsByStatus(status?: Array<string>): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: Array<Pet>;
|
||||
}>;
|
||||
findPetsByTags(tags?: Array<string>): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: Array<Pet>;
|
||||
}>;
|
||||
getPetById(petId: number): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: Pet;
|
||||
}>;
|
||||
updatePet(body?: Pet): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
updatePetWithForm(petId: string, name?: string, status?: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
uploadFile(petId: number, additionalMetadata?: string, file?: any): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
}
|
||||
export declare enum StoreApiApiKeys {
|
||||
api_key = 0,
|
||||
}
|
||||
export declare class StoreApi {
|
||||
protected basePath: string;
|
||||
protected defaultHeaders: any;
|
||||
protected authentications: {
|
||||
'default': Authentication;
|
||||
'api_key': ApiKeyAuth;
|
||||
'petstore_auth': OAuth;
|
||||
};
|
||||
constructor(basePath?: string);
|
||||
setApiKey(key: StoreApiApiKeys, value: string): void;
|
||||
accessToken: string;
|
||||
private extendObj<T1, T2>(objA, objB);
|
||||
deleteOrder(orderId: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
getInventory(): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: {
|
||||
[key: string]: number;
|
||||
};
|
||||
}>;
|
||||
getOrderById(orderId: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: Order;
|
||||
}>;
|
||||
placeOrder(body?: Order): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: Order;
|
||||
}>;
|
||||
}
|
||||
export declare enum UserApiApiKeys {
|
||||
api_key = 0,
|
||||
}
|
||||
export declare class UserApi {
|
||||
protected basePath: string;
|
||||
protected defaultHeaders: any;
|
||||
protected authentications: {
|
||||
'default': Authentication;
|
||||
'api_key': ApiKeyAuth;
|
||||
'petstore_auth': OAuth;
|
||||
};
|
||||
constructor(basePath?: string);
|
||||
setApiKey(key: UserApiApiKeys, value: string): void;
|
||||
accessToken: string;
|
||||
private extendObj<T1, T2>(objA, objB);
|
||||
createUser(body?: User): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
createUsersWithArrayInput(body?: Array<User>): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
createUsersWithListInput(body?: Array<User>): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
deleteUser(username: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
getUserByName(username: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: User;
|
||||
}>;
|
||||
loginUser(username?: string, password?: string): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: string;
|
||||
}>;
|
||||
logoutUser(): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
updateUser(username: string, body?: User): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
}
|
1070
samples/client/petstore/typescript-node/npm/api.js
Normal file
1070
samples/client/petstore/typescript-node/npm/api.js
Normal file
File diff suppressed because it is too large
Load Diff
1
samples/client/petstore/typescript-node/npm/api.js.map
Normal file
1
samples/client/petstore/typescript-node/npm/api.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,8 @@
|
||||
import request = require('request');
|
||||
import promise = require('bluebird');
|
||||
import http = require('http');
|
||||
import promise = require('bluebird');
|
||||
|
||||
let defaultBasePath = 'http://petstore.swagger.io/v2';
|
||||
|
||||
// ===============================================
|
||||
// This file is autogenerated - Please do not edit
|
||||
@ -9,65 +11,65 @@ import http = require('http');
|
||||
/* tslint:disable:no-unused-variable */
|
||||
|
||||
export class Category {
|
||||
"id": number;
|
||||
"name": string;
|
||||
'id': number;
|
||||
'name': string;
|
||||
}
|
||||
|
||||
export class Order {
|
||||
"id": number;
|
||||
"petId": number;
|
||||
"quantity": number;
|
||||
"shipDate": Date;
|
||||
'id': number;
|
||||
'petId': number;
|
||||
'quantity': number;
|
||||
'shipDate': Date;
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
"status": Order.StatusEnum;
|
||||
"complete": boolean;
|
||||
'status': Order.StatusEnum;
|
||||
'complete': boolean;
|
||||
}
|
||||
|
||||
export namespace Order {
|
||||
export enum StatusEnum {
|
||||
placed = <any> 'placed',
|
||||
approved = <any> 'approved',
|
||||
delivered = <any> 'delivered'
|
||||
StatusEnum_placed = <any> 'placed',
|
||||
StatusEnum_approved = <any> 'approved',
|
||||
StatusEnum_delivered = <any> 'delivered'
|
||||
}
|
||||
}
|
||||
export class Pet {
|
||||
"id": number;
|
||||
"category": Category;
|
||||
"name": string;
|
||||
"photoUrls": Array<string>;
|
||||
"tags": Array<Tag>;
|
||||
'id': number;
|
||||
'category': Category;
|
||||
'name': string;
|
||||
'photoUrls': Array<string>;
|
||||
'tags': Array<Tag>;
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
"status": Pet.StatusEnum;
|
||||
'status': Pet.StatusEnum;
|
||||
}
|
||||
|
||||
export namespace Pet {
|
||||
export enum StatusEnum {
|
||||
available = <any> 'available',
|
||||
pending = <any> 'pending',
|
||||
sold = <any> 'sold'
|
||||
StatusEnum_available = <any> 'available',
|
||||
StatusEnum_pending = <any> 'pending',
|
||||
StatusEnum_sold = <any> 'sold'
|
||||
}
|
||||
}
|
||||
export class Tag {
|
||||
"id": number;
|
||||
"name": string;
|
||||
'id': number;
|
||||
'name': string;
|
||||
}
|
||||
|
||||
export class User {
|
||||
"id": number;
|
||||
"username": string;
|
||||
"firstName": string;
|
||||
"lastName": string;
|
||||
"email": string;
|
||||
"password": string;
|
||||
"phone": string;
|
||||
'id': number;
|
||||
'username': string;
|
||||
'firstName': string;
|
||||
'lastName': string;
|
||||
'email': string;
|
||||
'password': string;
|
||||
'phone': string;
|
||||
/**
|
||||
* User Status
|
||||
*/
|
||||
"userStatus": number;
|
||||
'userStatus': number;
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +126,7 @@ export enum PetApiApiKeys {
|
||||
}
|
||||
|
||||
export class PetApi {
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -176,7 +178,6 @@ export class PetApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -184,7 +185,7 @@ export class PetApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -197,7 +198,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -209,7 +209,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -236,14 +235,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -256,7 +254,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -268,7 +265,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -290,14 +286,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -310,7 +305,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -322,7 +316,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -344,14 +337,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -364,7 +356,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -376,7 +367,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -400,14 +390,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
@ -422,7 +411,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -434,7 +422,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -452,7 +439,6 @@ export class PetApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'PUT',
|
||||
qs: queryParameters,
|
||||
@ -460,7 +446,7 @@ export class PetApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -473,7 +459,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -485,7 +470,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -519,14 +503,13 @@ export class PetApi {
|
||||
}
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
headers: headerParams,
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -539,7 +522,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -551,7 +533,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -586,14 +567,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
@ -606,7 +586,6 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -618,7 +597,6 @@ export class PetApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
@ -627,7 +605,7 @@ export enum StoreApiApiKeys {
|
||||
}
|
||||
|
||||
export class StoreApi {
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -685,14 +663,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -703,7 +680,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -715,7 +691,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -732,14 +707,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
@ -752,7 +726,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -764,7 +737,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -788,14 +760,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -806,7 +777,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -818,7 +788,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -836,7 +805,6 @@ export class StoreApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -844,7 +812,7 @@ export class StoreApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -855,7 +823,6 @@ export class StoreApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -867,7 +834,6 @@ export class StoreApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
@ -876,7 +842,7 @@ export enum UserApiApiKeys {
|
||||
}
|
||||
|
||||
export class UserApi {
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
protected basePath = defaultBasePath;
|
||||
protected defaultHeaders : any = {};
|
||||
|
||||
protected authentications = {
|
||||
@ -928,7 +894,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -936,7 +901,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -947,7 +912,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -959,7 +923,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -977,7 +940,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -985,7 +947,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -996,7 +958,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1008,7 +969,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1026,7 +986,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'POST',
|
||||
qs: queryParameters,
|
||||
@ -1034,7 +993,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1045,7 +1004,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1057,7 +1015,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1081,14 +1038,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1099,7 +1055,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1111,7 +1066,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1135,14 +1089,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1153,7 +1106,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1165,7 +1117,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1192,14 +1143,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1210,7 +1160,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1222,7 +1171,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1239,14 +1187,13 @@ 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,
|
||||
json: true,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1257,7 +1204,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1269,7 +1215,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
/**
|
||||
@ -1294,7 +1239,6 @@ export class UserApi {
|
||||
let useFormData = false;
|
||||
|
||||
let localVarDeferred = promise.defer<{ response: http.ClientResponse; body?: any; }>();
|
||||
|
||||
let requestOptions: request.Options = {
|
||||
method: 'PUT',
|
||||
qs: queryParameters,
|
||||
@ -1302,7 +1246,7 @@ export class UserApi {
|
||||
uri: localVarPath,
|
||||
json: true,
|
||||
body: body,
|
||||
}
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
@ -1313,7 +1257,6 @@ export class UserApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
localVarDeferred.reject(error);
|
||||
@ -1325,7 +1268,6 @@ export class UserApi {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return localVarDeferred.promise;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@swagger/angular2-typescript-petstore",
|
||||
"version": "0.0.1-SNAPSHOT.201605022215",
|
||||
"version": "0.0.1-SNAPSHOT.201605031634",
|
||||
"description": "NodeJS client for @swagger/angular2-typescript-petstore",
|
||||
"main": "api.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user