17
17
*/
18
18
19
19
import { Inject , Injectable , Optional } from '@angular/core' ;
20
- import { HttpClient , HttpHeaders , HttpParams } from '@angular/common/http' ;
20
+ import { HttpClient , HttpHeaders , HttpParams , HttpEvent } from '@angular/common/http' ;
21
21
import { Observable } from 'rxjs' ;
22
22
import { Configuration } from '../configuration' ;
23
23
import {
@@ -81,7 +81,8 @@ export class ApiService {
81
81
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
82
82
* @param reportProgress flag to report request and response progress.
83
83
*/
84
- public getNumberOfInstances ( componentType : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
84
+ public getNumberOfInstances ( componentType : string , observe : any = 'body' , reportProgress : boolean = false ) :
85
+ Observable < HttpEvent < number > > {
85
86
return this . get ( NUMBER_OF_INSTANCES , componentType ) ;
86
87
}
87
88
@@ -114,7 +115,7 @@ export class ApiService {
114
115
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
115
116
* @param reportProgress flag to report request and response progress.
116
117
*/
117
- public startInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
118
+ public startInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < HttpEvent < number > > {
118
119
return this . postAction ( START_INSTANCE , instanceId ) ;
119
120
}
120
121
@@ -124,7 +125,7 @@ export class ApiService {
124
125
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
125
126
* @param reportProgress flag to report request and response progress.
126
127
*/
127
- public stopInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
128
+ public stopInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < HttpEvent < number > > {
128
129
return this . postAction ( STOP_INSTANCE , instanceId ) ;
129
130
}
130
131
@@ -134,7 +135,7 @@ export class ApiService {
134
135
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
135
136
* @param reportProgress flag to report request and response progress.
136
137
*/
137
- public pauseInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
138
+ public pauseInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < HttpEvent < number > > {
138
139
return this . postAction ( PAUSE_INSTANCE , instanceId ) ;
139
140
}
140
141
@@ -144,7 +145,7 @@ export class ApiService {
144
145
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
145
146
* @param reportProgress flag to report request and response progress.
146
147
*/
147
- public resumeInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
148
+ public resumeInstance ( instanceId : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < HttpEvent < number > > {
148
149
return this . postAction ( RESUME_INSTANCE , instanceId ) ;
149
150
}
150
151
@@ -154,7 +155,7 @@ export class ApiService {
154
155
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
155
156
* @param reportProgress flag to report request and response progress.
156
157
*/
157
- public deleteInstance ( instanceId : string ) : Observable < number > {
158
+ public deleteInstance ( instanceId : string ) : Observable < HttpEvent < number > > {
158
159
return this . postAction ( DELETE_INSTANCE , instanceId ) ;
159
160
}
160
161
@@ -212,7 +213,7 @@ export class ApiService {
212
213
headers = headers . set ( 'Accept' , httpHeaderAcceptSelected ) ;
213
214
}
214
215
215
- return this . httpClient . post < Instance > ( `${ this . basePath } ${ endpoint } ` ,
216
+ return this . httpClient . post < Instance > ( `${ this . basePath } ${ endpoint } ` , { } ,
216
217
{
217
218
params : queryParameters ,
218
219
withCredentials : this . configuration . withCredentials ,
@@ -224,21 +225,23 @@ export class ApiService {
224
225
}
225
226
226
227
227
- public postAction ( endpoint : string , idInstance : string , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
228
+ public postAction ( endpoint : string , idInstance : string , observe : any = 'body' , reportProgress : boolean = false ) :
229
+ Observable < HttpEvent < number > > {
228
230
let queryParam = new HttpParams ( { encoder : new CustomHttpUrlEncodingCodec ( ) } ) ;
229
231
230
232
if ( idInstance === null || idInstance === undefined ) {
231
233
throw new Error ( 'Required ID Instance parameter' ) ;
232
234
} else {
233
- queryParam = queryParam . set ( 'InstanceID ' , < any > ( 'a' + idInstance ) ) ;
235
+ queryParam = queryParam . set ( 'instanceID ' , < any > ( 'a' + idInstance ) ) ;
234
236
}
235
237
236
238
return this . commonConf ( endpoint , queryParam , observe , reportProgress ) ;
237
239
}
238
240
239
241
240
242
// This method is a common configuration to set the headers and query params
241
- public commonConf ( endpoint : string , queryParameters : HttpParams , observe : any = 'body' , reportProgress : boolean = false ) : Observable < number > {
243
+ public commonConf ( endpoint : string , queryParameters : HttpParams , observe : any = 'body' , reportProgress : boolean = false ) :
244
+ Observable < HttpEvent < number > > {
242
245
let headers = this . defaultHeaders ;
243
246
244
247
// to determine the Accept header
@@ -251,7 +254,7 @@ export class ApiService {
251
254
headers = headers . set ( 'Accept' , httpHeaderAcceptSelected ) ;
252
255
}
253
256
254
- return this . httpClient . post < number > ( `${ this . basePath } ${ endpoint } ` ,
257
+ return this . httpClient . post < number > ( `${ this . basePath } ${ endpoint } ` , { } ,
255
258
{
256
259
params : queryParameters ,
257
260
withCredentials : this . configuration . withCredentials ,
0 commit comments