mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +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'];
|
||||
|
||||
@ -16,15 +15,13 @@ module api {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
url: path,
|
||||
@ -32,11 +29,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -45,15 +42,13 @@ 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',
|
||||
url: path,
|
||||
@ -61,11 +56,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -74,28 +69,28 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -104,28 +99,28 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -134,33 +129,31 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<Pet> {
|
||||
|
||||
public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<Pet> {
|
||||
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 getPetById');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -169,33 +162,31 @@ 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) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -204,33 +195,33 @@ 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) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -239,33 +230,31 @@ 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) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -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'];
|
||||
|
||||
@ -16,26 +15,24 @@ module api {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
}
|
||||
|
||||
public getInventory ( extraHttpRequestParams?: any ) : ng.IHttpPromise<map<String, number>> {
|
||||
|
||||
public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<map<String, number>> {
|
||||
var path = this.basePath + '/store/inventory';
|
||||
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -44,15 +41,13 @@ 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',
|
||||
url: path,
|
||||
@ -60,11 +55,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -73,33 +68,31 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<Order> {
|
||||
|
||||
public getOrderById (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<Order> {
|
||||
var path = this.basePath + '/store/order/{orderId}';
|
||||
|
||||
|
||||
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) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -108,33 +101,31 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
|
||||
public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/store/order/{orderId}';
|
||||
|
||||
|
||||
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) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -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'];
|
||||
|
||||
@ -16,15 +15,13 @@ module api {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
url: path,
|
||||
@ -32,11 +29,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -45,15 +42,13 @@ 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',
|
||||
url: path,
|
||||
@ -61,11 +56,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -74,15 +69,13 @@ 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',
|
||||
url: path,
|
||||
@ -90,11 +83,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -103,30 +96,32 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -135,26 +130,24 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public logoutUser ( extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
|
||||
public logoutUser (extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
var path = this.basePath + '/user/logout';
|
||||
|
||||
|
||||
var queryParameters: any = {};
|
||||
var headers: any = {};
|
||||
|
||||
|
||||
|
||||
var headerParams: any = {};
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -163,33 +156,31 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<User> {
|
||||
|
||||
public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<User> {
|
||||
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 getUserByName');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'GET',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -198,22 +189,20 @@ 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,11 +210,11 @@ module api {
|
||||
data: body,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -234,33 +223,31 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
public deleteUser (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
|
||||
|
||||
public deleteUser (username: string, 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 deleteUser');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var httpRequestParams: any = {
|
||||
method: 'DELETE',
|
||||
url: path,
|
||||
json: true,
|
||||
|
||||
params: queryParameters,
|
||||
headers: headers
|
||||
headers: headerParams
|
||||
};
|
||||
|
||||
if (extraHttpRequestParams) {
|
||||
for (var k in extraHttpRequestParams){
|
||||
for (var k in extraHttpRequestParams) {
|
||||
if (extraHttpRequestParams.hasOwnProperty(k)) {
|
||||
httpRequestParams[k] = extraHttpRequestParams[k];
|
||||
}
|
||||
@ -269,9 +256,5 @@ module api {
|
||||
|
||||
return this.$http(httpRequestParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module('api_UserApi', ['$http'])
|
||||
.service('UserApi', UserApi);
|
||||
}
|
Loading…
Reference in New Issue
Block a user