@bitbar/cloud-api-client 0.56.0 → 1.0.2

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.
Files changed (155) hide show
  1. package/dist/API.d.ts +55 -29
  2. package/dist/ApiConfig.d.ts +3 -3
  3. package/dist/CloudAPIClient.d.ts +3 -3
  4. package/dist/Filter.d.ts +3 -3
  5. package/dist/FilterBuilder.d.ts +19 -20
  6. package/dist/api/APIAdminListDevices.d.ts +8 -8
  7. package/dist/api/APIAdminListNotificationPlans.d.ts +9 -5
  8. package/dist/api/APIAdminListRuns.d.ts +12 -5
  9. package/dist/api/APIAdminListServices.d.ts +9 -10
  10. package/dist/api/APIAdminListStatistics.d.ts +8 -5
  11. package/dist/api/APIAdminResource.d.ts +97 -67
  12. package/dist/api/APIAdminResourceAccount.d.ts +6 -3
  13. package/dist/api/APIAdminResourceAccountService.d.ts +8 -5
  14. package/dist/api/APIAdminResourceCluster.d.ts +9 -5
  15. package/dist/api/APIAdminResourceDevice.d.ts +14 -9
  16. package/dist/api/APIAdminResourceDeviceModel.d.ts +9 -5
  17. package/dist/api/APIAdminResourceDeviceSession.d.ts +3 -3
  18. package/dist/api/APIAdminResourceDeviceSessionStandalone.d.ts +4 -10
  19. package/dist/api/APIAdminResourceDeviceTime.d.ts +10 -6
  20. package/dist/api/APIAdminResourceFramework.d.ts +11 -6
  21. package/dist/api/APIAdminResourceLicense.d.ts +10 -7
  22. package/dist/api/APIAdminResourceNotificationPlan.d.ts +11 -7
  23. package/dist/api/APIAdminResourceRun.d.ts +3 -4
  24. package/dist/api/APIAdminResourceRunStandalone.d.ts +10 -11
  25. package/dist/api/APIAdminResourceService.d.ts +7 -7
  26. package/dist/api/APIAdminResourceUser.d.ts +15 -9
  27. package/dist/api/APIAdminResourceUserAccount.d.ts +13 -8
  28. package/dist/api/APIEntity.d.ts +21 -18
  29. package/dist/api/APIList.d.ts +9 -11
  30. package/dist/api/APIListCleanupConfigurations.d.ts +9 -5
  31. package/dist/api/APIListDeviceTime.d.ts +9 -5
  32. package/dist/api/APIListDevices.d.ts +11 -10
  33. package/dist/api/APIListFiles.d.ts +8 -7
  34. package/dist/api/APIListNotifications.d.ts +11 -5
  35. package/dist/api/APIListProperties.d.ts +8 -4
  36. package/dist/api/APIListRuns.d.ts +8 -5
  37. package/dist/api/APIListServices.d.ts +14 -7
  38. package/dist/api/APIListSmartbearTunnels.d.ts +8 -3
  39. package/dist/api/APIListUsers.d.ts +15 -9
  40. package/dist/api/APIResource.d.ts +3 -2
  41. package/dist/api/APIResourceAccessGroup.d.ts +14 -8
  42. package/dist/api/APIResourceAccount.d.ts +10 -5
  43. package/dist/api/APIResourceAccountService.d.ts +9 -4
  44. package/dist/api/APIResourceAdditionalUser.d.ts +7 -4
  45. package/dist/api/APIResourceBillingPeriod.d.ts +7 -4
  46. package/dist/api/APIResourceBroker.d.ts +8 -5
  47. package/dist/api/APIResourceChannel.d.ts +8 -0
  48. package/dist/api/APIResourceCleanupConfiguration.d.ts +7 -5
  49. package/dist/api/APIResourceDevice.d.ts +10 -5
  50. package/dist/api/APIResourceDeviceGroup.d.ts +16 -9
  51. package/dist/api/APIResourceDeviceSession.d.ts +7 -6
  52. package/dist/api/APIResourceDeviceSessionCommon.d.ts +22 -14
  53. package/dist/api/APIResourceDeviceSessionStandalone.d.ts +15 -10
  54. package/dist/api/APIResourceFile.d.ts +16 -7
  55. package/dist/api/APIResourceLabelGroup.d.ts +10 -6
  56. package/dist/api/APIResourceNotification.d.ts +8 -4
  57. package/dist/api/APIResourceProject.d.ts +15 -12
  58. package/dist/api/APIResourceRun.d.ts +3 -3
  59. package/dist/api/APIResourceRunCommon.d.ts +28 -17
  60. package/dist/api/APIResourceUser.d.ts +53 -40
  61. package/dist/api/APIResourceUserSession.d.ts +10 -7
  62. package/dist/api/APIUserResourceAccount.d.ts +13 -7
  63. package/dist/api/class/FilesQueryParams.d.ts +4 -0
  64. package/dist/api/class/Images.filter.d.ts +2 -0
  65. package/dist/api/class/InputFileset.d.ts +11 -6
  66. package/dist/api/class/NonMedia.filter.d.ts +2 -0
  67. package/dist/api/class/OutputFileset.d.ts +19 -12
  68. package/dist/api/decorators/NonRequestable.d.ts +8 -0
  69. package/dist/api/factory/postAdminDeviceSessionChangeBillable.d.ts +4 -3
  70. package/dist/api/factory/postDeviceRunIds.d.ts +4 -3
  71. package/dist/api/interface/DeviceSession.d.ts +6 -5
  72. package/dist/api/interface/DeviceSessionBase.d.ts +4 -4
  73. package/dist/api/interface/DeviceSessionCommon.d.ts +15 -11
  74. package/dist/api/interface/DeviceSessionStandalone.d.ts +9 -7
  75. package/dist/api/models/AccessGroup.d.ts +14 -0
  76. package/dist/api/models/Account.d.ts +7 -0
  77. package/dist/api/models/AccountConcurrencyStatusMap.d.ts +4 -0
  78. package/dist/api/models/AccountPreference.d.ts +4 -0
  79. package/dist/api/models/AccountService.d.ts +66 -0
  80. package/dist/api/models/AccountServicePayment.d.ts +11 -0
  81. package/dist/api/models/Activity.d.ts +13 -0
  82. package/dist/api/models/AdminDevice.d.ts +50 -0
  83. package/dist/api/models/AdminDeviceSession.d.ts +36 -0
  84. package/dist/api/models/AdminDeviceSessionStatistics.d.ts +22 -0
  85. package/dist/api/models/AdminDeviceType.d.ts +12 -0
  86. package/dist/api/models/AdminEmail.d.ts +9 -0
  87. package/dist/api/models/AdminError.d.ts +39 -0
  88. package/dist/api/models/AdminFrameworkStatistics.d.ts +24 -0
  89. package/dist/api/models/AdminOverview.d.ts +10 -0
  90. package/dist/api/models/AdminTestRun.d.ts +31 -0
  91. package/dist/api/models/BillingPeriod.d.ts +40 -0
  92. package/dist/api/models/Broker.d.ts +10 -0
  93. package/dist/api/models/Browser.d.ts +15 -0
  94. package/dist/api/models/CleanupConfiguration.d.ts +5 -0
  95. package/dist/api/models/Cluster.d.ts +32 -0
  96. package/dist/api/models/Connection.d.ts +15 -0
  97. package/dist/api/models/CountryVatRate.d.ts +7 -0
  98. package/dist/api/models/DesktopBrowserCapabilities.d.ts +19 -0
  99. package/dist/api/models/Device.d.ts +108 -0
  100. package/dist/api/models/DeviceFilter.d.ts +17 -0
  101. package/dist/api/models/DeviceGroup.d.ts +26 -0
  102. package/dist/api/models/DeviceModel.d.ts +23 -0
  103. package/dist/api/models/DeviceModelCriterion.d.ts +19 -0
  104. package/dist/api/models/DeviceModelPool.d.ts +19 -0
  105. package/dist/api/models/DeviceProblem.d.ts +23 -0
  106. package/dist/api/models/DeviceSession.d.ts +137 -0
  107. package/dist/api/models/DeviceSessionDataAvailability.d.ts +9 -0
  108. package/dist/api/models/DeviceStatistics.d.ts +15 -0
  109. package/dist/api/models/DeviceStatus.d.ts +30 -0
  110. package/dist/api/models/DeviceTimeCountSessionReportEntry.d.ts +12 -0
  111. package/dist/api/models/DeviceTimeStepTimeReportEntry.d.ts +12 -0
  112. package/dist/api/models/DeviceUsage.d.ts +7 -0
  113. package/dist/api/models/Enum.d.ts +10 -0
  114. package/dist/api/models/Framework.d.ts +37 -0
  115. package/dist/api/models/HTTP.d.ts +33 -0
  116. package/dist/api/models/LabelGroup.d.ts +7 -0
  117. package/dist/api/models/License.d.ts +74 -0
  118. package/dist/api/models/Maintenance.d.ts +13 -0
  119. package/dist/api/models/Message.d.ts +3 -0
  120. package/dist/api/models/Notification.d.ts +34 -0
  121. package/dist/api/models/NotificationPlan.d.ts +20 -0
  122. package/dist/api/models/Project.d.ts +31 -0
  123. package/dist/api/models/ProjectJobConfig.d.ts +9 -0
  124. package/dist/api/models/Property.d.ts +17 -0
  125. package/dist/api/models/Role.d.ts +15 -0
  126. package/dist/api/models/Screenshot.d.ts +22 -0
  127. package/dist/api/models/Service.d.ts +61 -0
  128. package/dist/api/models/Settings.d.ts +6 -0
  129. package/dist/api/models/SharedResource.d.ts +16 -0
  130. package/dist/api/models/SmartbearTunnel.d.ts +20 -0
  131. package/dist/api/models/Tag.d.ts +16 -0
  132. package/dist/api/models/TestCaseRun.d.ts +40 -0
  133. package/dist/api/models/TestRun.d.ts +132 -0
  134. package/dist/api/models/TestRunDataAvailability.d.ts +10 -0
  135. package/dist/api/models/User.d.ts +75 -0
  136. package/dist/api/models/UserDeviceTime.d.ts +21 -0
  137. package/dist/api/models/UserDeviceTimeSummary.d.ts +14 -0
  138. package/dist/api/models/UserFile.d.ts +65 -0
  139. package/dist/api/models/UserPreference.d.ts +11 -0
  140. package/dist/api/models/UserStatistics.d.ts +14 -0
  141. package/dist/api/models/VatRate.d.ts +4 -0
  142. package/dist/bitbar-cloud-api-client.js +1064 -1009
  143. package/dist/bitbar-cloud-api-client.js.map +1 -1
  144. package/dist/bitbar-cloud-api-client.min.js +17 -2
  145. package/dist/bitbar-cloud-api-client.min.js.map +1 -1
  146. package/package.json +30 -26
  147. package/.nycrc +0 -14
  148. package/Jenkinsfile.sonar +0 -53
  149. package/dist/api/APIAdminResourceProject.d.ts +0 -6
  150. package/dist/api/APIListPurchased.d.ts +0 -5
  151. package/dist/api/APIListStatistics.d.ts +0 -6
  152. package/dist/api/APIResourceBuild.d.ts +0 -8
  153. package/dist/api/APIResourceJob.d.ts +0 -9
  154. package/sonar-project.properties +0 -17
  155. package/tsconfig.test.json +0 -20
@@ -1,30 +1,171 @@
1
- /* @bitbar/cloud-api-client v0.56.0 | Copyright 2022 (c) SmartBear Software and contributors | .git/blob/master/LICENSE */
1
+ /* @bitbar/cloud-api-client v1.0.2 | Copyright 2022 (c) SmartBear Software and contributors | .git/blob/master/LICENSE */
2
2
  (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@bitbar/finka'), require('axios'), require('qs')) :
4
- typeof define === 'function' && define.amd ? define(['@bitbar/finka', 'axios', 'qs'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["bitbar-cloud-api-client"] = factory(global["@bitbar/finka"], global.axios, global.qs));
6
- })(this, (function (finka, axios, qs) { 'use strict';
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('axios'), require('@bitbar/finka'), require('qs'), require('node-abort-controller')) :
4
+ typeof define === 'function' && define.amd ? define(['axios', '@bitbar/finka', 'qs', 'node-abort-controller'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["bitbar-cloud-api-client"] = factory(global.axios, global["@bitbar/finka"], global.qs, global["node-abort-controller"]));
6
+ })(this, (function (axios, finka, qs, nodeAbortController) { 'use strict';
7
7
 
8
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
9
 
10
- var finka__default = /*#__PURE__*/_interopDefaultLegacy(finka);
11
10
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
12
- var qs__default = /*#__PURE__*/_interopDefaultLegacy(qs);
11
+ var finka__default = /*#__PURE__*/_interopDefaultLegacy(finka);
12
+
13
+ var version = "1.0.2";
14
+
15
+ /******************************************************************************
16
+ Copyright (c) Microsoft Corporation.
17
+
18
+ Permission to use, copy, modify, and/or distribute this software for any
19
+ purpose with or without fee is hereby granted.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
22
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
24
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
25
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
+ PERFORMANCE OF THIS SOFTWARE.
28
+ ***************************************************************************** */
29
+
30
+ function __decorate(decorators, target, key, desc) {
31
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
32
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
34
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
35
+ }
36
+
37
+ class Filter {
38
+ constructor(name, value, operand) {
39
+ this.name = name;
40
+ this.value = value;
41
+ this.operand = operand;
42
+ }
43
+ }
13
44
 
14
45
  finka__default["default"]();
15
46
 
16
- var version = "0.56.0";
47
+ class FilterBuilder {
48
+ constructor() {
49
+ this.filters = [];
50
+ }
51
+ gt(name, value) {
52
+ return this.add(name, value, 'gt');
53
+ }
54
+ lt(name, value) {
55
+ return this.add(name, value, 'lt');
56
+ }
57
+ after(name, value) {
58
+ return this.add(name, value, 'after', true);
59
+ }
60
+ afterorequal(name, value) {
61
+ return this.add(name, value, 'afterorequal', true);
62
+ }
63
+ before(name, value) {
64
+ return this.add(name, value, 'before', true);
65
+ }
66
+ beforeorequal(name, value) {
67
+ return this.add(name, value, 'beforeorequal', true);
68
+ }
69
+ on(name, value) {
70
+ return this.add(name, value, 'on');
71
+ }
72
+ eq(name, value) {
73
+ return this.add(name, value, 'eq');
74
+ }
75
+ contains(name, value) {
76
+ return this.add(name, value, 'contains');
77
+ }
78
+ like(name, value) {
79
+ return this.add(name, value, 'like');
80
+ }
81
+ notlike(name, value) {
82
+ return this.add(name, value, 'notlike');
83
+ }
84
+ isnull(name) {
85
+ return this.add(name, undefined, 'isnull');
86
+ }
87
+ in(name, value) {
88
+ return this.add(name, value, 'in', true);
89
+ }
90
+ notin(name, value) {
91
+ return this.add(name, value, 'notin', true);
92
+ }
93
+ raw(filter) {
94
+ const filters = Array.wrap(filter);
95
+ for (const filter of filters) {
96
+ if (this.isFilterPart(filter)) {
97
+ this.filters.push(filter);
98
+ }
99
+ else {
100
+ throw new SyntaxError(`Filter ${filter} has invalid syntax`);
101
+ }
102
+ }
103
+ }
104
+ isFilterPart(str) {
105
+ return /^[a-zA-Z0-9.]{2,12}_(?:isnull$|(?:gt|lt|(?:after|before)(?:orequal)?|on|eq|contains|like|(?:not)?in)_)/.test(str);
106
+ }
107
+ toString() {
108
+ const parts = [];
109
+ let part, val;
110
+ for (const filter of this.filters) {
111
+ if (typeof filter === 'string') {
112
+ part = filter;
113
+ }
114
+ else {
115
+ val = '';
116
+ if (filter.value.length > 1 || typeof filter.value[0] !== 'undefined') {
117
+ val = `_${filter.value.join('|')}`;
118
+ }
119
+ part = `${filter.name}_${filter.operand}${val}`;
120
+ }
121
+ parts.push(part);
122
+ }
123
+ return parts.join(';');
124
+ }
125
+ add(name, value, operand, checkNull = false) {
126
+ let _value = Array.wrap(value);
127
+ if (_value.length === 0) {
128
+ return this;
129
+ }
130
+ for (let i = 0; i < _value.length; i++) {
131
+ const v = _value[i];
132
+ if (typeof v === 'object' && v instanceof Date) {
133
+ _value[i] = v.getTime();
134
+ }
135
+ }
136
+ let isNull = false;
137
+ if (checkNull) {
138
+ for (const v of _value) {
139
+ if (v !== null) {
140
+ continue;
141
+ }
142
+ isNull = true;
143
+ }
144
+ if (isNull) {
145
+ _value = _value.filter((item) => item !== null);
146
+ operand += 'ornull';
147
+ }
148
+ }
149
+ if (operand.endsWith('ornull') && _value.length === 0) {
150
+ operand = 'isnull';
151
+ }
152
+ this.filters.push(new Filter(name, _value, operand));
153
+ return this;
154
+ }
155
+ }
156
+
157
+ const ALLOWED_HTTP_METHODS = ['GET', 'POST', 'DELETE'];
158
+ var APIOrder;
159
+ (function (APIOrder) {
160
+ APIOrder["asc"] = "a";
161
+ APIOrder["desc"] = "d";
162
+ })(APIOrder || (APIOrder = {}));
17
163
 
18
- var ALLOWED_HTTP_METHODS;
19
- (function (ALLOWED_HTTP_METHODS) {
20
- ALLOWED_HTTP_METHODS["GET"] = "GET";
21
- ALLOWED_HTTP_METHODS["POST"] = "POST";
22
- ALLOWED_HTTP_METHODS["DELETE"] = "DELETE";
23
- })(ALLOWED_HTTP_METHODS || (ALLOWED_HTTP_METHODS = {}));
24
164
  class APIEntity {
25
165
  constructor(parent) {
26
166
  this.stack = [];
27
167
  this.requestConfig = {};
168
+ this.ALLOWED_HTTP_METHODS = ALLOWED_HTTP_METHODS;
28
169
  if (parent instanceof APIEntity) {
29
170
  this.root = parent.root;
30
171
  if (Array.isArray(parent.stack)) {
@@ -37,27 +178,19 @@
37
178
  else {
38
179
  this.root = parent;
39
180
  }
181
+ this.abortController = new nodeAbortController.AbortController();
40
182
  }
41
- push(...items) {
42
- for (const item of items) {
43
- this.stack.push(item);
44
- }
45
- return this;
183
+ abortRequest() {
184
+ this.abortController.abort();
46
185
  }
47
- pop() {
48
- this.stack.pop();
186
+ push(...items) {
187
+ this.stack = this.stack.concat(items);
49
188
  return this;
50
189
  }
51
190
  shift() {
52
191
  this.stack.shift();
53
192
  return this;
54
193
  }
55
- unshift(...items) {
56
- for (const item of items) {
57
- this.stack.unshift(item);
58
- }
59
- return this;
60
- }
61
194
  restack(...items) {
62
195
  this.stack = items;
63
196
  return this;
@@ -65,9 +198,6 @@
65
198
  get first() {
66
199
  return this.stack[0];
67
200
  }
68
- set first(val) {
69
- this.stack[0] = val;
70
- }
71
201
  get last() {
72
202
  return this.stack[this.stack.length - 1];
73
203
  }
@@ -77,7 +207,7 @@
77
207
  toUrl(absolute = false) {
78
208
  let url = `/${this.stack.join('/')}`;
79
209
  if (absolute) {
80
- url = this.root.axiosConfig.baseURL + url;
210
+ url = this.root.baseUrl + url;
81
211
  }
82
212
  return url;
83
213
  }
@@ -101,8 +231,9 @@
101
231
  }
102
232
  method(name) {
103
233
  const NAME = name.toLocaleUpperCase();
104
- if (!ALLOWED_HTTP_METHODS[NAME]) {
105
- throw new Error(`Method '${NAME}' is not allowed! You can use: ${Object.keys(ALLOWED_HTTP_METHODS).join(', ')}`);
234
+ const isAllowed = this.ALLOWED_HTTP_METHODS.indexOf(NAME) > -1;
235
+ if (!isAllowed) {
236
+ throw new Error(`Method '${NAME}' is not allowed! You can use: ${this.ALLOWED_HTTP_METHODS.join(', ')}`);
106
237
  }
107
238
  return this.setRequestConfig({
108
239
  method: NAME
@@ -115,9 +246,7 @@
115
246
  return this.method('POST');
116
247
  }
117
248
  params(params) {
118
- Object.deepAssign(this.requestConfig, {
119
- params
120
- });
249
+ this.setRequestConfig({ params });
121
250
  return this;
122
251
  }
123
252
  getParams() {
@@ -128,9 +257,7 @@
128
257
  return this;
129
258
  }
130
259
  data(data) {
131
- Object.deepAssign(this.requestConfig, {
132
- data
133
- });
260
+ this.setRequestConfig({ data });
134
261
  return this;
135
262
  }
136
263
  jsonData(data) {
@@ -145,14 +272,10 @@
145
272
  }).data(data);
146
273
  return this;
147
274
  }
148
- paramsSerializer(params) {
149
- return qs__default["default"].stringify(params, {
150
- arrayFormat: 'brackets'
151
- });
152
- }
153
275
  send() {
154
276
  const requestConfig = Object.deepAssign({}, this.requestConfig, {
155
- url: `/${this.stack.join('/')}`
277
+ url: `/${this.stack.join('/')}`,
278
+ signal: this.abortController.signal
156
279
  });
157
280
  if (requestConfig.headers == null) {
158
281
  requestConfig.headers = {};
@@ -163,137 +286,28 @@
163
286
  if (requestConfig.method === 'POST' &&
164
287
  requestConfig.headers['Content-Type'].startsWith('application/x-www-form-urlencoded') &&
165
288
  requestConfig.data != null) {
166
- requestConfig.data = qs__default["default"].stringify(requestConfig.data, {
167
- arrayFormat: 'brackets'
168
- });
289
+ requestConfig.data = this.paramsSerializer(requestConfig.data);
169
290
  }
170
291
  if (requestConfig.params) {
171
292
  requestConfig.paramsSerializer = this.paramsSerializer;
172
293
  }
173
294
  return this.root.axios.request(requestConfig);
174
295
  }
175
- }
176
-
177
- class Filter {
178
- constructor(name, value, operand) {
179
- this.name = name;
180
- this.value = value;
181
- this.operand = operand;
182
- }
183
- }
184
-
185
- class FilterBuilder {
186
- constructor() {
187
- this.filters = [];
188
- }
189
- add(name, value, operand, checkNull = false) {
190
- value = Array.wrap(value);
191
- if (value.length === 0) {
192
- return this;
193
- }
194
- for (let i = 0; i < value.length; i++) {
195
- const v = value[i];
196
- if (typeof v === 'object' && v instanceof Date) {
197
- value[i] = v.getTime();
198
- }
199
- }
200
- if (checkNull) {
201
- for (const v of value) {
202
- if (v !== null) {
203
- continue;
204
- }
205
- }
206
- }
207
- if (operand.endsWith('ornull') && value.length === 0) {
208
- operand = 'isnull';
209
- }
210
- this.filters.push(new Filter(name, value, operand));
211
- return this;
212
- }
213
- gt(name, value) {
214
- return this.add(name, value, 'gt');
215
- }
216
- lt(name, value) {
217
- return this.add(name, value, 'lt');
218
- }
219
- after(name, value) {
220
- return this.add(name, value, 'after', true);
221
- }
222
- afterorequal(name, value) {
223
- return this.add(name, value, 'afterorequal', true);
224
- }
225
- before(name, value) {
226
- return this.add(name, value, 'before', true);
227
- }
228
- beforeorequal(name, value) {
229
- return this.add(name, value, 'beforeorequal', true);
230
- }
231
- on(name, value) {
232
- return this.add(name, value, 'on');
233
- }
234
- eq(name, value) {
235
- return this.add(name, value, 'eq');
236
- }
237
- contains(name, value) {
238
- return this.add(name, value, 'contains');
239
- }
240
- like(name, value) {
241
- return this.add(name, value, 'like');
242
- }
243
- notlike(name, value) {
244
- return this.add(name, value, 'notlike');
245
- }
246
- isnull(name) {
247
- return this.add(name, undefined, 'isnull');
248
- }
249
- in(name, value) {
250
- return this.add(name, value, 'in', true);
251
- }
252
- notin(name, value) {
253
- return this.add(name, value, 'notin', true);
254
- }
255
- raw(filter) {
256
- const filters = Array.wrap(filter);
257
- for (const filter of filters) {
258
- if (this.isFilterPart(filter)) {
259
- this.filters.push(filter);
260
- }
261
- else {
262
- throw new SyntaxError(`Filter ${filter} has invalid syntax`);
263
- }
264
- }
265
- }
266
- isFilterPart(str) {
267
- return /^[a-zA-Z0-9.]{2,12}_(?:isnull$|(?:gt|lt|(?:after|before)(?:orequal)?|on|eq|contains|like|(?:not)?in)_)/.test(str);
268
- }
269
- toString() {
270
- const parts = [];
271
- let part, val;
272
- for (const filter of this.filters) {
273
- if (typeof filter === 'string') {
274
- part = filter;
275
- }
276
- else {
277
- val = '';
278
- if (filter.value.length > 1 || typeof filter.value[0] !== 'undefined') {
279
- val = `_${filter.value.join('|')}`;
280
- }
281
- part = `${filter.name}_${filter.operand}${val}`;
282
- }
283
- parts.push(part);
284
- }
285
- return parts.join(';');
296
+ paramsSerializer(params) {
297
+ return qs.stringify(params, {
298
+ arrayFormat: 'brackets'
299
+ });
286
300
  }
287
301
  }
288
302
 
289
303
  const DEFAULT_LIMIT = 20;
290
304
  const DEFAULT_OFFSET = 0;
291
- var APIOrder;
292
- (function (APIOrder) {
293
- APIOrder["asc"] = "a";
294
- APIOrder["desc"] = "d";
295
- })(APIOrder || (APIOrder = {}));
296
305
  class APIList extends APIEntity {
306
+ constructor() {
307
+ super(...arguments);
308
+ this.all = this.noLimit;
309
+ this.cut = this.between;
310
+ }
297
311
  create(data) {
298
312
  return this.post().data(data).send();
299
313
  }
@@ -370,16 +384,11 @@
370
384
  if (typeof filter !== 'string' && !isFilterBuilder) {
371
385
  throw new Error('Filter must be either string or instance of FilterBuilder');
372
386
  }
373
- if (isFilterBuilder) {
374
- filter = filter.toString();
375
- }
376
387
  return this.params({
377
- filter
388
+ filter: filter.toString()
378
389
  });
379
390
  }
380
391
  }
381
- APIList.prototype.all = APIList.prototype.noLimit;
382
- APIList.prototype.cut = APIList.prototype.between;
383
392
 
384
393
  class APIResource extends APIEntity {
385
394
  delete() {
@@ -393,7 +402,8 @@
393
402
  this.push('cleanup-configurations');
394
403
  }
395
404
  specific() {
396
- return new APIResource(this).push('specific');
405
+ return new APIResource(this)
406
+ .push('specific');
397
407
  }
398
408
  }
399
409
 
@@ -406,17 +416,14 @@
406
416
  this.push('cleanup-configurations', id);
407
417
  }
408
418
  devices() {
409
- return new APIList(this).push('devices');
419
+ return new APIResource(this).push('devices');
410
420
  }
411
421
  }
412
422
 
413
- class APIListDevices extends APIList {
423
+ class APIAdminListDevices extends APIList {
414
424
  constructor(parent) {
415
425
  super(parent);
416
- this.push('devices');
417
- }
418
- filters() {
419
- return new APIResource(this).push('filters');
426
+ this.push('admin', 'devices');
420
427
  }
421
428
  cleanupConfigurations() {
422
429
  return new APIListCleanupConfigurations(this);
@@ -424,176 +431,165 @@
424
431
  cleanupConfiguration(id) {
425
432
  return new APIResourceCleanupConfiguration(this, id);
426
433
  }
427
- desktopBrowserCapabilities() {
428
- return new APIResource(this).push('desktop-browser-capabilities');
429
- }
430
434
  }
431
435
 
432
- class APIListUsers extends APIList {
436
+ class APIAdminListNotificationPlans extends APIList {
433
437
  constructor(parent) {
434
438
  super(parent);
435
- this.push('users');
436
- }
437
- activate() {
438
- return new APIResource(this).push('activate').post();
439
+ this.push('admin', 'notification-plans');
439
440
  }
440
- recoveries() {
441
- return new APIResource(this).push('recoveries');
441
+ channels() {
442
+ return new APIList(this).push('channels');
442
443
  }
443
- passwordRecovery() {
444
- return new APIResource(this).push('password-recovery');
444
+ scopes() {
445
+ return new APIList(this).push('scopes');
445
446
  }
446
- resetApiKey() {
447
- return new APIResource(this).push('reset-api-key');
447
+ }
448
+
449
+ class APIAdminListRuns extends APIList {
450
+ constructor(parent) {
451
+ super(parent);
452
+ this.ALLOWED_HTTP_METHODS = ['GET'];
453
+ this.push('admin', 'runs');
448
454
  }
449
- validateVatId() {
450
- return new APIResource(this).push('validateVatId');
455
+ config() {
456
+ const apiResource = new APIResource(this);
457
+ apiResource.restack('runs', 'config');
458
+ return apiResource;
451
459
  }
452
460
  }
453
461
 
454
- class APIResourceBillingPeriod extends APIResource {
455
- constructor(parent, id) {
456
- if (id == null) {
457
- throw new Error('Resource ID cannot be null!');
458
- }
462
+ class APIAdminListServices extends APIList {
463
+ constructor(parent) {
459
464
  super(parent);
460
- this.push('billing-periods', id);
465
+ this.push('admin', 'services');
461
466
  }
462
- receipt() {
463
- return new APIResource(this).push('receipt').setRequestConfig({
464
- responseType: 'arraybuffer'
467
+ active() {
468
+ const apiList = new APIList(this);
469
+ apiList.params({
470
+ notArchived: true
471
+ });
472
+ return apiList;
473
+ }
474
+ activated() {
475
+ const apiList = this.active();
476
+ apiList.params({
477
+ filter: 'activated_eq_true',
478
+ limit: 0,
479
+ sort: 'name_a'
480
+ });
481
+ return apiList;
482
+ }
483
+ inUse() {
484
+ const apiList = new APIList(this);
485
+ apiList.params({
486
+ inUse: true,
487
+ limit: 0,
488
+ sort: 'name_a'
489
+ });
490
+ return apiList;
491
+ }
492
+ byPrice() {
493
+ const apiList = new APIList(this);
494
+ apiList.params({
495
+ sort: 'centPrice_a'
465
496
  });
497
+ return apiList;
466
498
  }
467
499
  }
468
500
 
469
- class APIResourceBuild extends APIResource {
470
- constructor(parent, id) {
471
- if (id == null) {
472
- throw new Error('Resource ID cannot be null!');
501
+ function NonRequestable(constructor) {
502
+ return class extends constructor {
503
+ send() {
504
+ return Promise.reject();
473
505
  }
506
+ };
507
+ }
508
+
509
+ let APIAdminListStatistics = class APIAdminListStatistics extends APIList {
510
+ constructor(parent) {
474
511
  super(parent);
475
- this.push('builds', id);
512
+ this.push('admin', 'statistics');
476
513
  }
477
- abort() {
478
- return new APIResource(this).push('abort');
514
+ deviceSessions() {
515
+ return new APIList(this).push('device-sessions');
479
516
  }
480
- outputFiles() {
481
- return new APIList(this).push('output-file-set', 'files');
517
+ frameworks() {
518
+ return new APIList(this).push('frameworks');
482
519
  }
483
- }
520
+ };
521
+ APIAdminListStatistics = __decorate([
522
+ NonRequestable
523
+ ], APIAdminListStatistics);
484
524
 
485
- class APIResourceJob extends APIResource {
525
+ class APIAdminResourceAccountService extends APIResource {
486
526
  constructor(parent, id) {
487
527
  if (id == null) {
488
528
  throw new Error('Resource ID cannot be null!');
489
529
  }
490
530
  super(parent);
491
- this.push('jobs', id);
531
+ this.push('admin', 'account-services', id);
492
532
  }
493
- builds() {
494
- return new APIList(this).push('builds');
533
+ activate() {
534
+ return new APIResource(this).push('activate').post();
495
535
  }
496
- build(id) {
497
- return new APIResourceBuild(this, id);
536
+ deactivate() {
537
+ return new APIResource(this).push('deactivate').post();
498
538
  }
499
539
  }
500
540
 
501
- class APIResourceDeviceGroup extends APIResource {
541
+ class APIAdminResourceCluster extends APIResource {
502
542
  constructor(parent, id) {
503
543
  if (id == null) {
504
544
  throw new Error('Resource ID cannot be null!');
505
545
  }
506
546
  super(parent);
507
- this.push('device-groups', id);
547
+ this.push('clusters', id);
508
548
  }
509
549
  devices() {
510
550
  return new APIList(this).push('devices');
511
551
  }
512
- device(id) {
513
- if (id == null) {
514
- throw new Error('Resource ID cannot be null!');
515
- }
516
- return new APIResource(this).push('devices', id);
517
- }
518
- selectors() {
519
- return new APIList(this).push('selectors');
520
- }
521
- selector(id) {
522
- if (id == null) {
523
- throw new Error('Resource ID cannot be null!');
524
- }
525
- return new APIResource(this).push('selectors', id);
526
- }
527
- share() {
528
- return new APIResource(this).push('share');
529
- }
530
- }
531
-
532
- function postDeviceRunIds(parent, name, ids) {
533
- const a = new APIResource(parent).push(name);
534
- if (ids != null) {
535
- a.params({
536
- deviceRunIds: ids
537
- });
538
- }
539
- return a.post();
540
552
  }
541
553
 
542
- class APIResourceRunCommon extends APIResource {
554
+ class APIAdminResourceDevice extends APIResource {
543
555
  constructor(parent, id) {
544
556
  if (id == null) {
545
557
  throw new Error('Resource ID cannot be null!');
546
558
  }
547
559
  super(parent);
548
- this.push('runs', id);
549
- }
550
- abort() {
551
- return new APIResource(this).push('abort').post();
552
- }
553
- dataAvailability() {
554
- return new APIList(this).push('data-availability');
555
- }
556
- deviceSessions() {
557
- return new APIList(this).push('device-sessions');
558
- }
559
- filesZip(ids) {
560
- return postDeviceRunIds(this, 'files.zip', ids);
561
- }
562
- logsZip(ids) {
563
- return postDeviceRunIds(this, 'logs.zip', ids);
564
- }
565
- performanceZip(ids) {
566
- return postDeviceRunIds(this, 'performance.zip', ids);
567
- }
568
- retry(ids) {
569
- return postDeviceRunIds(this, 'retry', ids).setRequestConfig({
570
- timeout: 0
571
- });
560
+ this.push('admin', 'devices', id);
572
561
  }
573
- screenshotNames() {
574
- return new APIList(this).push('screenshot-names');
562
+ blink() {
563
+ return new APIResource(this).push('blink').post();
575
564
  }
576
- screenshots() {
577
- return new APIList(this).push('screenshots');
565
+ cleanupConfiguration() {
566
+ return new APIResource(this).push('cleanup-configuration');
578
567
  }
579
- screenshotsZip(ids) {
580
- return postDeviceRunIds(this, 'screenshots.zip', ids);
568
+ labels() {
569
+ return new APIList(this).push('labels');
581
570
  }
582
- steps() {
583
- return new APIList(this).push('steps');
571
+ label(id) {
572
+ return new APIResource(this).push('labels', id);
584
573
  }
585
- tags() {
586
- return new APIList(this).push('tags');
574
+ queue() {
575
+ return new APIList(this).push('queue');
587
576
  }
588
- tag(id) {
577
+ }
578
+
579
+ class APIAdminResourceDeviceModel extends APIResource {
580
+ constructor(parent, id) {
589
581
  if (id == null) {
590
582
  throw new Error('Resource ID cannot be null!');
591
583
  }
592
- return new APIResource(this).push('tags', id);
584
+ super(parent);
585
+ this.push('admin', 'device-models', id);
586
+ }
587
+ browsers() {
588
+ return new APIList(this).push('browsers');
593
589
  }
594
590
  }
595
591
 
596
- class InputFileset extends APIResource {
592
+ let InputFileset = class InputFileset extends APIResource {
597
593
  constructor(parent) {
598
594
  super(parent);
599
595
  this.push('input-file-set');
@@ -604,7 +600,17 @@
604
600
  filesZip() {
605
601
  return new APIResource(this).push('files.zip');
606
602
  }
607
- }
603
+ };
604
+ InputFileset = __decorate([
605
+ NonRequestable
606
+ ], InputFileset);
607
+
608
+ const IMAGE_FILES_FILTER = new FilterBuilder();
609
+ IMAGE_FILES_FILTER.eq('state', 'READY');
610
+ IMAGE_FILES_FILTER.in('mimetype', [
611
+ 'image/png', 'image/jpg', 'image/jpeg', 'image/webp', 'image/gif'
612
+ ]);
613
+ IMAGE_FILES_FILTER.notlike('name', 'action-%%');
608
614
 
609
615
  const NON_MEDIA_FILES_FILTER = new FilterBuilder();
610
616
  NON_MEDIA_FILES_FILTER.eq('state', 'READY');
@@ -612,7 +618,8 @@
612
618
  'image/png', 'image/jpg', 'image/jpeg', 'image/webp', 'image/gif',
613
619
  'video/mp4', 'video/avi', 'video/webm', 'video/ogg', 'video/mpeg'
614
620
  ]);
615
- class OutputFileset extends APIResource {
621
+
622
+ let OutputFileset = class OutputFileset extends APIResource {
616
623
  constructor(parent) {
617
624
  super(parent);
618
625
  this.push('output-file-set');
@@ -621,9 +628,6 @@
621
628
  return new APIList(this).push('files');
622
629
  }
623
630
  file(id) {
624
- if (id == null) {
625
- throw new Error('Resource ID cannot be null!');
626
- }
627
631
  return new APIResource(this).push('files', id);
628
632
  }
629
633
  filesZip() {
@@ -633,13 +637,10 @@
633
637
  return new APIList(this).push('screenshots');
634
638
  }
635
639
  screenshot(id) {
636
- if (id == null) {
637
- throw new Error('Resource ID cannot be null!');
638
- }
639
640
  return new APIResource(this).push('screenshots', id);
640
641
  }
641
642
  screenshotFile(id) {
642
- this.screenshot(id).push('file');
643
+ return this.screenshot(id).push('file');
643
644
  }
644
645
  videos() {
645
646
  return this.files().params({
@@ -650,7 +651,18 @@
650
651
  nonMediaFiles() {
651
652
  return this.files().filter(NON_MEDIA_FILES_FILTER);
652
653
  }
653
- }
654
+ performance() {
655
+ return this.files().params({
656
+ tag: ['performance']
657
+ });
658
+ }
659
+ images() {
660
+ return this.files().filter(IMAGE_FILES_FILTER);
661
+ }
662
+ };
663
+ OutputFileset = __decorate([
664
+ NonRequestable
665
+ ], OutputFileset);
654
666
 
655
667
  class APIResourceDeviceSessionCommon extends APIResource {
656
668
  constructor(parent, id) {
@@ -693,257 +705,179 @@
693
705
  testCaseRuns() {
694
706
  return new APIList(this).push('test-case-runs');
695
707
  }
708
+ connections() {
709
+ return new APIList(this).push('connections');
710
+ }
711
+ logs() {
712
+ return new APIResource(this).push('logs').setRequestConfig({
713
+ responseType: 'text'
714
+ });
715
+ }
696
716
  }
697
717
 
698
- class APIResourceDeviceSession extends APIResourceDeviceSessionCommon {
699
- abort() {
700
- return new APIResource(this).push('abort').post();
701
- }
702
- retry() {
703
- return new APIResource(this).push('retry').post();
718
+ function postAdminDeviceSessionChangeBillable(parent, billable) {
719
+ const apiResource = new APIResource(parent);
720
+ const deviceSessionId = apiResource.last;
721
+ return apiResource.restack('admin', 'device-sessions', deviceSessionId, 'changebillable').params({
722
+ billable
723
+ }).post();
724
+ }
725
+
726
+ class APIAdminResourceDeviceSessionStandalone extends APIResourceDeviceSessionCommon {
727
+ changeBillable(billable) {
728
+ return postAdminDeviceSessionChangeBillable(this, billable);
704
729
  }
705
730
  }
706
731
 
707
- class APIResourceRun extends APIResourceRunCommon {
708
- deviceSession(id) {
709
- return new APIResourceDeviceSession(this, id);
732
+ class APIAdminResourceDeviceTime extends APIList {
733
+ constructor(parent) {
734
+ super(parent);
735
+ this.push('admin', 'device-time');
736
+ }
737
+ countSessionReport() {
738
+ return new APIList(this).push('count-session-report');
739
+ }
740
+ stepTimeReport() {
741
+ return new APIList(this).push('step-time-report');
710
742
  }
711
743
  }
712
744
 
713
- class APIResourceProject extends APIResource {
745
+ class APIAdminResourceFramework extends APIResource {
714
746
  constructor(parent, id) {
715
747
  if (id == null) {
716
748
  throw new Error('Resource ID cannot be null!');
717
749
  }
718
750
  super(parent);
719
- this.push('projects', id);
720
- }
721
- runs() {
722
- return new APIList(this).push('runs');
751
+ this.push('admin', 'frameworks', id);
723
752
  }
724
- run(id) {
725
- return new APIResourceRun(this, id);
753
+ config() {
754
+ return new APIResource(this).push('config');
726
755
  }
727
- runsExtended() {
728
- return new APIList(this).push('runs-extended');
756
+ requiredRoles() {
757
+ return new APIList(this).push('required-roles');
729
758
  }
730
- runExtended(id) {
759
+ }
760
+
761
+ class APIAdminResourceLicense extends APIResource {
762
+ constructor(parent, id) {
731
763
  if (id == null) {
732
764
  throw new Error('Resource ID cannot be null!');
733
765
  }
734
- return new APIResource(this).push('runs-extended', id);
766
+ super(parent);
767
+ this.push('admin', 'licenses', id);
735
768
  }
736
- files() {
737
- return new APIList(this).push('files');
769
+ activate() {
770
+ return new APIResource(this).push('activate');
738
771
  }
739
- filesZip() {
740
- return new APIResource(this).push('files.zip');
772
+ deactivate() {
773
+ return new APIResource(this).push('deactivate');
741
774
  }
742
- sharings() {
743
- return new APIList(this).push('sharings');
775
+ resend() {
776
+ return new APIResource(this).push('resend');
744
777
  }
745
- sharing(id) {
746
- if (id == null) {
747
- throw new Error('Resource ID cannot be null!');
748
- }
749
- return new APIResource(this).push('sharings', id);
778
+ download() {
779
+ return new APIResource(this).push('download');
750
780
  }
751
781
  }
752
782
 
753
- class APIResourceFile extends APIResource {
783
+ class APIAdminResourceNotificationPlan extends APIResource {
754
784
  constructor(parent, id) {
755
785
  if (id == null) {
756
786
  throw new Error('Resource ID cannot be null!');
757
787
  }
758
788
  super(parent);
759
- this.push('files', id);
789
+ this.push('admin', 'notification-plans', id);
760
790
  }
761
- file() {
762
- return new APIResource(this).push('file');
791
+ check() {
792
+ return new APIList(this).push('check');
763
793
  }
764
- icon() {
765
- return new APIResource(this).push('icon');
794
+ test() {
795
+ return new APIResource(this).push('test');
766
796
  }
767
- tags() {
768
- return new APIList(this).push('tags');
797
+ execute() {
798
+ return new APIResource(this).push('execute');
769
799
  }
770
800
  }
771
801
 
772
- class APIResourceNotification extends APIResource {
773
- constructor(parent, id) {
774
- if (id == null) {
775
- throw new Error('Resource ID cannot be null!');
776
- }
777
- super(parent);
778
- this.push('notifications', id);
779
- }
780
- test() {
781
- return new APIResource(this).push('test');
802
+ function postDeviceRunIds(parent, name, ids) {
803
+ const a = new APIResource(parent).push(name);
804
+ if (ids != null) {
805
+ a.params({
806
+ deviceRunIds: ids
807
+ });
782
808
  }
809
+ return a.post();
783
810
  }
784
811
 
785
- class APIResourceAccessGroup extends APIResource {
812
+ class APIAdminResourceRunStandalone extends APIResource {
786
813
  constructor(parent, id) {
787
814
  if (id == null) {
788
815
  throw new Error('Resource ID cannot be null!');
789
816
  }
790
817
  super(parent);
791
- this.push('access-groups', id);
818
+ this.push('admin', 'runs', id);
792
819
  }
793
- users() {
794
- return new APIList(this).push('users');
820
+ abort() {
821
+ return new APIResource(this).push('abort').post();
795
822
  }
796
- user(id) {
797
- if (id == null) {
798
- throw new Error('Resource ID cannot be null!');
799
- }
800
- return new APIResource(this).push('users', id);
823
+ changeBillable(billable) {
824
+ return new APIResource(this).push('changebillable').post().params({
825
+ billable
826
+ });
801
827
  }
802
- resources() {
803
- return new APIList(this).push('resources');
828
+ changePriority(priority) {
829
+ return new APIResource(this).push('changepriority').post().params({
830
+ priority
831
+ });
804
832
  }
805
- resource(id) {
806
- if (id == null) {
807
- throw new Error('Resource ID cannot be null!');
808
- }
809
- return new APIResource(this).push('resources', id);
833
+ retry(ids) {
834
+ return postDeviceRunIds(this, 'retry', ids).setRequestConfig({
835
+ timeout: 0
836
+ });
810
837
  }
811
838
  }
812
839
 
813
- class APIResourceAdditionalUser extends APIResource {
840
+ class APIAdminResourceService extends APIResource {
814
841
  constructor(parent, id) {
815
842
  if (id == null) {
816
843
  throw new Error('Resource ID cannot be null!');
817
844
  }
818
845
  super(parent);
819
- this.push('additional-users', id);
846
+ this.push('admin', 'services', id);
820
847
  }
821
- resendActivation() {
822
- return new APIResource(this).push('resend-activation');
848
+ activate() {
849
+ return new APIResource(this).push('activate').post();
823
850
  }
824
851
  }
825
852
 
826
- class APIUserResourceAccount extends APIResource {
853
+ let APIAdminResourceUserAccount = class APIAdminResourceUserAccount extends APIResource {
827
854
  constructor(parent) {
828
855
  super(parent);
829
856
  this.push('account');
830
857
  }
831
- additionalUsers() {
832
- return new APIList(this).push('additional-users');
833
- }
834
- additionalUser(id) {
835
- return new APIResourceAdditionalUser(this, id);
858
+ roles() {
859
+ return new APIList(this).push('roles');
836
860
  }
837
- serviceBillingPeriod(id) {
861
+ role(id) {
838
862
  if (id == null) {
839
863
  throw new Error('Resource ID cannot be null!');
840
864
  }
841
- const a = new APIResource(this);
842
- a.last += '-services';
843
- a.push(id, 'billing-period');
844
- return a;
845
- }
846
- }
847
-
848
- class APIListDeviceTime extends APIList {
849
- constructor(parent) {
850
- super(parent);
851
- this.push('device-time');
852
- }
853
- reserved() {
854
- return new APIList(this).push('reserved');
855
- }
856
- used() {
857
- return new APIList(this).push('used');
858
- }
859
- }
860
-
861
- class APIListFiles extends APIList {
862
- constructor(parent) {
863
- super(parent);
864
- this.push('files');
865
- }
866
- upload(obj) {
867
- let form;
868
- if (global.isNodeJs) {
869
- const fs = require('fs');
870
- const FormData = require('form-data');
871
- form = new FormData();
872
- form.append('file', fs.createReadStream(obj.dir + '/' + obj.filename), {
873
- filename: obj.filename
874
- });
875
- }
876
- else {
877
- throw new Error('Not supported yet!');
878
- }
879
- return this.post().headers(form.getHeaders()).data(form);
880
- }
881
- }
882
-
883
- class APIListPurchased extends APIList {
884
- constructor(parent) {
885
- super(parent);
886
- this.push('purchased');
887
- }
888
- }
889
-
890
- class APIListServices extends APIList {
891
- constructor(parent) {
892
- super(parent);
893
- this.push('services');
894
- }
895
- purchased() {
896
- return new APIListPurchased(this);
897
- }
898
- available() {
899
- return new APIList(this).push('available');
865
+ return new APIResource(this).push('roles', id);
900
866
  }
901
- active() {
867
+ services() {
902
868
  const a = new APIList(this);
903
- if (this.first === 'me') {
904
- a.push('active');
905
- }
906
- else {
907
- a.params({
908
- notArchived: true
909
- });
910
- }
869
+ a.last += '-services';
911
870
  return a;
912
871
  }
913
- }
914
-
915
- class APIListRuns extends APIList {
916
- constructor(parent) {
917
- super(parent);
918
- this.push('runs');
919
- }
920
- config() {
921
- return new APIResource(this).push('config');
922
- }
923
- }
924
-
925
- class APIListNotifications extends APIList {
926
- constructor(parent) {
927
- super(parent);
928
- this.push('notifications');
929
- }
930
- scopes() {
931
- return new APIList(this).push('scopes');
932
- }
933
- channels() {
934
- return new APIList(this).push('channels');
935
- }
936
- }
937
-
938
- class APIListSmartbearTunnels extends APIList {
939
- constructor(parent) {
940
- super(parent);
941
- this.push('tunnels');
942
- }
943
- active(active) {
944
- return this.params({ active: active });
872
+ update() {
873
+ const a = new APIResource(this);
874
+ a.last = 'update-account';
875
+ return a.post();
945
876
  }
946
- }
877
+ };
878
+ APIAdminResourceUserAccount = __decorate([
879
+ NonRequestable
880
+ ], APIAdminResourceUserAccount);
947
881
 
948
882
  class APIResourceDeviceSessionStandalone extends APIResource {
949
883
  constructor(parent, id) {
@@ -973,653 +907,777 @@
973
907
  }
974
908
  }
975
909
 
976
- class APIResourceUser extends APIResource {
910
+ let APIAdminResourceUser = class APIAdminResourceUser extends APIResource {
977
911
  constructor(parent, id) {
978
912
  if (id == null) {
979
913
  throw new Error('Resource ID cannot be null!');
980
914
  }
981
915
  super(parent);
982
- if (id === 'me') {
983
- this.push('me');
984
- }
985
- else if (typeof id === 'number') {
986
- this.push('users', id);
987
- }
988
- else {
989
- throw new TypeError('id is not a number');
990
- }
916
+ this.push('admin', 'users', id);
991
917
  }
992
- account() {
993
- return new APIUserResourceAccount(this);
918
+ disable() {
919
+ return new APIResource(this).push('disable');
994
920
  }
995
- deviceTime() {
996
- return new APIListDeviceTime(this);
921
+ enable() {
922
+ return new APIResource(this).push('enable');
997
923
  }
998
- deviceTimeSummary() {
999
- return new APIList(this).push('device-time-summary');
924
+ licenses() {
925
+ return new APIList(this).push('licenses');
1000
926
  }
1001
- services() {
1002
- return new APIListServices(this);
927
+ resendActivation() {
928
+ return new APIResource(this).push('resend-activation').post();
1003
929
  }
1004
- service(id) {
930
+ account() {
931
+ return new APIAdminResourceUserAccount(this);
932
+ }
933
+ deviceSession(id) {
934
+ return new APIResourceDeviceSessionStandalone(this, id);
935
+ }
936
+ };
937
+ APIAdminResourceUser = __decorate([
938
+ NonRequestable
939
+ ], APIAdminResourceUser);
940
+
941
+ class APIResourceAccessGroup extends APIResource {
942
+ constructor(parent, id) {
1005
943
  if (id == null) {
1006
944
  throw new Error('Resource ID cannot be null!');
1007
945
  }
1008
- return new APIResource(this).push('services', id);
1009
- }
1010
- billingPeriods() {
1011
- return new APIList(this).push('billing-periods');
946
+ super(parent);
947
+ this.push('access-groups', id);
1012
948
  }
1013
- billingPeriod(id) {
1014
- return new APIResourceBillingPeriod(this, id);
949
+ users() {
950
+ return new APIList(this).push('users');
1015
951
  }
1016
- jobs() {
1017
- return new APIList(this).push('jobs');
952
+ user(id) {
953
+ if (id == null) {
954
+ throw new Error('Resource ID cannot be null!');
955
+ }
956
+ return new APIResource(this).push('users', id);
1018
957
  }
1019
- job(id) {
1020
- return new APIResourceJob(this, id);
958
+ resources() {
959
+ return new APIList(this).push('resources');
1021
960
  }
1022
- deviceGroups() {
1023
- return new APIList(this).push('device-groups');
961
+ resource(id) {
962
+ if (id == null) {
963
+ throw new Error('Resource ID cannot be null!');
964
+ }
965
+ return new APIResource(this).push('resources', id);
1024
966
  }
1025
- deviceGroup(id) {
1026
- return new APIResourceDeviceGroup(this, id);
967
+ }
968
+
969
+ class APIResourceDeviceGroup extends APIResource {
970
+ constructor(parent, id) {
971
+ if (id == null) {
972
+ throw new Error('Resource ID cannot be null!');
973
+ }
974
+ super(parent);
975
+ this.push('device-groups', id);
1027
976
  }
1028
- deviceSessions() {
1029
- return new APIList(this).push('device-sessions');
977
+ devices() {
978
+ return new APIList(this).push('devices');
1030
979
  }
1031
- deviceSession(id) {
1032
- return new APIResourceDeviceSessionStandalone(this, id);
980
+ device(id) {
981
+ if (id == null) {
982
+ throw new Error('Resource ID cannot be null!');
983
+ }
984
+ return new APIResource(this).push('devices', id);
1033
985
  }
1034
- projects() {
1035
- return new APIList(this).push('projects');
986
+ selectors() {
987
+ return new APIList(this).push('selectors');
1036
988
  }
1037
- project(id) {
1038
- return new APIResourceProject(this, id);
989
+ selector(id) {
990
+ if (id == null) {
991
+ throw new Error('Resource ID cannot be null!');
992
+ }
993
+ return new APIResource(this).push('selectors', id);
1039
994
  }
1040
- files() {
1041
- return new APIListFiles(this);
995
+ share() {
996
+ return new APIList(this).push('share');
1042
997
  }
1043
- file(id) {
1044
- return new APIResourceFile(this, id);
998
+ }
999
+
1000
+ class APIResourceFile extends APIResource {
1001
+ constructor(parent, id) {
1002
+ if (id == null) {
1003
+ throw new Error('Resource ID cannot be null!');
1004
+ }
1005
+ super(parent);
1006
+ this.push('files', id);
1045
1007
  }
1046
- runs() {
1047
- return new APIListRuns(this);
1008
+ file() {
1009
+ return new APIResource(this).push('file');
1048
1010
  }
1049
- availableBuildExecutors() {
1050
- return new APIList(this).push('available-build-executors');
1011
+ icon() {
1012
+ return new APIResource(this).push('icon');
1051
1013
  }
1052
- availableFrameworks() {
1053
- return new APIList(this).push('available-frameworks');
1014
+ tags() {
1015
+ return new APIList(this).push('tags');
1054
1016
  }
1055
- resetApiKey() {
1056
- return new APIResource(this).push('reset-api-key');
1017
+ share() {
1018
+ return new APIList(this).push('share');
1057
1019
  }
1058
- restore() {
1059
- return new APIResource(this).push('restore');
1020
+ property(id) {
1021
+ if (id == null) {
1022
+ throw new Error('Resource ID cannot be null!');
1023
+ }
1024
+ return new APIResource(this).push('properties', id);
1060
1025
  }
1061
- feedback() {
1062
- return new APIResource(this).push('feedback');
1026
+ }
1027
+
1028
+ class APIResourceDeviceSession extends APIResourceDeviceSessionCommon {
1029
+ abort() {
1030
+ return new APIResource(this).push('abort').post();
1063
1031
  }
1064
- notifications() {
1065
- return new APIListNotifications(this);
1032
+ retry() {
1033
+ return new APIResource(this).push('retry').post();
1066
1034
  }
1067
- notification(id) {
1068
- return new APIResourceNotification(this, id);
1035
+ }
1036
+
1037
+ class APIResourceRunCommon extends APIResource {
1038
+ constructor(parent, id) {
1039
+ if (id == null) {
1040
+ throw new Error('Resource ID cannot be null!');
1041
+ }
1042
+ super(parent);
1043
+ this.push('runs', id);
1069
1044
  }
1070
- receipts() {
1071
- return new APIList(this).push('receipts');
1045
+ abort() {
1046
+ return new APIResource(this).push('abort').post();
1072
1047
  }
1073
- preferences() {
1074
- return new APIResource(this).push('preferences');
1048
+ buildLogsZip(ids) {
1049
+ return postDeviceRunIds(this, 'build-logs.zip', ids);
1075
1050
  }
1076
- uiPreferences() {
1077
- return new APIResource(this).push('ui-preferences');
1051
+ dataAvailability() {
1052
+ return new APIResource(this).push('data-availability');
1078
1053
  }
1079
- deviceUsage() {
1080
- return new APIList(this).push('device-usage');
1054
+ deviceSessions() {
1055
+ return new APIList(this).push('device-sessions');
1081
1056
  }
1082
- statistics() {
1083
- return new APIList(this).push('statistics');
1057
+ filesZip(ids) {
1058
+ return postDeviceRunIds(this, 'files.zip', ids);
1084
1059
  }
1085
- deviceStatistics() {
1086
- return new APIList(this).push('device-statistics');
1060
+ logsZip(ids) {
1061
+ return postDeviceRunIds(this, 'logs.zip', ids);
1087
1062
  }
1088
- accessGroups() {
1089
- return new APIList(this).push('access-groups');
1063
+ performanceZip(ids) {
1064
+ return postDeviceRunIds(this, 'performance.zip', ids);
1090
1065
  }
1091
- accessGroup(id) {
1092
- return new APIResourceAccessGroup(this, id);
1066
+ retry(ids) {
1067
+ return postDeviceRunIds(this, 'retry', ids).setRequestConfig({
1068
+ timeout: 0
1069
+ });
1093
1070
  }
1094
- smartbearTunnel(id) {
1095
- return new APIResource(this).push('tunnels', id);
1071
+ screenshotNames() {
1072
+ return new APIList(this).push('screenshot-names');
1096
1073
  }
1097
- smartbearTunnels() {
1098
- return new APIListSmartbearTunnels(this);
1074
+ screenshots() {
1075
+ return new APIList(this).push('screenshots');
1099
1076
  }
1100
- }
1101
-
1102
- class APIResourceDevice extends APIResource {
1103
- constructor(parent, id) {
1077
+ screenshotsZip(ids) {
1078
+ return postDeviceRunIds(this, 'screenshots.zip', ids);
1079
+ }
1080
+ steps() {
1081
+ return new APIList(this).push('steps');
1082
+ }
1083
+ tags() {
1084
+ return new APIList(this).push('tags');
1085
+ }
1086
+ tag(id) {
1104
1087
  if (id == null) {
1105
1088
  throw new Error('Resource ID cannot be null!');
1106
1089
  }
1107
- super(parent);
1108
- this.push('devices', id);
1090
+ return new APIResource(this).push('tags', id);
1109
1091
  }
1110
- properties() {
1111
- return new APIList(this).push('properties');
1092
+ }
1093
+
1094
+ class APIResourceRun extends APIResourceRunCommon {
1095
+ deviceSession(id) {
1096
+ return new APIResourceDeviceSession(this, id);
1112
1097
  }
1113
1098
  }
1114
1099
 
1115
- class APIResourceUserSession extends APIResource {
1116
- constructor(parent) {
1100
+ class APIResourceProject extends APIResource {
1101
+ constructor(parent, id) {
1102
+ if (id == null) {
1103
+ throw new Error('Resource ID cannot be null!');
1104
+ }
1117
1105
  super(parent);
1118
- this.push('user-sessions');
1106
+ this.push('projects', id);
1119
1107
  }
1120
- login(data) {
1121
- return new APIResource(this).push('login').post().data(data);
1108
+ runs() {
1109
+ return new APIList(this).push('runs');
1122
1110
  }
1123
- logout() {
1124
- return new APIResource(this).push('logout').post();
1111
+ run(id) {
1112
+ return new APIResourceRun(this, id);
1125
1113
  }
1126
- sso(name) {
1127
- return new APIResource(this).push(name + '-login');
1114
+ share() {
1115
+ return new APIList(this).push('share');
1128
1116
  }
1129
- portalLogin() {
1130
- return new APIResource(this).push('portal-login').post();
1117
+ unarchive() {
1118
+ return new APIResource(this).push('unarchive');
1131
1119
  }
1132
1120
  }
1133
1121
 
1134
- class APIAdminListRuns extends APIList {
1122
+ let APIAdminResource = class APIAdminResource extends APIResource {
1135
1123
  constructor(parent) {
1136
1124
  super(parent);
1137
- this.push('admin', 'runs');
1138
1125
  }
1139
- config() {
1140
- const a = new APIResource(this);
1141
- a.stack = ['runs', 'config'];
1142
- return a;
1126
+ accessGroups() {
1127
+ return new APIList(this).push('access-groups');
1143
1128
  }
1144
- }
1145
-
1146
- class APIAdminResourceCluster extends APIResource {
1147
- constructor(parent, id) {
1129
+ accessGroup(id) {
1130
+ return new APIResourceAccessGroup(this, id);
1131
+ }
1132
+ accounts() {
1133
+ return new APIList(this).push('admin', 'accounts');
1134
+ }
1135
+ account(id) {
1148
1136
  if (id == null) {
1149
1137
  throw new Error('Resource ID cannot be null!');
1150
1138
  }
1151
- super(parent);
1152
- this.push('clusters', id);
1139
+ return new APIResource(this).push('admin', 'accounts', id);
1153
1140
  }
1154
- devices() {
1155
- return new APIList(this).push('devices');
1141
+ accountServices() {
1142
+ return new APIList(this).push('admin', 'account-services');
1156
1143
  }
1157
- }
1158
-
1159
- class APIAdminResourceDeviceTime extends APIResource {
1160
- constructor(parent) {
1161
- super(parent);
1162
- this.push('admin', 'device-time');
1144
+ accountService(id) {
1145
+ return new APIAdminResourceAccountService(this, id);
1163
1146
  }
1164
- countSessionReport() {
1165
- return new APIList(this).push('count-session-report');
1147
+ activities() {
1148
+ return new APIList(this).push('admin', 'activities');
1166
1149
  }
1167
- stepTimeReport() {
1168
- return new APIList(this).push('step-time-report');
1150
+ billingPeriods() {
1151
+ return new APIList(this).push('admin', 'billing-periods');
1169
1152
  }
1170
- }
1171
-
1172
- class APIAdminResourceRunStandalone extends APIResource {
1173
- constructor(parent, id) {
1153
+ billingPeriod(id) {
1174
1154
  if (id == null) {
1175
1155
  throw new Error('Resource ID cannot be null!');
1176
1156
  }
1177
- super(parent);
1178
- this.push('admin', 'runs', id);
1157
+ return new APIResource(this).push('admin', 'billing-periods', id);
1179
1158
  }
1180
- abort() {
1181
- return new APIResource(this).push('abort').post();
1159
+ browsers() {
1160
+ return new APIList(this).push('admin', 'browsers');
1182
1161
  }
1183
- changeBillable(billable) {
1184
- return new APIResource(this).push('changebillable').post().params({
1185
- billable
1186
- });
1162
+ browser(id) {
1163
+ if (id == null) {
1164
+ throw new Error('Resource ID cannot be null!');
1165
+ }
1166
+ return new APIResource(this).push('admin', 'browsers', id);
1187
1167
  }
1188
- changePriority(priority) {
1189
- return new APIResource(this).push('changepriority').post().params({
1190
- priority
1191
- });
1168
+ clusters() {
1169
+ return new APIList(this).push('clusters');
1192
1170
  }
1193
- retry(ids) {
1194
- return postDeviceRunIds(this, 'retry', ids).setRequestConfig({
1195
- timeout: 0
1196
- });
1171
+ cluster(id) {
1172
+ return new APIAdminResourceCluster(this, id);
1197
1173
  }
1198
- deviceSessions() {
1199
- return new APIList(this).shift().push('device-sessions');
1174
+ countryVatRates() {
1175
+ return new APIList(this).push('admin', 'country-vat-rates');
1200
1176
  }
1201
- deviceSession(id) {
1202
- return new APIResourceDeviceSessionCommon(this, id).shift();
1177
+ countryVatRate(id) {
1178
+ if (id == null) {
1179
+ throw new Error('Resource ID cannot be null!');
1180
+ }
1181
+ return new APIResource(this).push('admin', 'country-vat-rates', id);
1203
1182
  }
1204
- }
1205
-
1206
- class APIAdminResourceDevice extends APIResource {
1207
- constructor(parent, id) {
1183
+ devices() {
1184
+ return new APIAdminListDevices(this);
1185
+ }
1186
+ device(id) {
1187
+ return new APIAdminResourceDevice(this, id);
1188
+ }
1189
+ devicesForModel(id) {
1208
1190
  if (id == null) {
1209
1191
  throw new Error('Resource ID cannot be null!');
1210
1192
  }
1211
- super(parent);
1212
- this.push('admin', 'devices', id);
1193
+ const apiList = this.devices();
1194
+ apiList.params({
1195
+ filter: 'deviceModelId_eq_' + id
1196
+ });
1197
+ return apiList;
1213
1198
  }
1214
- queue() {
1215
- return new APIList(this).push('queue');
1199
+ deviceStatuses() {
1200
+ return new APIList(this).push('admin', 'device', 'statuses');
1216
1201
  }
1217
- cleanupConfiguration() {
1218
- return new APIResource(this).push('cleanup-configuration');
1202
+ deviceModels() {
1203
+ return new APIList(this).push('admin', 'device-models');
1219
1204
  }
1220
- labels() {
1221
- return new APIList(this).push('labels');
1205
+ deviceModel(id) {
1206
+ return new APIAdminResourceDeviceModel(this, id);
1222
1207
  }
1223
- label(id) {
1224
- return new APIResource(this).push('labels', id);
1208
+ deviceProblems() {
1209
+ return new APIList(this).push('admin', 'device-problems');
1225
1210
  }
1226
- blink() {
1227
- return new APIResource(this).push('blink').post();
1211
+ deviceModelCriterias() {
1212
+ return new APIList(this).push('admin', 'device-model-criteria');
1228
1213
  }
1229
- }
1230
-
1231
- class APIAdminResourceAccountService extends APIResource {
1232
- constructor(parent, id) {
1214
+ deviceModelCriteria(id) {
1233
1215
  if (id == null) {
1234
1216
  throw new Error('Resource ID cannot be null!');
1235
1217
  }
1236
- super(parent);
1237
- this.push('admin', 'account-services', id);
1218
+ return new APIResource(this).push('admin', 'device-model-criteria', id);
1238
1219
  }
1239
- activate() {
1240
- return new APIResource(this).push('activate').post();
1220
+ deviceSessions() {
1221
+ return new APIList(this).push('admin', 'device-sessions');
1241
1222
  }
1242
- deactivate() {
1243
- return new APIResource(this).push('deactivate').post();
1223
+ deviceSession(id) {
1224
+ return new APIAdminResourceDeviceSessionStandalone(this, id);
1244
1225
  }
1245
- }
1246
-
1247
- class APIAdminResourceUserAccount extends APIResource {
1248
- constructor(parent) {
1249
- super(parent);
1250
- this.push('account');
1226
+ deviceTime() {
1227
+ return new APIAdminResourceDeviceTime(this);
1251
1228
  }
1252
- roles() {
1253
- return new APIList(this).push('roles');
1229
+ deviceTimeSummary() {
1230
+ return new APIList(this).push('admin', 'device-time-summary');
1254
1231
  }
1255
- role(id) {
1256
- if (id == null) {
1257
- throw new Error('Resource ID cannot be null!');
1258
- }
1259
- return new APIResource(this).push('roles', id);
1232
+ deviceTypes() {
1233
+ return new APIList(this).push('admin', 'device-types');
1260
1234
  }
1261
- services() {
1262
- const a = new APIList(this);
1263
- a.last += '-services';
1264
- return a;
1235
+ deviceType(id) {
1236
+ return new APIResource(this).push('admin', 'device-types', id);
1265
1237
  }
1266
- update() {
1267
- const a = new APIResource(this);
1268
- a.last = 'update-account';
1269
- return a.post();
1238
+ deviceGroups() {
1239
+ return new APIList(this).push('device-groups');
1270
1240
  }
1271
- }
1272
-
1273
- class APIAdminResourceUser extends APIResource {
1274
- constructor(parent, id) {
1241
+ deviceGroup(id) {
1242
+ return new APIResourceDeviceGroup(this, id);
1243
+ }
1244
+ emails() {
1245
+ return new APIList(this).push('admin', 'emails');
1246
+ }
1247
+ resendEmail(id) {
1275
1248
  if (id == null) {
1276
1249
  throw new Error('Resource ID cannot be null!');
1277
1250
  }
1278
- super(parent);
1279
- this.push('admin', 'users', id);
1251
+ return new APIResource(this).push('admin', 'emails', id, 'resend').post();
1280
1252
  }
1281
- disable() {
1282
- return new APIResource(this).push('disable');
1253
+ errors() {
1254
+ return new APIList(this).push('admin', 'errors');
1283
1255
  }
1284
- enable() {
1285
- return new APIResource(this).push('enable');
1256
+ files() {
1257
+ return new APIList(this).push('files');
1258
+ }
1259
+ file(id) {
1260
+ return new APIResourceFile(this, id);
1261
+ }
1262
+ frameworks() {
1263
+ return new APIList(this).push('admin', 'frameworks');
1264
+ }
1265
+ framework(id) {
1266
+ return new APIAdminResourceFramework(this, id);
1267
+ }
1268
+ frameworkAvailableLabels() {
1269
+ const apiList = this.frameworks();
1270
+ apiList.push('available-labels');
1271
+ return apiList;
1272
+ }
1273
+ interactiveQueue() {
1274
+ return new APIList(this).push('admin', 'interactive-queue');
1286
1275
  }
1287
1276
  licenses() {
1288
- return new APIList(this).push('licenses');
1277
+ return new APIList(this).push('admin', 'licenses');
1289
1278
  }
1290
- resendActivation() {
1291
- return new APIResource(this).push('resend-activation').post();
1279
+ license(id) {
1280
+ return new APIAdminResourceLicense(this, id);
1292
1281
  }
1293
- account() {
1294
- return new APIAdminResourceUserAccount(this);
1282
+ maintenance() {
1283
+ return new APIResource(this).push('admin', 'maintenance');
1295
1284
  }
1296
- }
1297
-
1298
- function postAdminDeviceSessionChangeBillable(parent, billable) {
1299
- const a = new APIResource(parent);
1300
- const deviceSessionId = a.last;
1301
- return a.restack('admin', 'device-sessions', deviceSessionId, 'changebillable').params({
1302
- billable
1303
- }).post();
1304
- }
1305
-
1306
- class APIAdminResourceDeviceSessionStandalone extends APIResourceDeviceSessionCommon {
1307
- changeBillable(billable) {
1308
- return postAdminDeviceSessionChangeBillable(this, billable);
1285
+ notificationPlans() {
1286
+ return new APIAdminListNotificationPlans(this);
1309
1287
  }
1310
- connections() {
1311
- return new APIList(this).push('connections');
1288
+ notificationPlan(id) {
1289
+ return new APIAdminResourceNotificationPlan(this, id);
1312
1290
  }
1313
- connection(id) {
1291
+ overview() {
1292
+ return new APIResource(this).push('admin', 'overview');
1293
+ }
1294
+ pools() {
1295
+ return new APIList(this).push('admin', 'pools');
1296
+ }
1297
+ pool(id) {
1298
+ return new APIResource(this).push('admin', 'pools', id);
1299
+ }
1300
+ projects() {
1301
+ return new APIList(this).push('projects');
1302
+ }
1303
+ project(id) {
1304
+ return new APIResourceProject(this, id);
1305
+ }
1306
+ roles() {
1307
+ return new APIList(this).push('admin', 'roles');
1308
+ }
1309
+ runs() {
1310
+ return new APIAdminListRuns(this);
1311
+ }
1312
+ run(id) {
1313
+ return new APIAdminResourceRunStandalone(this, id);
1314
+ }
1315
+ samples() {
1316
+ return new APIList(this).push('admin', 'samples');
1317
+ }
1318
+ sample(id) {
1314
1319
  if (id == null) {
1315
1320
  throw new Error('Resource ID cannot be null!');
1316
1321
  }
1317
- return new APIResource(this).push('connections', id);
1322
+ return new APIResource(this).push('admin', 'samples', id);
1318
1323
  }
1319
- release() {
1320
- return new APIResource(this).push('release').post();
1324
+ services() {
1325
+ return new APIAdminListServices(this);
1321
1326
  }
1322
- }
1327
+ service(id) {
1328
+ return new APIAdminResourceService(this, id);
1329
+ }
1330
+ settings() {
1331
+ return new APIResource(this).push('admin', 'settings');
1332
+ }
1333
+ statistics() {
1334
+ return new APIAdminListStatistics(this);
1335
+ }
1336
+ users() {
1337
+ return new APIList(this).push('users');
1338
+ }
1339
+ createUser() {
1340
+ return new APIList(this).push('admin', 'users').post();
1341
+ }
1342
+ user(id) {
1343
+ return new APIAdminResourceUser(this, id);
1344
+ }
1345
+ };
1346
+ APIAdminResource = __decorate([
1347
+ NonRequestable
1348
+ ], APIAdminResource);
1323
1349
 
1324
- class APIAdminListDevices extends APIList {
1350
+ class APIListDevices extends APIList {
1325
1351
  constructor(parent) {
1326
1352
  super(parent);
1327
- this.push('admin', 'devices');
1353
+ this.push('devices');
1328
1354
  }
1329
1355
  filters() {
1330
1356
  return new APIResource(this).push('filters');
1331
1357
  }
1332
- cleanupConfigurations() {
1333
- return new APIListCleanupConfigurations(this);
1334
- }
1335
- cleanupConfiguration(id) {
1336
- return new APIResourceCleanupConfiguration(this, id);
1337
- }
1338
1358
  desktopBrowserCapabilities() {
1339
1359
  return new APIResource(this).push('desktop-browser-capabilities');
1340
1360
  }
1341
1361
  }
1342
1362
 
1343
- class APIAdminResourceFramework extends APIResource {
1344
- constructor(parent, id) {
1363
+ class APIListProperties extends APIList {
1364
+ constructor(parent) {
1365
+ super(parent);
1366
+ this.push('properties');
1367
+ }
1368
+ appBan(id) {
1345
1369
  if (id == null) {
1346
1370
  throw new Error('Resource ID cannot be null!');
1347
1371
  }
1372
+ return new APIList(this).push('app-bans').params({
1373
+ testRunId: id
1374
+ });
1375
+ }
1376
+ maintenance() {
1377
+ return new APIList(this).params({
1378
+ filter: 'name_eq_CLOUD_HEADER_ANNOUNCEMENT',
1379
+ limit: 1,
1380
+ sort: 'updateTime_d'
1381
+ });
1382
+ }
1383
+ }
1384
+
1385
+ class APIListServices extends APIList {
1386
+ constructor(parent) {
1348
1387
  super(parent);
1349
- this.push('admin', 'frameworks', id);
1388
+ this.ALLOWED_HTTP_METHODS = ['POST'];
1389
+ this.push('services');
1350
1390
  }
1351
- config() {
1352
- return new APIResource(this).push('config');
1391
+ available() {
1392
+ return new APIList(this).push('available');
1353
1393
  }
1354
- requiredRoles() {
1355
- return new APIList(this).push('required-roles');
1394
+ active() {
1395
+ const apiList = new APIList(this);
1396
+ if (this.first === 'me') {
1397
+ apiList.push('active');
1398
+ }
1399
+ else {
1400
+ apiList.params({
1401
+ notArchived: true
1402
+ });
1403
+ }
1404
+ return apiList;
1405
+ }
1406
+ byPrice() {
1407
+ return new APIList(this).sort('centPrice');
1408
+ }
1409
+ availableByPrice() {
1410
+ return new APIList(this).push('available').sort('centPrice');
1411
+ }
1412
+ }
1413
+
1414
+ class APIListUsers extends APIList {
1415
+ constructor(parent) {
1416
+ super(parent);
1417
+ this.ALLOWED_HTTP_METHODS = ['POST'];
1418
+ this.push('users');
1419
+ }
1420
+ activate() {
1421
+ return new APIResource(this).push('activate').post();
1422
+ }
1423
+ recoveries() {
1424
+ return new APIResource(this).push('recoveries');
1425
+ }
1426
+ passwordRecovery() {
1427
+ return new APIResource(this).push('password-recovery');
1428
+ }
1429
+ validateVatId() {
1430
+ return new APIResource(this).push('validateVatId');
1356
1431
  }
1357
1432
  }
1358
1433
 
1359
- class APIAdminResourceLicense extends APIResource {
1434
+ class APIResourceAccount extends APIResource {
1360
1435
  constructor(parent, id) {
1361
1436
  if (id == null) {
1362
1437
  throw new Error('Resource ID cannot be null!');
1363
1438
  }
1364
1439
  super(parent);
1365
- this.push('admin', 'licenses', id);
1366
- }
1367
- activate() {
1368
- return new APIResource(this).push('activate');
1369
- }
1370
- deactivate() {
1371
- return new APIResource(this).push('deactivate');
1440
+ this.push('accounts', id);
1372
1441
  }
1373
- resend() {
1374
- return new APIResource(this).push('resend');
1442
+ concurrencyStatus() {
1443
+ return new APIResource(this).push('concurrency-status');
1375
1444
  }
1376
- download() {
1377
- return new APIResource(this).push('download');
1445
+ preferences() {
1446
+ return new APIResource(this).push('preferences');
1378
1447
  }
1379
1448
  }
1380
1449
 
1381
- class APIAdminListNotificationPlans extends APIList {
1450
+ class APIResourceBroker extends APIResource {
1382
1451
  constructor(parent) {
1383
1452
  super(parent);
1384
- this.push('admin', 'notification-plans');
1385
- }
1386
- channels() {
1387
- return new APIList(this).push('channels');
1453
+ this.push('broker');
1388
1454
  }
1389
- scopes() {
1390
- return new APIList(this).push('scopes');
1455
+ hubs() {
1456
+ return new APIList(this).push('hubs');
1391
1457
  }
1392
1458
  }
1393
1459
 
1394
- class APIAdminResourceNotificationPlan extends APIResource {
1460
+ class APIResourceDevice extends APIResource {
1395
1461
  constructor(parent, id) {
1396
1462
  if (id == null) {
1397
1463
  throw new Error('Resource ID cannot be null!');
1398
1464
  }
1399
1465
  super(parent);
1400
- this.push('admin', 'notification-plans', id);
1401
- }
1402
- check() {
1403
- return new APIList(this).push('check');
1466
+ this.push('devices', id);
1404
1467
  }
1405
- test() {
1406
- return new APIResource(this).push('test');
1468
+ properties() {
1469
+ return new APIList(this).push('properties');
1407
1470
  }
1408
- execute() {
1409
- return new APIResource(this).push('execute');
1471
+ browsers() {
1472
+ return new APIList(this).push('browsers');
1410
1473
  }
1411
1474
  }
1412
1475
 
1413
- class APIAdminResourceService extends APIResource {
1476
+ class APIResourceLabelGroup extends APIResource {
1414
1477
  constructor(parent, id) {
1415
1478
  if (id == null) {
1416
1479
  throw new Error('Resource ID cannot be null!');
1417
1480
  }
1418
1481
  super(parent);
1419
- this.push('admin', 'services', id);
1420
- }
1421
- activate() {
1422
- return new APIResource(this).push('activate').post();
1482
+ this.push('label-groups', id);
1423
1483
  }
1424
- deactivate() {
1425
- return new APIResource(this).push('deactivate').post();
1484
+ labels() {
1485
+ return new APIList(this).push('labels');
1426
1486
  }
1427
- roles() {
1428
- return new APIList(this).push('roles');
1487
+ label(id) {
1488
+ return new APIResource(this).push('labels', id);
1429
1489
  }
1430
1490
  }
1431
1491
 
1432
- class APIAdminListServices extends APIList {
1492
+ class APIListDeviceTime extends APIList {
1433
1493
  constructor(parent) {
1434
1494
  super(parent);
1435
- this.push('admin', 'services');
1495
+ this.push('device-time');
1436
1496
  }
1437
- purchased() {
1438
- return new APIListPurchased(this);
1497
+ reserved() {
1498
+ return new APIEntity(this).push('reserved');
1439
1499
  }
1440
- available() {
1441
- return new APIList(this).push('available');
1500
+ used() {
1501
+ return new APIEntity(this).push('used');
1442
1502
  }
1443
- active() {
1444
- const a = new APIList(this);
1445
- if (this.first === 'me') {
1446
- a.push('active');
1503
+ }
1504
+
1505
+ class APIListFiles extends APIList {
1506
+ constructor(parent) {
1507
+ super(parent);
1508
+ this.push('files');
1509
+ }
1510
+ upload(obj) {
1511
+ if (global.isNodeJs) {
1512
+ return this.nodeUpload(obj);
1447
1513
  }
1448
1514
  else {
1449
- a.params({
1450
- notArchived: true
1451
- });
1515
+ throw new Error('Not supported yet!');
1452
1516
  }
1453
- return a;
1454
1517
  }
1455
- activated() {
1456
- const a = this.active();
1457
- a.params({
1458
- filter: 'activated_eq_true',
1459
- limit: 0,
1460
- sort: 'name_a'
1518
+ nodeUpload(file) {
1519
+ const fs = require('fs');
1520
+ const FormData = require('form-data');
1521
+ const form = new FormData();
1522
+ form.append('file', fs.createReadStream(file.dir + '/' + file.filename), {
1523
+ filename: file.filename
1461
1524
  });
1462
- return a;
1525
+ return this.post().headers(form.getHeaders()).data(form);
1463
1526
  }
1464
- inUse() {
1465
- const a = new APIList(this);
1466
- a.params({
1467
- inUse: true,
1468
- limit: 0,
1469
- sort: 'name_a'
1470
- });
1471
- return a;
1527
+ }
1528
+
1529
+ class APIResourceChannel extends APIResource {
1530
+ constructor(parent, type) {
1531
+ if (type == null) {
1532
+ throw new Error('Resource ID cannot be null!');
1533
+ }
1534
+ super(parent);
1535
+ this.push('channels', type);
1472
1536
  }
1473
- byPrice() {
1474
- const a = new APIList(this);
1475
- a.params({
1476
- sort: 'centPrice_a'
1477
- });
1478
- return a;
1537
+ scopes() {
1538
+ return new APIList(this).push('scopes');
1479
1539
  }
1480
1540
  }
1481
1541
 
1482
- class APIAdminListStatistics extends APIList {
1542
+ class APIListNotifications extends APIList {
1483
1543
  constructor(parent) {
1484
1544
  super(parent);
1485
- this.push('admin', 'statistics');
1545
+ this.push('notifications');
1486
1546
  }
1487
- deviceSessions() {
1488
- return new APIList(this).push('device-sessions');
1547
+ scopes() {
1548
+ return new APIList(this).push('scopes');
1489
1549
  }
1490
- frameworks() {
1491
- return new APIList(this).push('frameworks');
1550
+ channels() {
1551
+ return new APIList(this).push('channels');
1552
+ }
1553
+ channel(type) {
1554
+ return new APIResourceChannel(this, type);
1492
1555
  }
1493
1556
  }
1494
1557
 
1495
- class APIAdminResourceDeviceModel extends APIResource {
1496
- constructor(parent, id) {
1497
- if (id == null) {
1498
- throw new Error('Resource ID cannot be null!');
1499
- }
1558
+ class APIListRuns extends APIList {
1559
+ constructor(parent) {
1500
1560
  super(parent);
1501
- this.push('admin', 'device-models', id);
1561
+ this.push('runs');
1502
1562
  }
1503
- browsers() {
1504
- return new APIList(this).push('browsers');
1563
+ config() {
1564
+ return new APIResource(this).push('config');
1505
1565
  }
1506
1566
  }
1507
1567
 
1508
- class APIAdminResource extends APIResource {
1568
+ class APIListSmartbearTunnels extends APIList {
1509
1569
  constructor(parent) {
1510
1570
  super(parent);
1571
+ this.ALLOWED_HTTP_METHODS = ['GET'];
1572
+ this.push('tunnels');
1511
1573
  }
1512
- accessGroups() {
1513
- return new APIList(this).push('access-groups');
1514
- }
1515
- accessGroup(id) {
1516
- return new APIResourceAccessGroup(this, id);
1517
- }
1518
- accounts() {
1519
- return new APIList(this).push('admin', 'accounts');
1574
+ active(active) {
1575
+ return this.params({ active: active });
1520
1576
  }
1521
- account(id) {
1577
+ }
1578
+
1579
+ class APIResourceBillingPeriod extends APIResource {
1580
+ constructor(parent, id) {
1522
1581
  if (id == null) {
1523
1582
  throw new Error('Resource ID cannot be null!');
1524
1583
  }
1525
- return new APIResource(this).push('admin', 'accounts', id);
1526
- }
1527
- accountServices() {
1528
- return new APIList(this).push('admin', 'account-services');
1529
- }
1530
- accountService(id) {
1531
- return new APIAdminResourceAccountService(this, id);
1532
- }
1533
- activities() {
1534
- return new APIList(this).push('admin', 'activities');
1584
+ super(parent);
1585
+ this.push('billing-periods', id);
1535
1586
  }
1536
- billingPeriods() {
1537
- return new APIList(this).push('admin', 'billing-periods');
1587
+ receipt() {
1588
+ return new APIResource(this).push('receipt').setRequestConfig({
1589
+ responseType: 'arraybuffer'
1590
+ });
1538
1591
  }
1539
- billingPeriod(id) {
1592
+ }
1593
+
1594
+ class APIResourceNotification extends APIResource {
1595
+ constructor(parent, id) {
1540
1596
  if (id == null) {
1541
1597
  throw new Error('Resource ID cannot be null!');
1542
1598
  }
1543
- return new APIResource(this).push('admin', 'billing-periods', id);
1599
+ super(parent);
1600
+ this.push('notifications', id);
1544
1601
  }
1545
- browsers() {
1546
- return new APIList(this).push('admin', 'browsers');
1602
+ test() {
1603
+ return new APIResource(this).push('test');
1547
1604
  }
1548
- browser(id) {
1605
+ }
1606
+
1607
+ class APIResourceAdditionalUser extends APIResource {
1608
+ constructor(parent, id) {
1549
1609
  if (id == null) {
1550
1610
  throw new Error('Resource ID cannot be null!');
1551
1611
  }
1552
- return new APIResource(this).push('admin', 'browsers', id);
1553
- }
1554
- clusters() {
1555
- return new APIList(this).push('clusters');
1556
- }
1557
- cluster(id) {
1558
- return new APIAdminResourceCluster(this, id);
1612
+ super(parent);
1613
+ this.push('additional-users', id);
1559
1614
  }
1560
- countryVatRates() {
1561
- return new APIList(this).push('admin', 'country-vat-rates');
1615
+ resendActivation() {
1616
+ return new APIResource(this).push('resend-activation');
1562
1617
  }
1563
- countryVatRate(id) {
1564
- if (id == null) {
1565
- throw new Error('Resource ID cannot be null!');
1566
- }
1567
- return new APIResource(this).push('admin', 'country-vat-rates', id);
1618
+ }
1619
+
1620
+ class APIUserResourceAccount extends APIResource {
1621
+ constructor(parent) {
1622
+ super(parent);
1623
+ this.push('account');
1568
1624
  }
1569
- devices() {
1570
- return new APIAdminListDevices(this);
1625
+ additionalUsers() {
1626
+ return new APIList(this).push('additional-users');
1571
1627
  }
1572
- device(id) {
1573
- return new APIAdminResourceDevice(this, id);
1628
+ additionalUser(id) {
1629
+ return new APIResourceAdditionalUser(this, id);
1574
1630
  }
1575
- devicesForModel(id) {
1631
+ serviceBillingPeriod(id) {
1576
1632
  if (id == null) {
1577
1633
  throw new Error('Resource ID cannot be null!');
1578
1634
  }
1579
- const a = this.devices();
1580
- a.params({
1581
- filter: 'deviceModelId_eq_' + id
1582
- });
1635
+ const a = new APIResource(this);
1636
+ a.last += '-services';
1637
+ a.push(id, 'billing-period');
1583
1638
  return a;
1584
1639
  }
1585
- deviceStatuses() {
1586
- return new APIList(this).push('admin', 'device', 'statuses');
1587
- }
1588
- deviceModels() {
1589
- return new APIList(this).push('admin', 'device-models');
1590
- }
1591
- deviceModel(id) {
1592
- return new APIAdminResourceDeviceModel(this, id);
1593
- }
1594
- deviceProblems() {
1595
- return new APIList(this).push('admin', 'device-problems');
1596
- }
1597
- deviceModelCriterias() {
1598
- return new APIList(this).push('admin', 'device-model-criteria');
1599
- }
1600
- deviceModelCriteria(id) {
1640
+ }
1641
+
1642
+ class APIResourceUser extends APIResource {
1643
+ constructor(parent, id) {
1601
1644
  if (id == null) {
1602
1645
  throw new Error('Resource ID cannot be null!');
1603
1646
  }
1604
- return new APIResource(this).push('admin', 'device-model-criteria', id);
1605
- }
1606
- deviceSessions() {
1607
- return new APIList(this).push('admin', 'device-sessions');
1647
+ super(parent);
1648
+ if (id === 'me') {
1649
+ this.push('me');
1650
+ }
1651
+ else if (typeof id === 'number') {
1652
+ this.push('users', id);
1653
+ }
1654
+ else {
1655
+ throw new TypeError('id is not a number');
1656
+ }
1608
1657
  }
1609
- deviceSession(id) {
1610
- return new APIAdminResourceDeviceSessionStandalone(this, id);
1658
+ account() {
1659
+ return new APIUserResourceAccount(this);
1611
1660
  }
1612
1661
  deviceTime() {
1613
- return new APIAdminResourceDeviceTime(this);
1662
+ return new APIListDeviceTime(this);
1614
1663
  }
1615
1664
  deviceTimeSummary() {
1616
- return new APIList(this).push('admin', 'device-time-summary');
1665
+ return new APIList(this).push('device-time-summary');
1617
1666
  }
1618
- deviceTypes() {
1619
- return new APIList(this).push('admin', 'device-types');
1667
+ services() {
1668
+ return new APIListServices(this);
1620
1669
  }
1621
- deviceType(id) {
1622
- return new APIResource(this).push('admin', 'device-types', id);
1670
+ service(id) {
1671
+ if (id == null) {
1672
+ throw new Error('Resource ID cannot be null!');
1673
+ }
1674
+ return new APIResource(this).push('services', id);
1675
+ }
1676
+ billingPeriods() {
1677
+ return new APIList(this).push('billing-periods');
1678
+ }
1679
+ billingPeriod(id) {
1680
+ return new APIResourceBillingPeriod(this, id);
1623
1681
  }
1624
1682
  deviceGroups() {
1625
1683
  return new APIList(this).push('device-groups');
@@ -1627,157 +1685,115 @@
1627
1685
  deviceGroup(id) {
1628
1686
  return new APIResourceDeviceGroup(this, id);
1629
1687
  }
1630
- emails() {
1631
- return new APIList(this).push('admin', 'emails');
1688
+ deviceSessions() {
1689
+ return new APIList(this).push('device-sessions');
1632
1690
  }
1633
- resendEmail(id) {
1634
- if (id == null) {
1635
- throw new Error('Resource ID cannot be null!');
1636
- }
1637
- return new APIResource(this).push('admin', 'emails', id, 'resend').post();
1691
+ deviceSession(id) {
1692
+ return new APIResourceDeviceSessionStandalone(this, id);
1638
1693
  }
1639
- errors() {
1640
- return new APIList(this).push('admin', 'errors');
1694
+ projects() {
1695
+ return new APIList(this).push('projects');
1696
+ }
1697
+ project(id) {
1698
+ return new APIResourceProject(this, id);
1641
1699
  }
1642
1700
  files() {
1643
- return new APIList(this).push('files');
1701
+ return new APIListFiles(this);
1644
1702
  }
1645
1703
  file(id) {
1646
1704
  return new APIResourceFile(this, id);
1647
1705
  }
1648
- frameworks() {
1649
- return new APIList(this).push('admin', 'frameworks');
1650
- }
1651
- framework(id) {
1652
- return new APIAdminResourceFramework(this, id);
1653
- }
1654
- frameworkAvailableLabels() {
1655
- const a = this.frameworks();
1656
- a.push('available-labels');
1657
- return a;
1658
- }
1659
- interactiveQueue() {
1660
- return new APIList(this).push('admin', 'interactive-queue');
1661
- }
1662
- licenses() {
1663
- return new APIList(this).push('admin', 'licenses');
1664
- }
1665
- license(id) {
1666
- return new APIAdminResourceLicense(this, id);
1667
- }
1668
- maintenance() {
1669
- return new APIResource(this).push('admin', 'maintenance');
1670
- }
1671
- marketShares() {
1672
- return new APIList(this).push('admin', 'market-shares');
1673
- }
1674
- notificationPlans() {
1675
- return new APIAdminListNotificationPlans(this);
1676
- }
1677
- notificationPlan(id) {
1678
- return new APIAdminResourceNotificationPlan(this, id);
1679
- }
1680
- overview() {
1681
- return new APIResource(this).push('admin', 'overview');
1706
+ runs() {
1707
+ return new APIListRuns(this);
1682
1708
  }
1683
- pools() {
1684
- return new APIList(this).push('admin', 'pools');
1709
+ availableFrameworks() {
1710
+ return new APIList(this).push('available-frameworks');
1685
1711
  }
1686
- pool(id) {
1687
- return new APIResource(this).push('admin', 'pools', id);
1712
+ resetApiKey() {
1713
+ return new APIResource(this).push('reset-api-key');
1688
1714
  }
1689
- projects() {
1690
- return new APIList(this).push('projects');
1715
+ restore() {
1716
+ return new APIResource(this).push('restore');
1691
1717
  }
1692
- project(id) {
1693
- return new APIResourceProject(this, id);
1718
+ feedback() {
1719
+ return new APIResource(this).push('feedback');
1694
1720
  }
1695
- roles() {
1696
- return new APIList(this).push('admin', 'roles');
1721
+ notifications() {
1722
+ return new APIListNotifications(this);
1697
1723
  }
1698
- runs() {
1699
- return new APIAdminListRuns(this);
1724
+ notification(id) {
1725
+ return new APIResourceNotification(this, id);
1700
1726
  }
1701
- run(id) {
1702
- return new APIAdminResourceRunStandalone(this, id);
1727
+ preferences() {
1728
+ return new APIResource(this).push('preferences');
1703
1729
  }
1704
- samples() {
1705
- return new APIList(this).push('admin', 'samples');
1730
+ uiPreferences() {
1731
+ return new APIResource(this).push('ui-preferences');
1706
1732
  }
1707
- sample(id) {
1708
- if (id == null) {
1709
- throw new Error('Resource ID cannot be null!');
1710
- }
1711
- return new APIResource(this).push('admin', 'samples', id);
1733
+ deviceUsage() {
1734
+ return new APIList(this).push('device-usage');
1712
1735
  }
1713
- services() {
1714
- return new APIAdminListServices(this);
1736
+ statistics() {
1737
+ return new APIResource(this).push('statistics');
1715
1738
  }
1716
- service(id) {
1717
- return new APIAdminResourceService(this, id);
1739
+ deviceStatistics() {
1740
+ return new APIList(this).push('device-statistics');
1718
1741
  }
1719
- settings() {
1720
- return new APIResource(this).push('admin', 'settings');
1742
+ accessGroups() {
1743
+ return new APIList(this).push('access-groups');
1721
1744
  }
1722
- statistics() {
1723
- return new APIAdminListStatistics(this);
1745
+ accessGroup(id) {
1746
+ return new APIResourceAccessGroup(this, id);
1724
1747
  }
1725
- users() {
1726
- return new APIList(this).push('users');
1748
+ smartbearTunnel(id) {
1749
+ return new APIResource(this).push('tunnels', id);
1727
1750
  }
1728
- createUser() {
1729
- return new APIList(this).push('admin', 'users').post();
1751
+ smartbearTunnels() {
1752
+ return new APIListSmartbearTunnels(this);
1730
1753
  }
1731
- user(id) {
1732
- return new APIAdminResourceUser(this, id);
1754
+ deleteAccount() {
1755
+ return new APIResource(this).push('delete');
1733
1756
  }
1734
1757
  }
1735
1758
 
1736
- class APIResourceAccount extends APIResource {
1737
- constructor(parent, id) {
1738
- if (id == null) {
1739
- throw new Error('Resource ID cannot be null!');
1740
- }
1759
+ class APIResourceUserSession extends APIResource {
1760
+ constructor(parent) {
1741
1761
  super(parent);
1742
- this.push('accounts', id);
1762
+ this.push('user-sessions');
1743
1763
  }
1744
- concurrencyStatus() {
1745
- return new APIResource(this).push('concurrency-status');
1764
+ login(data) {
1765
+ return new APIResource(this).push('login').post().data(data);
1746
1766
  }
1747
- preferences() {
1748
- return new APIResource(this).push('preferences');
1767
+ logout() {
1768
+ return new APIResource(this).push('logout').post();
1749
1769
  }
1750
- }
1751
-
1752
- class APIResourceBroker extends APIResource {
1753
- constructor(parent) {
1754
- super(parent);
1755
- this.push('broker');
1770
+ sso(name) {
1771
+ return new APIResource(this).push(name + '-login');
1756
1772
  }
1757
- hubs() {
1758
- return new APIList(this).push('hubs');
1773
+ portalLogin() {
1774
+ return new APIResource(this).push('portal-login').post();
1759
1775
  }
1760
1776
  }
1761
1777
 
1762
- if (global.isNodeJs) {
1778
+ if (globalThis.isNodeJs) {
1763
1779
  axios__default["default"].defaults.headers.common['User-Agent'] = `Bitbar Cloud API Client for JavaScript v${version}`;
1764
1780
  }
1765
1781
  axios__default["default"].defaults.maxContentLength = 1073741824;
1766
1782
  class API {
1767
1783
  constructor(config) {
1784
+ this.config = config;
1785
+ this.axiosConfig = {};
1768
1786
  if (config == null) {
1769
1787
  throw new Error('config cannot be empty');
1770
1788
  }
1771
- this.config = config;
1772
- this.axiosConfig = {};
1773
- if (this.config.cloudUrl == null) {
1789
+ else if (this.config.cloudUrl == null) {
1774
1790
  throw new TypeError('cloudUrl cannot be empty');
1775
1791
  }
1776
1792
  else if (typeof this.config.cloudUrl !== 'string') {
1777
1793
  throw new TypeError('cloudUrl must be a string');
1778
1794
  }
1779
1795
  else if (!/^https?:\/\/.{2,}/.test(this.config.cloudUrl)) {
1780
- throw new Error("cloudUrl doesn't look like a URL");
1796
+ throw new Error(`cloudUrl doesn't look like a URL`);
1781
1797
  }
1782
1798
  this.axiosConfig.baseURL = this.config.cloudUrl.replace(/\/+$/, '') + '/api';
1783
1799
  this.config.v2 = !!this.config.v2;
@@ -1789,7 +1805,7 @@
1789
1805
  throw new TypeError('apiKey must be a string');
1790
1806
  }
1791
1807
  else if (!/^[A-Za-z0-9]{32}$/.test(this.config.apiKey)) {
1792
- throw new Error("apiKey is in the wrong format");
1808
+ throw new Error('apiKey is in the wrong format');
1793
1809
  }
1794
1810
  this.axiosConfig.auth = {
1795
1811
  username: this.config.apiKey,
@@ -1799,44 +1815,41 @@
1799
1815
  this.axiosConfig.withCredentials = config.withCredentials == null ? false : config.withCredentials;
1800
1816
  this.axios = axios__default["default"].create(this.axiosConfig);
1801
1817
  }
1802
- userSession() {
1803
- return new APIResourceUserSession(this);
1804
- }
1805
- user(id) {
1806
- return new APIResourceUser(this, id);
1807
- }
1808
- users() {
1809
- return new APIListUsers(this);
1818
+ get baseUrl() {
1819
+ return this.axiosConfig.baseURL;
1810
1820
  }
1811
1821
  account(id) {
1812
1822
  return new APIResourceAccount(this, id);
1813
1823
  }
1814
- me() {
1815
- return this.user('me');
1816
- }
1817
1824
  admin() {
1818
1825
  return new APIAdminResource(this);
1819
1826
  }
1820
- devices() {
1821
- return new APIListDevices(this);
1827
+ broker() {
1828
+ return new APIResourceBroker(this);
1829
+ }
1830
+ clusters() {
1831
+ return new APIList(this).push('clusters');
1832
+ }
1833
+ cluster(id) {
1834
+ return new APIAdminResourceCluster(this, id);
1822
1835
  }
1823
1836
  device(id) {
1824
1837
  return new APIResourceDevice(this, id);
1825
1838
  }
1826
- deviceGroups() {
1827
- return new APIList(this).push('device-groups');
1828
- }
1829
1839
  deviceGroup(id) {
1830
1840
  return new APIResourceDeviceGroup(this, id);
1831
1841
  }
1832
- deviceSessions() {
1833
- return new APIList(this).push('device-sessions');
1842
+ deviceGroups() {
1843
+ return new APIList(this).push('device-groups');
1844
+ }
1845
+ devices() {
1846
+ return new APIListDevices(this);
1834
1847
  }
1835
1848
  deviceSession(id) {
1836
1849
  return new APIResourceDeviceSession(this, id);
1837
1850
  }
1838
- labelGroups() {
1839
- return new APIList(this).push('label-groups');
1851
+ deviceSessions() {
1852
+ return new APIList(this).push('device-sessions');
1840
1853
  }
1841
1854
  deviceStatistics() {
1842
1855
  return new APIList(this).push('device-statistics');
@@ -1844,14 +1857,56 @@
1844
1857
  enums() {
1845
1858
  return new APIResource(this).push('enums');
1846
1859
  }
1847
- licenses() {
1848
- return new APIResource(this).push('licenses');
1860
+ files() {
1861
+ return new APIList(this).push('files');
1862
+ }
1863
+ file(id) {
1864
+ return new APIResourceFile(this, id);
1865
+ }
1866
+ labelGroups() {
1867
+ return new APIList(this).push('label-groups');
1868
+ }
1869
+ labelGroup(id) {
1870
+ return new APIResourceLabelGroup(this, id);
1849
1871
  }
1850
1872
  labels() {
1851
1873
  return new APIList(this).push('labels');
1852
1874
  }
1853
- broker() {
1854
- return new APIResourceBroker(this);
1875
+ licenses() {
1876
+ return new APIResource(this).push('licenses');
1877
+ }
1878
+ license() {
1879
+ return new APIResource(this).push('license');
1880
+ }
1881
+ me() {
1882
+ return this.user('me');
1883
+ }
1884
+ projects() {
1885
+ return new APIList(this).push('projects');
1886
+ }
1887
+ project(id) {
1888
+ return new APIResourceProject(this, id);
1889
+ }
1890
+ properties() {
1891
+ return new APIListProperties(this);
1892
+ }
1893
+ property(id) {
1894
+ return new APIResource(this).push('properties', id);
1895
+ }
1896
+ run(id) {
1897
+ return new APIResourceRun(this, id);
1898
+ }
1899
+ services() {
1900
+ return new APIListServices(this);
1901
+ }
1902
+ user(id) {
1903
+ return new APIResourceUser(this, id);
1904
+ }
1905
+ users() {
1906
+ return new APIListUsers(this);
1907
+ }
1908
+ userSession() {
1909
+ return new APIResourceUserSession(this);
1855
1910
  }
1856
1911
  }
1857
1912