mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
Updating typescript samples
This commit is contained in:
parent
bc8eae838c
commit
3723a9ba2d
@ -1,6 +1,6 @@
|
||||
/// <reference path="api.d.ts" />
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
export class Category {
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="api.d.ts" />
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
export class Order {
|
||||
@ -11,7 +11,7 @@ module api {
|
||||
|
||||
quantity: number;
|
||||
|
||||
shipDate: DateTime;
|
||||
shipDate: Date;
|
||||
|
||||
/**
|
||||
* Order Status
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="api.d.ts" />
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
export class Pet {
|
@ -2,12 +2,11 @@
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
|
||||
export class PetApi {
|
||||
private basePath = 'http://petstore.swagger.io/v2';
|
||||
private basePath = '/v2';
|
||||
|
||||
static $inject: string[] = ['$http'];
|
||||
|
||||
@ -17,13 +16,11 @@ module api {
|
||||
}
|
||||
}
|
||||
|
||||
public updatePet (body: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public updatePet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/pet';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'PUT',
|
||||
@ -32,7 +29,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -46,13 +43,11 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public addPet (body: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public addPet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/pet';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
@ -61,7 +56,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -75,11 +70,11 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public findPetsByStatus (status: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<Pet>> {
|
||||
public findPetsByStatus (status?: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<Pet>> {
|
||||
var path = this.basePath + '/pet/findByStatus';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
if (status !== undefined) {
|
||||
queryParameters['status'] = status;
|
||||
@ -91,7 +86,7 @@ module api {
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -105,11 +100,11 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public findPetsByTags (tags: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<Pet>> {
|
||||
public findPetsByTags (tags?: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<Pet>> {
|
||||
var path = this.basePath + '/pet/findByTags';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
if (tags !== undefined) {
|
||||
queryParameters['tags'] = tags;
|
||||
@ -121,7 +116,7 @@ module api {
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -141,22 +136,20 @@ module api {
|
||||
path = path.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'petId' is set
|
||||
if (!petId) {
|
||||
throw new Error('Missing required parameter petId when calling getPetById');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -170,28 +163,26 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public updatePetWithForm (petId: string, name: string, status: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/pet/{petId}';
|
||||
|
||||
path = path.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'petId' is set
|
||||
if (!petId) {
|
||||
throw new Error('Missing required parameter petId when calling updatePetWithForm');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -205,28 +196,28 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public deletePet (apiKey: string, petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/pet/{petId}';
|
||||
|
||||
path = path.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'petId' is set
|
||||
if (!petId) {
|
||||
throw new Error('Missing required parameter petId when calling deletePet');
|
||||
}
|
||||
|
||||
|
||||
headerParams['apiKey'] = apiKey;
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'DELETE',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -240,28 +231,26 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public uploadFile (petId: number, additionalMetadata: string, file: file, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public uploadFile (petId: number, additionalMetadata?: string, file?: file, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/pet/{petId}/uploadImage';
|
||||
|
||||
path = path.replace('{' + 'petId' + '}', String(petId));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'petId' is set
|
||||
if (!petId) {
|
||||
throw new Error('Missing required parameter petId when calling uploadFile');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -274,9 +263,5 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module('api_PetApi', ['$http'])
|
||||
.service('PetApi', PetApi);
|
||||
}
|
@ -2,12 +2,11 @@
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
|
||||
export class StoreApi {
|
||||
private basePath = 'http://petstore.swagger.io/v2';
|
||||
private basePath = '/v2';
|
||||
|
||||
static $inject: string[] = ['$http'];
|
||||
|
||||
@ -21,9 +20,7 @@ module api {
|
||||
var path = this.basePath + '/store/inventory';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
@ -31,7 +28,7 @@ module api {
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -45,13 +42,11 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public placeOrder (body: Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<Order> {
|
||||
public placeOrder (body?: Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<Order> {
|
||||
var path = this.basePath + '/store/order';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
@ -60,7 +55,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -80,22 +75,20 @@ module api {
|
||||
path = path.replace('{' + 'orderId' + '}', String(orderId));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'orderId' is set
|
||||
if (!orderId) {
|
||||
throw new Error('Missing required parameter orderId when calling getOrderById');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -115,22 +108,20 @@ module api {
|
||||
path = path.replace('{' + 'orderId' + '}', String(orderId));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'orderId' is set
|
||||
if (!orderId) {
|
||||
throw new Error('Missing required parameter orderId when calling deleteOrder');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'DELETE',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -143,9 +134,5 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module('api_StoreApi', ['$http'])
|
||||
.service('StoreApi', StoreApi);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="api.d.ts" />
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
export class Tag {
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="api.d.ts" />
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
export class User {
|
@ -2,12 +2,11 @@
|
||||
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
module api {
|
||||
module {
|
||||
'use strict';
|
||||
|
||||
|
||||
export class UserApi {
|
||||
private basePath = 'http://petstore.swagger.io/v2';
|
||||
private basePath = '/v2';
|
||||
|
||||
static $inject: string[] = ['$http'];
|
||||
|
||||
@ -17,13 +16,11 @@ module api {
|
||||
}
|
||||
}
|
||||
|
||||
public createUser (body: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public createUser (body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/user';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
@ -32,7 +29,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -46,13 +43,11 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public createUsersWithArrayInput (body: Array<User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public createUsersWithArrayInput (body?: Array<User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/user/createWithArray';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
@ -61,7 +56,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -75,13 +70,11 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public createUsersWithListInput (body: Array<User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public createUsersWithListInput (body?: Array<User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/user/createWithList';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'POST',
|
||||
@ -90,7 +83,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -104,15 +97,17 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public loginUser (username: string, password: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
|
||||
public loginUser (username?: string, password?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
|
||||
var path = this.basePath + '/user/login';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
if (username !== undefined) {
|
||||
queryParameters['username'] = username;
|
||||
}if (password !== undefined) {
|
||||
}
|
||||
|
||||
if (password !== undefined) {
|
||||
queryParameters['password'] = password;
|
||||
}
|
||||
|
||||
@ -122,7 +117,7 @@ module api {
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -140,9 +135,7 @@ module api {
|
||||
var path = this.basePath + '/user/logout';
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
@ -150,7 +143,7 @@ module api {
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -170,22 +163,20 @@ module api {
|
||||
path = path.replace('{' + 'username' + '}', String(username));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'username' is set
|
||||
if (!username) {
|
||||
throw new Error('Missing required parameter username when calling getUserByName');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -199,21 +190,19 @@ module api {
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public updateUser (username: string, body: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
public updateUser (username: string, body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/user/{username}';
|
||||
|
||||
path = path.replace('{' + 'username' + '}', String(username));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'username' is set
|
||||
if (!username) {
|
||||
throw new Error('Missing required parameter username when calling updateUser');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'PUT',
|
||||
url: path,
|
||||
@ -221,7 +210,7 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -241,22 +230,20 @@ module api {
|
||||
path = path.replace('{' + 'username' + '}', String(username));
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
var headerParams: any = {};
|
||||
|
||||
// verify required parameter 'username' is set
|
||||
if (!username) {
|
||||
throw new Error('Missing required parameter username when calling deleteUser');
|
||||
}
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'DELETE',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
@ -269,9 +256,5 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module('api_UserApi', ['$http'])
|
||||
.service('UserApi', UserApi);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user