@bitbar/cloud-api-client 0.56.0 → 1.0.0

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/APIAdminResourceProject.d.ts +5 -4
  24. package/dist/api/APIAdminResourceRun.d.ts +5 -4
  25. package/dist/api/APIAdminResourceRunStandalone.d.ts +10 -11
  26. package/dist/api/APIAdminResourceService.d.ts +7 -7
  27. package/dist/api/APIAdminResourceUser.d.ts +15 -9
  28. package/dist/api/APIAdminResourceUserAccount.d.ts +13 -8
  29. package/dist/api/APIEntity.d.ts +21 -18
  30. package/dist/api/APIList.d.ts +9 -11
  31. package/dist/api/APIListCleanupConfigurations.d.ts +9 -5
  32. package/dist/api/APIListDeviceTime.d.ts +9 -5
  33. package/dist/api/APIListDevices.d.ts +11 -10
  34. package/dist/api/APIListFiles.d.ts +8 -7
  35. package/dist/api/APIListNotifications.d.ts +11 -5
  36. package/dist/api/APIListProperties.d.ts +8 -4
  37. package/dist/api/APIListRuns.d.ts +8 -5
  38. package/dist/api/APIListServices.d.ts +14 -7
  39. package/dist/api/APIListSmartbearTunnels.d.ts +8 -3
  40. package/dist/api/APIListUsers.d.ts +15 -9
  41. package/dist/api/APIResource.d.ts +3 -2
  42. package/dist/api/APIResourceAccessGroup.d.ts +14 -8
  43. package/dist/api/APIResourceAccount.d.ts +10 -5
  44. package/dist/api/APIResourceAccountService.d.ts +9 -4
  45. package/dist/api/APIResourceAdditionalUser.d.ts +7 -4
  46. package/dist/api/APIResourceBillingPeriod.d.ts +7 -4
  47. package/dist/api/APIResourceBroker.d.ts +8 -5
  48. package/dist/api/APIResourceChannel.d.ts +8 -0
  49. package/dist/api/APIResourceCleanupConfiguration.d.ts +7 -5
  50. package/dist/api/APIResourceDevice.d.ts +10 -5
  51. package/dist/api/APIResourceDeviceGroup.d.ts +16 -9
  52. package/dist/api/APIResourceDeviceSession.d.ts +7 -6
  53. package/dist/api/APIResourceDeviceSessionCommon.d.ts +22 -14
  54. package/dist/api/APIResourceDeviceSessionStandalone.d.ts +15 -10
  55. package/dist/api/APIResourceFile.d.ts +15 -7
  56. package/dist/api/APIResourceLabelGroup.d.ts +10 -6
  57. package/dist/api/APIResourceNotification.d.ts +8 -4
  58. package/dist/api/APIResourceProject.d.ts +12 -12
  59. package/dist/api/APIResourceRun.d.ts +3 -3
  60. package/dist/api/APIResourceRunCommon.d.ts +27 -17
  61. package/dist/api/APIResourceUser.d.ts +53 -40
  62. package/dist/api/APIResourceUserSession.d.ts +10 -7
  63. package/dist/api/APIUserResourceAccount.d.ts +13 -7
  64. package/dist/api/class/FilesQueryParams.d.ts +4 -0
  65. package/dist/api/class/Images.filter.d.ts +2 -0
  66. package/dist/api/class/InputFileset.d.ts +11 -6
  67. package/dist/api/class/NonMedia.filter.d.ts +2 -0
  68. package/dist/api/class/OutputFileset.d.ts +19 -12
  69. package/dist/api/decorators/NonRequestable.d.ts +8 -0
  70. package/dist/api/factory/postAdminDeviceSessionChangeBillable.d.ts +4 -3
  71. package/dist/api/factory/postDeviceRunIds.d.ts +4 -3
  72. package/dist/api/interface/DeviceSession.d.ts +6 -5
  73. package/dist/api/interface/DeviceSessionBase.d.ts +4 -4
  74. package/dist/api/interface/DeviceSessionCommon.d.ts +15 -11
  75. package/dist/api/interface/DeviceSessionStandalone.d.ts +9 -7
  76. package/dist/api/models/AccessGroup.d.ts +14 -0
  77. package/dist/api/models/Account.d.ts +7 -0
  78. package/dist/api/models/AccountConcurrencyStatusMap.d.ts +4 -0
  79. package/dist/api/models/AccountPreference.d.ts +4 -0
  80. package/dist/api/models/AccountService.d.ts +66 -0
  81. package/dist/api/models/AccountServicePayment.d.ts +11 -0
  82. package/dist/api/models/Activity.d.ts +13 -0
  83. package/dist/api/models/AdminDevice.d.ts +50 -0
  84. package/dist/api/models/AdminDeviceSession.d.ts +36 -0
  85. package/dist/api/models/AdminDeviceSessionStatistics.d.ts +22 -0
  86. package/dist/api/models/AdminDeviceType.d.ts +12 -0
  87. package/dist/api/models/AdminEmail.d.ts +9 -0
  88. package/dist/api/models/AdminError.d.ts +39 -0
  89. package/dist/api/models/AdminFrameworkStatistics.d.ts +24 -0
  90. package/dist/api/models/AdminOverview.d.ts +10 -0
  91. package/dist/api/models/AdminTestRun.d.ts +31 -0
  92. package/dist/api/models/BillingPeriod.d.ts +40 -0
  93. package/dist/api/models/Broker.d.ts +10 -0
  94. package/dist/api/models/Browser.d.ts +15 -0
  95. package/dist/api/models/CleanupConfiguration.d.ts +5 -0
  96. package/dist/api/models/Cluster.d.ts +32 -0
  97. package/dist/api/models/Connection.d.ts +15 -0
  98. package/dist/api/models/CountryVatRate.d.ts +7 -0
  99. package/dist/api/models/DesktopBrowserCapabilities.d.ts +19 -0
  100. package/dist/api/models/Device.d.ts +108 -0
  101. package/dist/api/models/DeviceFilter.d.ts +17 -0
  102. package/dist/api/models/DeviceGroup.d.ts +30 -0
  103. package/dist/api/models/DeviceModel.d.ts +23 -0
  104. package/dist/api/models/DeviceModelCriterion.d.ts +19 -0
  105. package/dist/api/models/DeviceModelPool.d.ts +19 -0
  106. package/dist/api/models/DeviceProblem.d.ts +23 -0
  107. package/dist/api/models/DeviceSession.d.ts +137 -0
  108. package/dist/api/models/DeviceSessionDataAvailability.d.ts +9 -0
  109. package/dist/api/models/DeviceStatistics.d.ts +15 -0
  110. package/dist/api/models/DeviceStatus.d.ts +30 -0
  111. package/dist/api/models/DeviceTimeCountSessionReportEntry.d.ts +12 -0
  112. package/dist/api/models/DeviceTimeStepTimeReportEntry.d.ts +12 -0
  113. package/dist/api/models/DeviceUsage.d.ts +7 -0
  114. package/dist/api/models/Enum.d.ts +10 -0
  115. package/dist/api/models/Framework.d.ts +37 -0
  116. package/dist/api/models/HTTP.d.ts +33 -0
  117. package/dist/api/models/LabelGroup.d.ts +7 -0
  118. package/dist/api/models/License.d.ts +74 -0
  119. package/dist/api/models/Maintenance.d.ts +13 -0
  120. package/dist/api/models/Message.d.ts +3 -0
  121. package/dist/api/models/Notification.d.ts +34 -0
  122. package/dist/api/models/NotificationPlan.d.ts +20 -0
  123. package/dist/api/models/Project.d.ts +31 -0
  124. package/dist/api/models/ProjectJobConfig.d.ts +9 -0
  125. package/dist/api/models/Property.d.ts +17 -0
  126. package/dist/api/models/Role.d.ts +15 -0
  127. package/dist/api/models/Screenshot.d.ts +22 -0
  128. package/dist/api/models/Service.d.ts +61 -0
  129. package/dist/api/models/Settings.d.ts +6 -0
  130. package/dist/api/models/SharedResource.d.ts +11 -0
  131. package/dist/api/models/SmartbearTunnel.d.ts +20 -0
  132. package/dist/api/models/Tag.d.ts +16 -0
  133. package/dist/api/models/TestCaseRun.d.ts +40 -0
  134. package/dist/api/models/TestRun.d.ts +132 -0
  135. package/dist/api/models/TestRunDataAvailability.d.ts +10 -0
  136. package/dist/api/models/User.d.ts +75 -0
  137. package/dist/api/models/UserDeviceTime.d.ts +21 -0
  138. package/dist/api/models/UserDeviceTimeSummary.d.ts +14 -0
  139. package/dist/api/models/UserFile.d.ts +65 -0
  140. package/dist/api/models/UserPreference.d.ts +11 -0
  141. package/dist/api/models/UserStatistics.d.ts +14 -0
  142. package/dist/api/models/VatRate.d.ts +4 -0
  143. package/dist/bitbar-cloud-api-client.js +1047 -1007
  144. package/dist/bitbar-cloud-api-client.js.map +1 -1
  145. package/dist/bitbar-cloud-api-client.min.js +17 -2
  146. package/dist/bitbar-cloud-api-client.min.js.map +1 -1
  147. package/package.json +30 -26
  148. package/.nycrc +0 -14
  149. package/Jenkinsfile.sonar +0 -53
  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.0 | 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.0";
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
  }
696
- }
697
-
698
- class APIResourceDeviceSession extends APIResourceDeviceSessionCommon {
699
- abort() {
700
- return new APIResource(this).push('abort').post();
708
+ connections() {
709
+ return new APIList(this).push('connections');
701
710
  }
702
- retry() {
703
- return new APIResource(this).push('retry').post();
711
+ logs() {
712
+ return new APIResource(this).push('logs').setRequestConfig({
713
+ responseType: 'text'
714
+ });
704
715
  }
705
716
  }
706
717
 
707
- class APIResourceRun extends APIResourceRunCommon {
708
- deviceSession(id) {
709
- return new APIResourceDeviceSession(this, id);
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);
710
729
  }
711
730
  }
712
731
 
713
- class APIResourceProject extends APIResource {
714
- constructor(parent, id) {
715
- if (id == null) {
716
- throw new Error('Resource ID cannot be null!');
717
- }
732
+ class APIAdminResourceDeviceTime extends APIList {
733
+ constructor(parent) {
718
734
  super(parent);
719
- this.push('projects', id);
720
- }
721
- runs() {
722
- return new APIList(this).push('runs');
735
+ this.push('admin', 'device-time');
723
736
  }
724
- run(id) {
725
- return new APIResourceRun(this, id);
737
+ countSessionReport() {
738
+ return new APIList(this).push('count-session-report');
726
739
  }
727
- runsExtended() {
728
- return new APIList(this).push('runs-extended');
740
+ stepTimeReport() {
741
+ return new APIList(this).push('step-time-report');
729
742
  }
730
- runExtended(id) {
743
+ }
744
+
745
+ class APIAdminResourceFramework extends APIResource {
746
+ constructor(parent, id) {
731
747
  if (id == null) {
732
748
  throw new Error('Resource ID cannot be null!');
733
749
  }
734
- return new APIResource(this).push('runs-extended', id);
735
- }
736
- files() {
737
- return new APIList(this).push('files');
738
- }
739
- filesZip() {
740
- return new APIResource(this).push('files.zip');
750
+ super(parent);
751
+ this.push('admin', 'frameworks', id);
741
752
  }
742
- sharings() {
743
- return new APIList(this).push('sharings');
753
+ config() {
754
+ return new APIResource(this).push('config');
744
755
  }
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);
756
+ requiredRoles() {
757
+ return new APIList(this).push('required-roles');
750
758
  }
751
759
  }
752
760
 
753
- class APIResourceFile extends APIResource {
761
+ class APIAdminResourceLicense extends APIResource {
754
762
  constructor(parent, id) {
755
763
  if (id == null) {
756
764
  throw new Error('Resource ID cannot be null!');
757
765
  }
758
766
  super(parent);
759
- this.push('files', id);
767
+ this.push('admin', 'licenses', id);
760
768
  }
761
- file() {
762
- return new APIResource(this).push('file');
769
+ activate() {
770
+ return new APIResource(this).push('activate');
763
771
  }
764
- icon() {
765
- return new APIResource(this).push('icon');
772
+ deactivate() {
773
+ return new APIResource(this).push('deactivate');
766
774
  }
767
- tags() {
768
- return new APIList(this).push('tags');
775
+ resend() {
776
+ return new APIResource(this).push('resend');
777
+ }
778
+ download() {
779
+ return new APIResource(this).push('download');
769
780
  }
770
781
  }
771
782
 
772
- class APIResourceNotification extends APIResource {
783
+ class APIAdminResourceNotificationPlan extends APIResource {
773
784
  constructor(parent, id) {
774
785
  if (id == null) {
775
786
  throw new Error('Resource ID cannot be null!');
776
787
  }
777
788
  super(parent);
778
- this.push('notifications', id);
789
+ this.push('admin', 'notification-plans', id);
790
+ }
791
+ check() {
792
+ return new APIList(this).push('check');
779
793
  }
780
794
  test() {
781
795
  return new APIResource(this).push('test');
782
796
  }
797
+ execute() {
798
+ return new APIResource(this).push('execute');
799
+ }
783
800
  }
784
801
 
785
- class APIResourceAccessGroup extends APIResource {
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
+ });
808
+ }
809
+ return a.post();
810
+ }
811
+
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,762 @@
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);
946
+ super(parent);
947
+ this.push('access-groups', id);
1009
948
  }
1010
- billingPeriods() {
1011
- return new APIList(this).push('billing-periods');
949
+ users() {
950
+ return new APIList(this).push('users');
1012
951
  }
1013
- billingPeriod(id) {
1014
- return new APIResourceBillingPeriod(this, id);
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);
1015
957
  }
1016
- jobs() {
1017
- return new APIList(this).push('jobs');
958
+ resources() {
959
+ return new APIList(this).push('resources');
1018
960
  }
1019
- job(id) {
1020
- return new APIResourceJob(this, id);
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);
1021
966
  }
1022
- deviceGroups() {
1023
- return new APIList(this).push('device-groups');
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);
1024
976
  }
1025
- deviceGroup(id) {
1026
- return new APIResourceDeviceGroup(this, id);
977
+ devices() {
978
+ return new APIList(this).push('devices');
1027
979
  }
1028
- deviceSessions() {
1029
- return new APIList(this).push('device-sessions');
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);
1030
985
  }
1031
- deviceSession(id) {
1032
- return new APIResourceDeviceSessionStandalone(this, id);
986
+ selectors() {
987
+ return new APIList(this).push('selectors');
1033
988
  }
1034
- projects() {
1035
- return new APIList(this).push('projects');
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);
1036
994
  }
1037
- project(id) {
1038
- return new APIResourceProject(this, id);
995
+ share() {
996
+ return new APIResource(this).push('share');
1039
997
  }
1040
- files() {
1041
- return new APIListFiles(this);
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);
1042
1007
  }
1043
- file(id) {
1044
- return new APIResourceFile(this, id);
1008
+ file() {
1009
+ return new APIResource(this).push('file');
1045
1010
  }
1046
- runs() {
1047
- return new APIListRuns(this);
1011
+ icon() {
1012
+ return new APIResource(this).push('icon');
1048
1013
  }
1049
- availableBuildExecutors() {
1050
- return new APIList(this).push('available-build-executors');
1014
+ tags() {
1015
+ return new APIList(this).push('tags');
1051
1016
  }
1052
- availableFrameworks() {
1053
- return new APIList(this).push('available-frameworks');
1017
+ share() {
1018
+ return new APIList(this).push('share');
1054
1019
  }
1055
- resetApiKey() {
1056
- return new APIResource(this).push('reset-api-key');
1020
+ }
1021
+
1022
+ class APIResourceDeviceSession extends APIResourceDeviceSessionCommon {
1023
+ abort() {
1024
+ return new APIResource(this).push('abort').post();
1057
1025
  }
1058
- restore() {
1059
- return new APIResource(this).push('restore');
1026
+ retry() {
1027
+ return new APIResource(this).push('retry').post();
1060
1028
  }
1061
- feedback() {
1062
- return new APIResource(this).push('feedback');
1029
+ }
1030
+
1031
+ class APIResourceRunCommon extends APIResource {
1032
+ constructor(parent, id) {
1033
+ if (id == null) {
1034
+ throw new Error('Resource ID cannot be null!');
1035
+ }
1036
+ super(parent);
1037
+ this.push('runs', id);
1063
1038
  }
1064
- notifications() {
1065
- return new APIListNotifications(this);
1039
+ abort() {
1040
+ return new APIResource(this).push('abort').post();
1066
1041
  }
1067
- notification(id) {
1068
- return new APIResourceNotification(this, id);
1042
+ dataAvailability() {
1043
+ return new APIResource(this).push('data-availability');
1069
1044
  }
1070
- receipts() {
1071
- return new APIList(this).push('receipts');
1045
+ deviceSessions() {
1046
+ return new APIList(this).push('device-sessions');
1072
1047
  }
1073
- preferences() {
1074
- return new APIResource(this).push('preferences');
1048
+ filesZip(ids) {
1049
+ return postDeviceRunIds(this, 'files.zip', ids);
1075
1050
  }
1076
- uiPreferences() {
1077
- return new APIResource(this).push('ui-preferences');
1051
+ logsZip(ids) {
1052
+ return postDeviceRunIds(this, 'logs.zip', ids);
1078
1053
  }
1079
- deviceUsage() {
1080
- return new APIList(this).push('device-usage');
1054
+ performanceZip(ids) {
1055
+ return postDeviceRunIds(this, 'performance.zip', ids);
1081
1056
  }
1082
- statistics() {
1083
- return new APIList(this).push('statistics');
1057
+ retry(ids) {
1058
+ return postDeviceRunIds(this, 'retry', ids).setRequestConfig({
1059
+ timeout: 0
1060
+ });
1084
1061
  }
1085
- deviceStatistics() {
1086
- return new APIList(this).push('device-statistics');
1062
+ screenshotNames() {
1063
+ return new APIList(this).push('screenshot-names');
1087
1064
  }
1088
- accessGroups() {
1089
- return new APIList(this).push('access-groups');
1065
+ screenshots() {
1066
+ return new APIList(this).push('screenshots');
1090
1067
  }
1091
- accessGroup(id) {
1092
- return new APIResourceAccessGroup(this, id);
1068
+ screenshotsZip(ids) {
1069
+ return postDeviceRunIds(this, 'screenshots.zip', ids);
1093
1070
  }
1094
- smartbearTunnel(id) {
1095
- return new APIResource(this).push('tunnels', id);
1071
+ steps() {
1072
+ return new APIList(this).push('steps');
1096
1073
  }
1097
- smartbearTunnels() {
1098
- return new APIListSmartbearTunnels(this);
1074
+ tags() {
1075
+ return new APIList(this).push('tags');
1076
+ }
1077
+ tag(id) {
1078
+ if (id == null) {
1079
+ throw new Error('Resource ID cannot be null!');
1080
+ }
1081
+ return new APIResource(this).push('tags', id);
1099
1082
  }
1100
1083
  }
1101
1084
 
1102
- class APIResourceDevice extends APIResource {
1085
+ class APIResourceRun extends APIResourceRunCommon {
1086
+ deviceSession(id) {
1087
+ return new APIResourceDeviceSession(this, id);
1088
+ }
1089
+ }
1090
+
1091
+ class APIResourceProject extends APIResource {
1103
1092
  constructor(parent, id) {
1104
1093
  if (id == null) {
1105
1094
  throw new Error('Resource ID cannot be null!');
1106
1095
  }
1107
1096
  super(parent);
1108
- this.push('devices', id);
1097
+ this.push('projects', id);
1109
1098
  }
1110
- properties() {
1111
- return new APIList(this).push('properties');
1099
+ runs() {
1100
+ return new APIList(this).push('runs');
1101
+ }
1102
+ run(id) {
1103
+ return new APIResourceRun(this, id);
1112
1104
  }
1113
1105
  }
1114
1106
 
1115
- class APIResourceUserSession extends APIResource {
1107
+ let APIAdminResource = class APIAdminResource extends APIResource {
1116
1108
  constructor(parent) {
1117
1109
  super(parent);
1118
- this.push('user-sessions');
1119
1110
  }
1120
- login(data) {
1121
- return new APIResource(this).push('login').post().data(data);
1111
+ accessGroups() {
1112
+ return new APIList(this).push('access-groups');
1122
1113
  }
1123
- logout() {
1124
- return new APIResource(this).push('logout').post();
1114
+ accessGroup(id) {
1115
+ return new APIResourceAccessGroup(this, id);
1125
1116
  }
1126
- sso(name) {
1127
- return new APIResource(this).push(name + '-login');
1117
+ accounts() {
1118
+ return new APIList(this).push('admin', 'accounts');
1128
1119
  }
1129
- portalLogin() {
1130
- return new APIResource(this).push('portal-login').post();
1120
+ account(id) {
1121
+ if (id == null) {
1122
+ throw new Error('Resource ID cannot be null!');
1123
+ }
1124
+ return new APIResource(this).push('admin', 'accounts', id);
1131
1125
  }
1132
- }
1133
-
1134
- class APIAdminListRuns extends APIList {
1135
- constructor(parent) {
1136
- super(parent);
1137
- this.push('admin', 'runs');
1126
+ accountServices() {
1127
+ return new APIList(this).push('admin', 'account-services');
1138
1128
  }
1139
- config() {
1140
- const a = new APIResource(this);
1141
- a.stack = ['runs', 'config'];
1142
- return a;
1129
+ accountService(id) {
1130
+ return new APIAdminResourceAccountService(this, id);
1143
1131
  }
1144
- }
1145
-
1146
- class APIAdminResourceCluster extends APIResource {
1147
- constructor(parent, id) {
1132
+ activities() {
1133
+ return new APIList(this).push('admin', 'activities');
1134
+ }
1135
+ billingPeriods() {
1136
+ return new APIList(this).push('admin', 'billing-periods');
1137
+ }
1138
+ billingPeriod(id) {
1148
1139
  if (id == null) {
1149
1140
  throw new Error('Resource ID cannot be null!');
1150
1141
  }
1151
- super(parent);
1152
- this.push('clusters', id);
1142
+ return new APIResource(this).push('admin', 'billing-periods', id);
1153
1143
  }
1154
- devices() {
1155
- return new APIList(this).push('devices');
1144
+ browsers() {
1145
+ return new APIList(this).push('admin', 'browsers');
1156
1146
  }
1157
- }
1158
-
1159
- class APIAdminResourceDeviceTime extends APIResource {
1160
- constructor(parent) {
1161
- super(parent);
1162
- this.push('admin', 'device-time');
1147
+ browser(id) {
1148
+ if (id == null) {
1149
+ throw new Error('Resource ID cannot be null!');
1150
+ }
1151
+ return new APIResource(this).push('admin', 'browsers', id);
1163
1152
  }
1164
- countSessionReport() {
1165
- return new APIList(this).push('count-session-report');
1153
+ clusters() {
1154
+ return new APIList(this).push('clusters');
1166
1155
  }
1167
- stepTimeReport() {
1168
- return new APIList(this).push('step-time-report');
1156
+ cluster(id) {
1157
+ return new APIAdminResourceCluster(this, id);
1169
1158
  }
1170
- }
1171
-
1172
- class APIAdminResourceRunStandalone extends APIResource {
1173
- constructor(parent, id) {
1159
+ countryVatRates() {
1160
+ return new APIList(this).push('admin', 'country-vat-rates');
1161
+ }
1162
+ countryVatRate(id) {
1174
1163
  if (id == null) {
1175
1164
  throw new Error('Resource ID cannot be null!');
1176
1165
  }
1177
- super(parent);
1178
- this.push('admin', 'runs', id);
1166
+ return new APIResource(this).push('admin', 'country-vat-rates', id);
1179
1167
  }
1180
- abort() {
1181
- return new APIResource(this).push('abort').post();
1168
+ devices() {
1169
+ return new APIAdminListDevices(this);
1182
1170
  }
1183
- changeBillable(billable) {
1184
- return new APIResource(this).push('changebillable').post().params({
1185
- billable
1186
- });
1171
+ device(id) {
1172
+ return new APIAdminResourceDevice(this, id);
1187
1173
  }
1188
- changePriority(priority) {
1189
- return new APIResource(this).push('changepriority').post().params({
1190
- priority
1174
+ devicesForModel(id) {
1175
+ if (id == null) {
1176
+ throw new Error('Resource ID cannot be null!');
1177
+ }
1178
+ const apiList = this.devices();
1179
+ apiList.params({
1180
+ filter: 'deviceModelId_eq_' + id
1191
1181
  });
1182
+ return apiList;
1192
1183
  }
1193
- retry(ids) {
1194
- return postDeviceRunIds(this, 'retry', ids).setRequestConfig({
1195
- timeout: 0
1196
- });
1184
+ deviceStatuses() {
1185
+ return new APIList(this).push('admin', 'device', 'statuses');
1197
1186
  }
1198
- deviceSessions() {
1199
- return new APIList(this).shift().push('device-sessions');
1187
+ deviceModels() {
1188
+ return new APIList(this).push('admin', 'device-models');
1200
1189
  }
1201
- deviceSession(id) {
1202
- return new APIResourceDeviceSessionCommon(this, id).shift();
1190
+ deviceModel(id) {
1191
+ return new APIAdminResourceDeviceModel(this, id);
1203
1192
  }
1204
- }
1205
-
1206
- class APIAdminResourceDevice extends APIResource {
1207
- constructor(parent, id) {
1193
+ deviceProblems() {
1194
+ return new APIList(this).push('admin', 'device-problems');
1195
+ }
1196
+ deviceModelCriterias() {
1197
+ return new APIList(this).push('admin', 'device-model-criteria');
1198
+ }
1199
+ deviceModelCriteria(id) {
1208
1200
  if (id == null) {
1209
1201
  throw new Error('Resource ID cannot be null!');
1210
1202
  }
1211
- super(parent);
1212
- this.push('admin', 'devices', id);
1203
+ return new APIResource(this).push('admin', 'device-model-criteria', id);
1213
1204
  }
1214
- queue() {
1215
- return new APIList(this).push('queue');
1205
+ deviceSessions() {
1206
+ return new APIList(this).push('admin', 'device-sessions');
1216
1207
  }
1217
- cleanupConfiguration() {
1218
- return new APIResource(this).push('cleanup-configuration');
1208
+ deviceSession(id) {
1209
+ return new APIAdminResourceDeviceSessionStandalone(this, id);
1219
1210
  }
1220
- labels() {
1221
- return new APIList(this).push('labels');
1211
+ deviceTime() {
1212
+ return new APIAdminResourceDeviceTime(this);
1222
1213
  }
1223
- label(id) {
1224
- return new APIResource(this).push('labels', id);
1214
+ deviceTimeSummary() {
1215
+ return new APIList(this).push('admin', 'device-time-summary');
1225
1216
  }
1226
- blink() {
1227
- return new APIResource(this).push('blink').post();
1217
+ deviceTypes() {
1218
+ return new APIList(this).push('admin', 'device-types');
1228
1219
  }
1229
- }
1230
-
1231
- class APIAdminResourceAccountService extends APIResource {
1232
- constructor(parent, id) {
1220
+ deviceType(id) {
1221
+ return new APIResource(this).push('admin', 'device-types', id);
1222
+ }
1223
+ deviceGroups() {
1224
+ return new APIList(this).push('device-groups');
1225
+ }
1226
+ deviceGroup(id) {
1227
+ return new APIResourceDeviceGroup(this, id);
1228
+ }
1229
+ emails() {
1230
+ return new APIList(this).push('admin', 'emails');
1231
+ }
1232
+ resendEmail(id) {
1233
1233
  if (id == null) {
1234
1234
  throw new Error('Resource ID cannot be null!');
1235
1235
  }
1236
- super(parent);
1237
- this.push('admin', 'account-services', id);
1236
+ return new APIResource(this).push('admin', 'emails', id, 'resend').post();
1238
1237
  }
1239
- activate() {
1240
- return new APIResource(this).push('activate').post();
1238
+ errors() {
1239
+ return new APIList(this).push('admin', 'errors');
1241
1240
  }
1242
- deactivate() {
1243
- return new APIResource(this).push('deactivate').post();
1241
+ files() {
1242
+ return new APIList(this).push('files');
1244
1243
  }
1245
- }
1246
-
1247
- class APIAdminResourceUserAccount extends APIResource {
1248
- constructor(parent) {
1249
- super(parent);
1250
- this.push('account');
1244
+ file(id) {
1245
+ return new APIResourceFile(this, id);
1246
+ }
1247
+ frameworks() {
1248
+ return new APIList(this).push('admin', 'frameworks');
1249
+ }
1250
+ framework(id) {
1251
+ return new APIAdminResourceFramework(this, id);
1252
+ }
1253
+ frameworkAvailableLabels() {
1254
+ const apiList = this.frameworks();
1255
+ apiList.push('available-labels');
1256
+ return apiList;
1257
+ }
1258
+ interactiveQueue() {
1259
+ return new APIList(this).push('admin', 'interactive-queue');
1260
+ }
1261
+ licenses() {
1262
+ return new APIList(this).push('admin', 'licenses');
1263
+ }
1264
+ license(id) {
1265
+ return new APIAdminResourceLicense(this, id);
1266
+ }
1267
+ maintenance() {
1268
+ return new APIResource(this).push('admin', 'maintenance');
1269
+ }
1270
+ notificationPlans() {
1271
+ return new APIAdminListNotificationPlans(this);
1272
+ }
1273
+ notificationPlan(id) {
1274
+ return new APIAdminResourceNotificationPlan(this, id);
1275
+ }
1276
+ overview() {
1277
+ return new APIResource(this).push('admin', 'overview');
1278
+ }
1279
+ pools() {
1280
+ return new APIList(this).push('admin', 'pools');
1281
+ }
1282
+ pool(id) {
1283
+ return new APIResource(this).push('admin', 'pools', id);
1284
+ }
1285
+ projects() {
1286
+ return new APIList(this).push('projects');
1287
+ }
1288
+ project(id) {
1289
+ return new APIResourceProject(this, id);
1251
1290
  }
1252
1291
  roles() {
1253
- return new APIList(this).push('roles');
1292
+ return new APIList(this).push('admin', 'roles');
1254
1293
  }
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);
1294
+ runs() {
1295
+ return new APIAdminListRuns(this);
1260
1296
  }
1261
- services() {
1262
- const a = new APIList(this);
1263
- a.last += '-services';
1264
- return a;
1297
+ run(id) {
1298
+ return new APIAdminResourceRunStandalone(this, id);
1265
1299
  }
1266
- update() {
1267
- const a = new APIResource(this);
1268
- a.last = 'update-account';
1269
- return a.post();
1300
+ samples() {
1301
+ return new APIList(this).push('admin', 'samples');
1270
1302
  }
1271
- }
1272
-
1273
- class APIAdminResourceUser extends APIResource {
1274
- constructor(parent, id) {
1303
+ sample(id) {
1275
1304
  if (id == null) {
1276
1305
  throw new Error('Resource ID cannot be null!');
1277
1306
  }
1278
- super(parent);
1279
- this.push('admin', 'users', id);
1307
+ return new APIResource(this).push('admin', 'samples', id);
1280
1308
  }
1281
- disable() {
1282
- return new APIResource(this).push('disable');
1309
+ services() {
1310
+ return new APIAdminListServices(this);
1283
1311
  }
1284
- enable() {
1285
- return new APIResource(this).push('enable');
1312
+ service(id) {
1313
+ return new APIAdminResourceService(this, id);
1286
1314
  }
1287
- licenses() {
1288
- return new APIList(this).push('licenses');
1315
+ settings() {
1316
+ return new APIResource(this).push('admin', 'settings');
1289
1317
  }
1290
- resendActivation() {
1291
- return new APIResource(this).push('resend-activation').post();
1318
+ statistics() {
1319
+ return new APIAdminListStatistics(this);
1292
1320
  }
1293
- account() {
1294
- return new APIAdminResourceUserAccount(this);
1321
+ users() {
1322
+ return new APIList(this).push('users');
1295
1323
  }
1296
- }
1324
+ createUser() {
1325
+ return new APIList(this).push('admin', 'users').post();
1326
+ }
1327
+ user(id) {
1328
+ return new APIAdminResourceUser(this, id);
1329
+ }
1330
+ };
1331
+ APIAdminResource = __decorate([
1332
+ NonRequestable
1333
+ ], APIAdminResource);
1297
1334
 
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();
1335
+ class APIListDevices extends APIList {
1336
+ constructor(parent) {
1337
+ super(parent);
1338
+ this.push('devices');
1339
+ }
1340
+ filters() {
1341
+ return new APIResource(this).push('filters');
1342
+ }
1343
+ desktopBrowserCapabilities() {
1344
+ return new APIResource(this).push('desktop-browser-capabilities');
1345
+ }
1304
1346
  }
1305
1347
 
1306
- class APIAdminResourceDeviceSessionStandalone extends APIResourceDeviceSessionCommon {
1307
- changeBillable(billable) {
1308
- return postAdminDeviceSessionChangeBillable(this, billable);
1309
- }
1310
- connections() {
1311
- return new APIList(this).push('connections');
1348
+ class APIListProperties extends APIList {
1349
+ constructor(parent) {
1350
+ super(parent);
1351
+ this.push('properties');
1312
1352
  }
1313
- connection(id) {
1353
+ appBan(id) {
1314
1354
  if (id == null) {
1315
1355
  throw new Error('Resource ID cannot be null!');
1316
1356
  }
1317
- return new APIResource(this).push('connections', id);
1357
+ return new APIList(this).push('app-bans').params({
1358
+ testRunId: id
1359
+ });
1318
1360
  }
1319
- release() {
1320
- return new APIResource(this).push('release').post();
1361
+ maintenance() {
1362
+ return new APIList(this).params({
1363
+ filter: 'name_eq_CLOUD_HEADER_ANNOUNCEMENT',
1364
+ limit: 1,
1365
+ sort: 'updateTime_d'
1366
+ });
1321
1367
  }
1322
1368
  }
1323
1369
 
1324
- class APIAdminListDevices extends APIList {
1370
+ class APIListServices extends APIList {
1325
1371
  constructor(parent) {
1326
1372
  super(parent);
1327
- this.push('admin', 'devices');
1373
+ this.ALLOWED_HTTP_METHODS = ['POST'];
1374
+ this.push('services');
1328
1375
  }
1329
- filters() {
1330
- return new APIResource(this).push('filters');
1376
+ available() {
1377
+ return new APIList(this).push('available');
1331
1378
  }
1332
- cleanupConfigurations() {
1333
- return new APIListCleanupConfigurations(this);
1379
+ active() {
1380
+ const apiList = new APIList(this);
1381
+ if (this.first === 'me') {
1382
+ apiList.push('active');
1383
+ }
1384
+ else {
1385
+ apiList.params({
1386
+ notArchived: true
1387
+ });
1388
+ }
1389
+ return apiList;
1334
1390
  }
1335
- cleanupConfiguration(id) {
1336
- return new APIResourceCleanupConfiguration(this, id);
1391
+ byPrice() {
1392
+ return new APIList(this).sort('centPrice');
1337
1393
  }
1338
- desktopBrowserCapabilities() {
1339
- return new APIResource(this).push('desktop-browser-capabilities');
1394
+ availableByPrice() {
1395
+ return new APIList(this).push('available').sort('centPrice');
1340
1396
  }
1341
1397
  }
1342
1398
 
1343
- class APIAdminResourceFramework extends APIResource {
1344
- constructor(parent, id) {
1345
- if (id == null) {
1346
- throw new Error('Resource ID cannot be null!');
1347
- }
1399
+ class APIListUsers extends APIList {
1400
+ constructor(parent) {
1348
1401
  super(parent);
1349
- this.push('admin', 'frameworks', id);
1402
+ this.ALLOWED_HTTP_METHODS = ['POST'];
1403
+ this.push('users');
1350
1404
  }
1351
- config() {
1352
- return new APIResource(this).push('config');
1405
+ activate() {
1406
+ return new APIResource(this).push('activate').post();
1353
1407
  }
1354
- requiredRoles() {
1355
- return new APIList(this).push('required-roles');
1408
+ recoveries() {
1409
+ return new APIResource(this).push('recoveries');
1410
+ }
1411
+ passwordRecovery() {
1412
+ return new APIResource(this).push('password-recovery');
1413
+ }
1414
+ validateVatId() {
1415
+ return new APIResource(this).push('validateVatId');
1356
1416
  }
1357
1417
  }
1358
1418
 
1359
- class APIAdminResourceLicense extends APIResource {
1419
+ class APIResourceAccount extends APIResource {
1360
1420
  constructor(parent, id) {
1361
1421
  if (id == null) {
1362
1422
  throw new Error('Resource ID cannot be null!');
1363
1423
  }
1364
1424
  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');
1425
+ this.push('accounts', id);
1372
1426
  }
1373
- resend() {
1374
- return new APIResource(this).push('resend');
1427
+ concurrencyStatus() {
1428
+ return new APIResource(this).push('concurrency-status');
1375
1429
  }
1376
- download() {
1377
- return new APIResource(this).push('download');
1430
+ preferences() {
1431
+ return new APIResource(this).push('preferences');
1378
1432
  }
1379
1433
  }
1380
1434
 
1381
- class APIAdminListNotificationPlans extends APIList {
1435
+ class APIResourceBroker extends APIResource {
1382
1436
  constructor(parent) {
1383
1437
  super(parent);
1384
- this.push('admin', 'notification-plans');
1385
- }
1386
- channels() {
1387
- return new APIList(this).push('channels');
1438
+ this.push('broker');
1388
1439
  }
1389
- scopes() {
1390
- return new APIList(this).push('scopes');
1440
+ hubs() {
1441
+ return new APIList(this).push('hubs');
1391
1442
  }
1392
1443
  }
1393
1444
 
1394
- class APIAdminResourceNotificationPlan extends APIResource {
1445
+ class APIResourceDevice extends APIResource {
1395
1446
  constructor(parent, id) {
1396
1447
  if (id == null) {
1397
1448
  throw new Error('Resource ID cannot be null!');
1398
1449
  }
1399
1450
  super(parent);
1400
- this.push('admin', 'notification-plans', id);
1401
- }
1402
- check() {
1403
- return new APIList(this).push('check');
1451
+ this.push('devices', id);
1404
1452
  }
1405
- test() {
1406
- return new APIResource(this).push('test');
1453
+ properties() {
1454
+ return new APIList(this).push('properties');
1407
1455
  }
1408
- execute() {
1409
- return new APIResource(this).push('execute');
1456
+ browsers() {
1457
+ return new APIList(this).push('browsers');
1410
1458
  }
1411
1459
  }
1412
1460
 
1413
- class APIAdminResourceService extends APIResource {
1461
+ class APIResourceLabelGroup extends APIResource {
1414
1462
  constructor(parent, id) {
1415
1463
  if (id == null) {
1416
1464
  throw new Error('Resource ID cannot be null!');
1417
1465
  }
1418
1466
  super(parent);
1419
- this.push('admin', 'services', id);
1420
- }
1421
- activate() {
1422
- return new APIResource(this).push('activate').post();
1467
+ this.push('label-groups', id);
1423
1468
  }
1424
- deactivate() {
1425
- return new APIResource(this).push('deactivate').post();
1469
+ labels() {
1470
+ return new APIList(this).push('labels');
1426
1471
  }
1427
- roles() {
1428
- return new APIList(this).push('roles');
1472
+ label(id) {
1473
+ return new APIResource(this).push('labels', id);
1429
1474
  }
1430
1475
  }
1431
1476
 
1432
- class APIAdminListServices extends APIList {
1477
+ class APIListDeviceTime extends APIList {
1433
1478
  constructor(parent) {
1434
1479
  super(parent);
1435
- this.push('admin', 'services');
1480
+ this.push('device-time');
1436
1481
  }
1437
- purchased() {
1438
- return new APIListPurchased(this);
1482
+ reserved() {
1483
+ return new APIEntity(this).push('reserved');
1439
1484
  }
1440
- available() {
1441
- return new APIList(this).push('available');
1485
+ used() {
1486
+ return new APIEntity(this).push('used');
1442
1487
  }
1443
- active() {
1444
- const a = new APIList(this);
1445
- if (this.first === 'me') {
1446
- a.push('active');
1488
+ }
1489
+
1490
+ class APIListFiles extends APIList {
1491
+ constructor(parent) {
1492
+ super(parent);
1493
+ this.push('files');
1494
+ }
1495
+ upload(obj) {
1496
+ if (global.isNodeJs) {
1497
+ return this.nodeUpload(obj);
1447
1498
  }
1448
1499
  else {
1449
- a.params({
1450
- notArchived: true
1451
- });
1500
+ throw new Error('Not supported yet!');
1452
1501
  }
1453
- return a;
1454
1502
  }
1455
- activated() {
1456
- const a = this.active();
1457
- a.params({
1458
- filter: 'activated_eq_true',
1459
- limit: 0,
1460
- sort: 'name_a'
1503
+ nodeUpload(file) {
1504
+ const fs = require('fs');
1505
+ const FormData = require('form-data');
1506
+ const form = new FormData();
1507
+ form.append('file', fs.createReadStream(file.dir + '/' + file.filename), {
1508
+ filename: file.filename
1461
1509
  });
1462
- return a;
1510
+ return this.post().headers(form.getHeaders()).data(form);
1463
1511
  }
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;
1512
+ }
1513
+
1514
+ class APIResourceChannel extends APIResource {
1515
+ constructor(parent, type) {
1516
+ if (type == null) {
1517
+ throw new Error('Resource ID cannot be null!');
1518
+ }
1519
+ super(parent);
1520
+ this.push('channels', type);
1472
1521
  }
1473
- byPrice() {
1474
- const a = new APIList(this);
1475
- a.params({
1476
- sort: 'centPrice_a'
1477
- });
1478
- return a;
1522
+ scopes() {
1523
+ return new APIList(this).push('scopes');
1479
1524
  }
1480
1525
  }
1481
1526
 
1482
- class APIAdminListStatistics extends APIList {
1527
+ class APIListNotifications extends APIList {
1483
1528
  constructor(parent) {
1484
1529
  super(parent);
1485
- this.push('admin', 'statistics');
1530
+ this.push('notifications');
1486
1531
  }
1487
- deviceSessions() {
1488
- return new APIList(this).push('device-sessions');
1532
+ scopes() {
1533
+ return new APIList(this).push('scopes');
1489
1534
  }
1490
- frameworks() {
1491
- return new APIList(this).push('frameworks');
1535
+ channels() {
1536
+ return new APIList(this).push('channels');
1537
+ }
1538
+ channel(type) {
1539
+ return new APIResourceChannel(this, type);
1492
1540
  }
1493
1541
  }
1494
1542
 
1495
- class APIAdminResourceDeviceModel extends APIResource {
1496
- constructor(parent, id) {
1497
- if (id == null) {
1498
- throw new Error('Resource ID cannot be null!');
1499
- }
1543
+ class APIListRuns extends APIList {
1544
+ constructor(parent) {
1500
1545
  super(parent);
1501
- this.push('admin', 'device-models', id);
1546
+ this.push('runs');
1502
1547
  }
1503
- browsers() {
1504
- return new APIList(this).push('browsers');
1548
+ config() {
1549
+ return new APIResource(this).push('config');
1505
1550
  }
1506
1551
  }
1507
1552
 
1508
- class APIAdminResource extends APIResource {
1553
+ class APIListSmartbearTunnels extends APIList {
1509
1554
  constructor(parent) {
1510
1555
  super(parent);
1556
+ this.ALLOWED_HTTP_METHODS = ['GET'];
1557
+ this.push('tunnels');
1511
1558
  }
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');
1559
+ active(active) {
1560
+ return this.params({ active: active });
1520
1561
  }
1521
- account(id) {
1562
+ }
1563
+
1564
+ class APIResourceBillingPeriod extends APIResource {
1565
+ constructor(parent, id) {
1522
1566
  if (id == null) {
1523
1567
  throw new Error('Resource ID cannot be null!');
1524
1568
  }
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');
1569
+ super(parent);
1570
+ this.push('billing-periods', id);
1535
1571
  }
1536
- billingPeriods() {
1537
- return new APIList(this).push('admin', 'billing-periods');
1572
+ receipt() {
1573
+ return new APIResource(this).push('receipt').setRequestConfig({
1574
+ responseType: 'arraybuffer'
1575
+ });
1538
1576
  }
1539
- billingPeriod(id) {
1577
+ }
1578
+
1579
+ class APIResourceNotification extends APIResource {
1580
+ constructor(parent, id) {
1540
1581
  if (id == null) {
1541
1582
  throw new Error('Resource ID cannot be null!');
1542
1583
  }
1543
- return new APIResource(this).push('admin', 'billing-periods', id);
1584
+ super(parent);
1585
+ this.push('notifications', id);
1544
1586
  }
1545
- browsers() {
1546
- return new APIList(this).push('admin', 'browsers');
1587
+ test() {
1588
+ return new APIResource(this).push('test');
1547
1589
  }
1548
- browser(id) {
1590
+ }
1591
+
1592
+ class APIResourceAdditionalUser extends APIResource {
1593
+ constructor(parent, id) {
1549
1594
  if (id == null) {
1550
1595
  throw new Error('Resource ID cannot be null!');
1551
1596
  }
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);
1597
+ super(parent);
1598
+ this.push('additional-users', id);
1559
1599
  }
1560
- countryVatRates() {
1561
- return new APIList(this).push('admin', 'country-vat-rates');
1600
+ resendActivation() {
1601
+ return new APIResource(this).push('resend-activation');
1562
1602
  }
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);
1603
+ }
1604
+
1605
+ class APIUserResourceAccount extends APIResource {
1606
+ constructor(parent) {
1607
+ super(parent);
1608
+ this.push('account');
1568
1609
  }
1569
- devices() {
1570
- return new APIAdminListDevices(this);
1610
+ additionalUsers() {
1611
+ return new APIList(this).push('additional-users');
1571
1612
  }
1572
- device(id) {
1573
- return new APIAdminResourceDevice(this, id);
1613
+ additionalUser(id) {
1614
+ return new APIResourceAdditionalUser(this, id);
1574
1615
  }
1575
- devicesForModel(id) {
1616
+ serviceBillingPeriod(id) {
1576
1617
  if (id == null) {
1577
1618
  throw new Error('Resource ID cannot be null!');
1578
1619
  }
1579
- const a = this.devices();
1580
- a.params({
1581
- filter: 'deviceModelId_eq_' + id
1582
- });
1620
+ const a = new APIResource(this);
1621
+ a.last += '-services';
1622
+ a.push(id, 'billing-period');
1583
1623
  return a;
1584
1624
  }
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) {
1625
+ }
1626
+
1627
+ class APIResourceUser extends APIResource {
1628
+ constructor(parent, id) {
1601
1629
  if (id == null) {
1602
1630
  throw new Error('Resource ID cannot be null!');
1603
1631
  }
1604
- return new APIResource(this).push('admin', 'device-model-criteria', id);
1605
- }
1606
- deviceSessions() {
1607
- return new APIList(this).push('admin', 'device-sessions');
1632
+ super(parent);
1633
+ if (id === 'me') {
1634
+ this.push('me');
1635
+ }
1636
+ else if (typeof id === 'number') {
1637
+ this.push('users', id);
1638
+ }
1639
+ else {
1640
+ throw new TypeError('id is not a number');
1641
+ }
1608
1642
  }
1609
- deviceSession(id) {
1610
- return new APIAdminResourceDeviceSessionStandalone(this, id);
1643
+ account() {
1644
+ return new APIUserResourceAccount(this);
1611
1645
  }
1612
1646
  deviceTime() {
1613
- return new APIAdminResourceDeviceTime(this);
1647
+ return new APIListDeviceTime(this);
1614
1648
  }
1615
1649
  deviceTimeSummary() {
1616
- return new APIList(this).push('admin', 'device-time-summary');
1650
+ return new APIList(this).push('device-time-summary');
1617
1651
  }
1618
- deviceTypes() {
1619
- return new APIList(this).push('admin', 'device-types');
1652
+ services() {
1653
+ return new APIListServices(this);
1620
1654
  }
1621
- deviceType(id) {
1622
- return new APIResource(this).push('admin', 'device-types', id);
1655
+ service(id) {
1656
+ if (id == null) {
1657
+ throw new Error('Resource ID cannot be null!');
1658
+ }
1659
+ return new APIResource(this).push('services', id);
1660
+ }
1661
+ billingPeriods() {
1662
+ return new APIList(this).push('billing-periods');
1663
+ }
1664
+ billingPeriod(id) {
1665
+ return new APIResourceBillingPeriod(this, id);
1623
1666
  }
1624
1667
  deviceGroups() {
1625
1668
  return new APIList(this).push('device-groups');
@@ -1627,157 +1670,115 @@
1627
1670
  deviceGroup(id) {
1628
1671
  return new APIResourceDeviceGroup(this, id);
1629
1672
  }
1630
- emails() {
1631
- return new APIList(this).push('admin', 'emails');
1673
+ deviceSessions() {
1674
+ return new APIList(this).push('device-sessions');
1632
1675
  }
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();
1676
+ deviceSession(id) {
1677
+ return new APIResourceDeviceSessionStandalone(this, id);
1638
1678
  }
1639
- errors() {
1640
- return new APIList(this).push('admin', 'errors');
1679
+ projects() {
1680
+ return new APIList(this).push('projects');
1681
+ }
1682
+ project(id) {
1683
+ return new APIResourceProject(this, id);
1641
1684
  }
1642
1685
  files() {
1643
- return new APIList(this).push('files');
1686
+ return new APIListFiles(this);
1644
1687
  }
1645
1688
  file(id) {
1646
1689
  return new APIResourceFile(this, id);
1647
1690
  }
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');
1691
+ runs() {
1692
+ return new APIListRuns(this);
1682
1693
  }
1683
- pools() {
1684
- return new APIList(this).push('admin', 'pools');
1694
+ availableFrameworks() {
1695
+ return new APIList(this).push('available-frameworks');
1685
1696
  }
1686
- pool(id) {
1687
- return new APIResource(this).push('admin', 'pools', id);
1697
+ resetApiKey() {
1698
+ return new APIResource(this).push('reset-api-key');
1688
1699
  }
1689
- projects() {
1690
- return new APIList(this).push('projects');
1700
+ restore() {
1701
+ return new APIResource(this).push('restore');
1691
1702
  }
1692
- project(id) {
1693
- return new APIResourceProject(this, id);
1703
+ feedback() {
1704
+ return new APIResource(this).push('feedback');
1694
1705
  }
1695
- roles() {
1696
- return new APIList(this).push('admin', 'roles');
1706
+ notifications() {
1707
+ return new APIListNotifications(this);
1697
1708
  }
1698
- runs() {
1699
- return new APIAdminListRuns(this);
1709
+ notification(id) {
1710
+ return new APIResourceNotification(this, id);
1700
1711
  }
1701
- run(id) {
1702
- return new APIAdminResourceRunStandalone(this, id);
1712
+ preferences() {
1713
+ return new APIResource(this).push('preferences');
1703
1714
  }
1704
- samples() {
1705
- return new APIList(this).push('admin', 'samples');
1715
+ uiPreferences() {
1716
+ return new APIResource(this).push('ui-preferences');
1706
1717
  }
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);
1718
+ deviceUsage() {
1719
+ return new APIList(this).push('device-usage');
1712
1720
  }
1713
- services() {
1714
- return new APIAdminListServices(this);
1721
+ statistics() {
1722
+ return new APIResource(this).push('statistics');
1715
1723
  }
1716
- service(id) {
1717
- return new APIAdminResourceService(this, id);
1724
+ deviceStatistics() {
1725
+ return new APIList(this).push('device-statistics');
1718
1726
  }
1719
- settings() {
1720
- return new APIResource(this).push('admin', 'settings');
1727
+ accessGroups() {
1728
+ return new APIList(this).push('access-groups');
1721
1729
  }
1722
- statistics() {
1723
- return new APIAdminListStatistics(this);
1730
+ accessGroup(id) {
1731
+ return new APIResourceAccessGroup(this, id);
1724
1732
  }
1725
- users() {
1726
- return new APIList(this).push('users');
1733
+ smartbearTunnel(id) {
1734
+ return new APIResource(this).push('tunnels', id);
1727
1735
  }
1728
- createUser() {
1729
- return new APIList(this).push('admin', 'users').post();
1736
+ smartbearTunnels() {
1737
+ return new APIListSmartbearTunnels(this);
1730
1738
  }
1731
- user(id) {
1732
- return new APIAdminResourceUser(this, id);
1739
+ deleteAccount() {
1740
+ return new APIResource(this).push('delete');
1733
1741
  }
1734
1742
  }
1735
1743
 
1736
- class APIResourceAccount extends APIResource {
1737
- constructor(parent, id) {
1738
- if (id == null) {
1739
- throw new Error('Resource ID cannot be null!');
1740
- }
1744
+ class APIResourceUserSession extends APIResource {
1745
+ constructor(parent) {
1741
1746
  super(parent);
1742
- this.push('accounts', id);
1747
+ this.push('user-sessions');
1743
1748
  }
1744
- concurrencyStatus() {
1745
- return new APIResource(this).push('concurrency-status');
1749
+ login(data) {
1750
+ return new APIResource(this).push('login').post().data(data);
1746
1751
  }
1747
- preferences() {
1748
- return new APIResource(this).push('preferences');
1752
+ logout() {
1753
+ return new APIResource(this).push('logout').post();
1749
1754
  }
1750
- }
1751
-
1752
- class APIResourceBroker extends APIResource {
1753
- constructor(parent) {
1754
- super(parent);
1755
- this.push('broker');
1755
+ sso(name) {
1756
+ return new APIResource(this).push(name + '-login');
1756
1757
  }
1757
- hubs() {
1758
- return new APIList(this).push('hubs');
1758
+ portalLogin() {
1759
+ return new APIResource(this).push('portal-login').post();
1759
1760
  }
1760
1761
  }
1761
1762
 
1762
- if (global.isNodeJs) {
1763
+ if (globalThis.isNodeJs) {
1763
1764
  axios__default["default"].defaults.headers.common['User-Agent'] = `Bitbar Cloud API Client for JavaScript v${version}`;
1764
1765
  }
1765
1766
  axios__default["default"].defaults.maxContentLength = 1073741824;
1766
1767
  class API {
1767
1768
  constructor(config) {
1769
+ this.config = config;
1770
+ this.axiosConfig = {};
1768
1771
  if (config == null) {
1769
1772
  throw new Error('config cannot be empty');
1770
1773
  }
1771
- this.config = config;
1772
- this.axiosConfig = {};
1773
- if (this.config.cloudUrl == null) {
1774
+ else if (this.config.cloudUrl == null) {
1774
1775
  throw new TypeError('cloudUrl cannot be empty');
1775
1776
  }
1776
1777
  else if (typeof this.config.cloudUrl !== 'string') {
1777
1778
  throw new TypeError('cloudUrl must be a string');
1778
1779
  }
1779
1780
  else if (!/^https?:\/\/.{2,}/.test(this.config.cloudUrl)) {
1780
- throw new Error("cloudUrl doesn't look like a URL");
1781
+ throw new Error(`cloudUrl doesn't look like a URL`);
1781
1782
  }
1782
1783
  this.axiosConfig.baseURL = this.config.cloudUrl.replace(/\/+$/, '') + '/api';
1783
1784
  this.config.v2 = !!this.config.v2;
@@ -1789,7 +1790,7 @@
1789
1790
  throw new TypeError('apiKey must be a string');
1790
1791
  }
1791
1792
  else if (!/^[A-Za-z0-9]{32}$/.test(this.config.apiKey)) {
1792
- throw new Error("apiKey is in the wrong format");
1793
+ throw new Error('apiKey is in the wrong format');
1793
1794
  }
1794
1795
  this.axiosConfig.auth = {
1795
1796
  username: this.config.apiKey,
@@ -1799,44 +1800,41 @@
1799
1800
  this.axiosConfig.withCredentials = config.withCredentials == null ? false : config.withCredentials;
1800
1801
  this.axios = axios__default["default"].create(this.axiosConfig);
1801
1802
  }
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);
1803
+ get baseUrl() {
1804
+ return this.axiosConfig.baseURL;
1810
1805
  }
1811
1806
  account(id) {
1812
1807
  return new APIResourceAccount(this, id);
1813
1808
  }
1814
- me() {
1815
- return this.user('me');
1816
- }
1817
1809
  admin() {
1818
1810
  return new APIAdminResource(this);
1819
1811
  }
1820
- devices() {
1821
- return new APIListDevices(this);
1812
+ broker() {
1813
+ return new APIResourceBroker(this);
1814
+ }
1815
+ clusters() {
1816
+ return new APIList(this).push('clusters');
1817
+ }
1818
+ cluster(id) {
1819
+ return new APIAdminResourceCluster(this, id);
1822
1820
  }
1823
1821
  device(id) {
1824
1822
  return new APIResourceDevice(this, id);
1825
1823
  }
1826
- deviceGroups() {
1827
- return new APIList(this).push('device-groups');
1828
- }
1829
1824
  deviceGroup(id) {
1830
1825
  return new APIResourceDeviceGroup(this, id);
1831
1826
  }
1832
- deviceSessions() {
1833
- return new APIList(this).push('device-sessions');
1827
+ deviceGroups() {
1828
+ return new APIList(this).push('device-groups');
1829
+ }
1830
+ devices() {
1831
+ return new APIListDevices(this);
1834
1832
  }
1835
1833
  deviceSession(id) {
1836
1834
  return new APIResourceDeviceSession(this, id);
1837
1835
  }
1838
- labelGroups() {
1839
- return new APIList(this).push('label-groups');
1836
+ deviceSessions() {
1837
+ return new APIList(this).push('device-sessions');
1840
1838
  }
1841
1839
  deviceStatistics() {
1842
1840
  return new APIList(this).push('device-statistics');
@@ -1844,14 +1842,56 @@
1844
1842
  enums() {
1845
1843
  return new APIResource(this).push('enums');
1846
1844
  }
1847
- licenses() {
1848
- return new APIResource(this).push('licenses');
1845
+ files() {
1846
+ return new APIList(this).push('files');
1847
+ }
1848
+ file(id) {
1849
+ return new APIResourceFile(this, id);
1850
+ }
1851
+ labelGroups() {
1852
+ return new APIList(this).push('label-groups');
1853
+ }
1854
+ labelGroup(id) {
1855
+ return new APIResourceLabelGroup(this, id);
1849
1856
  }
1850
1857
  labels() {
1851
1858
  return new APIList(this).push('labels');
1852
1859
  }
1853
- broker() {
1854
- return new APIResourceBroker(this);
1860
+ licenses() {
1861
+ return new APIResource(this).push('licenses');
1862
+ }
1863
+ license() {
1864
+ return new APIResource(this).push('license');
1865
+ }
1866
+ me() {
1867
+ return this.user('me');
1868
+ }
1869
+ projects() {
1870
+ return new APIList(this).push('projects');
1871
+ }
1872
+ project(id) {
1873
+ return new APIResourceProject(this, id);
1874
+ }
1875
+ properties() {
1876
+ return new APIListProperties(this);
1877
+ }
1878
+ property(id) {
1879
+ return new APIResource(this).push('properties', id);
1880
+ }
1881
+ run(id) {
1882
+ return new APIResourceRun(this, id);
1883
+ }
1884
+ services() {
1885
+ return new APIListServices(this);
1886
+ }
1887
+ user(id) {
1888
+ return new APIResourceUser(this, id);
1889
+ }
1890
+ users() {
1891
+ return new APIListUsers(this);
1892
+ }
1893
+ userSession() {
1894
+ return new APIResourceUserSession(this);
1855
1895
  }
1856
1896
  }
1857
1897