@opentap/runner-client 1.0.0-alpha.37.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1399 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ /* eslint-disable @typescript-eslint/no-namespace */
17
+ /* eslint-disable @typescript-eslint/prefer-namespace-keyword */
18
+ import { BaseClient } from './BaseClient';
19
+ import { ApiException, ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, Links, ListItemType, ProfileGroup, Session, } from './DTOs';
20
+ var RunnerClient = /** @class */ (function (_super) {
21
+ __extends(RunnerClient, _super);
22
+ function RunnerClient(baseSubject, server) {
23
+ var _this = _super.call(this, baseSubject, server) || this;
24
+ _this.jsonParseReviver = undefined;
25
+ return _this;
26
+ }
27
+ /**
28
+ * Generic error callback function.
29
+ * @returns
30
+ */
31
+ RunnerClient.prototype.error = function () {
32
+ return function (error) {
33
+ throw new Error(error);
34
+ };
35
+ };
36
+ /**
37
+ * Generic success callback function.
38
+ * @returns
39
+ */
40
+ RunnerClient.prototype.success = function () {
41
+ return function (response) { return response; };
42
+ };
43
+ /**
44
+ * Get the created image with the specified ID.
45
+ * @param imageId
46
+ * @returns {{Promise<Image>}}
47
+ */
48
+ RunnerClient.prototype.getImage = function (imageId) {
49
+ return (imageId === null || imageId === void 0 ? void 0 : imageId.length) > 0
50
+ ? this.request('GetImage', imageId).then(this.success()).catch(this.error())
51
+ : Promise.reject('imageId is not defined');
52
+ };
53
+ /**
54
+ * Get all created images
55
+ * @returns {{Promise<Image[]>}}
56
+ */
57
+ RunnerClient.prototype.getImages = function () {
58
+ return this.request('GetImages').then(this.success()).catch(this.error());
59
+ };
60
+ /**
61
+ * Create a OpenTAP package configuration image from a list image inputs consisting of user specified packages and repositories.
62
+ * @param images List of images
63
+ * @returns {{Promise<Image>}}
64
+ */
65
+ RunnerClient.prototype.resolveImage = function (images) {
66
+ return (images === null || images === void 0 ? void 0 : images.length) > 0
67
+ ? this.request('ResolveImage', images).then(this.success()).catch(this.error())
68
+ : Promise.reject('images list is not defined or is empty');
69
+ };
70
+ /**
71
+ * Shut down a session
72
+ * @param sessionId the ID of the session to shut down
73
+ * @returns {{Promise<void>}}
74
+ */
75
+ RunnerClient.prototype.shutdownSession = function (sessionId) {
76
+ return (sessionId === null || sessionId === void 0 ? void 0 : sessionId.length) > 0
77
+ ? this.request('ShutdownSession', sessionId).then(this.success()).catch(this.error())
78
+ : Promise.reject('sessionId is not defined');
79
+ };
80
+ /**
81
+ * Start a session
82
+ * @returns {{Promise<Session>}}
83
+ */
84
+ RunnerClient.prototype.startSession = function () {
85
+ // TODO: Ask Dennis
86
+ // ? Shouldn't this endpoint return the newly created session?
87
+ return this.request('StartSession').then(this.success()).catch(this.error());
88
+ };
89
+ /**
90
+ * Get the session manager image.
91
+ * @returns {{Promise<Image>}}
92
+ */
93
+ RunnerClient.prototype.getSessionManagerImage = function () {
94
+ return this.request('GetSessionManagerImage').then(this.success()).catch(this.error());
95
+ };
96
+ /**
97
+ * Start a session based on an image.
98
+ * @param imageId
99
+ * @returns {{Promise<Session>}}
100
+ */
101
+ RunnerClient.prototype.startImageSession = function (image) {
102
+ return image
103
+ ? this.request('StartImageSession', image).then(this.success()).catch(this.error())
104
+ : Promise.reject('imageId is not defined');
105
+ };
106
+ /**
107
+ * Retrives the already running sessions
108
+ */
109
+ RunnerClient.prototype.getSessions = function () {
110
+ var _this = this;
111
+ var url_ = this.baseUrl + '/sessions';
112
+ url_ = url_.replace(/[?&]$/, '');
113
+ var options_ = {
114
+ method: 'GET',
115
+ headers: {
116
+ Accept: 'application/json',
117
+ },
118
+ };
119
+ return this.http.fetch(url_, options_).then(function (_response) {
120
+ return _this.processGetSessions(_response);
121
+ });
122
+ };
123
+ RunnerClient.prototype.processGetSessions = function (response) {
124
+ var _this = this;
125
+ var status = response.status;
126
+ var _headers = {};
127
+ if (response.headers && response.headers.forEach) {
128
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
129
+ }
130
+ if (status === 200) {
131
+ return response.text().then(function (_responseText) {
132
+ var result200 = null;
133
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
134
+ if (Array.isArray(resultData200)) {
135
+ result200 = [];
136
+ for (var _i = 0, resultData200_1 = resultData200; _i < resultData200_1.length; _i++) {
137
+ var item = resultData200_1[_i];
138
+ result200.push(Session.fromJS(item));
139
+ }
140
+ }
141
+ else {
142
+ result200 = null;
143
+ }
144
+ return result200;
145
+ });
146
+ }
147
+ else if (status !== 200 && status !== 204) {
148
+ return response.text().then(function (_responseText) {
149
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
150
+ });
151
+ }
152
+ return Promise.resolve(null);
153
+ };
154
+ /**
155
+ * Register a self-started Session to a SessionManager.
156
+ */
157
+ RunnerClient.prototype.registerSession = function (session) {
158
+ var _this = this;
159
+ var url_ = this.baseUrl + '/sessions/register';
160
+ url_ = url_.replace(/[?&]$/, '');
161
+ var content_ = JSON.stringify(session);
162
+ var options_ = {
163
+ body: content_,
164
+ method: 'POST',
165
+ headers: {
166
+ 'Content-Type': 'application/json',
167
+ Accept: 'application/json',
168
+ },
169
+ };
170
+ return this.http.fetch(url_, options_).then(function (_response) {
171
+ return _this.processRegisterSession(_response);
172
+ });
173
+ };
174
+ RunnerClient.prototype.processRegisterSession = function (response) {
175
+ var _this = this;
176
+ var status = response.status;
177
+ var _headers = {};
178
+ if (response.headers && response.headers.forEach) {
179
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
180
+ }
181
+ if (status === 200) {
182
+ return response.text().then(function (_responseText) {
183
+ var result200 = null;
184
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
185
+ result200 = Session.fromJS(resultData200);
186
+ return result200;
187
+ });
188
+ }
189
+ else if (status === 400) {
190
+ return response.text().then(function (_responseText) {
191
+ var result400 = null;
192
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
193
+ result400 = ErrorResponse.fromJS(resultData400);
194
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
195
+ });
196
+ }
197
+ else if (status !== 200 && status !== 204) {
198
+ return response.text().then(function (_responseText) {
199
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
200
+ });
201
+ }
202
+ return Promise.resolve(null);
203
+ };
204
+ /**
205
+ * Shutdown Sessions and SessionManager
206
+ */
207
+ RunnerClient.prototype.shutdown = function () {
208
+ var _this = this;
209
+ var url_ = this.baseUrl + '/sessionmanager';
210
+ url_ = url_.replace(/[?&]$/, '');
211
+ var options_ = {
212
+ method: 'DELETE',
213
+ headers: {},
214
+ };
215
+ return this.http.fetch(url_, options_).then(function (_response) {
216
+ return _this.processShutdown(_response);
217
+ });
218
+ };
219
+ RunnerClient.prototype.processShutdown = function (response) {
220
+ var _this = this;
221
+ var status = response.status;
222
+ var _headers = {};
223
+ if (response.headers && response.headers.forEach) {
224
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
225
+ }
226
+ if (status === 200) {
227
+ return response.text().then(function () {
228
+ return;
229
+ });
230
+ }
231
+ else if (status === 400) {
232
+ return response.text().then(function (_responseText) {
233
+ var result400 = null;
234
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
235
+ result400 = ErrorResponse.fromJS(resultData400);
236
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
237
+ });
238
+ }
239
+ else if (status !== 200 && status !== 204) {
240
+ return response.text().then(function (_responseText) {
241
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
242
+ });
243
+ }
244
+ return Promise.resolve(null);
245
+ };
246
+ /**
247
+ * Links to other applications or services
248
+ */
249
+ RunnerClient.prototype.getLinks = function () {
250
+ var _this = this;
251
+ var url_ = this.baseUrl + '/links';
252
+ url_ = url_.replace(/[?&]$/, '');
253
+ var options_ = {
254
+ method: 'GET',
255
+ headers: {
256
+ Accept: 'application/json',
257
+ },
258
+ };
259
+ return this.http.fetch(url_, options_).then(function (_response) {
260
+ return _this.processGetLinks(_response);
261
+ });
262
+ };
263
+ RunnerClient.prototype.processGetLinks = function (response) {
264
+ var _this = this;
265
+ var status = response.status;
266
+ var _headers = {};
267
+ if (response.headers && response.headers.forEach) {
268
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
269
+ }
270
+ if (status === 200) {
271
+ return response.text().then(function (_responseText) {
272
+ var result200 = null;
273
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
274
+ result200 = Links.fromJS(resultData200);
275
+ return result200;
276
+ });
277
+ }
278
+ else if (status === 400) {
279
+ return response.text().then(function (_responseText) {
280
+ var result400 = null;
281
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
282
+ result400 = ErrorResponse.fromJS(resultData400);
283
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
284
+ });
285
+ }
286
+ else if (status !== 200 && status !== 204) {
287
+ return response.text().then(function (_responseText) {
288
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
289
+ });
290
+ }
291
+ return Promise.resolve(null);
292
+ };
293
+ /**
294
+ * Retrieve component settings overview
295
+ */
296
+ RunnerClient.prototype.getComponentSettingsOverview = function () {
297
+ var _this = this;
298
+ var url_ = this.baseUrl + '/componentsettings';
299
+ url_ = url_.replace(/[?&]$/, '');
300
+ var options_ = {
301
+ method: 'GET',
302
+ headers: {
303
+ Accept: 'application/json',
304
+ },
305
+ };
306
+ return this.http.fetch(url_, options_).then(function (_response) {
307
+ return _this.processGetComponentSettingsOverview(_response);
308
+ });
309
+ };
310
+ RunnerClient.prototype.processGetComponentSettingsOverview = function (response) {
311
+ var _this = this;
312
+ var status = response.status;
313
+ var _headers = {};
314
+ if (response.headers && response.headers.forEach) {
315
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
316
+ }
317
+ if (status === 200) {
318
+ return response.text().then(function (_responseText) {
319
+ var result200 = null;
320
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
321
+ if (Array.isArray(resultData200)) {
322
+ result200 = [];
323
+ for (var _i = 0, resultData200_2 = resultData200; _i < resultData200_2.length; _i++) {
324
+ var item = resultData200_2[_i];
325
+ result200.push(ComponentSettingsIdentifier.fromJS(item));
326
+ }
327
+ }
328
+ else {
329
+ result200 = null;
330
+ }
331
+ return result200;
332
+ });
333
+ }
334
+ else if (status === 400) {
335
+ return response.text().then(function (_responseText) {
336
+ var result400 = null;
337
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
338
+ result400 = ErrorResponse.fromJS(resultData400);
339
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
340
+ });
341
+ }
342
+ else if (status !== 200 && status !== 204) {
343
+ return response.text().then(function (_responseText) {
344
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
345
+ });
346
+ }
347
+ return Promise.resolve(null);
348
+ };
349
+ /**
350
+ * Change componentsettings
351
+ */
352
+ RunnerClient.prototype.setComponentSettings = function (groupName, name, returnedSettings) {
353
+ var _this = this;
354
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}';
355
+ if (groupName === undefined || groupName === null)
356
+ throw new Error("The parameter 'groupName' must be defined.");
357
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
358
+ if (name === undefined || name === null)
359
+ throw new Error("The parameter 'name' must be defined.");
360
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
361
+ url_ = url_.replace(/[?&]$/, '');
362
+ var content_ = JSON.stringify(returnedSettings);
363
+ var options_ = {
364
+ body: content_,
365
+ method: 'POST',
366
+ headers: {
367
+ 'Content-Type': 'application/json',
368
+ Accept: 'application/json',
369
+ },
370
+ };
371
+ return this.http.fetch(url_, options_).then(function (_response) {
372
+ return _this.processSetComponentSettings(_response);
373
+ });
374
+ };
375
+ RunnerClient.prototype.processSetComponentSettings = function (response) {
376
+ var _this = this;
377
+ var status = response.status;
378
+ var _headers = {};
379
+ if (response.headers && response.headers.forEach) {
380
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
381
+ }
382
+ if (status === 200) {
383
+ return response.text().then(function (_responseText) {
384
+ var result200 = null;
385
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
386
+ result200 = ComponentSettingsBase.fromJS(resultData200);
387
+ return result200;
388
+ });
389
+ }
390
+ else if (status === 400) {
391
+ return response.text().then(function (_responseText) {
392
+ var result400 = null;
393
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
394
+ result400 = ErrorResponse.fromJS(resultData400);
395
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
396
+ });
397
+ }
398
+ else if (status !== 200 && status !== 204) {
399
+ return response.text().then(function (_responseText) {
400
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
401
+ });
402
+ }
403
+ return Promise.resolve(null);
404
+ };
405
+ /**
406
+ * Retrieve componentsettings
407
+ */
408
+ RunnerClient.prototype.getComponentSettings = function (groupName, name) {
409
+ var _this = this;
410
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}';
411
+ if (groupName === undefined || groupName === null)
412
+ throw new Error("The parameter 'groupName' must be defined.");
413
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
414
+ if (name === undefined || name === null)
415
+ throw new Error("The parameter 'name' must be defined.");
416
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
417
+ url_ = url_.replace(/[?&]$/, '');
418
+ var options_ = {
419
+ method: 'GET',
420
+ headers: {
421
+ Accept: 'application/json',
422
+ },
423
+ };
424
+ return this.http.fetch(url_, options_).then(function (_response) {
425
+ return _this.processGetComponentSettings(_response);
426
+ });
427
+ };
428
+ RunnerClient.prototype.processGetComponentSettings = function (response) {
429
+ var _this = this;
430
+ var status = response.status;
431
+ var _headers = {};
432
+ if (response.headers && response.headers.forEach) {
433
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
434
+ }
435
+ if (status === 200) {
436
+ return response.text().then(function (_responseText) {
437
+ var result200 = null;
438
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
439
+ result200 = ComponentSettingsBase.fromJS(resultData200);
440
+ return result200;
441
+ });
442
+ }
443
+ else if (status === 400) {
444
+ return response.text().then(function (_responseText) {
445
+ var result400 = null;
446
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
447
+ result400 = ErrorResponse.fromJS(resultData400);
448
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
449
+ });
450
+ }
451
+ else if (status !== 200 && status !== 204) {
452
+ return response.text().then(function (_responseText) {
453
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
454
+ });
455
+ }
456
+ return Promise.resolve(null);
457
+ };
458
+ /**
459
+ * Retrieve componentsettings list item
460
+ */
461
+ RunnerClient.prototype.getComponentSettingsListItem = function (groupName, name, index) {
462
+ var _this = this;
463
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}';
464
+ if (groupName === undefined || groupName === null)
465
+ throw new Error("The parameter 'groupName' must be defined.");
466
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
467
+ if (name === undefined || name === null)
468
+ throw new Error("The parameter 'name' must be defined.");
469
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
470
+ if (index === undefined || index === null)
471
+ throw new Error("The parameter 'index' must be defined.");
472
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
473
+ url_ = url_.replace(/[?&]$/, '');
474
+ var options_ = {
475
+ method: 'GET',
476
+ headers: {
477
+ Accept: 'application/json',
478
+ },
479
+ };
480
+ return this.http.fetch(url_, options_).then(function (_response) {
481
+ return _this.processGetComponentSettingsListItem(_response);
482
+ });
483
+ };
484
+ RunnerClient.prototype.processGetComponentSettingsListItem = function (response) {
485
+ var _this = this;
486
+ var status = response.status;
487
+ var _headers = {};
488
+ if (response.headers && response.headers.forEach) {
489
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
490
+ }
491
+ if (status === 200) {
492
+ return response.text().then(function (_responseText) {
493
+ var result200 = null;
494
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
495
+ result200 = ComponentSettingsListItem.fromJS(resultData200);
496
+ return result200;
497
+ });
498
+ }
499
+ else if (status === 400) {
500
+ return response.text().then(function (_responseText) {
501
+ var result400 = null;
502
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
503
+ result400 = ErrorResponse.fromJS(resultData400);
504
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
505
+ });
506
+ }
507
+ else if (status !== 200 && status !== 204) {
508
+ return response.text().then(function (_responseText) {
509
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
510
+ });
511
+ }
512
+ return Promise.resolve(null);
513
+ };
514
+ /**
515
+ * Set componentsettings list item settings
516
+ */
517
+ RunnerClient.prototype.setComponentSettingsListItem = function (groupName, name, index, item) {
518
+ var _this = this;
519
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}';
520
+ if (groupName === undefined || groupName === null)
521
+ throw new Error("The parameter 'groupName' must be defined.");
522
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
523
+ if (name === undefined || name === null)
524
+ throw new Error("The parameter 'name' must be defined.");
525
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
526
+ if (index === undefined || index === null)
527
+ throw new Error("The parameter 'index' must be defined.");
528
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
529
+ url_ = url_.replace(/[?&]$/, '');
530
+ var content_ = JSON.stringify(item);
531
+ var options_ = {
532
+ body: content_,
533
+ method: 'POST',
534
+ headers: {
535
+ 'Content-Type': 'application/json',
536
+ Accept: 'application/json',
537
+ },
538
+ };
539
+ return this.http.fetch(url_, options_).then(function (_response) {
540
+ return _this.processSetComponentSettingsListItem(_response);
541
+ });
542
+ };
543
+ RunnerClient.prototype.processSetComponentSettingsListItem = function (response) {
544
+ var _this = this;
545
+ var status = response.status;
546
+ var _headers = {};
547
+ if (response.headers && response.headers.forEach) {
548
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
549
+ }
550
+ if (status === 200) {
551
+ return response.text().then(function (_responseText) {
552
+ var result200 = null;
553
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
554
+ result200 = ComponentSettingsListItem.fromJS(resultData200);
555
+ return result200;
556
+ });
557
+ }
558
+ else if (status === 400) {
559
+ return response.text().then(function (_responseText) {
560
+ var result400 = null;
561
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
562
+ result400 = ErrorResponse.fromJS(resultData400);
563
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
564
+ });
565
+ }
566
+ else if (status !== 200 && status !== 204) {
567
+ return response.text().then(function (_responseText) {
568
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
569
+ });
570
+ }
571
+ return Promise.resolve(null);
572
+ };
573
+ /**
574
+ * Get component setting data grid
575
+ * @return Get component setting data grid
576
+ */
577
+ RunnerClient.prototype.getComponentSettingDataGrid = function (groupName, name, index, propertyName) {
578
+ var _this = this;
579
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}/{propertyName}/datagrid';
580
+ if (groupName === undefined || groupName === null)
581
+ throw new Error("The parameter 'groupName' must be defined.");
582
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
583
+ if (name === undefined || name === null)
584
+ throw new Error("The parameter 'name' must be defined.");
585
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
586
+ if (index === undefined || index === null)
587
+ throw new Error("The parameter 'index' must be defined.");
588
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
589
+ if (propertyName === undefined || propertyName === null)
590
+ throw new Error("The parameter 'propertyName' must be defined.");
591
+ url_ = url_.replace('{propertyName}', encodeURIComponent('' + propertyName));
592
+ url_ = url_.replace(/[?&]$/, '');
593
+ var options_ = {
594
+ method: 'GET',
595
+ headers: {
596
+ Accept: 'application/json',
597
+ },
598
+ };
599
+ return this.http.fetch(url_, options_).then(function (_response) {
600
+ return _this.processGetComponentSettingDataGrid(_response);
601
+ });
602
+ };
603
+ RunnerClient.prototype.processGetComponentSettingDataGrid = function (response) {
604
+ var _this = this;
605
+ var status = response.status;
606
+ var _headers = {};
607
+ if (response.headers && response.headers.forEach) {
608
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
609
+ }
610
+ if (status === 200) {
611
+ return response.text().then(function (_responseText) {
612
+ var result200 = null;
613
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
614
+ result200 = DataGridControl.fromJS(resultData200);
615
+ return result200;
616
+ });
617
+ }
618
+ else if (status !== 200 && status !== 204) {
619
+ return response.text().then(function (_responseText) {
620
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
621
+ });
622
+ }
623
+ return Promise.resolve(null);
624
+ };
625
+ /**
626
+ * Set component setting data grid
627
+ * @return Set data grid
628
+ */
629
+ RunnerClient.prototype.setComponentSettingDataGrid = function (groupName, name, index, propertyName, dataGridControl) {
630
+ var _this = this;
631
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}/{propertyName}/datagrid';
632
+ if (groupName === undefined || groupName === null)
633
+ throw new Error("The parameter 'groupName' must be defined.");
634
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
635
+ if (name === undefined || name === null)
636
+ throw new Error("The parameter 'name' must be defined.");
637
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
638
+ if (index === undefined || index === null)
639
+ throw new Error("The parameter 'index' must be defined.");
640
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
641
+ if (propertyName === undefined || propertyName === null)
642
+ throw new Error("The parameter 'propertyName' must be defined.");
643
+ url_ = url_.replace('{propertyName}', encodeURIComponent('' + propertyName));
644
+ url_ = url_.replace(/[?&]$/, '');
645
+ var content_ = JSON.stringify(dataGridControl);
646
+ var options_ = {
647
+ body: content_,
648
+ method: 'POST',
649
+ headers: {
650
+ 'Content-Type': 'application/json',
651
+ Accept: 'application/json',
652
+ },
653
+ };
654
+ return this.http.fetch(url_, options_).then(function (_response) {
655
+ return _this.processSetComponentSettingDataGrid(_response);
656
+ });
657
+ };
658
+ RunnerClient.prototype.processSetComponentSettingDataGrid = function (response) {
659
+ var _this = this;
660
+ var status = response.status;
661
+ var _headers = {};
662
+ if (response.headers && response.headers.forEach) {
663
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
664
+ }
665
+ if (status === 200) {
666
+ return response.text().then(function (_responseText) {
667
+ var result200 = null;
668
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
669
+ result200 = DataGridControl.fromJS(resultData200);
670
+ return result200;
671
+ });
672
+ }
673
+ else if (status !== 200 && status !== 204) {
674
+ return response.text().then(function (_responseText) {
675
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
676
+ });
677
+ }
678
+ return Promise.resolve(null);
679
+ };
680
+ /**
681
+ * Add component setting item to data grid
682
+ * @return Add component setting data grid item
683
+ */
684
+ RunnerClient.prototype.addComponentSettingDataGridItemType = function (groupName, name, index, propertyName, typeName) {
685
+ var _this = this;
686
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}/{propertyName}/datagrid/new/{typeName}';
687
+ if (groupName === undefined || groupName === null)
688
+ throw new Error("The parameter 'groupName' must be defined.");
689
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
690
+ if (name === undefined || name === null)
691
+ throw new Error("The parameter 'name' must be defined.");
692
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
693
+ if (index === undefined || index === null)
694
+ throw new Error("The parameter 'index' must be defined.");
695
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
696
+ if (propertyName === undefined || propertyName === null)
697
+ throw new Error("The parameter 'propertyName' must be defined.");
698
+ url_ = url_.replace('{propertyName}', encodeURIComponent('' + propertyName));
699
+ if (typeName === undefined || typeName === null)
700
+ throw new Error("The parameter 'typeName' must be defined.");
701
+ url_ = url_.replace('{typeName}', encodeURIComponent('' + typeName));
702
+ url_ = url_.replace(/[?&]$/, '');
703
+ var options_ = {
704
+ method: 'POST',
705
+ headers: {
706
+ Accept: 'application/json',
707
+ },
708
+ };
709
+ return this.http.fetch(url_, options_).then(function (_response) {
710
+ return _this.processAddComponentSettingDataGridItemType(_response);
711
+ });
712
+ };
713
+ RunnerClient.prototype.processAddComponentSettingDataGridItemType = function (response) {
714
+ var _this = this;
715
+ var status = response.status;
716
+ var _headers = {};
717
+ if (response.headers && response.headers.forEach) {
718
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
719
+ }
720
+ if (status === 200) {
721
+ return response.text().then(function (_responseText) {
722
+ var result200 = null;
723
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
724
+ result200 = DataGridControl.fromJS(resultData200);
725
+ return result200;
726
+ });
727
+ }
728
+ else if (status !== 200 && status !== 204) {
729
+ return response.text().then(function (_responseText) {
730
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
731
+ });
732
+ }
733
+ return Promise.resolve(null);
734
+ };
735
+ /**
736
+ * Add component setting item to data grid
737
+ * @return Add component setting data grid item
738
+ */
739
+ RunnerClient.prototype.addComponentSettingDataGridItem = function (groupName, name, index, propertyName) {
740
+ var _this = this;
741
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}/{propertyName}/datagrid/new';
742
+ if (groupName === undefined || groupName === null)
743
+ throw new Error("The parameter 'groupName' must be defined.");
744
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
745
+ if (name === undefined || name === null)
746
+ throw new Error("The parameter 'name' must be defined.");
747
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
748
+ if (index === undefined || index === null)
749
+ throw new Error("The parameter 'index' must be defined.");
750
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
751
+ if (propertyName === undefined || propertyName === null)
752
+ throw new Error("The parameter 'propertyName' must be defined.");
753
+ url_ = url_.replace('{propertyName}', encodeURIComponent('' + propertyName));
754
+ url_ = url_.replace(/[?&]$/, '');
755
+ var options_ = {
756
+ method: 'POST',
757
+ headers: {
758
+ Accept: 'application/json',
759
+ },
760
+ };
761
+ return this.http.fetch(url_, options_).then(function (_response) {
762
+ return _this.processAddComponentSettingDataGridItem(_response);
763
+ });
764
+ };
765
+ RunnerClient.prototype.processAddComponentSettingDataGridItem = function (response) {
766
+ var _this = this;
767
+ var status = response.status;
768
+ var _headers = {};
769
+ if (response.headers && response.headers.forEach) {
770
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
771
+ }
772
+ if (status === 200) {
773
+ return response.text().then(function (_responseText) {
774
+ var result200 = null;
775
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
776
+ result200 = DataGridControl.fromJS(resultData200);
777
+ return result200;
778
+ });
779
+ }
780
+ else if (status !== 200 && status !== 204) {
781
+ return response.text().then(function (_responseText) {
782
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
783
+ });
784
+ }
785
+ return Promise.resolve(null);
786
+ };
787
+ /**
788
+ * Get item types available in the component setting data grid
789
+ * @return Get component setting data grid types
790
+ */
791
+ RunnerClient.prototype.getComponentSettingDataGridTypes = function (groupName, name, index, propertyName) {
792
+ var _this = this;
793
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/{index}/{propertyName}/datagrid/availabletypes';
794
+ if (groupName === undefined || groupName === null)
795
+ throw new Error("The parameter 'groupName' must be defined.");
796
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
797
+ if (name === undefined || name === null)
798
+ throw new Error("The parameter 'name' must be defined.");
799
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
800
+ if (index === undefined || index === null)
801
+ throw new Error("The parameter 'index' must be defined.");
802
+ url_ = url_.replace('{index}', encodeURIComponent('' + index));
803
+ if (propertyName === undefined || propertyName === null)
804
+ throw new Error("The parameter 'propertyName' must be defined.");
805
+ url_ = url_.replace('{propertyName}', encodeURIComponent('' + propertyName));
806
+ url_ = url_.replace(/[?&]$/, '');
807
+ var options_ = {
808
+ method: 'GET',
809
+ headers: {
810
+ Accept: 'application/json',
811
+ },
812
+ };
813
+ return this.http.fetch(url_, options_).then(function (_response) {
814
+ return _this.processGetComponentSettingDataGridTypes(_response);
815
+ });
816
+ };
817
+ RunnerClient.prototype.processGetComponentSettingDataGridTypes = function (response) {
818
+ var _this = this;
819
+ var status = response.status;
820
+ var _headers = {};
821
+ if (response.headers && response.headers.forEach) {
822
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
823
+ }
824
+ if (status === 200) {
825
+ return response.text().then(function (_responseText) {
826
+ var result200 = null;
827
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
828
+ if (Array.isArray(resultData200)) {
829
+ result200 = [];
830
+ for (var _i = 0, resultData200_3 = resultData200; _i < resultData200_3.length; _i++) {
831
+ var item = resultData200_3[_i];
832
+ result200.push(ListItemType.fromJS(item));
833
+ }
834
+ }
835
+ else {
836
+ result200 = null;
837
+ }
838
+ return result200;
839
+ });
840
+ }
841
+ else if (status !== 200 && status !== 204) {
842
+ return response.text().then(function (_responseText) {
843
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
844
+ });
845
+ }
846
+ return Promise.resolve(null);
847
+ };
848
+ /**
849
+ * Change componentsettings profiles
850
+ */
851
+ RunnerClient.prototype.setComponentSettingsProfiles = function (returnedSettings) {
852
+ var _this = this;
853
+ var url_ = this.baseUrl + '/componentsettings/profiles';
854
+ url_ = url_.replace(/[?&]$/, '');
855
+ var content_ = JSON.stringify(returnedSettings);
856
+ var options_ = {
857
+ body: content_,
858
+ method: 'POST',
859
+ headers: {
860
+ 'Content-Type': 'application/json',
861
+ Accept: 'application/json',
862
+ },
863
+ };
864
+ return this.http.fetch(url_, options_).then(function (_response) {
865
+ return _this.processSetComponentSettingsProfiles(_response);
866
+ });
867
+ };
868
+ RunnerClient.prototype.processSetComponentSettingsProfiles = function (response) {
869
+ var _this = this;
870
+ var status = response.status;
871
+ var _headers = {};
872
+ if (response.headers && response.headers.forEach) {
873
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
874
+ }
875
+ if (status === 200) {
876
+ return response.text().then(function (_responseText) {
877
+ var result200 = null;
878
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
879
+ if (Array.isArray(resultData200)) {
880
+ result200 = [];
881
+ for (var _i = 0, resultData200_4 = resultData200; _i < resultData200_4.length; _i++) {
882
+ var item = resultData200_4[_i];
883
+ result200.push(ProfileGroup.fromJS(item));
884
+ }
885
+ }
886
+ else {
887
+ result200 = null;
888
+ }
889
+ return result200;
890
+ });
891
+ }
892
+ else if (status === 400) {
893
+ return response.text().then(function (_responseText) {
894
+ var result400 = null;
895
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
896
+ result400 = ErrorResponse.fromJS(resultData400);
897
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
898
+ });
899
+ }
900
+ else if (status !== 200 && status !== 204) {
901
+ return response.text().then(function (_responseText) {
902
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
903
+ });
904
+ }
905
+ return Promise.resolve(null);
906
+ };
907
+ /**
908
+ * Get componentsettings profiles
909
+ */
910
+ RunnerClient.prototype.getComponentSettingsProfiles = function () {
911
+ var _this = this;
912
+ var url_ = this.baseUrl + '/componentsettings/profiles';
913
+ url_ = url_.replace(/[?&]$/, '');
914
+ var options_ = {
915
+ method: 'GET',
916
+ headers: {
917
+ Accept: 'application/json',
918
+ },
919
+ };
920
+ return this.http.fetch(url_, options_).then(function (_response) {
921
+ return _this.processGetComponentSettingsProfiles(_response);
922
+ });
923
+ };
924
+ RunnerClient.prototype.processGetComponentSettingsProfiles = function (response) {
925
+ var _this = this;
926
+ var status = response.status;
927
+ var _headers = {};
928
+ if (response.headers && response.headers.forEach) {
929
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
930
+ }
931
+ if (status === 200) {
932
+ return response.text().then(function (_responseText) {
933
+ var result200 = null;
934
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
935
+ if (Array.isArray(resultData200)) {
936
+ result200 = [];
937
+ for (var _i = 0, resultData200_5 = resultData200; _i < resultData200_5.length; _i++) {
938
+ var item = resultData200_5[_i];
939
+ result200.push(ProfileGroup.fromJS(item));
940
+ }
941
+ }
942
+ else {
943
+ result200 = null;
944
+ }
945
+ return result200;
946
+ });
947
+ }
948
+ else if (status === 400) {
949
+ return response.text().then(function (_responseText) {
950
+ var result400 = null;
951
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
952
+ result400 = ErrorResponse.fromJS(resultData400);
953
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
954
+ });
955
+ }
956
+ else if (status !== 200 && status !== 204) {
957
+ return response.text().then(function (_responseText) {
958
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
959
+ });
960
+ }
961
+ return Promise.resolve(null);
962
+ };
963
+ /**
964
+ * Upload exported OpenTAP Settings files
965
+ * @param file (optional)
966
+ */
967
+ RunnerClient.prototype.uploadComponentSettings = function (file) {
968
+ var _this = this;
969
+ var url_ = this.baseUrl + '/componentsettings/upload';
970
+ url_ = url_.replace(/[?&]$/, '');
971
+ var content_ = new FormData();
972
+ if (file !== null && file !== undefined)
973
+ content_.append('file', file.data, file.fileName ? file.fileName : 'file');
974
+ var options_ = {
975
+ body: content_,
976
+ method: 'POST',
977
+ headers: {},
978
+ };
979
+ return this.http.fetch(url_, options_).then(function (_response) {
980
+ return _this.processUploadComponentSettings(_response);
981
+ });
982
+ };
983
+ RunnerClient.prototype.processUploadComponentSettings = function (response) {
984
+ var _this = this;
985
+ var status = response.status;
986
+ var _headers = {};
987
+ if (response.headers && response.headers.forEach) {
988
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
989
+ }
990
+ if (status === 200) {
991
+ return response.text().then(function () {
992
+ return;
993
+ });
994
+ }
995
+ else if (status === 400) {
996
+ return response.text().then(function (_responseText) {
997
+ var result400 = null;
998
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
999
+ result400 = ErrorResponse.fromJS(resultData400);
1000
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1001
+ });
1002
+ }
1003
+ else if (status !== 200 && status !== 204) {
1004
+ return response.text().then(function (_responseText) {
1005
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1006
+ });
1007
+ }
1008
+ return Promise.resolve(null);
1009
+ };
1010
+ /**
1011
+ * DEPRECATED: Use /componentsettings/load (LoadComponentSettingsFromRepository) instead
1012
+ * @deprecated
1013
+ */
1014
+ RunnerClient.prototype.loadComponentSettingsFromPackageReference = function (packageReference) {
1015
+ var _this = this;
1016
+ var url_ = this.baseUrl + '/componentsettings/packagereference';
1017
+ url_ = url_.replace(/[?&]$/, '');
1018
+ var content_ = JSON.stringify(packageReference);
1019
+ var options_ = {
1020
+ body: content_,
1021
+ method: 'POST',
1022
+ headers: {
1023
+ 'Content-Type': 'application/json',
1024
+ Accept: 'application/json',
1025
+ },
1026
+ };
1027
+ return this.http.fetch(url_, options_).then(function (_response) {
1028
+ return _this.processLoadComponentSettingsFromPackageReference(_response);
1029
+ });
1030
+ };
1031
+ RunnerClient.prototype.processLoadComponentSettingsFromPackageReference = function (response) {
1032
+ var _this = this;
1033
+ var status = response.status;
1034
+ var _headers = {};
1035
+ if (response.headers && response.headers.forEach) {
1036
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1037
+ }
1038
+ if (status === 200) {
1039
+ return response.text().then(function (_responseText) {
1040
+ var result200 = null;
1041
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1042
+ if (Array.isArray(resultData200)) {
1043
+ result200 = [];
1044
+ for (var _i = 0, resultData200_6 = resultData200; _i < resultData200_6.length; _i++) {
1045
+ var item = resultData200_6[_i];
1046
+ result200.push(ErrorResponse.fromJS(item));
1047
+ }
1048
+ }
1049
+ else {
1050
+ result200 = null;
1051
+ }
1052
+ return result200;
1053
+ });
1054
+ }
1055
+ else if (status === 400) {
1056
+ return response.text().then(function (_responseText) {
1057
+ var result400 = null;
1058
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1059
+ result400 = ErrorResponse.fromJS(resultData400);
1060
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1061
+ });
1062
+ }
1063
+ else if (status !== 200 && status !== 204) {
1064
+ return response.text().then(function (_responseText) {
1065
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1066
+ });
1067
+ }
1068
+ return Promise.resolve(null);
1069
+ };
1070
+ /**
1071
+ * Load a component settings TapPackage by referencing a package in a package repository
1072
+ */
1073
+ RunnerClient.prototype.loadComponentSettingsFromRepository = function (packageReference) {
1074
+ var _this = this;
1075
+ var url_ = this.baseUrl + '/componentsettings/repository/load';
1076
+ url_ = url_.replace(/[?&]$/, '');
1077
+ var content_ = JSON.stringify(packageReference);
1078
+ var options_ = {
1079
+ body: content_,
1080
+ method: 'POST',
1081
+ headers: {
1082
+ 'Content-Type': 'application/json',
1083
+ Accept: 'application/json',
1084
+ },
1085
+ };
1086
+ return this.http.fetch(url_, options_).then(function (_response) {
1087
+ return _this.processLoadComponentSettingsFromRepository(_response);
1088
+ });
1089
+ };
1090
+ RunnerClient.prototype.processLoadComponentSettingsFromRepository = function (response) {
1091
+ var _this = this;
1092
+ var status = response.status;
1093
+ var _headers = {};
1094
+ if (response.headers && response.headers.forEach) {
1095
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1096
+ }
1097
+ if (status === 200) {
1098
+ return response.text().then(function (_responseText) {
1099
+ var result200 = null;
1100
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1101
+ if (Array.isArray(resultData200)) {
1102
+ result200 = [];
1103
+ for (var _i = 0, resultData200_7 = resultData200; _i < resultData200_7.length; _i++) {
1104
+ var item = resultData200_7[_i];
1105
+ result200.push(ErrorResponse.fromJS(item));
1106
+ }
1107
+ }
1108
+ else {
1109
+ result200 = null;
1110
+ }
1111
+ return result200;
1112
+ });
1113
+ }
1114
+ else if (status === 400) {
1115
+ return response.text().then(function (_responseText) {
1116
+ var result400 = null;
1117
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1118
+ result400 = ErrorResponse.fromJS(resultData400);
1119
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1120
+ });
1121
+ }
1122
+ else if (status !== 200 && status !== 204) {
1123
+ return response.text().then(function (_responseText) {
1124
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1125
+ });
1126
+ }
1127
+ return Promise.resolve(null);
1128
+ };
1129
+ /**
1130
+ * Save a TapPackage containing component settings in a package repository
1131
+ * @return Settings TapPackage uploaded.
1132
+ */
1133
+ RunnerClient.prototype.saveComponentSettingsToRepository = function (repositoryPackageDefinition) {
1134
+ var _this = this;
1135
+ var url_ = this.baseUrl + '/componentsettings/repository/save';
1136
+ url_ = url_.replace(/[?&]$/, '');
1137
+ var content_ = JSON.stringify(repositoryPackageDefinition);
1138
+ var options_ = {
1139
+ body: content_,
1140
+ method: 'POST',
1141
+ headers: {
1142
+ 'Content-Type': 'application/json',
1143
+ },
1144
+ };
1145
+ return this.http.fetch(url_, options_).then(function (_response) {
1146
+ return _this.processSaveComponentSettingsToRepository(_response);
1147
+ });
1148
+ };
1149
+ RunnerClient.prototype.processSaveComponentSettingsToRepository = function (response) {
1150
+ var status = response.status;
1151
+ var _headers = {};
1152
+ if (response.headers && response.headers.forEach) {
1153
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1154
+ }
1155
+ if (status === 200) {
1156
+ return response.text().then(function () {
1157
+ return;
1158
+ });
1159
+ }
1160
+ else if (status !== 200 && status !== 204) {
1161
+ return response.text().then(function (_responseText) {
1162
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1163
+ });
1164
+ }
1165
+ return Promise.resolve(null);
1166
+ };
1167
+ /**
1168
+ * Retrieve types available to be added to specified component settings list
1169
+ */
1170
+ RunnerClient.prototype.getComponentSettingsListAvailableTypes = function (groupName, name) {
1171
+ var _this = this;
1172
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/types';
1173
+ if (groupName === undefined || groupName === null)
1174
+ throw new Error("The parameter 'groupName' must be defined.");
1175
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
1176
+ if (name === undefined || name === null)
1177
+ throw new Error("The parameter 'name' must be defined.");
1178
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
1179
+ url_ = url_.replace(/[?&]$/, '');
1180
+ var options_ = {
1181
+ method: 'GET',
1182
+ headers: {
1183
+ Accept: 'application/json',
1184
+ },
1185
+ };
1186
+ return this.http.fetch(url_, options_).then(function (_response) {
1187
+ return _this.processGetComponentSettingsListAvailableTypes(_response);
1188
+ });
1189
+ };
1190
+ RunnerClient.prototype.processGetComponentSettingsListAvailableTypes = function (response) {
1191
+ var _this = this;
1192
+ var status = response.status;
1193
+ var _headers = {};
1194
+ if (response.headers && response.headers.forEach) {
1195
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1196
+ }
1197
+ if (status === 200) {
1198
+ return response.text().then(function (_responseText) {
1199
+ var result200 = null;
1200
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1201
+ if (Array.isArray(resultData200)) {
1202
+ result200 = [];
1203
+ for (var _i = 0, resultData200_8 = resultData200; _i < resultData200_8.length; _i++) {
1204
+ var item = resultData200_8[_i];
1205
+ result200.push(ListItemType.fromJS(item));
1206
+ }
1207
+ }
1208
+ else {
1209
+ result200 = null;
1210
+ }
1211
+ return result200;
1212
+ });
1213
+ }
1214
+ else if (status === 400) {
1215
+ return response.text().then(function (_responseText) {
1216
+ var result400 = null;
1217
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1218
+ result400 = ErrorResponse.fromJS(resultData400);
1219
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1220
+ });
1221
+ }
1222
+ else if (status !== 200 && status !== 204) {
1223
+ return response.text().then(function (_responseText) {
1224
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1225
+ });
1226
+ }
1227
+ return Promise.resolve(null);
1228
+ };
1229
+ /**
1230
+ * Adds a new item to a component settings list
1231
+ */
1232
+ RunnerClient.prototype.addComponentSettingsListItem = function (groupName, name, typeName) {
1233
+ var _this = this;
1234
+ var url_ = this.baseUrl + '/componentsettings/{groupName}/{name}/item/new/{typeName}';
1235
+ if (groupName === undefined || groupName === null)
1236
+ throw new Error("The parameter 'groupName' must be defined.");
1237
+ url_ = url_.replace('{groupName}', encodeURIComponent('' + groupName));
1238
+ if (name === undefined || name === null)
1239
+ throw new Error("The parameter 'name' must be defined.");
1240
+ url_ = url_.replace('{name}', encodeURIComponent('' + name));
1241
+ if (typeName === undefined || typeName === null)
1242
+ throw new Error("The parameter 'typeName' must be defined.");
1243
+ url_ = url_.replace('{typeName}', encodeURIComponent('' + typeName));
1244
+ url_ = url_.replace(/[?&]$/, '');
1245
+ var options_ = {
1246
+ method: 'POST',
1247
+ headers: {
1248
+ Accept: 'application/json',
1249
+ },
1250
+ };
1251
+ return this.http.fetch(url_, options_).then(function (_response) {
1252
+ return _this.processAddComponentSettingsListItem(_response);
1253
+ });
1254
+ };
1255
+ RunnerClient.prototype.processAddComponentSettingsListItem = function (response) {
1256
+ var _this = this;
1257
+ var status = response.status;
1258
+ var _headers = {};
1259
+ if (response.headers && response.headers.forEach) {
1260
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1261
+ }
1262
+ if (status === 200) {
1263
+ return response.text().then(function (_responseText) {
1264
+ var result200 = null;
1265
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1266
+ result200 = ComponentSettingsBase.fromJS(resultData200);
1267
+ return result200;
1268
+ });
1269
+ }
1270
+ else if (status === 400) {
1271
+ return response.text().then(function (_responseText) {
1272
+ var result400 = null;
1273
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1274
+ result400 = ErrorResponse.fromJS(resultData400);
1275
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1276
+ });
1277
+ }
1278
+ else if (status !== 200 && status !== 204) {
1279
+ return response.text().then(function (_responseText) {
1280
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1281
+ });
1282
+ }
1283
+ return Promise.resolve(null);
1284
+ };
1285
+ /**
1286
+ * Retrieve settings types used in creating a Settings TapPackage
1287
+ */
1288
+ RunnerClient.prototype.getSettingsTypes = function () {
1289
+ var _this = this;
1290
+ var url_ = this.baseUrl + '/componentsettings/types';
1291
+ url_ = url_.replace(/[?&]$/, '');
1292
+ var options_ = {
1293
+ method: 'GET',
1294
+ headers: {
1295
+ Accept: 'application/json',
1296
+ },
1297
+ };
1298
+ return this.http.fetch(url_, options_).then(function (_response) {
1299
+ return _this.processGetSettingsTypes(_response);
1300
+ });
1301
+ };
1302
+ RunnerClient.prototype.processGetSettingsTypes = function (response) {
1303
+ var _this = this;
1304
+ var status = response.status;
1305
+ var _headers = {};
1306
+ if (response.headers && response.headers.forEach) {
1307
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1308
+ }
1309
+ if (status === 200) {
1310
+ return response.text().then(function (_responseText) {
1311
+ var result200 = null;
1312
+ var resultData200 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1313
+ if (Array.isArray(resultData200)) {
1314
+ result200 = [];
1315
+ for (var _i = 0, resultData200_9 = resultData200; _i < resultData200_9.length; _i++) {
1316
+ var item = resultData200_9[_i];
1317
+ result200.push(item);
1318
+ }
1319
+ }
1320
+ else {
1321
+ result200 = null;
1322
+ }
1323
+ return result200;
1324
+ });
1325
+ }
1326
+ else if (status === 400) {
1327
+ return response.text().then(function (_responseText) {
1328
+ var result400 = null;
1329
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1330
+ result400 = ErrorResponse.fromJS(resultData400);
1331
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1332
+ });
1333
+ }
1334
+ else if (status !== 200 && status !== 204) {
1335
+ return response.text().then(function (_responseText) {
1336
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1337
+ });
1338
+ }
1339
+ return Promise.resolve(null);
1340
+ };
1341
+ /**
1342
+ * Download a TapPackage containing settings files
1343
+ */
1344
+ RunnerClient.prototype.downloadSettingsPackage = function (settingsTapPackage) {
1345
+ var _this = this;
1346
+ var url_ = this.baseUrl + '/componentsettings/download';
1347
+ url_ = url_.replace(/[?&]$/, '');
1348
+ var content_ = JSON.stringify(settingsTapPackage);
1349
+ var options_ = {
1350
+ body: content_,
1351
+ method: 'POST',
1352
+ headers: {
1353
+ 'Content-Type': 'application/json',
1354
+ Accept: 'application/octet-stream',
1355
+ },
1356
+ };
1357
+ return this.http.fetch(url_, options_).then(function (_response) {
1358
+ return _this.processDownloadSettingsPackage(_response);
1359
+ });
1360
+ };
1361
+ RunnerClient.prototype.processDownloadSettingsPackage = function (response) {
1362
+ var _this = this;
1363
+ var status = response.status;
1364
+ var _headers = {};
1365
+ if (response.headers && response.headers.forEach) {
1366
+ response.headers.forEach(function (v, k) { return (_headers[k] = v); });
1367
+ }
1368
+ if (status === 200 || status === 206) {
1369
+ var contentDisposition = response.headers ? response.headers.get('content-disposition') : undefined;
1370
+ var fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
1371
+ var fileName_1 = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
1372
+ return response.blob().then(function (blob) {
1373
+ return { fileName: fileName_1, data: blob, status: status, headers: _headers };
1374
+ });
1375
+ }
1376
+ else if (status === 400) {
1377
+ return response.text().then(function (_responseText) {
1378
+ var result400 = null;
1379
+ var resultData400 = _responseText === '' ? null : JSON.parse(_responseText, _this.jsonParseReviver);
1380
+ result400 = ErrorResponse.fromJS(resultData400);
1381
+ return throwException('A server side error occurred.', status, _responseText, _headers, result400);
1382
+ });
1383
+ }
1384
+ else if (status !== 200 && status !== 204) {
1385
+ return response.text().then(function (_responseText) {
1386
+ return throwException('An unexpected server error occurred.', status, _responseText, _headers);
1387
+ });
1388
+ }
1389
+ return Promise.resolve(null);
1390
+ };
1391
+ return RunnerClient;
1392
+ }(BaseClient));
1393
+ export { RunnerClient };
1394
+ function throwException(message, status, response, headers, result) {
1395
+ if (result !== null && result !== undefined)
1396
+ throw result;
1397
+ else
1398
+ throw new ApiException(message, status, response, headers, null);
1399
+ }