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