mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Ts node angular2 typings (#6178)
* removed typings for typescript-node language and updated typescript version * updated sample of typescript-node by running .\bin\windows\typescript-node.bat
This commit is contained in:
parent
e807b81471
commit
f9eaef8f24
@ -77,7 +77,6 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
||||
|
||||
//Files for building our lib
|
||||
supportingFiles.add(new SupportingFile("package.mustache", getPackageRootDirectory(), "package.json"));
|
||||
supportingFiles.add(new SupportingFile("typings.mustache", getPackageRootDirectory(), "typings.json"));
|
||||
supportingFiles.add(new SupportingFile("tsconfig.mustache", getPackageRootDirectory(), "tsconfig.json"));
|
||||
}
|
||||
|
||||
|
@ -4,21 +4,22 @@
|
||||
"description": "NodeJS client for {{npmName}}",
|
||||
"repository": "{{gitUserId}}/{{gitRepoId}}",
|
||||
"main": "api.js",
|
||||
"types": "api.d.ts",
|
||||
"scripts": {
|
||||
"postinstall": "typings install",
|
||||
"clean": "rm -Rf node_modules/ typings/ *.js",
|
||||
"clean": "rm -Rf node_modules/ *.js",
|
||||
"build": "tsc",
|
||||
"test": "npm run build && node client.js"
|
||||
},
|
||||
"author": "Swagger Codegen Contributors",
|
||||
"license": "Unlicense",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.3.5",
|
||||
"request": "^2.72.0"
|
||||
"bluebird": "^3.5.0",
|
||||
"request": "^2.81.0",
|
||||
"@types/bluebird": "*",
|
||||
"@types/request": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^0.8.1"
|
||||
"typescript": "^2.4.2"
|
||||
}{{#npmRepository}},
|
||||
"publishConfig":{
|
||||
"registry":"{{npmRepository}}"
|
||||
|
@ -8,12 +8,11 @@
|
||||
"removeComments": true,
|
||||
"sourceMap": true,
|
||||
"noLib": false,
|
||||
"declaration": true
|
||||
"declaration": true,
|
||||
"lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"typings/browser",
|
||||
"typings/browser.d.ts"
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"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,9 +1,9 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@wordnik.com
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
@ -136,6 +136,41 @@ class ObjectSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
export class ApiResponse {
|
||||
'code': number;
|
||||
'type': string;
|
||||
'message': string;
|
||||
|
||||
static discriminator = undefined;
|
||||
|
||||
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
|
||||
{
|
||||
"name": "code",
|
||||
"baseName": "code",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"baseName": "type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"baseName": "message",
|
||||
"type": "string"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return ApiResponse.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
*/
|
||||
export class Category {
|
||||
'id': number;
|
||||
'name': string;
|
||||
@ -159,6 +194,9 @@ export class Category {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
*/
|
||||
export class Order {
|
||||
'id': number;
|
||||
'petId': number;
|
||||
@ -216,6 +254,9 @@ export namespace Order {
|
||||
Delivered = <any> 'delivered'
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
*/
|
||||
export class Pet {
|
||||
'id': number;
|
||||
'category': Category;
|
||||
@ -273,6 +314,9 @@ export namespace Pet {
|
||||
Sold = <any> 'sold'
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A tag for a pet
|
||||
*/
|
||||
export class Tag {
|
||||
'id': number;
|
||||
'name': string;
|
||||
@ -296,6 +340,9 @@ export class Tag {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
*/
|
||||
export class User {
|
||||
'id': number;
|
||||
'username': string;
|
||||
@ -365,6 +412,7 @@ let enumsMap = {
|
||||
}
|
||||
|
||||
let typeMap = {
|
||||
"ApiResponse": ApiResponse,
|
||||
"Category": Category,
|
||||
"Order": Order,
|
||||
"Pet": Pet,
|
||||
@ -478,13 +526,18 @@ export class PetApi {
|
||||
* @summary Add a new pet to the store
|
||||
* @param body Pet object that needs to be added to the store
|
||||
*/
|
||||
public addPet (body?: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public addPet (body: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/pet';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling addPet.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
@ -585,13 +638,18 @@ export class PetApi {
|
||||
* @summary Finds Pets by status
|
||||
* @param status Status values that need to be considered for filter
|
||||
*/
|
||||
public findPetsByStatus (status?: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
|
||||
public findPetsByStatus (status: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
|
||||
const localVarPath = this.basePath + '/pet/findByStatus';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'status' is not null or undefined
|
||||
if (status === null || status === undefined) {
|
||||
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
|
||||
}
|
||||
|
||||
if (status !== undefined) {
|
||||
queryParameters['status'] = ObjectSerializer.serialize(status, "Array<string>");
|
||||
}
|
||||
@ -639,13 +697,18 @@ export class PetApi {
|
||||
* @summary Finds Pets by tags
|
||||
* @param tags Tags to filter by
|
||||
*/
|
||||
public findPetsByTags (tags?: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
|
||||
public findPetsByTags (tags: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
|
||||
const localVarPath = this.basePath + '/pet/findByTags';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'tags' is not null or undefined
|
||||
if (tags === null || tags === undefined) {
|
||||
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
|
||||
}
|
||||
|
||||
if (tags !== undefined) {
|
||||
queryParameters['tags'] = ObjectSerializer.serialize(tags, "Array<string>");
|
||||
}
|
||||
@ -689,9 +752,9 @@ export class PetApi {
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
* Returns a single pet
|
||||
* @summary Find pet by ID
|
||||
* @param petId ID of pet that needs to be fetched
|
||||
* @param petId ID of pet to return
|
||||
*/
|
||||
public getPetById (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> {
|
||||
const localVarPath = this.basePath + '/pet/{petId}'
|
||||
@ -720,8 +783,6 @@ export class PetApi {
|
||||
|
||||
this.authentications.api_key.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.petstore_auth.applyToRequest(requestOptions);
|
||||
|
||||
this.authentications.default.applyToRequest(requestOptions);
|
||||
|
||||
if (Object.keys(formParams).length) {
|
||||
@ -751,13 +812,18 @@ export class PetApi {
|
||||
* @summary Update an existing pet
|
||||
* @param body Pet object that needs to be added to the store
|
||||
*/
|
||||
public updatePet (body?: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public updatePet (body: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/pet';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling updatePet.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
@ -803,7 +869,7 @@ export class PetApi {
|
||||
* @param name Updated name of the pet
|
||||
* @param status Updated status of the pet
|
||||
*/
|
||||
public updatePetWithForm (petId: string, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/pet/{petId}'
|
||||
.replace('{' + 'petId' + '}', String(petId));
|
||||
let queryParameters: any = {};
|
||||
@ -868,7 +934,7 @@ export class PetApi {
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
*/
|
||||
public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> {
|
||||
const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
|
||||
.replace('{' + 'petId' + '}', String(petId));
|
||||
let queryParameters: any = {};
|
||||
@ -913,11 +979,12 @@ export class PetApi {
|
||||
requestOptions.form = formParams;
|
||||
}
|
||||
}
|
||||
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
|
||||
return new Promise<{ response: http.ClientResponse; body: ApiResponse; }>((resolve, reject) => {
|
||||
request(requestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
body = ObjectSerializer.deserialize(body, "ApiResponse");
|
||||
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
@ -1086,7 +1153,7 @@ export class StoreApi {
|
||||
* @summary Find purchase order by ID
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
*/
|
||||
public getOrderById (orderId: string) : Promise<{ response: http.ClientResponse; body: Order; }> {
|
||||
public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> {
|
||||
const localVarPath = this.basePath + '/store/order/{orderId}'
|
||||
.replace('{' + 'orderId' + '}', String(orderId));
|
||||
let queryParameters: any = {};
|
||||
@ -1140,13 +1207,18 @@ export class StoreApi {
|
||||
* @summary Place an order for a pet
|
||||
* @param body order placed for purchasing the pet
|
||||
*/
|
||||
public placeOrder (body?: Order) : Promise<{ response: http.ClientResponse; body: Order; }> {
|
||||
public placeOrder (body: Order) : Promise<{ response: http.ClientResponse; body: Order; }> {
|
||||
const localVarPath = this.basePath + '/store/order';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
@ -1241,13 +1313,18 @@ export class UserApi {
|
||||
* @summary Create user
|
||||
* @param body Created user object
|
||||
*/
|
||||
public createUser (body?: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public createUser (body: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling createUser.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
@ -1289,13 +1366,18 @@ export class UserApi {
|
||||
* @summary Creates list of users with given input array
|
||||
* @param body List of user object
|
||||
*/
|
||||
public createUsersWithArrayInput (body?: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public createUsersWithArrayInput (body: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/createWithArray';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
@ -1337,13 +1419,18 @@ export class UserApi {
|
||||
* @summary Creates list of users with given input array
|
||||
* @param body List of user object
|
||||
*/
|
||||
public createUsersWithListInput (body?: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public createUsersWithListInput (body: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/createWithList';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
@ -1493,13 +1580,23 @@ export class UserApi {
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
*/
|
||||
public loginUser (username?: string, password?: string) : Promise<{ response: http.ClientResponse; body: string; }> {
|
||||
public loginUser (username: string, password: string) : Promise<{ response: http.ClientResponse; body: string; }> {
|
||||
const localVarPath = this.basePath + '/user/login';
|
||||
let queryParameters: any = {};
|
||||
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
|
||||
let formParams: any = {};
|
||||
|
||||
|
||||
// verify required parameter 'username' is not null or undefined
|
||||
if (username === null || username === undefined) {
|
||||
throw new Error('Required parameter username was null or undefined when calling loginUser.');
|
||||
}
|
||||
|
||||
// verify required parameter 'password' is not null or undefined
|
||||
if (password === null || password === undefined) {
|
||||
throw new Error('Required parameter password was null or undefined when calling loginUser.');
|
||||
}
|
||||
|
||||
if (username !== undefined) {
|
||||
queryParameters['username'] = ObjectSerializer.serialize(username, "string");
|
||||
}
|
||||
@ -1596,7 +1693,7 @@ export class UserApi {
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
*/
|
||||
public updateUser (username: string, body?: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
public updateUser (username: string, body: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/{username}'
|
||||
.replace('{' + 'username' + '}', String(username));
|
||||
let queryParameters: any = {};
|
||||
@ -1609,6 +1706,11 @@ export class UserApi {
|
||||
throw new Error('Required parameter username was null or undefined when calling updateUser.');
|
||||
}
|
||||
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new Error('Required parameter body was null or undefined when calling updateUser.');
|
||||
}
|
||||
|
||||
|
||||
let useFormData = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user