remove line break in TS methods' comment

This commit is contained in:
wing328 2015-11-12 16:13:10 +08:00
parent 52320e5f71
commit cbc63d3285
12 changed files with 245 additions and 1031 deletions

View File

@ -37,8 +37,7 @@ namespace {{package}} {
* {{summary}}
* {{notes}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}
*/
{{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
const path = this.basePath + '{{path}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};

View File

@ -171,8 +171,7 @@ export class {{classname}} {
* {{summary}}
* {{notes}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}
*/
{{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
const path = this.url + this.basePath + '{{path}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};

View File

@ -3,22 +3,11 @@
namespace API.Client {
'use strict';
export interface Category {
id?: number;
name?: string;
}
}

View File

@ -3,65 +3,30 @@
namespace API.Client {
'use strict';
export interface Order {
id?: number;
petId?: number;
quantity?: number;
shipDate?: Date;
/**
* Order Status
*/
status?: Order.StatusEnum;
complete?: boolean;
}
export namespace Order {
export enum StatusEnum {
placed = <any> 'placed',
approved = <any> 'approved',
delivered = <any> 'delivered',
}
}
}

View File

@ -3,65 +3,30 @@
namespace API.Client {
'use strict';
export interface Pet {
id?: number;
category?: Category;
name: string;
photoUrls: Array<string>;
tags?: Array<Tag>;
/**
* pet status in the store
*/
status?: Pet.StatusEnum;
}
export namespace Pet {
export enum StatusEnum {
available = <any> 'available',
pending = <any> 'pending',
sold = <any> 'sold',
}
}
}

View File

@ -2,11 +2,9 @@
/* tslint:disable:no-unused-variable member-ordering */
namespace API.Client {
'use strict';
export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : any = {};
@ -28,26 +26,16 @@ namespace API.Client {
return <T1&T2>objA;
}
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
*/
public updatePet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'PUT',
url: path,
@ -65,26 +53,16 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
*/
public addPet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -102,31 +80,20 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma seperated strings
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus (status?: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<Pet>> {
const path = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
if (status !== undefined) {
queryParameters['status'] = status;
}
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -143,31 +110,20 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
public findPetsByTags (tags?: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<Pet>> {
const path = this.basePath + '/pet/findByTags';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
if (tags !== undefined) {
queryParameters['tags'] = tags;
}
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -184,12 +140,10 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
*/
public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<Pet> {
const path = this.basePath + '/pet/{petId}'
@ -197,19 +151,10 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling getPetById');
}
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -226,14 +171,12 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/pet/{petId}'
@ -241,35 +184,18 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling updatePetWithForm');
}
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['name'] = name;
formParams['status'] = status;
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -287,13 +213,11 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/pet/{petId}'
@ -301,24 +225,12 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling deletePet');
}
headerParams['api_key'] = apiKey;
let httpRequestParams: any = {
method: 'DELETE',
url: path,
@ -335,14 +247,12 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/pet/{petId}/uploadImage'
@ -350,35 +260,18 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling uploadFile');
}
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['additionalMetadata'] = additionalMetadata;
formParams['file'] = file;
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -396,7 +289,5 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
}
}

View File

@ -2,11 +2,9 @@
/* tslint:disable:no-unused-variable member-ordering */
namespace API.Client {
'use strict';
export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : any = {};
@ -28,23 +26,15 @@ namespace API.Client {
return <T1&T2>objA;
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
*/
public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> {
const path = this.basePath + '/store/inventory';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -61,26 +51,16 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
*/
public placeOrder (body?: Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<Order> {
const path = this.basePath + '/store/order';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -98,12 +78,10 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<Order> {
const path = this.basePath + '/store/order/{orderId}'
@ -111,19 +89,10 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -140,12 +109,10 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/store/order/{orderId}'
@ -153,19 +120,10 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
let httpRequestParams: any = {
method: 'DELETE',
url: path,
@ -182,7 +140,5 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
}
}

View File

@ -3,22 +3,11 @@
namespace API.Client {
'use strict';
export interface Tag {
id?: number;
name?: string;
}
}

View File

@ -3,50 +3,26 @@
namespace API.Client {
'use strict';
export interface User {
id?: number;
username?: string;
firstName?: string;
lastName?: string;
email?: string;
password?: string;
phone?: string;
/**
* User Status
*/
userStatus?: number;
}
}

View File

@ -2,11 +2,9 @@
/* tslint:disable:no-unused-variable member-ordering */
namespace API.Client {
'use strict';
export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders : any = {};
@ -28,26 +26,16 @@ namespace API.Client {
return <T1&T2>objA;
}
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object
*/
public createUser (body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/user';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -65,26 +53,16 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Creates list of users with given input array
*
* @param body List of user object
*/
public createUsersWithArrayInput (body?: Array<User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/user/createWithArray';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -102,26 +80,16 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Creates list of users with given input array
*
* @param body List of user object
*/
public createUsersWithListInput (body?: Array<User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/user/createWithList';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'POST',
url: path,
@ -139,39 +107,25 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
*/
public loginUser (username?: string, password?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
const path = this.basePath + '/user/login';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
if (username !== undefined) {
queryParameters['username'] = username;
}
if (password !== undefined) {
queryParameters['password'] = password;
}
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -188,23 +142,15 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Logs out current logged in user session
*
*/
public logoutUser (extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/user/logout';
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -221,12 +167,10 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<User> {
const path = this.basePath + '/user/{username}'
@ -234,19 +178,10 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
let httpRequestParams: any = {
method: 'GET',
url: path,
@ -263,13 +198,11 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUser (username: string, body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/user/{username}'
@ -277,21 +210,10 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling updateUser');
}
let httpRequestParams: any = {
method: 'PUT',
url: path,
@ -309,12 +231,10 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
*/
public deleteUser (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/user/{username}'
@ -322,19 +242,10 @@ namespace API.Client {
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling deleteUser');
}
let httpRequestParams: any = {
method: 'DELETE',
url: path,
@ -351,7 +262,5 @@ namespace API.Client {
return this.$http(httpRequestParams);
}
}
}

View File

@ -1,37 +1,9 @@
/// <reference path="User.ts" />
/// <reference path="Category.ts" />
/// <reference path="Pet.ts" />
/// <reference path="Tag.ts" />
/// <reference path="Order.ts" />
/// <reference path="UserApi.ts" />
/// <reference path="StoreApi.ts" />
/// <reference path="PetApi.ts" />
/// <reference path="StoreApi.ts" />

File diff suppressed because it is too large Load Diff