@obniz/obniz-now-sdk 0.1.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 (34) hide show
  1. package/README.md +8 -0
  2. package/dist/ObnizApiError.d.ts +62 -0
  3. package/dist/ObnizNow.d.ts +104 -0
  4. package/dist/ObnizNow.test.d.ts +1 -0
  5. package/dist/ObnizNowApiError.d.ts +62 -0
  6. package/dist/index.browser.mjs +3253 -0
  7. package/dist/index.browser.mjs.map +1 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +3379 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/index.mjs +3376 -0
  12. package/dist/index.mjs.map +1 -0
  13. package/dist/sdk-core/apis/AnalyticsApi.d.ts +35 -0
  14. package/dist/sdk-core/apis/ConnectionModelsApi.d.ts +89 -0
  15. package/dist/sdk-core/apis/ConnectionsApi.d.ts +61 -0
  16. package/dist/sdk-core/apis/ConvertersApi.d.ts +28 -0
  17. package/dist/sdk-core/apis/EventsApi.d.ts +49 -0
  18. package/dist/sdk-core/apis/GroupsApi.d.ts +62 -0
  19. package/dist/sdk-core/apis/InboundConnectionsApi.d.ts +47 -0
  20. package/dist/sdk-core/apis/InboundSourcesApi.d.ts +113 -0
  21. package/dist/sdk-core/apis/IntegrationsApi.d.ts +121 -0
  22. package/dist/sdk-core/apis/IntelligencesApi.d.ts +84 -0
  23. package/dist/sdk-core/apis/IssuesApi.d.ts +63 -0
  24. package/dist/sdk-core/apis/MachineApi.d.ts +142 -0
  25. package/dist/sdk-core/apis/MachinesApi.d.ts +97 -0
  26. package/dist/sdk-core/apis/NotificationsApi.d.ts +72 -0
  27. package/dist/sdk-core/apis/ReportsApi.d.ts +85 -0
  28. package/dist/sdk-core/apis/ThreadsApi.d.ts +165 -0
  29. package/dist/sdk-core/apis/UnitsApi.d.ts +151 -0
  30. package/dist/sdk-core/apis/index.d.ts +17 -0
  31. package/dist/sdk-core/index.d.ts +3 -0
  32. package/dist/sdk-core/models/index.d.ts +5368 -0
  33. package/dist/sdk-core/runtime.d.ts +181 -0
  34. package/package.json +49 -0
package/dist/index.js ADDED
@@ -0,0 +1,3379 @@
1
+ 'use strict';
2
+
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * API EN
7
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+ *
9
+ * The version of the OpenAPI document: 1.0.0
10
+ *
11
+ *
12
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
13
+ * https://openapi-generator.tech
14
+ * Do not edit the class manually.
15
+ */
16
+ const BASE_PATH = "https://api.obniz.com".replace(/\/+$/, "");
17
+ class Configuration {
18
+ constructor(configuration = {}) {
19
+ this.configuration = configuration;
20
+ }
21
+ set config(configuration) {
22
+ this.configuration = configuration;
23
+ }
24
+ get basePath() {
25
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
26
+ }
27
+ get fetchApi() {
28
+ return this.configuration.fetchApi;
29
+ }
30
+ get middleware() {
31
+ return this.configuration.middleware || [];
32
+ }
33
+ get queryParamsStringify() {
34
+ return this.configuration.queryParamsStringify || querystring;
35
+ }
36
+ get username() {
37
+ return this.configuration.username;
38
+ }
39
+ get password() {
40
+ return this.configuration.password;
41
+ }
42
+ get apiKey() {
43
+ const apiKey = this.configuration.apiKey;
44
+ if (apiKey) {
45
+ return typeof apiKey === 'function' ? apiKey : () => apiKey;
46
+ }
47
+ return undefined;
48
+ }
49
+ get accessToken() {
50
+ const accessToken = this.configuration.accessToken;
51
+ if (accessToken) {
52
+ return typeof accessToken === 'function' ? accessToken : async () => accessToken;
53
+ }
54
+ return undefined;
55
+ }
56
+ get headers() {
57
+ return this.configuration.headers;
58
+ }
59
+ get credentials() {
60
+ return this.configuration.credentials;
61
+ }
62
+ }
63
+ const DefaultConfig = new Configuration();
64
+ /**
65
+ * This is the base class for all generated API classes.
66
+ */
67
+ class BaseAPI {
68
+ constructor(configuration = DefaultConfig) {
69
+ this.configuration = configuration;
70
+ this.fetchApi = async (url, init) => {
71
+ let fetchParams = { url, init };
72
+ for (const middleware of this.middleware) {
73
+ if (middleware.pre) {
74
+ fetchParams = await middleware.pre({
75
+ fetch: this.fetchApi,
76
+ ...fetchParams,
77
+ }) || fetchParams;
78
+ }
79
+ }
80
+ let response = undefined;
81
+ try {
82
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
83
+ }
84
+ catch (e) {
85
+ for (const middleware of this.middleware) {
86
+ if (middleware.onError) {
87
+ response = await middleware.onError({
88
+ fetch: this.fetchApi,
89
+ url: fetchParams.url,
90
+ init: fetchParams.init,
91
+ error: e,
92
+ response: response ? response.clone() : undefined,
93
+ }) || response;
94
+ }
95
+ }
96
+ if (response === undefined) {
97
+ if (e instanceof Error) {
98
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
99
+ }
100
+ else {
101
+ throw e;
102
+ }
103
+ }
104
+ }
105
+ for (const middleware of this.middleware) {
106
+ if (middleware.post) {
107
+ response = await middleware.post({
108
+ fetch: this.fetchApi,
109
+ url: fetchParams.url,
110
+ init: fetchParams.init,
111
+ response: response.clone(),
112
+ }) || response;
113
+ }
114
+ }
115
+ return response;
116
+ };
117
+ this.middleware = configuration.middleware;
118
+ }
119
+ withMiddleware(...middlewares) {
120
+ const next = this.clone();
121
+ next.middleware = next.middleware.concat(...middlewares);
122
+ return next;
123
+ }
124
+ withPreMiddleware(...preMiddlewares) {
125
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
126
+ return this.withMiddleware(...middlewares);
127
+ }
128
+ withPostMiddleware(...postMiddlewares) {
129
+ const middlewares = postMiddlewares.map((post) => ({ post }));
130
+ return this.withMiddleware(...middlewares);
131
+ }
132
+ /**
133
+ * Check if the given MIME is a JSON MIME.
134
+ * JSON MIME examples:
135
+ * application/json
136
+ * application/json; charset=UTF8
137
+ * APPLICATION/JSON
138
+ * application/vnd.company+json
139
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
140
+ * @return True if the given MIME is JSON, false otherwise.
141
+ */
142
+ isJsonMime(mime) {
143
+ if (!mime) {
144
+ return false;
145
+ }
146
+ return BaseAPI.jsonRegex.test(mime);
147
+ }
148
+ async request(context, initOverrides) {
149
+ const { url, init } = await this.createFetchParams(context, initOverrides);
150
+ const response = await this.fetchApi(url, init);
151
+ if (response && (response.status >= 200 && response.status < 300)) {
152
+ return response;
153
+ }
154
+ throw new ResponseError(response, 'Response returned an error code');
155
+ }
156
+ async createFetchParams(context, initOverrides) {
157
+ let url = this.configuration.basePath + context.path;
158
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
159
+ // only add the querystring to the URL if there are query parameters.
160
+ // this is done to avoid urls ending with a "?" character which buggy webservers
161
+ // do not handle correctly sometimes.
162
+ url += '?' + this.configuration.queryParamsStringify(context.query);
163
+ }
164
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
165
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
166
+ const initOverrideFn = typeof initOverrides === "function"
167
+ ? initOverrides
168
+ : async () => initOverrides;
169
+ const initParams = {
170
+ method: context.method,
171
+ headers,
172
+ body: context.body,
173
+ credentials: this.configuration.credentials,
174
+ };
175
+ const overriddenInit = {
176
+ ...initParams,
177
+ ...(await initOverrideFn({
178
+ init: initParams,
179
+ context,
180
+ }))
181
+ };
182
+ let body;
183
+ if (isFormData(overriddenInit.body)
184
+ || (overriddenInit.body instanceof URLSearchParams)
185
+ || isBlob(overriddenInit.body)) {
186
+ body = overriddenInit.body;
187
+ }
188
+ else if (this.isJsonMime(headers['Content-Type'])) {
189
+ body = JSON.stringify(overriddenInit.body);
190
+ }
191
+ else {
192
+ body = overriddenInit.body;
193
+ }
194
+ const init = {
195
+ ...overriddenInit,
196
+ body
197
+ };
198
+ return { url, init };
199
+ }
200
+ /**
201
+ * Create a shallow clone of `this` by constructing a new instance
202
+ * and then shallow cloning data members.
203
+ */
204
+ clone() {
205
+ const constructor = this.constructor;
206
+ const next = new constructor(this.configuration);
207
+ next.middleware = this.middleware.slice();
208
+ return next;
209
+ }
210
+ }
211
+ BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
212
+ function isBlob(value) {
213
+ return typeof Blob !== 'undefined' && value instanceof Blob;
214
+ }
215
+ function isFormData(value) {
216
+ return typeof FormData !== "undefined" && value instanceof FormData;
217
+ }
218
+ class ResponseError extends Error {
219
+ constructor(response, msg) {
220
+ super(msg);
221
+ this.response = response;
222
+ this.name = "ResponseError";
223
+ }
224
+ }
225
+ class FetchError extends Error {
226
+ constructor(cause, msg) {
227
+ super(msg);
228
+ this.cause = cause;
229
+ this.name = "FetchError";
230
+ }
231
+ }
232
+ class RequiredError extends Error {
233
+ constructor(field, msg) {
234
+ super(msg);
235
+ this.field = field;
236
+ this.name = "RequiredError";
237
+ }
238
+ }
239
+ const COLLECTION_FORMATS = {
240
+ csv: ","};
241
+ function querystring(params, prefix = '') {
242
+ return Object.keys(params)
243
+ .map(key => querystringSingleKey(key, params[key], prefix))
244
+ .filter(part => part.length > 0)
245
+ .join('&');
246
+ }
247
+ function querystringSingleKey(key, value, keyPrefix = '') {
248
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
249
+ if (value instanceof Array) {
250
+ const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
251
+ .join(`&${encodeURIComponent(fullKey)}=`);
252
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
253
+ }
254
+ if (value instanceof Set) {
255
+ const valueAsArray = Array.from(value);
256
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
257
+ }
258
+ if (value instanceof Date) {
259
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
260
+ }
261
+ if (value instanceof Object) {
262
+ return querystring(value, fullKey);
263
+ }
264
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
265
+ }
266
+ function canConsumeForm(consumes) {
267
+ for (const consume of consumes) {
268
+ if ('multipart/form-data' === consume.contentType) {
269
+ return true;
270
+ }
271
+ }
272
+ return false;
273
+ }
274
+ class JSONApiResponse {
275
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
276
+ this.raw = raw;
277
+ this.transformer = transformer;
278
+ }
279
+ async value() {
280
+ return this.transformer(await this.raw.json());
281
+ }
282
+ }
283
+ class VoidApiResponse {
284
+ constructor(raw) {
285
+ this.raw = raw;
286
+ }
287
+ async value() {
288
+ return undefined;
289
+ }
290
+ }
291
+ class BlobApiResponse {
292
+ constructor(raw) {
293
+ this.raw = raw;
294
+ }
295
+ async value() {
296
+ return await this.raw.blob();
297
+ }
298
+ ;
299
+ }
300
+
301
+ /* tslint:disable */
302
+ /* eslint-disable */
303
+ /**
304
+ * API EN
305
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
306
+ *
307
+ * The version of the OpenAPI document: 1.0.0
308
+ *
309
+ *
310
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
311
+ * https://openapi-generator.tech
312
+ * Do not edit the class manually.
313
+ */
314
+ /**
315
+ *
316
+ */
317
+ class AnalyticsApi extends BaseAPI {
318
+ /**
319
+ * Executes the specified analytics model and returns calculation results. The structure of the result objects depends on the analytics model implementation. If start or end is omitted, the analytics model is executed once without interval splitting. **Authorization** - API token is required in the `Authorization` header **Permissions** - `analytics:read` permission is required
320
+ * Get analytics results for a specific model
321
+ */
322
+ async getAnalyticsResultsRaw(requestParameters, initOverrides) {
323
+ if (requestParameters['analyticsModelId'] == null) {
324
+ throw new RequiredError('analyticsModelId', 'Required parameter "analyticsModelId" was null or undefined when calling getAnalyticsResults().');
325
+ }
326
+ if (requestParameters['unitId'] == null) {
327
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling getAnalyticsResults().');
328
+ }
329
+ const queryParameters = {};
330
+ if (requestParameters['start'] != null) {
331
+ queryParameters['start'] = requestParameters['start'];
332
+ }
333
+ if (requestParameters['end'] != null) {
334
+ queryParameters['end'] = requestParameters['end'];
335
+ }
336
+ if (requestParameters['unitId'] != null) {
337
+ queryParameters['unit_id'] = requestParameters['unitId'];
338
+ }
339
+ if (requestParameters['params'] != null) {
340
+ queryParameters['params'] = requestParameters['params'];
341
+ }
342
+ const headerParameters = {};
343
+ if (this.configuration && this.configuration.apiKey) {
344
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
345
+ }
346
+ const response = await this.request({
347
+ path: `/api/1/analytics/{analytics_model_id}/results`.replace(`{${"analytics_model_id"}}`, encodeURIComponent(String(requestParameters['analyticsModelId']))),
348
+ method: 'GET',
349
+ headers: headerParameters,
350
+ query: queryParameters,
351
+ }, initOverrides);
352
+ return new JSONApiResponse(response);
353
+ }
354
+ /**
355
+ * Executes the specified analytics model and returns calculation results. The structure of the result objects depends on the analytics model implementation. If start or end is omitted, the analytics model is executed once without interval splitting. **Authorization** - API token is required in the `Authorization` header **Permissions** - `analytics:read` permission is required
356
+ * Get analytics results for a specific model
357
+ */
358
+ async getAnalyticsResults(requestParameters, initOverrides) {
359
+ const response = await this.getAnalyticsResultsRaw(requestParameters, initOverrides);
360
+ return await response.value();
361
+ }
362
+ }
363
+
364
+ /* tslint:disable */
365
+ /* eslint-disable */
366
+ /**
367
+ * API EN
368
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
369
+ *
370
+ * The version of the OpenAPI document: 1.0.0
371
+ *
372
+ *
373
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
374
+ * https://openapi-generator.tech
375
+ * Do not edit the class manually.
376
+ */
377
+ /**
378
+ *
379
+ */
380
+ class ConnectionModelsApi extends BaseAPI {
381
+ /**
382
+ * Retrieves all connection models (controllers) that are available for installation on a specific machine. This endpoint filters out models that are already installed on the machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Available controller metadata (identity, version, title, etc.) - Install configuration structure - Installation conditions and requirements - Controller type and capabilities **Filtering**: - Excludes models already installed on the machine - Only shows models where user\'s role allows installation (based on `installRole`) - Includes intelligence controllers from the account
383
+ * List available connection models for installation
384
+ */
385
+ async getAvailableConnectionModelsRaw(requestParameters, initOverrides) {
386
+ if (requestParameters['machineId'] == null) {
387
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getAvailableConnectionModels().');
388
+ }
389
+ const queryParameters = {};
390
+ const headerParameters = {};
391
+ if (this.configuration && this.configuration.apiKey) {
392
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
393
+ }
394
+ const response = await this.request({
395
+ path: `/api/1/machine/{machine_id}/connection_models/available`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
396
+ method: 'GET',
397
+ headers: headerParameters,
398
+ query: queryParameters,
399
+ }, initOverrides);
400
+ return new JSONApiResponse(response);
401
+ }
402
+ /**
403
+ * Retrieves all connection models (controllers) that are available for installation on a specific machine. This endpoint filters out models that are already installed on the machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Available controller metadata (identity, version, title, etc.) - Install configuration structure - Installation conditions and requirements - Controller type and capabilities **Filtering**: - Excludes models already installed on the machine - Only shows models where user\'s role allows installation (based on `installRole`) - Includes intelligence controllers from the account
404
+ * List available connection models for installation
405
+ */
406
+ async getAvailableConnectionModels(requestParameters, initOverrides) {
407
+ const response = await this.getAvailableConnectionModelsRaw(requestParameters, initOverrides);
408
+ return await response.value();
409
+ }
410
+ /**
411
+ * Retrieves detailed information about a specific connection model installed on a machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata - Install configuration structure - Current install configuration values - Permissions indicating whether the user can delete the model **Query parameters**: Can specify `model_version` (defaults to 1)
412
+ * Get specific connection model details
413
+ */
414
+ async getConnectionModelByNameRaw(requestParameters, initOverrides) {
415
+ if (requestParameters['machineId'] == null) {
416
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getConnectionModelByName().');
417
+ }
418
+ if (requestParameters['modelName'] == null) {
419
+ throw new RequiredError('modelName', 'Required parameter "modelName" was null or undefined when calling getConnectionModelByName().');
420
+ }
421
+ const queryParameters = {};
422
+ if (requestParameters['modelVersion'] != null) {
423
+ queryParameters['model_version'] = requestParameters['modelVersion'];
424
+ }
425
+ const headerParameters = {};
426
+ if (this.configuration && this.configuration.apiKey) {
427
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
428
+ }
429
+ const response = await this.request({
430
+ path: `/api/1/machine/{machine_id}/connection_model/{model_name}`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))).replace(`{${"model_name"}}`, encodeURIComponent(String(requestParameters['modelName']))),
431
+ method: 'GET',
432
+ headers: headerParameters,
433
+ query: queryParameters,
434
+ }, initOverrides);
435
+ return new JSONApiResponse(response);
436
+ }
437
+ /**
438
+ * Retrieves detailed information about a specific connection model installed on a machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata - Install configuration structure - Current install configuration values - Permissions indicating whether the user can delete the model **Query parameters**: Can specify `model_version` (defaults to 1)
439
+ * Get specific connection model details
440
+ */
441
+ async getConnectionModelByName(requestParameters, initOverrides) {
442
+ const response = await this.getConnectionModelByNameRaw(requestParameters, initOverrides);
443
+ return await response.value();
444
+ }
445
+ /**
446
+ * Retrieves all connection models (controllers) installed on a specific machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata (model_name, model_version, etc.) - Install configuration structure for each model - Permissions indicating whether the user can delete each model - Controller conditions for installation **Role-based filtering** - Only returns models where user\'s role ≤ model\'s `view_role_level`
447
+ * List machine\'s connection models
448
+ */
449
+ async getMachineConnectionModelsRaw(requestParameters, initOverrides) {
450
+ if (requestParameters['machineId'] == null) {
451
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getMachineConnectionModels().');
452
+ }
453
+ const queryParameters = {};
454
+ const headerParameters = {};
455
+ if (this.configuration && this.configuration.apiKey) {
456
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
457
+ }
458
+ const response = await this.request({
459
+ path: `/api/1/machine/{machine_id}/connection_models`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
460
+ method: 'GET',
461
+ headers: headerParameters,
462
+ query: queryParameters,
463
+ }, initOverrides);
464
+ return new JSONApiResponse(response);
465
+ }
466
+ /**
467
+ * Retrieves all connection models (controllers) installed on a specific machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata (model_name, model_version, etc.) - Install configuration structure for each model - Permissions indicating whether the user can delete each model - Controller conditions for installation **Role-based filtering** - Only returns models where user\'s role ≤ model\'s `view_role_level`
468
+ * List machine\'s connection models
469
+ */
470
+ async getMachineConnectionModels(requestParameters, initOverrides) {
471
+ const response = await this.getMachineConnectionModelsRaw(requestParameters, initOverrides);
472
+ return await response.value();
473
+ }
474
+ /**
475
+ * Updates the install configuration for a specific connection model on a machine. This allows changing controller settings without reinstalling the entire model. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:write` permission is required **Use case**: Modify controller parameters after installation (e.g., changing thresholds, intervals, etc.) **Query parameters**: Can specify `model_version` (defaults to 1)
476
+ * Update connection model install configuration
477
+ */
478
+ async updateConnectionModelInstallConfigRaw(requestParameters, initOverrides) {
479
+ if (requestParameters['machineId'] == null) {
480
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling updateConnectionModelInstallConfig().');
481
+ }
482
+ if (requestParameters['modelName'] == null) {
483
+ throw new RequiredError('modelName', 'Required parameter "modelName" was null or undefined when calling updateConnectionModelInstallConfig().');
484
+ }
485
+ if (requestParameters['updateInstallConfigRequest'] == null) {
486
+ throw new RequiredError('updateInstallConfigRequest', 'Required parameter "updateInstallConfigRequest" was null or undefined when calling updateConnectionModelInstallConfig().');
487
+ }
488
+ const queryParameters = {};
489
+ if (requestParameters['modelVersion'] != null) {
490
+ queryParameters['model_version'] = requestParameters['modelVersion'];
491
+ }
492
+ const headerParameters = {};
493
+ headerParameters['Content-Type'] = 'application/json';
494
+ if (this.configuration && this.configuration.apiKey) {
495
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
496
+ }
497
+ const response = await this.request({
498
+ path: `/api/1/machine/{machine_id}/connection_model/{model_name}/install_config`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))).replace(`{${"model_name"}}`, encodeURIComponent(String(requestParameters['modelName']))),
499
+ method: 'POST',
500
+ headers: headerParameters,
501
+ query: queryParameters,
502
+ body: requestParameters['updateInstallConfigRequest'],
503
+ }, initOverrides);
504
+ return new JSONApiResponse(response);
505
+ }
506
+ /**
507
+ * Updates the install configuration for a specific connection model on a machine. This allows changing controller settings without reinstalling the entire model. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:write` permission is required **Use case**: Modify controller parameters after installation (e.g., changing thresholds, intervals, etc.) **Query parameters**: Can specify `model_version` (defaults to 1)
508
+ * Update connection model install configuration
509
+ */
510
+ async updateConnectionModelInstallConfig(requestParameters, initOverrides) {
511
+ const response = await this.updateConnectionModelInstallConfigRaw(requestParameters, initOverrides);
512
+ return await response.value();
513
+ }
514
+ /**
515
+ * Performs batch operations (add, update, delete) on connection models for a specific machine. This endpoint allows you to manage all connection models in a single request. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:delete` permission is required for deletions - `connections:write` permission is required for additions and updates **Operations**: - **Add**: If model doesn\'t exist, creates a new connection model - **Update**: If model already exists, updates `view_role_level` and `install_config` - **Delete**: Models not included in the request but currently installed will be deleted **Side effects**: - Updates the machine\'s `connection_models` array
516
+ * Batch update connection models
517
+ */
518
+ async updateConnectionModelsRaw(requestParameters, initOverrides) {
519
+ if (requestParameters['machineId'] == null) {
520
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling updateConnectionModels().');
521
+ }
522
+ if (requestParameters['updateConnectionModelsRequest'] == null) {
523
+ throw new RequiredError('updateConnectionModelsRequest', 'Required parameter "updateConnectionModelsRequest" was null or undefined when calling updateConnectionModels().');
524
+ }
525
+ const queryParameters = {};
526
+ const headerParameters = {};
527
+ headerParameters['Content-Type'] = 'application/json';
528
+ if (this.configuration && this.configuration.apiKey) {
529
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
530
+ }
531
+ const response = await this.request({
532
+ path: `/api/1/machine/{machine_id}/connection_models`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
533
+ method: 'POST',
534
+ headers: headerParameters,
535
+ query: queryParameters,
536
+ body: requestParameters['updateConnectionModelsRequest'],
537
+ }, initOverrides);
538
+ return new JSONApiResponse(response);
539
+ }
540
+ /**
541
+ * Performs batch operations (add, update, delete) on connection models for a specific machine. This endpoint allows you to manage all connection models in a single request. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:delete` permission is required for deletions - `connections:write` permission is required for additions and updates **Operations**: - **Add**: If model doesn\'t exist, creates a new connection model - **Update**: If model already exists, updates `view_role_level` and `install_config` - **Delete**: Models not included in the request but currently installed will be deleted **Side effects**: - Updates the machine\'s `connection_models` array
542
+ * Batch update connection models
543
+ */
544
+ async updateConnectionModels(requestParameters, initOverrides) {
545
+ const response = await this.updateConnectionModelsRaw(requestParameters, initOverrides);
546
+ return await response.value();
547
+ }
548
+ }
549
+
550
+ /* tslint:disable */
551
+ /* eslint-disable */
552
+ /**
553
+ * API EN
554
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
555
+ *
556
+ * The version of the OpenAPI document: 1.0.0
557
+ *
558
+ *
559
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
560
+ * https://openapi-generator.tech
561
+ * Do not edit the class manually.
562
+ */
563
+ /**
564
+ *
565
+ */
566
+ class ConnectionsApi extends BaseAPI {
567
+ /**
568
+ * Creates new connection models linking a controller model to one or more machines. Can target specific machines by ID or all machines that don\'t have this model installed. Automatically handles pagination when using \'all\' to process large numbers of machines. **Authorization** - API token is required in the `Authorization` header - Only account owners can access this endpoint **Permissions** - `connections:write` permission is required
569
+ * Add model connections to machines
570
+ */
571
+ async addConnectionsRaw(requestParameters, initOverrides) {
572
+ if (requestParameters['addConnectionsRequest'] == null) {
573
+ throw new RequiredError('addConnectionsRequest', 'Required parameter "addConnectionsRequest" was null or undefined when calling addConnections().');
574
+ }
575
+ const queryParameters = {};
576
+ const headerParameters = {};
577
+ headerParameters['Content-Type'] = 'application/json';
578
+ if (this.configuration && this.configuration.apiKey) {
579
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
580
+ }
581
+ const response = await this.request({
582
+ path: `/api/1/connections/add`,
583
+ method: 'POST',
584
+ headers: headerParameters,
585
+ query: queryParameters,
586
+ body: requestParameters['addConnectionsRequest'],
587
+ }, initOverrides);
588
+ return new JSONApiResponse(response);
589
+ }
590
+ /**
591
+ * Creates new connection models linking a controller model to one or more machines. Can target specific machines by ID or all machines that don\'t have this model installed. Automatically handles pagination when using \'all\' to process large numbers of machines. **Authorization** - API token is required in the `Authorization` header - Only account owners can access this endpoint **Permissions** - `connections:write` permission is required
592
+ * Add model connections to machines
593
+ */
594
+ async addConnections(requestParameters, initOverrides) {
595
+ const response = await this.addConnectionsRaw(requestParameters, initOverrides);
596
+ return await response.value();
597
+ }
598
+ /**
599
+ * Removes a connection model linking a controller to a machine. This disconnects the specified controller model from the machine. **Authorization** - API token is required in the `Authorization` header - Only account owners can access this endpoint **Permissions** - `connections:delete` permission is required
600
+ * Delete a connection model
601
+ */
602
+ async deleteConnectionRaw(requestParameters, initOverrides) {
603
+ if (requestParameters['machineId'] == null) {
604
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling deleteConnection().');
605
+ }
606
+ if (requestParameters['modelName'] == null) {
607
+ throw new RequiredError('modelName', 'Required parameter "modelName" was null or undefined when calling deleteConnection().');
608
+ }
609
+ if (requestParameters['modelVersion'] == null) {
610
+ throw new RequiredError('modelVersion', 'Required parameter "modelVersion" was null or undefined when calling deleteConnection().');
611
+ }
612
+ const queryParameters = {};
613
+ const headerParameters = {};
614
+ if (this.configuration && this.configuration.apiKey) {
615
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
616
+ }
617
+ const response = await this.request({
618
+ path: `/api/1/connections/{machine_id}/{model_name}/{model_version}`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))).replace(`{${"model_name"}}`, encodeURIComponent(String(requestParameters['modelName']))).replace(`{${"model_version"}}`, encodeURIComponent(String(requestParameters['modelVersion']))),
619
+ method: 'DELETE',
620
+ headers: headerParameters,
621
+ query: queryParameters,
622
+ }, initOverrides);
623
+ return new VoidApiResponse(response);
624
+ }
625
+ /**
626
+ * Removes a connection model linking a controller to a machine. This disconnects the specified controller model from the machine. **Authorization** - API token is required in the `Authorization` header - Only account owners can access this endpoint **Permissions** - `connections:delete` permission is required
627
+ * Delete a connection model
628
+ */
629
+ async deleteConnection(requestParameters, initOverrides) {
630
+ await this.deleteConnectionRaw(requestParameters, initOverrides);
631
+ }
632
+ /**
633
+ * Retrieves a paginated list of connection models associated with machines in the account. Connections link controller models to machines, enabling specific functionality. Results can be filtered by controller type. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required
634
+ * Get list of connections
635
+ */
636
+ async listConnectionsRaw(requestParameters, initOverrides) {
637
+ const queryParameters = {};
638
+ if (requestParameters['limit'] != null) {
639
+ queryParameters['limit'] = requestParameters['limit'];
640
+ }
641
+ if (requestParameters['offset'] != null) {
642
+ queryParameters['offset'] = requestParameters['offset'];
643
+ }
644
+ if (requestParameters['types'] != null) {
645
+ queryParameters['types'] = requestParameters['types'];
646
+ }
647
+ const headerParameters = {};
648
+ if (this.configuration && this.configuration.apiKey) {
649
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
650
+ }
651
+ const response = await this.request({
652
+ path: `/api/1/connections/list`,
653
+ method: 'GET',
654
+ headers: headerParameters,
655
+ query: queryParameters,
656
+ }, initOverrides);
657
+ return new JSONApiResponse(response);
658
+ }
659
+ /**
660
+ * Retrieves a paginated list of connection models associated with machines in the account. Connections link controller models to machines, enabling specific functionality. Results can be filtered by controller type. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required
661
+ * Get list of connections
662
+ */
663
+ async listConnections(requestParameters = {}, initOverrides) {
664
+ const response = await this.listConnectionsRaw(requestParameters, initOverrides);
665
+ return await response.value();
666
+ }
667
+ }
668
+
669
+ /* tslint:disable */
670
+ /* eslint-disable */
671
+ /**
672
+ * API EN
673
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
674
+ *
675
+ * The version of the OpenAPI document: 1.0.0
676
+ *
677
+ *
678
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
679
+ * https://openapi-generator.tech
680
+ * Do not edit the class manually.
681
+ */
682
+ /**
683
+ *
684
+ */
685
+ class EventsApi extends BaseAPI {
686
+ /**
687
+ * Retrieves events in reverse chronological order with optional filtering and pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `events:read` permission is required
688
+ * Get events list
689
+ */
690
+ async listEventsRaw(requestParameters, initOverrides) {
691
+ const queryParameters = {};
692
+ if (requestParameters['limit'] != null) {
693
+ queryParameters['limit'] = requestParameters['limit'];
694
+ }
695
+ if (requestParameters['offset'] != null) {
696
+ queryParameters['offset'] = requestParameters['offset'];
697
+ }
698
+ if (requestParameters['start'] != null) {
699
+ queryParameters['start'] = requestParameters['start'];
700
+ }
701
+ if (requestParameters['end'] != null) {
702
+ queryParameters['end'] = requestParameters['end'];
703
+ }
704
+ if (requestParameters['machineIds'] != null) {
705
+ queryParameters['machine_ids'] = requestParameters['machineIds'].join(COLLECTION_FORMATS["csv"]);
706
+ }
707
+ if (requestParameters['groupId'] != null) {
708
+ queryParameters['group_id'] = requestParameters['groupId'];
709
+ }
710
+ if (requestParameters['minLevel'] != null) {
711
+ queryParameters['min_level'] = requestParameters['minLevel'];
712
+ }
713
+ if (requestParameters['name'] != null) {
714
+ queryParameters['name'] = requestParameters['name'];
715
+ }
716
+ const headerParameters = {};
717
+ if (this.configuration && this.configuration.apiKey) {
718
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
719
+ }
720
+ const response = await this.request({
721
+ path: `/api/1/events`,
722
+ method: 'GET',
723
+ headers: headerParameters,
724
+ query: queryParameters,
725
+ }, initOverrides);
726
+ return new JSONApiResponse(response);
727
+ }
728
+ /**
729
+ * Retrieves events in reverse chronological order with optional filtering and pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `events:read` permission is required
730
+ * Get events list
731
+ */
732
+ async listEvents(requestParameters = {}, initOverrides) {
733
+ const response = await this.listEventsRaw(requestParameters, initOverrides);
734
+ return await response.value();
735
+ }
736
+ }
737
+
738
+ /* tslint:disable */
739
+ /* eslint-disable */
740
+ /**
741
+ * API EN
742
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
743
+ *
744
+ * The version of the OpenAPI document: 1.0.0
745
+ *
746
+ *
747
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
748
+ * https://openapi-generator.tech
749
+ * Do not edit the class manually.
750
+ */
751
+ /**
752
+ *
753
+ */
754
+ class GroupsApi extends BaseAPI {
755
+ /**
756
+ * Returns group information along with machines belonging to the group. The user must belong to the same account and have sufficient permissions (owner role or explicit membership in the requested group). Pagination is applied to the machines list using limit and offset. **Authorization** - API token is required in the `Authorization` header **Permissions** - `groups:read` permission is required
757
+ * Get group information
758
+ */
759
+ async getGroupRaw(requestParameters, initOverrides) {
760
+ if (requestParameters['groupId'] == null) {
761
+ throw new RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling getGroup().');
762
+ }
763
+ const queryParameters = {};
764
+ if (requestParameters['limit'] != null) {
765
+ queryParameters['limit'] = requestParameters['limit'];
766
+ }
767
+ if (requestParameters['offset'] != null) {
768
+ queryParameters['offset'] = requestParameters['offset'];
769
+ }
770
+ const headerParameters = {};
771
+ if (this.configuration && this.configuration.apiKey) {
772
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
773
+ }
774
+ const response = await this.request({
775
+ path: `/api/1/groups/{group_id}`.replace(`{${"group_id"}}`, encodeURIComponent(String(requestParameters['groupId']))),
776
+ method: 'GET',
777
+ headers: headerParameters,
778
+ query: queryParameters,
779
+ }, initOverrides);
780
+ return new JSONApiResponse(response);
781
+ }
782
+ /**
783
+ * Returns group information along with machines belonging to the group. The user must belong to the same account and have sufficient permissions (owner role or explicit membership in the requested group). Pagination is applied to the machines list using limit and offset. **Authorization** - API token is required in the `Authorization` header **Permissions** - `groups:read` permission is required
784
+ * Get group information
785
+ */
786
+ async getGroup(requestParameters, initOverrides) {
787
+ const response = await this.getGroupRaw(requestParameters, initOverrides);
788
+ return await response.value();
789
+ }
790
+ /**
791
+ * Returns a paginated list of groups accessible to the user. Access scope depends on user role: - Owner: all groups in the account - Member: only the group the user belongs to Results can be filtered by group name using a case-insensitive partial match. **Authorization** - API token is required in the `Authorization` header **Permissions** - `groups:read` permission is required
792
+ * Get group list
793
+ */
794
+ async listGroupsRaw(requestParameters, initOverrides) {
795
+ const queryParameters = {};
796
+ if (requestParameters['searchWord'] != null) {
797
+ queryParameters['search_word'] = requestParameters['searchWord'];
798
+ }
799
+ if (requestParameters['offset'] != null) {
800
+ queryParameters['offset'] = requestParameters['offset'];
801
+ }
802
+ if (requestParameters['limit'] != null) {
803
+ queryParameters['limit'] = requestParameters['limit'];
804
+ }
805
+ const headerParameters = {};
806
+ if (this.configuration && this.configuration.apiKey) {
807
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
808
+ }
809
+ const response = await this.request({
810
+ path: `/api/1/groups`,
811
+ method: 'GET',
812
+ headers: headerParameters,
813
+ query: queryParameters,
814
+ }, initOverrides);
815
+ return new JSONApiResponse(response);
816
+ }
817
+ /**
818
+ * Returns a paginated list of groups accessible to the user. Access scope depends on user role: - Owner: all groups in the account - Member: only the group the user belongs to Results can be filtered by group name using a case-insensitive partial match. **Authorization** - API token is required in the `Authorization` header **Permissions** - `groups:read` permission is required
819
+ * Get group list
820
+ */
821
+ async listGroups(requestParameters = {}, initOverrides) {
822
+ const response = await this.listGroupsRaw(requestParameters, initOverrides);
823
+ return await response.value();
824
+ }
825
+ /**
826
+ * Replaces custom fields for the specified group. The user must be an account owner or belong to the target group. Existing custom fields are fully replaced by the provided object. **Authorization** - API token is required in the `Authorization` header **Permissions** - `groups:write` permission is required
827
+ * Update group custom fields
828
+ */
829
+ async updateGroupCustomFieldsRaw(requestParameters, initOverrides) {
830
+ if (requestParameters['groupId'] == null) {
831
+ throw new RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling updateGroupCustomFields().');
832
+ }
833
+ if (requestParameters['updateGroupCustomFieldsRequest'] == null) {
834
+ throw new RequiredError('updateGroupCustomFieldsRequest', 'Required parameter "updateGroupCustomFieldsRequest" was null or undefined when calling updateGroupCustomFields().');
835
+ }
836
+ const queryParameters = {};
837
+ const headerParameters = {};
838
+ headerParameters['Content-Type'] = 'application/json';
839
+ if (this.configuration && this.configuration.apiKey) {
840
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
841
+ }
842
+ const response = await this.request({
843
+ path: `/api/1/groups/{group_id}/custom`.replace(`{${"group_id"}}`, encodeURIComponent(String(requestParameters['groupId']))),
844
+ method: 'POST',
845
+ headers: headerParameters,
846
+ query: queryParameters,
847
+ body: requestParameters['updateGroupCustomFieldsRequest'],
848
+ }, initOverrides);
849
+ return new JSONApiResponse(response);
850
+ }
851
+ /**
852
+ * Replaces custom fields for the specified group. The user must be an account owner or belong to the target group. Existing custom fields are fully replaced by the provided object. **Authorization** - API token is required in the `Authorization` header **Permissions** - `groups:write` permission is required
853
+ * Update group custom fields
854
+ */
855
+ async updateGroupCustomFields(requestParameters, initOverrides) {
856
+ const response = await this.updateGroupCustomFieldsRaw(requestParameters, initOverrides);
857
+ return await response.value();
858
+ }
859
+ }
860
+
861
+ /* tslint:disable */
862
+ /* eslint-disable */
863
+ /**
864
+ * API EN
865
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
866
+ *
867
+ * The version of the OpenAPI document: 1.0.0
868
+ *
869
+ *
870
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
871
+ * https://openapi-generator.tech
872
+ * Do not edit the class manually.
873
+ */
874
+ /**
875
+ *
876
+ */
877
+ class InboundConnectionsApi extends BaseAPI {
878
+ /**
879
+ * Creates multiple machines and their inbound connections in a single request. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:write` permission is required **Results** Each unit in the request gets a result indicating success or error.
880
+ * Batch create inbound connections
881
+ */
882
+ async batchCreateConnectionsRaw(requestParameters, initOverrides) {
883
+ if (requestParameters['id'] == null) {
884
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling batchCreateConnections().');
885
+ }
886
+ if (requestParameters['batchCreateConnectionsRequest'] == null) {
887
+ throw new RequiredError('batchCreateConnectionsRequest', 'Required parameter "batchCreateConnectionsRequest" was null or undefined when calling batchCreateConnections().');
888
+ }
889
+ const queryParameters = {};
890
+ const headerParameters = {};
891
+ headerParameters['Content-Type'] = 'application/json';
892
+ if (this.configuration && this.configuration.apiKey) {
893
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
894
+ }
895
+ const response = await this.request({
896
+ path: `/api/1/inbound/{id}/connections/batch-create`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
897
+ method: 'POST',
898
+ headers: headerParameters,
899
+ query: queryParameters,
900
+ body: requestParameters['batchCreateConnectionsRequest'],
901
+ }, initOverrides);
902
+ return new JSONApiResponse(response);
903
+ }
904
+ /**
905
+ * Creates multiple machines and their inbound connections in a single request. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:write` permission is required **Results** Each unit in the request gets a result indicating success or error.
906
+ * Batch create inbound connections
907
+ */
908
+ async batchCreateConnections(requestParameters, initOverrides) {
909
+ const response = await this.batchCreateConnectionsRaw(requestParameters, initOverrides);
910
+ return await response.value();
911
+ }
912
+ /**
913
+ * Returns a paginated list of inbound connections for a specific inbound source. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:read` permission is required
914
+ * List inbound connections
915
+ */
916
+ async listInboundConnectionsRaw(requestParameters, initOverrides) {
917
+ if (requestParameters['id'] == null) {
918
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling listInboundConnections().');
919
+ }
920
+ const queryParameters = {};
921
+ if (requestParameters['limit'] != null) {
922
+ queryParameters['limit'] = requestParameters['limit'];
923
+ }
924
+ if (requestParameters['offset'] != null) {
925
+ queryParameters['offset'] = requestParameters['offset'];
926
+ }
927
+ const headerParameters = {};
928
+ if (this.configuration && this.configuration.apiKey) {
929
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
930
+ }
931
+ const response = await this.request({
932
+ path: `/api/1/inbound/{id}/connections/list`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
933
+ method: 'GET',
934
+ headers: headerParameters,
935
+ query: queryParameters,
936
+ }, initOverrides);
937
+ return new JSONApiResponse(response);
938
+ }
939
+ /**
940
+ * Returns a paginated list of inbound connections for a specific inbound source. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:read` permission is required
941
+ * List inbound connections
942
+ */
943
+ async listInboundConnections(requestParameters, initOverrides) {
944
+ const response = await this.listInboundConnectionsRaw(requestParameters, initOverrides);
945
+ return await response.value();
946
+ }
947
+ }
948
+
949
+ /* tslint:disable */
950
+ /* eslint-disable */
951
+ /**
952
+ * API EN
953
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
954
+ *
955
+ * The version of the OpenAPI document: 1.0.0
956
+ *
957
+ *
958
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
959
+ * https://openapi-generator.tech
960
+ * Do not edit the class manually.
961
+ */
962
+ /**
963
+ *
964
+ */
965
+ class InboundSourcesApi extends BaseAPI {
966
+ /**
967
+ * Creates a new inbound data source. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:write` permission is required **Supported Gateway Models** - SLGW_01 - Salta Gateway **Supported Formats** - application/x-www-form-urlencoded - application/json
968
+ * Create inbound source
969
+ */
970
+ async addInboundSourceRaw(requestParameters, initOverrides) {
971
+ if (requestParameters['addInboundSourceRequest'] == null) {
972
+ throw new RequiredError('addInboundSourceRequest', 'Required parameter "addInboundSourceRequest" was null or undefined when calling addInboundSource().');
973
+ }
974
+ const queryParameters = {};
975
+ const headerParameters = {};
976
+ headerParameters['Content-Type'] = 'application/json';
977
+ if (this.configuration && this.configuration.apiKey) {
978
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
979
+ }
980
+ const response = await this.request({
981
+ path: `/api/1/inbound/add-source`,
982
+ method: 'POST',
983
+ headers: headerParameters,
984
+ query: queryParameters,
985
+ body: requestParameters['addInboundSourceRequest'],
986
+ }, initOverrides);
987
+ return new JSONApiResponse(response);
988
+ }
989
+ /**
990
+ * Creates a new inbound data source. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:write` permission is required **Supported Gateway Models** - SLGW_01 - Salta Gateway **Supported Formats** - application/x-www-form-urlencoded - application/json
991
+ * Create inbound source
992
+ */
993
+ async addInboundSource(requestParameters, initOverrides) {
994
+ const response = await this.addInboundSourceRaw(requestParameters, initOverrides);
995
+ return await response.value();
996
+ }
997
+ /**
998
+ * Deletes an existing inbound source by ID. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:delete` permission is required
999
+ * Delete inbound source
1000
+ */
1001
+ async deleteInboundSourceRaw(requestParameters, initOverrides) {
1002
+ if (requestParameters['id'] == null) {
1003
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteInboundSource().');
1004
+ }
1005
+ const queryParameters = {};
1006
+ const headerParameters = {};
1007
+ if (this.configuration && this.configuration.apiKey) {
1008
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1009
+ }
1010
+ const response = await this.request({
1011
+ path: `/api/1/inbound/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1012
+ method: 'DELETE',
1013
+ headers: headerParameters,
1014
+ query: queryParameters,
1015
+ }, initOverrides);
1016
+ return new VoidApiResponse(response);
1017
+ }
1018
+ /**
1019
+ * Deletes an existing inbound source by ID. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:delete` permission is required
1020
+ * Delete inbound source
1021
+ */
1022
+ async deleteInboundSource(requestParameters, initOverrides) {
1023
+ await this.deleteInboundSourceRaw(requestParameters, initOverrides);
1024
+ }
1025
+ /**
1026
+ * Retrieves a single inbound source by ID. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:read` permission is required
1027
+ * Get inbound source
1028
+ */
1029
+ async getInboundSourceRaw(requestParameters, initOverrides) {
1030
+ if (requestParameters['id'] == null) {
1031
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling getInboundSource().');
1032
+ }
1033
+ const queryParameters = {};
1034
+ const headerParameters = {};
1035
+ if (this.configuration && this.configuration.apiKey) {
1036
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1037
+ }
1038
+ const response = await this.request({
1039
+ path: `/api/1/inbound/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1040
+ method: 'GET',
1041
+ headers: headerParameters,
1042
+ query: queryParameters,
1043
+ }, initOverrides);
1044
+ return new JSONApiResponse(response);
1045
+ }
1046
+ /**
1047
+ * Retrieves a single inbound source by ID. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:read` permission is required
1048
+ * Get inbound source
1049
+ */
1050
+ async getInboundSource(requestParameters, initOverrides) {
1051
+ const response = await this.getInboundSourceRaw(requestParameters, initOverrides);
1052
+ return await response.value();
1053
+ }
1054
+ /**
1055
+ * Returns a paginated list of inbound sources. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:read` permission is required **Filtering** - Filter by name (partial match)
1056
+ * List inbound sources
1057
+ */
1058
+ async listInboundSourcesRaw(requestParameters, initOverrides) {
1059
+ const queryParameters = {};
1060
+ if (requestParameters['name'] != null) {
1061
+ queryParameters['name'] = requestParameters['name'];
1062
+ }
1063
+ if (requestParameters['limit'] != null) {
1064
+ queryParameters['limit'] = requestParameters['limit'];
1065
+ }
1066
+ if (requestParameters['offset'] != null) {
1067
+ queryParameters['offset'] = requestParameters['offset'];
1068
+ }
1069
+ const headerParameters = {};
1070
+ if (this.configuration && this.configuration.apiKey) {
1071
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1072
+ }
1073
+ const response = await this.request({
1074
+ path: `/api/1/inbound/list`,
1075
+ method: 'GET',
1076
+ headers: headerParameters,
1077
+ query: queryParameters,
1078
+ }, initOverrides);
1079
+ return new JSONApiResponse(response);
1080
+ }
1081
+ /**
1082
+ * Returns a paginated list of inbound sources. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:read` permission is required **Filtering** - Filter by name (partial match)
1083
+ * List inbound sources
1084
+ */
1085
+ async listInboundSources(requestParameters = {}, initOverrides) {
1086
+ const response = await this.listInboundSourcesRaw(requestParameters, initOverrides);
1087
+ return await response.value();
1088
+ }
1089
+ /**
1090
+ * Receives sensor data from external gateway devices. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources_upload:write` permission is required **Rate Limiting** - Limited by account plan (InboundSourcesUpload limit) - Returns 402 when limit is exceeded **Supported Formats** - application/x-www-form-urlencoded (SLGW_01 gateway) - application/json (not yet supported - returns 501)
1091
+ * Receive sensor data
1092
+ */
1093
+ async receiveInboundDataRaw(requestParameters, initOverrides) {
1094
+ if (requestParameters['id'] == null) {
1095
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling receiveInboundData().');
1096
+ }
1097
+ const queryParameters = {};
1098
+ const headerParameters = {};
1099
+ if (this.configuration && this.configuration.apiKey) {
1100
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1101
+ }
1102
+ const response = await this.request({
1103
+ path: `/api/1/inbound/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1104
+ method: 'POST',
1105
+ headers: headerParameters,
1106
+ query: queryParameters,
1107
+ }, initOverrides);
1108
+ return new JSONApiResponse(response);
1109
+ }
1110
+ /**
1111
+ * Receives sensor data from external gateway devices. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources_upload:write` permission is required **Rate Limiting** - Limited by account plan (InboundSourcesUpload limit) - Returns 402 when limit is exceeded **Supported Formats** - application/x-www-form-urlencoded (SLGW_01 gateway) - application/json (not yet supported - returns 501)
1112
+ * Receive sensor data
1113
+ */
1114
+ async receiveInboundData(requestParameters, initOverrides) {
1115
+ const response = await this.receiveInboundDataRaw(requestParameters, initOverrides);
1116
+ switch (response.raw.status) {
1117
+ case 200:
1118
+ return await response.value();
1119
+ case 204:
1120
+ return null;
1121
+ default:
1122
+ return await response.value();
1123
+ }
1124
+ }
1125
+ /**
1126
+ * Removes a sensor ID from the inbound source\'s external_detections list. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:delete` permission is required
1127
+ * Remove sensor detection
1128
+ */
1129
+ async removeDetectionRaw(requestParameters, initOverrides) {
1130
+ if (requestParameters['id'] == null) {
1131
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling removeDetection().');
1132
+ }
1133
+ if (requestParameters['removeDetectionRequest'] == null) {
1134
+ throw new RequiredError('removeDetectionRequest', 'Required parameter "removeDetectionRequest" was null or undefined when calling removeDetection().');
1135
+ }
1136
+ const queryParameters = {};
1137
+ const headerParameters = {};
1138
+ headerParameters['Content-Type'] = 'application/json';
1139
+ if (this.configuration && this.configuration.apiKey) {
1140
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1141
+ }
1142
+ const response = await this.request({
1143
+ path: `/api/1/inbound/{id}/remove-detection`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1144
+ method: 'DELETE',
1145
+ headers: headerParameters,
1146
+ query: queryParameters,
1147
+ body: requestParameters['removeDetectionRequest'],
1148
+ }, initOverrides);
1149
+ return new VoidApiResponse(response);
1150
+ }
1151
+ /**
1152
+ * Removes a sensor ID from the inbound source\'s external_detections list. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:delete` permission is required
1153
+ * Remove sensor detection
1154
+ */
1155
+ async removeDetection(requestParameters, initOverrides) {
1156
+ await this.removeDetectionRaw(requestParameters, initOverrides);
1157
+ }
1158
+ /**
1159
+ * Partially updates an existing inbound source. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:write` permission is required **Updatable Fields** - id - account_id - name - format - gateway_id - gateway_model - created_at - updated_at
1160
+ * Update inbound source
1161
+ */
1162
+ async updateInboundSourceRaw(requestParameters, initOverrides) {
1163
+ if (requestParameters['id'] == null) {
1164
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling updateInboundSource().');
1165
+ }
1166
+ if (requestParameters['updateInboundSourceRequest'] == null) {
1167
+ throw new RequiredError('updateInboundSourceRequest', 'Required parameter "updateInboundSourceRequest" was null or undefined when calling updateInboundSource().');
1168
+ }
1169
+ const queryParameters = {};
1170
+ const headerParameters = {};
1171
+ headerParameters['Content-Type'] = 'application/json';
1172
+ if (this.configuration && this.configuration.apiKey) {
1173
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1174
+ }
1175
+ const response = await this.request({
1176
+ path: `/api/1/inbound/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1177
+ method: 'PATCH',
1178
+ headers: headerParameters,
1179
+ query: queryParameters,
1180
+ body: requestParameters['updateInboundSourceRequest'],
1181
+ }, initOverrides);
1182
+ return new VoidApiResponse(response);
1183
+ }
1184
+ /**
1185
+ * Partially updates an existing inbound source. **Authorization** - API token is required in the `Authorization` header **Permissions** - `inbound_sources:write` permission is required **Updatable Fields** - id - account_id - name - format - gateway_id - gateway_model - created_at - updated_at
1186
+ * Update inbound source
1187
+ */
1188
+ async updateInboundSource(requestParameters, initOverrides) {
1189
+ await this.updateInboundSourceRaw(requestParameters, initOverrides);
1190
+ }
1191
+ }
1192
+
1193
+ /* tslint:disable */
1194
+ /* eslint-disable */
1195
+ /**
1196
+ * API EN
1197
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1198
+ *
1199
+ * The version of the OpenAPI document: 1.0.0
1200
+ *
1201
+ *
1202
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1203
+ * https://openapi-generator.tech
1204
+ * Do not edit the class manually.
1205
+ */
1206
+ /**
1207
+ *
1208
+ */
1209
+ class IntegrationsApi extends BaseAPI {
1210
+ /**
1211
+ * Creates integrations for multiple machines in a single request. One integration is created per machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:write` permission is required
1212
+ * Add integrations for multiple machines
1213
+ */
1214
+ async addIntegrationsRaw(requestParameters, initOverrides) {
1215
+ if (requestParameters['addIntegrationsRequest'] == null) {
1216
+ throw new RequiredError('addIntegrationsRequest', 'Required parameter "addIntegrationsRequest" was null or undefined when calling addIntegrations().');
1217
+ }
1218
+ const queryParameters = {};
1219
+ const headerParameters = {};
1220
+ headerParameters['Content-Type'] = 'application/json';
1221
+ if (this.configuration && this.configuration.apiKey) {
1222
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1223
+ }
1224
+ const response = await this.request({
1225
+ path: `/api/1/integrations/add-integration`,
1226
+ method: 'POST',
1227
+ headers: headerParameters,
1228
+ query: queryParameters,
1229
+ body: requestParameters['addIntegrationsRequest'],
1230
+ }, initOverrides);
1231
+ return new JSONApiResponse(response);
1232
+ }
1233
+ /**
1234
+ * Creates integrations for multiple machines in a single request. One integration is created per machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:write` permission is required
1235
+ * Add integrations for multiple machines
1236
+ */
1237
+ async addIntegrations(requestParameters, initOverrides) {
1238
+ const response = await this.addIntegrationsRaw(requestParameters, initOverrides);
1239
+ return await response.value();
1240
+ }
1241
+ /**
1242
+ * Deletes an existing integration by ID. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:delete` permission is required
1243
+ * Delete integration
1244
+ */
1245
+ async deleteIntegrationRaw(requestParameters, initOverrides) {
1246
+ if (requestParameters['id'] == null) {
1247
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteIntegration().');
1248
+ }
1249
+ const queryParameters = {};
1250
+ const headerParameters = {};
1251
+ if (this.configuration && this.configuration.apiKey) {
1252
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1253
+ }
1254
+ const response = await this.request({
1255
+ path: `/api/1/integrations/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1256
+ method: 'DELETE',
1257
+ headers: headerParameters,
1258
+ query: queryParameters,
1259
+ }, initOverrides);
1260
+ return new VoidApiResponse(response);
1261
+ }
1262
+ /**
1263
+ * Deletes an existing integration by ID. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:delete` permission is required
1264
+ * Delete integration
1265
+ */
1266
+ async deleteIntegration(requestParameters, initOverrides) {
1267
+ await this.deleteIntegrationRaw(requestParameters, initOverrides);
1268
+ }
1269
+ /**
1270
+ * Returns detailed information about a specific integration. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:read` permission is required
1271
+ * Get integration by ID
1272
+ */
1273
+ async getIntegrationRaw(requestParameters, initOverrides) {
1274
+ if (requestParameters['id'] == null) {
1275
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling getIntegration().');
1276
+ }
1277
+ const queryParameters = {};
1278
+ const headerParameters = {};
1279
+ if (this.configuration && this.configuration.apiKey) {
1280
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1281
+ }
1282
+ const response = await this.request({
1283
+ path: `/api/1/integrations/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1284
+ method: 'GET',
1285
+ headers: headerParameters,
1286
+ query: queryParameters,
1287
+ }, initOverrides);
1288
+ return new JSONApiResponse(response);
1289
+ }
1290
+ /**
1291
+ * Returns detailed information about a specific integration. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:read` permission is required
1292
+ * Get integration by ID
1293
+ */
1294
+ async getIntegration(requestParameters, initOverrides) {
1295
+ const response = await this.getIntegrationRaw(requestParameters, initOverrides);
1296
+ return await response.value();
1297
+ }
1298
+ /**
1299
+ * Retrieves transformed machine data through an API Pull integration. This endpoint: - Validates the integration exists and is enabled - Collects machine state data since last usage - Transforms data according to integration schema **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:read` permission is required **Rate Limiting** - Rate limits are based on account plan - Returns X-RateLimit-Limit and X-RateLimit-Remaining headers **Notes** - Only works with APIPull type integrations - Returns data collected since the integration was last used (or last 30 minutes)
1300
+ * Get integration data
1301
+ */
1302
+ async getIntegrationDataRaw(requestParameters, initOverrides) {
1303
+ if (requestParameters['id'] == null) {
1304
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling getIntegrationData().');
1305
+ }
1306
+ const queryParameters = {};
1307
+ const headerParameters = {};
1308
+ if (this.configuration && this.configuration.apiKey) {
1309
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1310
+ }
1311
+ const response = await this.request({
1312
+ path: `/api/1/integrations/{id}/data`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1313
+ method: 'GET',
1314
+ headers: headerParameters,
1315
+ query: queryParameters,
1316
+ }, initOverrides);
1317
+ return new JSONApiResponse(response);
1318
+ }
1319
+ /**
1320
+ * Retrieves transformed machine data through an API Pull integration. This endpoint: - Validates the integration exists and is enabled - Collects machine state data since last usage - Transforms data according to integration schema **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:read` permission is required **Rate Limiting** - Rate limits are based on account plan - Returns X-RateLimit-Limit and X-RateLimit-Remaining headers **Notes** - Only works with APIPull type integrations - Returns data collected since the integration was last used (or last 30 minutes)
1321
+ * Get integration data
1322
+ */
1323
+ async getIntegrationData(requestParameters, initOverrides) {
1324
+ const response = await this.getIntegrationDataRaw(requestParameters, initOverrides);
1325
+ return await response.value();
1326
+ }
1327
+ /**
1328
+ * Returns a paginated list of integrations. **Authorization**: - API token is required in the `Authorization` header **Permissions** - `integrations:read` permission is required **Filtering**: - Filter by machine IDs - Filter by integration name (partial match)
1329
+ * List integrations
1330
+ */
1331
+ async listIntegrationsRaw(requestParameters, initOverrides) {
1332
+ const queryParameters = {};
1333
+ if (requestParameters['machineIds'] != null) {
1334
+ queryParameters['machine_ids'] = requestParameters['machineIds'];
1335
+ }
1336
+ if (requestParameters['name'] != null) {
1337
+ queryParameters['name'] = requestParameters['name'];
1338
+ }
1339
+ if (requestParameters['limit'] != null) {
1340
+ queryParameters['limit'] = requestParameters['limit'];
1341
+ }
1342
+ if (requestParameters['offset'] != null) {
1343
+ queryParameters['offset'] = requestParameters['offset'];
1344
+ }
1345
+ const headerParameters = {};
1346
+ if (this.configuration && this.configuration.apiKey) {
1347
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1348
+ }
1349
+ const response = await this.request({
1350
+ path: `/api/1/integrations/list`,
1351
+ method: 'GET',
1352
+ headers: headerParameters,
1353
+ query: queryParameters,
1354
+ }, initOverrides);
1355
+ return new JSONApiResponse(response);
1356
+ }
1357
+ /**
1358
+ * Returns a paginated list of integrations. **Authorization**: - API token is required in the `Authorization` header **Permissions** - `integrations:read` permission is required **Filtering**: - Filter by machine IDs - Filter by integration name (partial match)
1359
+ * List integrations
1360
+ */
1361
+ async listIntegrations(requestParameters = {}, initOverrides) {
1362
+ const response = await this.listIntegrationsRaw(requestParameters, initOverrides);
1363
+ return await response.value();
1364
+ }
1365
+ /**
1366
+ * Tests an integration schema by transforming sample or provided data. This endpoint allows you to: - Validate integration schema before creating an integration - Test data transformation with sample controller data - Provide custom data to test transformation - Preview the output format **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:write` permission is required **Supported Integration Types** - PubSub - Transforms data for Google Cloud Pub/Sub - APIPull - Transforms data for API Pull endpoints - APIPush - Transforms data for API Push endpoints
1367
+ * Test integration transformation
1368
+ */
1369
+ async transformIntegrationRaw(requestParameters, initOverrides) {
1370
+ if (requestParameters['transformIntegrationRequest'] == null) {
1371
+ throw new RequiredError('transformIntegrationRequest', 'Required parameter "transformIntegrationRequest" was null or undefined when calling transformIntegration().');
1372
+ }
1373
+ const queryParameters = {};
1374
+ const headerParameters = {};
1375
+ headerParameters['Content-Type'] = 'application/json';
1376
+ if (this.configuration && this.configuration.apiKey) {
1377
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1378
+ }
1379
+ const response = await this.request({
1380
+ path: `/api/1/integrations/transform`,
1381
+ method: 'POST',
1382
+ headers: headerParameters,
1383
+ query: queryParameters,
1384
+ body: requestParameters['transformIntegrationRequest'],
1385
+ }, initOverrides);
1386
+ return new JSONApiResponse(response);
1387
+ }
1388
+ /**
1389
+ * Tests an integration schema by transforming sample or provided data. This endpoint allows you to: - Validate integration schema before creating an integration - Test data transformation with sample controller data - Provide custom data to test transformation - Preview the output format **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:write` permission is required **Supported Integration Types** - PubSub - Transforms data for Google Cloud Pub/Sub - APIPull - Transforms data for API Pull endpoints - APIPush - Transforms data for API Push endpoints
1390
+ * Test integration transformation
1391
+ */
1392
+ async transformIntegration(requestParameters, initOverrides) {
1393
+ const response = await this.transformIntegrationRaw(requestParameters, initOverrides);
1394
+ return await response.value();
1395
+ }
1396
+ /**
1397
+ * Partially updates an existing integration. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:write` permission is required **Updatable Fields** - Any field from the Integration schema can be updated using this endpoint. - Common fields include name, enabled, schema, configuration, service, credentials.
1398
+ * Update integration
1399
+ */
1400
+ async updateIntegrationRaw(requestParameters, initOverrides) {
1401
+ if (requestParameters['id'] == null) {
1402
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling updateIntegration().');
1403
+ }
1404
+ if (requestParameters['updateIntegrationRequest'] == null) {
1405
+ throw new RequiredError('updateIntegrationRequest', 'Required parameter "updateIntegrationRequest" was null or undefined when calling updateIntegration().');
1406
+ }
1407
+ const queryParameters = {};
1408
+ const headerParameters = {};
1409
+ headerParameters['Content-Type'] = 'application/json';
1410
+ if (this.configuration && this.configuration.apiKey) {
1411
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1412
+ }
1413
+ const response = await this.request({
1414
+ path: `/api/1/integrations/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1415
+ method: 'PATCH',
1416
+ headers: headerParameters,
1417
+ query: queryParameters,
1418
+ body: requestParameters['updateIntegrationRequest'],
1419
+ }, initOverrides);
1420
+ return new VoidApiResponse(response);
1421
+ }
1422
+ /**
1423
+ * Partially updates an existing integration. **Authorization** - API token is required in the `Authorization` header **Permissions** - `integrations:write` permission is required **Updatable Fields** - Any field from the Integration schema can be updated using this endpoint. - Common fields include name, enabled, schema, configuration, service, credentials.
1424
+ * Update integration
1425
+ */
1426
+ async updateIntegration(requestParameters, initOverrides) {
1427
+ await this.updateIntegrationRaw(requestParameters, initOverrides);
1428
+ }
1429
+ }
1430
+
1431
+ /* tslint:disable */
1432
+ /* eslint-disable */
1433
+ /**
1434
+ * API EN
1435
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1436
+ *
1437
+ * The version of the OpenAPI document: 1.0.0
1438
+ *
1439
+ *
1440
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1441
+ * https://openapi-generator.tech
1442
+ * Do not edit the class manually.
1443
+ */
1444
+ /**
1445
+ *
1446
+ */
1447
+ class IntelligencesApi extends BaseAPI {
1448
+ /**
1449
+ * Creates a new intelligence controller. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:write` permission is required **Validation** - Name and version combination must be unique - Version must be a positive integer - All required fields must be provided - `type` must be a valid ControllerType - `publishment` must be a valid ControllerPublishment - `code_type` must be a valid CodeType
1450
+ * Add intelligence
1451
+ */
1452
+ async addIntelligenceRaw(requestParameters, initOverrides) {
1453
+ if (requestParameters['intelligenceInput'] == null) {
1454
+ throw new RequiredError('intelligenceInput', 'Required parameter "intelligenceInput" was null or undefined when calling addIntelligence().');
1455
+ }
1456
+ const queryParameters = {};
1457
+ const headerParameters = {};
1458
+ headerParameters['Content-Type'] = 'application/json';
1459
+ if (this.configuration && this.configuration.apiKey) {
1460
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1461
+ }
1462
+ const response = await this.request({
1463
+ path: `/api/1/intelligences/add-intelligence`,
1464
+ method: 'POST',
1465
+ headers: headerParameters,
1466
+ query: queryParameters,
1467
+ body: requestParameters['intelligenceInput'],
1468
+ }, initOverrides);
1469
+ return new JSONApiResponse(response);
1470
+ }
1471
+ /**
1472
+ * Creates a new intelligence controller. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:write` permission is required **Validation** - Name and version combination must be unique - Version must be a positive integer - All required fields must be provided - `type` must be a valid ControllerType - `publishment` must be a valid ControllerPublishment - `code_type` must be a valid CodeType
1473
+ * Add intelligence
1474
+ */
1475
+ async addIntelligence(requestParameters, initOverrides) {
1476
+ const response = await this.addIntelligenceRaw(requestParameters, initOverrides);
1477
+ return await response.value();
1478
+ }
1479
+ /**
1480
+ * Deletes an intelligence controller and its associated authority. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:delete` permission is required
1481
+ * Delete intelligence
1482
+ */
1483
+ async deleteIntelligenceRaw(requestParameters, initOverrides) {
1484
+ if (requestParameters['name'] == null) {
1485
+ throw new RequiredError('name', 'Required parameter "name" was null or undefined when calling deleteIntelligence().');
1486
+ }
1487
+ if (requestParameters['version'] == null) {
1488
+ throw new RequiredError('version', 'Required parameter "version" was null or undefined when calling deleteIntelligence().');
1489
+ }
1490
+ const queryParameters = {};
1491
+ const headerParameters = {};
1492
+ if (this.configuration && this.configuration.apiKey) {
1493
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1494
+ }
1495
+ const response = await this.request({
1496
+ path: `/api/1/intelligences/{name}/{version}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))).replace(`{${"version"}}`, encodeURIComponent(String(requestParameters['version']))),
1497
+ method: 'DELETE',
1498
+ headers: headerParameters,
1499
+ query: queryParameters,
1500
+ }, initOverrides);
1501
+ return new VoidApiResponse(response);
1502
+ }
1503
+ /**
1504
+ * Deletes an intelligence controller and its associated authority. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:delete` permission is required
1505
+ * Delete intelligence
1506
+ */
1507
+ async deleteIntelligence(requestParameters, initOverrides) {
1508
+ await this.deleteIntelligenceRaw(requestParameters, initOverrides);
1509
+ }
1510
+ /**
1511
+ * Updates an existing intelligence controller. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:write` permission is required **Validation** - Version must be a positive integer - All required fields must be provided - `type` must be a valid ControllerType - `publishment` must be a valid ControllerPublishment - `code_type` must be a valid CodeType
1512
+ * Edit intelligence
1513
+ */
1514
+ async editIntelligenceRaw(requestParameters, initOverrides) {
1515
+ if (requestParameters['name'] == null) {
1516
+ throw new RequiredError('name', 'Required parameter "name" was null or undefined when calling editIntelligence().');
1517
+ }
1518
+ if (requestParameters['version'] == null) {
1519
+ throw new RequiredError('version', 'Required parameter "version" was null or undefined when calling editIntelligence().');
1520
+ }
1521
+ if (requestParameters['intelligenceInput'] == null) {
1522
+ throw new RequiredError('intelligenceInput', 'Required parameter "intelligenceInput" was null or undefined when calling editIntelligence().');
1523
+ }
1524
+ const queryParameters = {};
1525
+ const headerParameters = {};
1526
+ headerParameters['Content-Type'] = 'application/json';
1527
+ if (this.configuration && this.configuration.apiKey) {
1528
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1529
+ }
1530
+ const response = await this.request({
1531
+ path: `/api/1/intelligences/{name}/{version}/edit`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))).replace(`{${"version"}}`, encodeURIComponent(String(requestParameters['version']))),
1532
+ method: 'POST',
1533
+ headers: headerParameters,
1534
+ query: queryParameters,
1535
+ body: requestParameters['intelligenceInput'],
1536
+ }, initOverrides);
1537
+ return new JSONApiResponse(response);
1538
+ }
1539
+ /**
1540
+ * Updates an existing intelligence controller. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:write` permission is required **Validation** - Version must be a positive integer - All required fields must be provided - `type` must be a valid ControllerType - `publishment` must be a valid ControllerPublishment - `code_type` must be a valid CodeType
1541
+ * Edit intelligence
1542
+ */
1543
+ async editIntelligence(requestParameters, initOverrides) {
1544
+ const response = await this.editIntelligenceRaw(requestParameters, initOverrides);
1545
+ return await response.value();
1546
+ }
1547
+ /**
1548
+ * Returns a list of all available intelligence controllers. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:read` permission is required **Visibility Rules** - Public intelligences are visible to all users - Private intelligences are visible only if user has authority
1549
+ * List all intelligences
1550
+ */
1551
+ async getAllIntelligencesRaw(initOverrides) {
1552
+ const queryParameters = {};
1553
+ const headerParameters = {};
1554
+ if (this.configuration && this.configuration.apiKey) {
1555
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1556
+ }
1557
+ const response = await this.request({
1558
+ path: `/api/1/intelligences/get-all`,
1559
+ method: 'GET',
1560
+ headers: headerParameters,
1561
+ query: queryParameters,
1562
+ }, initOverrides);
1563
+ return new JSONApiResponse(response);
1564
+ }
1565
+ /**
1566
+ * Returns a list of all available intelligence controllers. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:read` permission is required **Visibility Rules** - Public intelligences are visible to all users - Private intelligences are visible only if user has authority
1567
+ * List all intelligences
1568
+ */
1569
+ async getAllIntelligences(initOverrides) {
1570
+ const response = await this.getAllIntelligencesRaw(initOverrides);
1571
+ return await response.value();
1572
+ }
1573
+ /**
1574
+ * Retrieves a specific intelligence controller by name and version. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:read` permission is required **Responce** - Returns `allowedToEdit: true` if user\'s account owns the intelligence - Returns `allowedToEdit: false` otherwise
1575
+ * Get intelligence
1576
+ */
1577
+ async getIntelligenceRaw(requestParameters, initOverrides) {
1578
+ if (requestParameters['name'] == null) {
1579
+ throw new RequiredError('name', 'Required parameter "name" was null or undefined when calling getIntelligence().');
1580
+ }
1581
+ if (requestParameters['version'] == null) {
1582
+ throw new RequiredError('version', 'Required parameter "version" was null or undefined when calling getIntelligence().');
1583
+ }
1584
+ const queryParameters = {};
1585
+ const headerParameters = {};
1586
+ if (this.configuration && this.configuration.apiKey) {
1587
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1588
+ }
1589
+ const response = await this.request({
1590
+ path: `/api/1/intelligences/{name}/{version}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))).replace(`{${"version"}}`, encodeURIComponent(String(requestParameters['version']))),
1591
+ method: 'GET',
1592
+ headers: headerParameters,
1593
+ query: queryParameters,
1594
+ }, initOverrides);
1595
+ return new JSONApiResponse(response);
1596
+ }
1597
+ /**
1598
+ * Retrieves a specific intelligence controller by name and version. **Authorization** - API token is required in the `Authorization` header **Permissions** - `intelligences:read` permission is required **Responce** - Returns `allowedToEdit: true` if user\'s account owns the intelligence - Returns `allowedToEdit: false` otherwise
1599
+ * Get intelligence
1600
+ */
1601
+ async getIntelligence(requestParameters, initOverrides) {
1602
+ const response = await this.getIntelligenceRaw(requestParameters, initOverrides);
1603
+ return await response.value();
1604
+ }
1605
+ }
1606
+
1607
+ /* tslint:disable */
1608
+ /* eslint-disable */
1609
+ /**
1610
+ * API EN
1611
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1612
+ *
1613
+ * The version of the OpenAPI document: 1.0.0
1614
+ *
1615
+ *
1616
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1617
+ * https://openapi-generator.tech
1618
+ * Do not edit the class manually.
1619
+ */
1620
+ /**
1621
+ *
1622
+ */
1623
+ class IssuesApi extends BaseAPI {
1624
+ /**
1625
+ * Marks an issue as closed by setting the closed_at timestamp **Authorization** - API token is required in the `Authorization` header **Permissions** - `issues:write` permission is required
1626
+ * Close an issue
1627
+ */
1628
+ async closeIssueRaw(requestParameters, initOverrides) {
1629
+ if (requestParameters['id'] == null) {
1630
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling closeIssue().');
1631
+ }
1632
+ const queryParameters = {};
1633
+ const headerParameters = {};
1634
+ if (this.configuration && this.configuration.apiKey) {
1635
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1636
+ }
1637
+ const response = await this.request({
1638
+ path: `/api/1/issues/{id}/close`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
1639
+ method: 'POST',
1640
+ headers: headerParameters,
1641
+ query: queryParameters,
1642
+ }, initOverrides);
1643
+ return new JSONApiResponse(response);
1644
+ }
1645
+ /**
1646
+ * Marks an issue as closed by setting the closed_at timestamp **Authorization** - API token is required in the `Authorization` header **Permissions** - `issues:write` permission is required
1647
+ * Close an issue
1648
+ */
1649
+ async closeIssue(requestParameters, initOverrides) {
1650
+ const response = await this.closeIssueRaw(requestParameters, initOverrides);
1651
+ return await response.value();
1652
+ }
1653
+ /**
1654
+ * Retrieves issues associated with the account and group with optional filtering and pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `issues:read` permission is required
1655
+ * Get issues list
1656
+ */
1657
+ async listIssuesRaw(requestParameters, initOverrides) {
1658
+ const queryParameters = {};
1659
+ if (requestParameters['limit'] != null) {
1660
+ queryParameters['limit'] = requestParameters['limit'];
1661
+ }
1662
+ if (requestParameters['offset'] != null) {
1663
+ queryParameters['offset'] = requestParameters['offset'];
1664
+ }
1665
+ if (requestParameters['searchFilter'] != null) {
1666
+ queryParameters['search_filter'] = requestParameters['searchFilter'];
1667
+ }
1668
+ if (requestParameters['searchWord'] != null) {
1669
+ queryParameters['search_word'] = requestParameters['searchWord'];
1670
+ }
1671
+ if (requestParameters['isOpen'] != null) {
1672
+ queryParameters['is_open'] = requestParameters['isOpen'];
1673
+ }
1674
+ const headerParameters = {};
1675
+ if (this.configuration && this.configuration.apiKey) {
1676
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1677
+ }
1678
+ const response = await this.request({
1679
+ path: `/api/1/issues`,
1680
+ method: 'GET',
1681
+ headers: headerParameters,
1682
+ query: queryParameters,
1683
+ }, initOverrides);
1684
+ return new JSONApiResponse(response);
1685
+ }
1686
+ /**
1687
+ * Retrieves issues associated with the account and group with optional filtering and pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `issues:read` permission is required
1688
+ * Get issues list
1689
+ */
1690
+ async listIssues(requestParameters = {}, initOverrides) {
1691
+ const response = await this.listIssuesRaw(requestParameters, initOverrides);
1692
+ return await response.value();
1693
+ }
1694
+ }
1695
+
1696
+ /* tslint:disable */
1697
+ /* eslint-disable */
1698
+ /**
1699
+ * API EN
1700
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1701
+ *
1702
+ * The version of the OpenAPI document: 1.0.0
1703
+ *
1704
+ *
1705
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1706
+ * https://openapi-generator.tech
1707
+ * Do not edit the class manually.
1708
+ */
1709
+ /**
1710
+ *
1711
+ */
1712
+ class MachineApi extends BaseAPI {
1713
+ /**
1714
+ * Permanently deletes a machine and all its associated data. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:delete` permission is required **Side effects**: - Deletes the machine from the database - Cascades deletion to related records (connections, events, etc.) **Warning**: This operation is irreversible!
1715
+ * Delete a machine
1716
+ */
1717
+ async deleteMachineRaw(requestParameters, initOverrides) {
1718
+ if (requestParameters['machineId'] == null) {
1719
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling deleteMachine().');
1720
+ }
1721
+ const queryParameters = {};
1722
+ const headerParameters = {};
1723
+ if (this.configuration && this.configuration.apiKey) {
1724
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1725
+ }
1726
+ const response = await this.request({
1727
+ path: `/api/1/machine/{machine_id}`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1728
+ method: 'DELETE',
1729
+ headers: headerParameters,
1730
+ query: queryParameters,
1731
+ }, initOverrides);
1732
+ return new JSONApiResponse(response);
1733
+ }
1734
+ /**
1735
+ * Permanently deletes a machine and all its associated data. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:delete` permission is required **Side effects**: - Deletes the machine from the database - Cascades deletion to related records (connections, events, etc.) **Warning**: This operation is irreversible!
1736
+ * Delete a machine
1737
+ */
1738
+ async deleteMachine(requestParameters, initOverrides) {
1739
+ const response = await this.deleteMachineRaw(requestParameters, initOverrides);
1740
+ return await response.value();
1741
+ }
1742
+ /**
1743
+ * Retrieves all connection models (controllers) that are available for installation on a specific machine. This endpoint filters out models that are already installed on the machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Available controller metadata (identity, version, title, etc.) - Install configuration structure - Installation conditions and requirements - Controller type and capabilities **Filtering**: - Excludes models already installed on the machine - Only shows models where user\'s role allows installation (based on `installRole`) - Includes intelligence controllers from the account
1744
+ * List available connection models for installation
1745
+ */
1746
+ async getAvailableConnectionModelsRaw(requestParameters, initOverrides) {
1747
+ if (requestParameters['machineId'] == null) {
1748
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getAvailableConnectionModels().');
1749
+ }
1750
+ const queryParameters = {};
1751
+ const headerParameters = {};
1752
+ if (this.configuration && this.configuration.apiKey) {
1753
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1754
+ }
1755
+ const response = await this.request({
1756
+ path: `/api/1/machine/{machine_id}/connection_models/available`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1757
+ method: 'GET',
1758
+ headers: headerParameters,
1759
+ query: queryParameters,
1760
+ }, initOverrides);
1761
+ return new JSONApiResponse(response);
1762
+ }
1763
+ /**
1764
+ * Retrieves all connection models (controllers) that are available for installation on a specific machine. This endpoint filters out models that are already installed on the machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Available controller metadata (identity, version, title, etc.) - Install configuration structure - Installation conditions and requirements - Controller type and capabilities **Filtering**: - Excludes models already installed on the machine - Only shows models where user\'s role allows installation (based on `installRole`) - Includes intelligence controllers from the account
1765
+ * List available connection models for installation
1766
+ */
1767
+ async getAvailableConnectionModels(requestParameters, initOverrides) {
1768
+ const response = await this.getAvailableConnectionModelsRaw(requestParameters, initOverrides);
1769
+ return await response.value();
1770
+ }
1771
+ /**
1772
+ * Retrieves detailed information about a specific connection model installed on a machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata - Install configuration structure - Current install configuration values - Permissions indicating whether the user can delete the model **Query parameters**: Can specify `model_version` (defaults to 1)
1773
+ * Get specific connection model details
1774
+ */
1775
+ async getConnectionModelByNameRaw(requestParameters, initOverrides) {
1776
+ if (requestParameters['machineId'] == null) {
1777
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getConnectionModelByName().');
1778
+ }
1779
+ if (requestParameters['modelName'] == null) {
1780
+ throw new RequiredError('modelName', 'Required parameter "modelName" was null or undefined when calling getConnectionModelByName().');
1781
+ }
1782
+ const queryParameters = {};
1783
+ if (requestParameters['modelVersion'] != null) {
1784
+ queryParameters['model_version'] = requestParameters['modelVersion'];
1785
+ }
1786
+ const headerParameters = {};
1787
+ if (this.configuration && this.configuration.apiKey) {
1788
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1789
+ }
1790
+ const response = await this.request({
1791
+ path: `/api/1/machine/{machine_id}/connection_model/{model_name}`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))).replace(`{${"model_name"}}`, encodeURIComponent(String(requestParameters['modelName']))),
1792
+ method: 'GET',
1793
+ headers: headerParameters,
1794
+ query: queryParameters,
1795
+ }, initOverrides);
1796
+ return new JSONApiResponse(response);
1797
+ }
1798
+ /**
1799
+ * Retrieves detailed information about a specific connection model installed on a machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata - Install configuration structure - Current install configuration values - Permissions indicating whether the user can delete the model **Query parameters**: Can specify `model_version` (defaults to 1)
1800
+ * Get specific connection model details
1801
+ */
1802
+ async getConnectionModelByName(requestParameters, initOverrides) {
1803
+ const response = await this.getConnectionModelByNameRaw(requestParameters, initOverrides);
1804
+ return await response.value();
1805
+ }
1806
+ /**
1807
+ * Retrieves detailed information about a specific machine, including its current state. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:read` permission is required **Response includes**: - Machine metadata (name, id, connection models, etc.) - Current machine state (`machine_stat`) - key-value pairs of the latest state data
1808
+ * Get machine details
1809
+ */
1810
+ async getMachineRaw(requestParameters, initOverrides) {
1811
+ if (requestParameters['machineId'] == null) {
1812
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getMachine().');
1813
+ }
1814
+ const queryParameters = {};
1815
+ const headerParameters = {};
1816
+ if (this.configuration && this.configuration.apiKey) {
1817
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1818
+ }
1819
+ const response = await this.request({
1820
+ path: `/api/1/machine/{machine_id}`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1821
+ method: 'GET',
1822
+ headers: headerParameters,
1823
+ query: queryParameters,
1824
+ }, initOverrides);
1825
+ return new JSONApiResponse(response);
1826
+ }
1827
+ /**
1828
+ * Retrieves detailed information about a specific machine, including its current state. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:read` permission is required **Response includes**: - Machine metadata (name, id, connection models, etc.) - Current machine state (`machine_stat`) - key-value pairs of the latest state data
1829
+ * Get machine details
1830
+ */
1831
+ async getMachine(requestParameters, initOverrides) {
1832
+ const response = await this.getMachineRaw(requestParameters, initOverrides);
1833
+ return await response.value();
1834
+ }
1835
+ /**
1836
+ * Retrieves all connection models (controllers) installed on a specific machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata (model_name, model_version, etc.) - Install configuration structure for each model - Permissions indicating whether the user can delete each model - Controller conditions for installation **Role-based filtering** - Only returns models where user\'s role ≤ model\'s `view_role_level`
1837
+ * List machine\'s connection models
1838
+ */
1839
+ async getMachineConnectionModelsRaw(requestParameters, initOverrides) {
1840
+ if (requestParameters['machineId'] == null) {
1841
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getMachineConnectionModels().');
1842
+ }
1843
+ const queryParameters = {};
1844
+ const headerParameters = {};
1845
+ if (this.configuration && this.configuration.apiKey) {
1846
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1847
+ }
1848
+ const response = await this.request({
1849
+ path: `/api/1/machine/{machine_id}/connection_models`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1850
+ method: 'GET',
1851
+ headers: headerParameters,
1852
+ query: queryParameters,
1853
+ }, initOverrides);
1854
+ return new JSONApiResponse(response);
1855
+ }
1856
+ /**
1857
+ * Retrieves all connection models (controllers) installed on a specific machine. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:read` permission is required **Response includes**: - Connection model metadata (model_name, model_version, etc.) - Install configuration structure for each model - Permissions indicating whether the user can delete each model - Controller conditions for installation **Role-based filtering** - Only returns models where user\'s role ≤ model\'s `view_role_level`
1858
+ * List machine\'s connection models
1859
+ */
1860
+ async getMachineConnectionModels(requestParameters, initOverrides) {
1861
+ const response = await this.getMachineConnectionModelsRaw(requestParameters, initOverrides);
1862
+ return await response.value();
1863
+ }
1864
+ /**
1865
+ * Retrieves a list of groups that the specified machine is assigned to. **Authorization** - API token is required in the `Authorization` header - User must have access to the account that owns the machine **Permissions** - `machines:read` permission is required **Response includes**: - Machine ID - List of groups (id and name) that the machine belongs to
1866
+ * Get machine groups
1867
+ */
1868
+ async getMachineGroupsRaw(requestParameters, initOverrides) {
1869
+ if (requestParameters['machineId'] == null) {
1870
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling getMachineGroups().');
1871
+ }
1872
+ const queryParameters = {};
1873
+ const headerParameters = {};
1874
+ if (this.configuration && this.configuration.apiKey) {
1875
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1876
+ }
1877
+ const response = await this.request({
1878
+ path: `/api/1/machine/{machine_id}/groups`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1879
+ method: 'GET',
1880
+ headers: headerParameters,
1881
+ query: queryParameters,
1882
+ }, initOverrides);
1883
+ return new JSONApiResponse(response);
1884
+ }
1885
+ /**
1886
+ * Retrieves a list of groups that the specified machine is assigned to. **Authorization** - API token is required in the `Authorization` header - User must have access to the account that owns the machine **Permissions** - `machines:read` permission is required **Response includes**: - Machine ID - List of groups (id and name) that the machine belongs to
1887
+ * Get machine groups
1888
+ */
1889
+ async getMachineGroups(requestParameters, initOverrides) {
1890
+ const response = await this.getMachineGroupsRaw(requestParameters, initOverrides);
1891
+ return await response.value();
1892
+ }
1893
+ /**
1894
+ * Updates the install configuration for a specific connection model on a machine. This allows changing controller settings without reinstalling the entire model. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:write` permission is required **Use case**: Modify controller parameters after installation (e.g., changing thresholds, intervals, etc.) **Query parameters**: Can specify `model_version` (defaults to 1)
1895
+ * Update connection model install configuration
1896
+ */
1897
+ async updateConnectionModelInstallConfigRaw(requestParameters, initOverrides) {
1898
+ if (requestParameters['machineId'] == null) {
1899
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling updateConnectionModelInstallConfig().');
1900
+ }
1901
+ if (requestParameters['modelName'] == null) {
1902
+ throw new RequiredError('modelName', 'Required parameter "modelName" was null or undefined when calling updateConnectionModelInstallConfig().');
1903
+ }
1904
+ if (requestParameters['updateInstallConfigRequest'] == null) {
1905
+ throw new RequiredError('updateInstallConfigRequest', 'Required parameter "updateInstallConfigRequest" was null or undefined when calling updateConnectionModelInstallConfig().');
1906
+ }
1907
+ const queryParameters = {};
1908
+ if (requestParameters['modelVersion'] != null) {
1909
+ queryParameters['model_version'] = requestParameters['modelVersion'];
1910
+ }
1911
+ const headerParameters = {};
1912
+ headerParameters['Content-Type'] = 'application/json';
1913
+ if (this.configuration && this.configuration.apiKey) {
1914
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1915
+ }
1916
+ const response = await this.request({
1917
+ path: `/api/1/machine/{machine_id}/connection_model/{model_name}/install_config`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))).replace(`{${"model_name"}}`, encodeURIComponent(String(requestParameters['modelName']))),
1918
+ method: 'POST',
1919
+ headers: headerParameters,
1920
+ query: queryParameters,
1921
+ body: requestParameters['updateInstallConfigRequest'],
1922
+ }, initOverrides);
1923
+ return new JSONApiResponse(response);
1924
+ }
1925
+ /**
1926
+ * Updates the install configuration for a specific connection model on a machine. This allows changing controller settings without reinstalling the entire model. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:write` permission is required **Use case**: Modify controller parameters after installation (e.g., changing thresholds, intervals, etc.) **Query parameters**: Can specify `model_version` (defaults to 1)
1927
+ * Update connection model install configuration
1928
+ */
1929
+ async updateConnectionModelInstallConfig(requestParameters, initOverrides) {
1930
+ const response = await this.updateConnectionModelInstallConfigRaw(requestParameters, initOverrides);
1931
+ return await response.value();
1932
+ }
1933
+ /**
1934
+ * Performs batch operations (add, update, delete) on connection models for a specific machine. This endpoint allows you to manage all connection models in a single request. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:delete` permission is required for deletions - `connections:write` permission is required for additions and updates **Operations**: - **Add**: If model doesn\'t exist, creates a new connection model - **Update**: If model already exists, updates `view_role_level` and `install_config` - **Delete**: Models not included in the request but currently installed will be deleted **Side effects**: - Updates the machine\'s `connection_models` array
1935
+ * Batch update connection models
1936
+ */
1937
+ async updateConnectionModelsRaw(requestParameters, initOverrides) {
1938
+ if (requestParameters['machineId'] == null) {
1939
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling updateConnectionModels().');
1940
+ }
1941
+ if (requestParameters['updateConnectionModelsRequest'] == null) {
1942
+ throw new RequiredError('updateConnectionModelsRequest', 'Required parameter "updateConnectionModelsRequest" was null or undefined when calling updateConnectionModels().');
1943
+ }
1944
+ const queryParameters = {};
1945
+ const headerParameters = {};
1946
+ headerParameters['Content-Type'] = 'application/json';
1947
+ if (this.configuration && this.configuration.apiKey) {
1948
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1949
+ }
1950
+ const response = await this.request({
1951
+ path: `/api/1/machine/{machine_id}/connection_models`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1952
+ method: 'POST',
1953
+ headers: headerParameters,
1954
+ query: queryParameters,
1955
+ body: requestParameters['updateConnectionModelsRequest'],
1956
+ }, initOverrides);
1957
+ return new JSONApiResponse(response);
1958
+ }
1959
+ /**
1960
+ * Performs batch operations (add, update, delete) on connection models for a specific machine. This endpoint allows you to manage all connection models in a single request. **Authorization** - API token is required in the `Authorization` header **Permissions** - `connections:delete` permission is required for deletions - `connections:write` permission is required for additions and updates **Operations**: - **Add**: If model doesn\'t exist, creates a new connection model - **Update**: If model already exists, updates `view_role_level` and `install_config` - **Delete**: Models not included in the request but currently installed will be deleted **Side effects**: - Updates the machine\'s `connection_models` array
1961
+ * Batch update connection models
1962
+ */
1963
+ async updateConnectionModels(requestParameters, initOverrides) {
1964
+ const response = await this.updateConnectionModelsRaw(requestParameters, initOverrides);
1965
+ return await response.value();
1966
+ }
1967
+ /**
1968
+ * Updates the public visibility status of a machine. When a machine is public, its data can be accessed without authentication through public endpoints. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required **Side effects** - Updates `is_public` flag on the machine
1969
+ * Update machine public visibility
1970
+ */
1971
+ async updateMachinePublicRaw(requestParameters, initOverrides) {
1972
+ if (requestParameters['machineId'] == null) {
1973
+ throw new RequiredError('machineId', 'Required parameter "machineId" was null or undefined when calling updateMachinePublic().');
1974
+ }
1975
+ if (requestParameters['updateMachinePublicRequest'] == null) {
1976
+ throw new RequiredError('updateMachinePublicRequest', 'Required parameter "updateMachinePublicRequest" was null or undefined when calling updateMachinePublic().');
1977
+ }
1978
+ const queryParameters = {};
1979
+ const headerParameters = {};
1980
+ headerParameters['Content-Type'] = 'application/json';
1981
+ if (this.configuration && this.configuration.apiKey) {
1982
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
1983
+ }
1984
+ const response = await this.request({
1985
+ path: `/api/1/machine/{machine_id}/public`.replace(`{${"machine_id"}}`, encodeURIComponent(String(requestParameters['machineId']))),
1986
+ method: 'POST',
1987
+ headers: headerParameters,
1988
+ query: queryParameters,
1989
+ body: requestParameters['updateMachinePublicRequest'],
1990
+ }, initOverrides);
1991
+ return new JSONApiResponse(response);
1992
+ }
1993
+ /**
1994
+ * Updates the public visibility status of a machine. When a machine is public, its data can be accessed without authentication through public endpoints. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required **Side effects** - Updates `is_public` flag on the machine
1995
+ * Update machine public visibility
1996
+ */
1997
+ async updateMachinePublic(requestParameters, initOverrides) {
1998
+ const response = await this.updateMachinePublicRaw(requestParameters, initOverrides);
1999
+ return await response.value();
2000
+ }
2001
+ }
2002
+
2003
+ /* tslint:disable */
2004
+ /* eslint-disable */
2005
+ /**
2006
+ * API EN
2007
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2008
+ *
2009
+ * The version of the OpenAPI document: 1.0.0
2010
+ *
2011
+ *
2012
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2013
+ * https://openapi-generator.tech
2014
+ * Do not edit the class manually.
2015
+ */
2016
+ /**
2017
+ *
2018
+ */
2019
+ class MachinesApi extends BaseAPI {
2020
+ /**
2021
+ * Creates a new machine for a Bluetooth Low Energy (BLE) device. This operation performs the following steps: - Creates a new machine within the account - Optionally installs a controller based on the specified `parts` value - Assigns the machine to one or more groups - Creates a BLE converter linking the device address to the machine **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required **Notes** - If the specified `parts` value does not have a corresponding controller, the machine is created without installing a controller - The BLE address must be unique within the account
2022
+ * Add a BLE device as a machine
2023
+ */
2024
+ async addBleMachineRaw(requestParameters, initOverrides) {
2025
+ if (requestParameters['addBleMachineRequest'] == null) {
2026
+ throw new RequiredError('addBleMachineRequest', 'Required parameter "addBleMachineRequest" was null or undefined when calling addBleMachine().');
2027
+ }
2028
+ const queryParameters = {};
2029
+ const headerParameters = {};
2030
+ headerParameters['Content-Type'] = 'application/json';
2031
+ if (this.configuration && this.configuration.apiKey) {
2032
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2033
+ }
2034
+ const response = await this.request({
2035
+ path: `/api/1/machines/add/ble`,
2036
+ method: 'POST',
2037
+ headers: headerParameters,
2038
+ query: queryParameters,
2039
+ body: requestParameters['addBleMachineRequest'],
2040
+ }, initOverrides);
2041
+ return new JSONApiResponse(response);
2042
+ }
2043
+ /**
2044
+ * Creates a new machine for a Bluetooth Low Energy (BLE) device. This operation performs the following steps: - Creates a new machine within the account - Optionally installs a controller based on the specified `parts` value - Assigns the machine to one or more groups - Creates a BLE converter linking the device address to the machine **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required **Notes** - If the specified `parts` value does not have a corresponding controller, the machine is created without installing a controller - The BLE address must be unique within the account
2045
+ * Add a BLE device as a machine
2046
+ */
2047
+ async addBleMachine(requestParameters, initOverrides) {
2048
+ const response = await this.addBleMachineRaw(requestParameters, initOverrides);
2049
+ return await response.value();
2050
+ }
2051
+ /**
2052
+ * Registers an obniz device and creates a new machine linked to it. Checks device availability, registers it if needed, sets up configuration, and installs the app. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required
2053
+ * Add an obniz device as a machine
2054
+ */
2055
+ async addMachineRaw(requestParameters, initOverrides) {
2056
+ if (requestParameters['addMachineRequest'] == null) {
2057
+ throw new RequiredError('addMachineRequest', 'Required parameter "addMachineRequest" was null or undefined when calling addMachine().');
2058
+ }
2059
+ const queryParameters = {};
2060
+ const headerParameters = {};
2061
+ headerParameters['Content-Type'] = 'application/json';
2062
+ if (this.configuration && this.configuration.apiKey) {
2063
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2064
+ }
2065
+ const response = await this.request({
2066
+ path: `/api/1/machines/add`,
2067
+ method: 'POST',
2068
+ headers: headerParameters,
2069
+ query: queryParameters,
2070
+ body: requestParameters['addMachineRequest'],
2071
+ }, initOverrides);
2072
+ return new JSONApiResponse(response);
2073
+ }
2074
+ /**
2075
+ * Registers an obniz device and creates a new machine linked to it. Checks device availability, registers it if needed, sets up configuration, and installs the app. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required
2076
+ * Add an obniz device as a machine
2077
+ */
2078
+ async addMachine(requestParameters, initOverrides) {
2079
+ const response = await this.addMachineRaw(requestParameters, initOverrides);
2080
+ return await response.value();
2081
+ }
2082
+ /**
2083
+ * Retrieves all machines in the account that don\'t have a specified model/version installed. Used to find machines where a model can be added. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:read` permission is required
2084
+ * Get machines without a specific model
2085
+ */
2086
+ async getAvailableMachinesForModelRaw(requestParameters, initOverrides) {
2087
+ if (requestParameters['modelName'] == null) {
2088
+ throw new RequiredError('modelName', 'Required parameter "modelName" was null or undefined when calling getAvailableMachinesForModel().');
2089
+ }
2090
+ if (requestParameters['modelVersion'] == null) {
2091
+ throw new RequiredError('modelVersion', 'Required parameter "modelVersion" was null or undefined when calling getAvailableMachinesForModel().');
2092
+ }
2093
+ const queryParameters = {};
2094
+ if (requestParameters['modelName'] != null) {
2095
+ queryParameters['model_name'] = requestParameters['modelName'];
2096
+ }
2097
+ if (requestParameters['modelVersion'] != null) {
2098
+ queryParameters['model_version'] = requestParameters['modelVersion'];
2099
+ }
2100
+ const headerParameters = {};
2101
+ if (this.configuration && this.configuration.apiKey) {
2102
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2103
+ }
2104
+ const response = await this.request({
2105
+ path: `/api/1/machines/available-for-model`,
2106
+ method: 'GET',
2107
+ headers: headerParameters,
2108
+ query: queryParameters,
2109
+ }, initOverrides);
2110
+ return new JSONApiResponse(response);
2111
+ }
2112
+ /**
2113
+ * Retrieves all machines in the account that don\'t have a specified model/version installed. Used to find machines where a model can be added. **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:read` permission is required
2114
+ * Get machines without a specific model
2115
+ */
2116
+ async getAvailableMachinesForModel(requestParameters, initOverrides) {
2117
+ const response = await this.getAvailableMachinesForModelRaw(requestParameters, initOverrides);
2118
+ return await response.value();
2119
+ }
2120
+ /**
2121
+ * Retrieves machines within the account with optional filtering by name, obniz ID, group, or state conditions **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:read` permission is required
2122
+ * Get machines list
2123
+ */
2124
+ async listMachinesRaw(requestParameters, initOverrides) {
2125
+ const queryParameters = {};
2126
+ if (requestParameters['limit'] != null) {
2127
+ queryParameters['limit'] = requestParameters['limit'];
2128
+ }
2129
+ if (requestParameters['offset'] != null) {
2130
+ queryParameters['offset'] = requestParameters['offset'];
2131
+ }
2132
+ if (requestParameters['searchFilter'] != null) {
2133
+ queryParameters['search_filter'] = requestParameters['searchFilter'];
2134
+ }
2135
+ if (requestParameters['searchWord'] != null) {
2136
+ queryParameters['search_word'] = requestParameters['searchWord'];
2137
+ }
2138
+ if (requestParameters['states'] != null) {
2139
+ queryParameters['states'] = requestParameters['states'];
2140
+ }
2141
+ const headerParameters = {};
2142
+ if (this.configuration && this.configuration.apiKey) {
2143
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2144
+ }
2145
+ const response = await this.request({
2146
+ path: `/api/1/machines`,
2147
+ method: 'GET',
2148
+ headers: headerParameters,
2149
+ query: queryParameters,
2150
+ }, initOverrides);
2151
+ return new JSONApiResponse(response);
2152
+ }
2153
+ /**
2154
+ * Retrieves machines within the account with optional filtering by name, obniz ID, group, or state conditions **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:read` permission is required
2155
+ * Get machines list
2156
+ */
2157
+ async listMachines(requestParameters = {}, initOverrides) {
2158
+ const response = await this.listMachinesRaw(requestParameters, initOverrides);
2159
+ return await response.value();
2160
+ }
2161
+ /**
2162
+ * Removes the association between machines and an obniz device by setting connected_obniz_id to null for all machines linked to the specified obniz ID **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required
2163
+ * Unregister obniz device from machines
2164
+ */
2165
+ async unregisterObnizRaw(requestParameters, initOverrides) {
2166
+ if (requestParameters['unregisterObnizRequest'] == null) {
2167
+ throw new RequiredError('unregisterObnizRequest', 'Required parameter "unregisterObnizRequest" was null or undefined when calling unregisterObniz().');
2168
+ }
2169
+ const queryParameters = {};
2170
+ const headerParameters = {};
2171
+ headerParameters['Content-Type'] = 'application/json';
2172
+ if (this.configuration && this.configuration.apiKey) {
2173
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2174
+ }
2175
+ const response = await this.request({
2176
+ path: `/api/1/machines/unregist/obniz`,
2177
+ method: 'POST',
2178
+ headers: headerParameters,
2179
+ query: queryParameters,
2180
+ body: requestParameters['unregisterObnizRequest'],
2181
+ }, initOverrides);
2182
+ return new JSONApiResponse(response);
2183
+ }
2184
+ /**
2185
+ * Removes the association between machines and an obniz device by setting connected_obniz_id to null for all machines linked to the specified obniz ID **Authorization** - API token is required in the `Authorization` header **Permissions** - `machines:write` permission is required
2186
+ * Unregister obniz device from machines
2187
+ */
2188
+ async unregisterObniz(requestParameters, initOverrides) {
2189
+ const response = await this.unregisterObnizRaw(requestParameters, initOverrides);
2190
+ return await response.value();
2191
+ }
2192
+ }
2193
+
2194
+ /* tslint:disable */
2195
+ /* eslint-disable */
2196
+ /**
2197
+ * API EN
2198
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2199
+ *
2200
+ * The version of the OpenAPI document: 1.0.0
2201
+ *
2202
+ *
2203
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2204
+ * https://openapi-generator.tech
2205
+ * Do not edit the class manually.
2206
+ */
2207
+ /**
2208
+ *
2209
+ */
2210
+ class NotificationsApi extends BaseAPI {
2211
+ /**
2212
+ * Creates a new notification destination with validation for email addresses (checks format and duplicates) **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:write` permission is required
2213
+ * Create a notification destination
2214
+ */
2215
+ async createNotificationRaw(requestParameters, initOverrides) {
2216
+ if (requestParameters['createNotificationRequest'] == null) {
2217
+ throw new RequiredError('createNotificationRequest', 'Required parameter "createNotificationRequest" was null or undefined when calling createNotification().');
2218
+ }
2219
+ const queryParameters = {};
2220
+ const headerParameters = {};
2221
+ headerParameters['Content-Type'] = 'application/json';
2222
+ if (this.configuration && this.configuration.apiKey) {
2223
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2224
+ }
2225
+ const response = await this.request({
2226
+ path: `/api/1/notifications`,
2227
+ method: 'POST',
2228
+ headers: headerParameters,
2229
+ query: queryParameters,
2230
+ body: requestParameters['createNotificationRequest'],
2231
+ }, initOverrides);
2232
+ return new JSONApiResponse(response);
2233
+ }
2234
+ /**
2235
+ * Creates a new notification destination with validation for email addresses (checks format and duplicates) **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:write` permission is required
2236
+ * Create a notification destination
2237
+ */
2238
+ async createNotification(requestParameters, initOverrides) {
2239
+ const response = await this.createNotificationRaw(requestParameters, initOverrides);
2240
+ return await response.value();
2241
+ }
2242
+ /**
2243
+ * Permanently removes a notification destination from the account **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:delete` permission is required
2244
+ * Delete a notification destination
2245
+ */
2246
+ async deleteNotificationRaw(requestParameters, initOverrides) {
2247
+ if (requestParameters['id'] == null) {
2248
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteNotification().');
2249
+ }
2250
+ const queryParameters = {};
2251
+ const headerParameters = {};
2252
+ if (this.configuration && this.configuration.apiKey) {
2253
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2254
+ }
2255
+ const response = await this.request({
2256
+ path: `/api/1/notifications/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2257
+ method: 'DELETE',
2258
+ headers: headerParameters,
2259
+ query: queryParameters,
2260
+ }, initOverrides);
2261
+ return new VoidApiResponse(response);
2262
+ }
2263
+ /**
2264
+ * Permanently removes a notification destination from the account **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:delete` permission is required
2265
+ * Delete a notification destination
2266
+ */
2267
+ async deleteNotification(requestParameters, initOverrides) {
2268
+ await this.deleteNotificationRaw(requestParameters, initOverrides);
2269
+ }
2270
+ /**
2271
+ * Retrieves notification destinations within the account with pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:read` permission is required
2272
+ * Get notifications list
2273
+ */
2274
+ async listNotificationsRaw(requestParameters, initOverrides) {
2275
+ const queryParameters = {};
2276
+ if (requestParameters['limit'] != null) {
2277
+ queryParameters['limit'] = requestParameters['limit'];
2278
+ }
2279
+ if (requestParameters['offset'] != null) {
2280
+ queryParameters['offset'] = requestParameters['offset'];
2281
+ }
2282
+ if (requestParameters['groupId'] != null) {
2283
+ queryParameters['group_id'] = requestParameters['groupId'];
2284
+ }
2285
+ const headerParameters = {};
2286
+ if (this.configuration && this.configuration.apiKey) {
2287
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2288
+ }
2289
+ const response = await this.request({
2290
+ path: `/api/1/notifications`,
2291
+ method: 'GET',
2292
+ headers: headerParameters,
2293
+ query: queryParameters,
2294
+ }, initOverrides);
2295
+ return new JSONApiResponse(response);
2296
+ }
2297
+ /**
2298
+ * Retrieves notification destinations within the account with pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:read` permission is required
2299
+ * Get notifications list
2300
+ */
2301
+ async listNotifications(requestParameters = {}, initOverrides) {
2302
+ const response = await this.listNotificationsRaw(requestParameters, initOverrides);
2303
+ return await response.value();
2304
+ }
2305
+ /**
2306
+ * Sends a test notification to verify the configuration is working correctly **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:write` permission is required
2307
+ * Test a notification destination
2308
+ */
2309
+ async testNotificationRaw(requestParameters, initOverrides) {
2310
+ if (requestParameters['id'] == null) {
2311
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling testNotification().');
2312
+ }
2313
+ const queryParameters = {};
2314
+ const headerParameters = {};
2315
+ if (this.configuration && this.configuration.apiKey) {
2316
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2317
+ }
2318
+ const response = await this.request({
2319
+ path: `/api/1/notifications/{id}/test`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2320
+ method: 'POST',
2321
+ headers: headerParameters,
2322
+ query: queryParameters,
2323
+ }, initOverrides);
2324
+ return new JSONApiResponse(response);
2325
+ }
2326
+ /**
2327
+ * Sends a test notification to verify the configuration is working correctly **Authorization** - API token is required in the `Authorization` header **Permissions** - `notifications:write` permission is required
2328
+ * Test a notification destination
2329
+ */
2330
+ async testNotification(requestParameters, initOverrides) {
2331
+ const response = await this.testNotificationRaw(requestParameters, initOverrides);
2332
+ return await response.value();
2333
+ }
2334
+ }
2335
+
2336
+ /* tslint:disable */
2337
+ /* eslint-disable */
2338
+ /**
2339
+ * API EN
2340
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2341
+ *
2342
+ * The version of the OpenAPI document: 1.0.0
2343
+ *
2344
+ *
2345
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2346
+ * https://openapi-generator.tech
2347
+ * Do not edit the class manually.
2348
+ */
2349
+ /**
2350
+ *
2351
+ */
2352
+ class ReportsApi extends BaseAPI {
2353
+ /**
2354
+ * Creates a new CSV export job for the specified units and properties. **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:write` permission is required **Plan Limitations** - Subject to plan limits for report generation - Maximum concurrent CSV exports applies **Validation** - units array must not be empty - properties array must not be empty - start_date and end_date are required - Each unit must have unit_id and label - Each property must have a key
2355
+ * Create CSV export
2356
+ */
2357
+ async createCSVExportRaw(requestParameters, initOverrides) {
2358
+ if (requestParameters['createCSVExportRequest'] == null) {
2359
+ throw new RequiredError('createCSVExportRequest', 'Required parameter "createCSVExportRequest" was null or undefined when calling createCSVExport().');
2360
+ }
2361
+ const queryParameters = {};
2362
+ const headerParameters = {};
2363
+ headerParameters['Content-Type'] = 'application/json';
2364
+ if (this.configuration && this.configuration.apiKey) {
2365
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2366
+ }
2367
+ const response = await this.request({
2368
+ path: `/api/1/reports/csv`,
2369
+ method: 'POST',
2370
+ headers: headerParameters,
2371
+ query: queryParameters,
2372
+ body: requestParameters['createCSVExportRequest'],
2373
+ }, initOverrides);
2374
+ return new JSONApiResponse(response);
2375
+ }
2376
+ /**
2377
+ * Creates a new CSV export job for the specified units and properties. **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:write` permission is required **Plan Limitations** - Subject to plan limits for report generation - Maximum concurrent CSV exports applies **Validation** - units array must not be empty - properties array must not be empty - start_date and end_date are required - Each unit must have unit_id and label - Each property must have a key
2378
+ * Create CSV export
2379
+ */
2380
+ async createCSVExport(requestParameters, initOverrides) {
2381
+ const response = await this.createCSVExportRaw(requestParameters, initOverrides);
2382
+ return await response.value();
2383
+ }
2384
+ /**
2385
+ * Retrieves the status and details of a specific CSV export job. - User must own the export (account_id must match) **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:read` permission is required **Export Status** - pending: Export queued but not started - processing: Export in progress - completed: Export finished, file available for download - failed: Export failed
2386
+ * Get CSV export status
2387
+ */
2388
+ async getCSVExportStatusRaw(requestParameters, initOverrides) {
2389
+ if (requestParameters['exportId'] == null) {
2390
+ throw new RequiredError('exportId', 'Required parameter "exportId" was null or undefined when calling getCSVExportStatus().');
2391
+ }
2392
+ const queryParameters = {};
2393
+ const headerParameters = {};
2394
+ if (this.configuration && this.configuration.apiKey) {
2395
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2396
+ }
2397
+ const response = await this.request({
2398
+ path: `/api/1/reports/csv/{exportId}`.replace(`{${"exportId"}}`, encodeURIComponent(String(requestParameters['exportId']))),
2399
+ method: 'GET',
2400
+ headers: headerParameters,
2401
+ query: queryParameters,
2402
+ }, initOverrides);
2403
+ return new JSONApiResponse(response);
2404
+ }
2405
+ /**
2406
+ * Retrieves the status and details of a specific CSV export job. - User must own the export (account_id must match) **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:read` permission is required **Export Status** - pending: Export queued but not started - processing: Export in progress - completed: Export finished, file available for download - failed: Export failed
2407
+ * Get CSV export status
2408
+ */
2409
+ async getCSVExportStatus(requestParameters, initOverrides) {
2410
+ const response = await this.getCSVExportStatusRaw(requestParameters, initOverrides);
2411
+ return await response.value();
2412
+ }
2413
+ /**
2414
+ * Returns a paginated list of CSV export jobs for the account. **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:read` permission is required **Filtering** - Filter by group_id (optional) - Filter by status (optional)
2415
+ * List CSV exports
2416
+ */
2417
+ async listCSVExportsRaw(requestParameters, initOverrides) {
2418
+ const queryParameters = {};
2419
+ if (requestParameters['limit'] != null) {
2420
+ queryParameters['limit'] = requestParameters['limit'];
2421
+ }
2422
+ if (requestParameters['offset'] != null) {
2423
+ queryParameters['offset'] = requestParameters['offset'];
2424
+ }
2425
+ if (requestParameters['groupId'] != null) {
2426
+ queryParameters['group_id'] = requestParameters['groupId'];
2427
+ }
2428
+ if (requestParameters['status'] != null) {
2429
+ queryParameters['status'] = requestParameters['status'];
2430
+ }
2431
+ const headerParameters = {};
2432
+ if (this.configuration && this.configuration.apiKey) {
2433
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2434
+ }
2435
+ const response = await this.request({
2436
+ path: `/api/1/reports/csv`,
2437
+ method: 'GET',
2438
+ headers: headerParameters,
2439
+ query: queryParameters,
2440
+ }, initOverrides);
2441
+ return new JSONApiResponse(response);
2442
+ }
2443
+ /**
2444
+ * Returns a paginated list of CSV export jobs for the account. **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:read` permission is required **Filtering** - Filter by group_id (optional) - Filter by status (optional)
2445
+ * List CSV exports
2446
+ */
2447
+ async listCSVExports(requestParameters = {}, initOverrides) {
2448
+ const response = await this.listCSVExportsRaw(requestParameters, initOverrides);
2449
+ return await response.value();
2450
+ }
2451
+ /**
2452
+ * Retrieves export reports associated with the account and group with pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:read` permission is required
2453
+ * Get reports list
2454
+ */
2455
+ async listReportsRaw(requestParameters, initOverrides) {
2456
+ const queryParameters = {};
2457
+ if (requestParameters['limit'] != null) {
2458
+ queryParameters['limit'] = requestParameters['limit'];
2459
+ }
2460
+ if (requestParameters['offset'] != null) {
2461
+ queryParameters['offset'] = requestParameters['offset'];
2462
+ }
2463
+ if (requestParameters['groupId'] != null) {
2464
+ queryParameters['group_id'] = requestParameters['groupId'];
2465
+ }
2466
+ const headerParameters = {};
2467
+ if (this.configuration && this.configuration.apiKey) {
2468
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2469
+ }
2470
+ const response = await this.request({
2471
+ path: `/api/1/reports`,
2472
+ method: 'GET',
2473
+ headers: headerParameters,
2474
+ query: queryParameters,
2475
+ }, initOverrides);
2476
+ return new JSONApiResponse(response);
2477
+ }
2478
+ /**
2479
+ * Retrieves export reports associated with the account and group with pagination **Authorization** - API token is required in the `Authorization` header **Permissions** - `reports:read` permission is required
2480
+ * Get reports list
2481
+ */
2482
+ async listReports(requestParameters = {}, initOverrides) {
2483
+ const response = await this.listReportsRaw(requestParameters, initOverrides);
2484
+ return await response.value();
2485
+ }
2486
+ }
2487
+
2488
+ /* tslint:disable */
2489
+ /* eslint-disable */
2490
+ /**
2491
+ * API EN
2492
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2493
+ *
2494
+ * The version of the OpenAPI document: 1.0.0
2495
+ *
2496
+ *
2497
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2498
+ * https://openapi-generator.tech
2499
+ * Do not edit the class manually.
2500
+ */
2501
+ /**
2502
+ *
2503
+ */
2504
+ class ThreadsApi extends BaseAPI {
2505
+ /**
2506
+ * Create a new thread (field record). Supports both JSON and multipart/form-data requests. Validation rules: - Title: required, max 255 characters - Content: required, max 1000 characters - Allowed file types: .jpg, .jpeg, .png, .pdf, .csv, .xlsx, .xls - Each entity must have exactly one of: machine_id, issue_id, or event_id **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2507
+ * Create new thread
2508
+ */
2509
+ async createThreadRaw(requestParameters, initOverrides) {
2510
+ if (requestParameters['createThreadRequest'] == null) {
2511
+ throw new RequiredError('createThreadRequest', 'Required parameter "createThreadRequest" was null or undefined when calling createThread().');
2512
+ }
2513
+ const queryParameters = {};
2514
+ const headerParameters = {};
2515
+ headerParameters['Content-Type'] = 'application/json';
2516
+ if (this.configuration && this.configuration.apiKey) {
2517
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2518
+ }
2519
+ const response = await this.request({
2520
+ path: `/api/1/threads`,
2521
+ method: 'POST',
2522
+ headers: headerParameters,
2523
+ query: queryParameters,
2524
+ body: requestParameters['createThreadRequest'],
2525
+ }, initOverrides);
2526
+ return new JSONApiResponse(response);
2527
+ }
2528
+ /**
2529
+ * Create a new thread (field record). Supports both JSON and multipart/form-data requests. Validation rules: - Title: required, max 255 characters - Content: required, max 1000 characters - Allowed file types: .jpg, .jpeg, .png, .pdf, .csv, .xlsx, .xls - Each entity must have exactly one of: machine_id, issue_id, or event_id **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2530
+ * Create new thread
2531
+ */
2532
+ async createThread(requestParameters, initOverrides) {
2533
+ const response = await this.createThreadRaw(requestParameters, initOverrides);
2534
+ return await response.value();
2535
+ }
2536
+ /**
2537
+ * Create a new post in a thread **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2538
+ * Create thread post
2539
+ */
2540
+ async createThreadPostRaw(requestParameters, initOverrides) {
2541
+ if (requestParameters['id'] == null) {
2542
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling createThreadPost().');
2543
+ }
2544
+ if (requestParameters['content'] == null) {
2545
+ throw new RequiredError('content', 'Required parameter "content" was null or undefined when calling createThreadPost().');
2546
+ }
2547
+ const queryParameters = {};
2548
+ const headerParameters = {};
2549
+ if (this.configuration && this.configuration.apiKey) {
2550
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2551
+ }
2552
+ const consumes = [
2553
+ { contentType: 'multipart/form-data' },
2554
+ ];
2555
+ // @ts-ignore: canConsumeForm may be unused
2556
+ const canConsumeForm$1 = canConsumeForm(consumes);
2557
+ let formParams;
2558
+ let useForm = false;
2559
+ // use FormData to transmit files using content-type "multipart/form-data"
2560
+ useForm = canConsumeForm$1;
2561
+ if (useForm) {
2562
+ formParams = new FormData();
2563
+ }
2564
+ else {
2565
+ formParams = new URLSearchParams();
2566
+ }
2567
+ if (requestParameters['content'] != null) {
2568
+ formParams.append('content', requestParameters['content']);
2569
+ }
2570
+ if (requestParameters['entities'] != null) {
2571
+ formParams.append('entities', requestParameters['entities']);
2572
+ }
2573
+ if (requestParameters['files'] != null) {
2574
+ requestParameters['files'].forEach((element) => {
2575
+ formParams.append('files', element);
2576
+ });
2577
+ }
2578
+ const response = await this.request({
2579
+ path: `/api/1/threads/{id}/posts`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2580
+ method: 'POST',
2581
+ headers: headerParameters,
2582
+ query: queryParameters,
2583
+ body: formParams,
2584
+ }, initOverrides);
2585
+ return new JSONApiResponse(response);
2586
+ }
2587
+ /**
2588
+ * Create a new post in a thread **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2589
+ * Create thread post
2590
+ */
2591
+ async createThreadPost(requestParameters, initOverrides) {
2592
+ const response = await this.createThreadPostRaw(requestParameters, initOverrides);
2593
+ return await response.value();
2594
+ }
2595
+ /**
2596
+ * Download a file attached to a thread post **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2597
+ * Download thread file
2598
+ */
2599
+ async downloadThreadFileRaw(requestParameters, initOverrides) {
2600
+ if (requestParameters['threadId'] == null) {
2601
+ throw new RequiredError('threadId', 'Required parameter "threadId" was null or undefined when calling downloadThreadFile().');
2602
+ }
2603
+ if (requestParameters['fileName'] == null) {
2604
+ throw new RequiredError('fileName', 'Required parameter "fileName" was null or undefined when calling downloadThreadFile().');
2605
+ }
2606
+ const queryParameters = {};
2607
+ const headerParameters = {};
2608
+ if (this.configuration && this.configuration.apiKey) {
2609
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2610
+ }
2611
+ const response = await this.request({
2612
+ path: `/api/1/threads/{threadId}/files/{fileName}`.replace(`{${"threadId"}}`, encodeURIComponent(String(requestParameters['threadId']))).replace(`{${"fileName"}}`, encodeURIComponent(String(requestParameters['fileName']))),
2613
+ method: 'GET',
2614
+ headers: headerParameters,
2615
+ query: queryParameters,
2616
+ }, initOverrides);
2617
+ return new BlobApiResponse(response);
2618
+ }
2619
+ /**
2620
+ * Download a file attached to a thread post **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2621
+ * Download thread file
2622
+ */
2623
+ async downloadThreadFile(requestParameters, initOverrides) {
2624
+ const response = await this.downloadThreadFileRaw(requestParameters, initOverrides);
2625
+ return await response.value();
2626
+ }
2627
+ /**
2628
+ * Get a specific thread by ID **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2629
+ * Get thread by ID
2630
+ */
2631
+ async getThreadByIdRaw(requestParameters, initOverrides) {
2632
+ if (requestParameters['id'] == null) {
2633
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling getThreadById().');
2634
+ }
2635
+ const queryParameters = {};
2636
+ if (requestParameters['groupId'] != null) {
2637
+ queryParameters['group_id'] = requestParameters['groupId'];
2638
+ }
2639
+ const headerParameters = {};
2640
+ if (this.configuration && this.configuration.apiKey) {
2641
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2642
+ }
2643
+ const response = await this.request({
2644
+ path: `/api/1/threads/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2645
+ method: 'GET',
2646
+ headers: headerParameters,
2647
+ query: queryParameters,
2648
+ }, initOverrides);
2649
+ return new JSONApiResponse(response);
2650
+ }
2651
+ /**
2652
+ * Get a specific thread by ID **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2653
+ * Get thread by ID
2654
+ */
2655
+ async getThreadById(requestParameters, initOverrides) {
2656
+ const response = await this.getThreadByIdRaw(requestParameters, initOverrides);
2657
+ return await response.value();
2658
+ }
2659
+ /**
2660
+ * Get all entities related to a thread (machines, issues, events) **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2661
+ * Get thread entities
2662
+ */
2663
+ async getThreadEntitiesRaw(requestParameters, initOverrides) {
2664
+ if (requestParameters['id'] == null) {
2665
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling getThreadEntities().');
2666
+ }
2667
+ const queryParameters = {};
2668
+ if (requestParameters['entityType'] != null) {
2669
+ queryParameters['entity_type'] = requestParameters['entityType'];
2670
+ }
2671
+ const headerParameters = {};
2672
+ if (this.configuration && this.configuration.apiKey) {
2673
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2674
+ }
2675
+ const response = await this.request({
2676
+ path: `/api/1/threads/{id}/entities`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2677
+ method: 'GET',
2678
+ headers: headerParameters,
2679
+ query: queryParameters,
2680
+ }, initOverrides);
2681
+ return new JSONApiResponse(response);
2682
+ }
2683
+ /**
2684
+ * Get all entities related to a thread (machines, issues, events) **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2685
+ * Get thread entities
2686
+ */
2687
+ async getThreadEntities(requestParameters, initOverrides) {
2688
+ const response = await this.getThreadEntitiesRaw(requestParameters, initOverrides);
2689
+ return await response.value();
2690
+ }
2691
+ /**
2692
+ * Get posts for a specific thread **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2693
+ * Get thread posts
2694
+ */
2695
+ async listThreadPostsRaw(requestParameters, initOverrides) {
2696
+ if (requestParameters['id'] == null) {
2697
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling listThreadPosts().');
2698
+ }
2699
+ const queryParameters = {};
2700
+ const headerParameters = {};
2701
+ if (this.configuration && this.configuration.apiKey) {
2702
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2703
+ }
2704
+ const response = await this.request({
2705
+ path: `/api/1/threads/{id}/posts`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2706
+ method: 'GET',
2707
+ headers: headerParameters,
2708
+ query: queryParameters,
2709
+ }, initOverrides);
2710
+ return new JSONApiResponse(response);
2711
+ }
2712
+ /**
2713
+ * Get posts for a specific thread **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2714
+ * Get thread posts
2715
+ */
2716
+ async listThreadPosts(requestParameters, initOverrides) {
2717
+ const response = await this.listThreadPostsRaw(requestParameters, initOverrides);
2718
+ return await response.value();
2719
+ }
2720
+ /**
2721
+ * Get threads (field records) associated with the account and group **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2722
+ * Get threads list
2723
+ */
2724
+ async listThreadsRaw(requestParameters, initOverrides) {
2725
+ const queryParameters = {};
2726
+ if (requestParameters['limit'] != null) {
2727
+ queryParameters['limit'] = requestParameters['limit'];
2728
+ }
2729
+ if (requestParameters['offset'] != null) {
2730
+ queryParameters['offset'] = requestParameters['offset'];
2731
+ }
2732
+ if (requestParameters['search'] != null) {
2733
+ queryParameters['search'] = requestParameters['search'];
2734
+ }
2735
+ if (requestParameters['isOpen'] != null) {
2736
+ queryParameters['is_open'] = requestParameters['isOpen'];
2737
+ }
2738
+ if (requestParameters['groupId'] != null) {
2739
+ queryParameters['group_id'] = requestParameters['groupId'];
2740
+ }
2741
+ const headerParameters = {};
2742
+ if (this.configuration && this.configuration.apiKey) {
2743
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2744
+ }
2745
+ const response = await this.request({
2746
+ path: `/api/1/threads`,
2747
+ method: 'GET',
2748
+ headers: headerParameters,
2749
+ query: queryParameters,
2750
+ }, initOverrides);
2751
+ return new JSONApiResponse(response);
2752
+ }
2753
+ /**
2754
+ * Get threads (field records) associated with the account and group **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:read` permission is required
2755
+ * Get threads list
2756
+ */
2757
+ async listThreads(requestParameters = {}, initOverrides) {
2758
+ const response = await this.listThreadsRaw(requestParameters, initOverrides);
2759
+ return await response.value();
2760
+ }
2761
+ /**
2762
+ * Update thread (change status) **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2763
+ * Update thread status
2764
+ */
2765
+ async updateThreadRaw(requestParameters, initOverrides) {
2766
+ if (requestParameters['id'] == null) {
2767
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling updateThread().');
2768
+ }
2769
+ if (requestParameters['updateThreadRequest'] == null) {
2770
+ throw new RequiredError('updateThreadRequest', 'Required parameter "updateThreadRequest" was null or undefined when calling updateThread().');
2771
+ }
2772
+ const queryParameters = {};
2773
+ const headerParameters = {};
2774
+ headerParameters['Content-Type'] = 'application/json';
2775
+ if (this.configuration && this.configuration.apiKey) {
2776
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2777
+ }
2778
+ const response = await this.request({
2779
+ path: `/api/1/threads/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
2780
+ method: 'POST',
2781
+ headers: headerParameters,
2782
+ query: queryParameters,
2783
+ body: requestParameters['updateThreadRequest'],
2784
+ }, initOverrides);
2785
+ return new JSONApiResponse(response);
2786
+ }
2787
+ /**
2788
+ * Update thread (change status) **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2789
+ * Update thread status
2790
+ */
2791
+ async updateThread(requestParameters, initOverrides) {
2792
+ const response = await this.updateThreadRaw(requestParameters, initOverrides);
2793
+ return await response.value();
2794
+ }
2795
+ /**
2796
+ * Update a specific post in a thread **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2797
+ * Update thread post
2798
+ */
2799
+ async updateThreadPostRaw(requestParameters, initOverrides) {
2800
+ if (requestParameters['id'] == null) {
2801
+ throw new RequiredError('id', 'Required parameter "id" was null or undefined when calling updateThreadPost().');
2802
+ }
2803
+ if (requestParameters['number'] == null) {
2804
+ throw new RequiredError('number', 'Required parameter "number" was null or undefined when calling updateThreadPost().');
2805
+ }
2806
+ if (requestParameters['updateThreadPostRequest'] == null) {
2807
+ throw new RequiredError('updateThreadPostRequest', 'Required parameter "updateThreadPostRequest" was null or undefined when calling updateThreadPost().');
2808
+ }
2809
+ const queryParameters = {};
2810
+ const headerParameters = {};
2811
+ headerParameters['Content-Type'] = 'application/json';
2812
+ if (this.configuration && this.configuration.apiKey) {
2813
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2814
+ }
2815
+ const response = await this.request({
2816
+ path: `/api/1/threads/{id}/posts/{number}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))).replace(`{${"number"}}`, encodeURIComponent(String(requestParameters['number']))),
2817
+ method: 'POST',
2818
+ headers: headerParameters,
2819
+ query: queryParameters,
2820
+ body: requestParameters['updateThreadPostRequest'],
2821
+ }, initOverrides);
2822
+ return new JSONApiResponse(response);
2823
+ }
2824
+ /**
2825
+ * Update a specific post in a thread **Authorization** - API token is required in the `Authorization` header **Permissions** - `threads:write` permission is required
2826
+ * Update thread post
2827
+ */
2828
+ async updateThreadPost(requestParameters, initOverrides) {
2829
+ const response = await this.updateThreadPostRaw(requestParameters, initOverrides);
2830
+ return await response.value();
2831
+ }
2832
+ }
2833
+
2834
+ /* tslint:disable */
2835
+ /* eslint-disable */
2836
+ /**
2837
+ * API EN
2838
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2839
+ *
2840
+ * The version of the OpenAPI document: 1.0.0
2841
+ *
2842
+ *
2843
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2844
+ * https://openapi-generator.tech
2845
+ * Do not edit the class manually.
2846
+ */
2847
+ /**
2848
+ *
2849
+ */
2850
+ class UnitsApi extends BaseAPI {
2851
+ /**
2852
+ * Permanently removes a specific state and its history for a unit **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:delete` permission is required
2853
+ * Delete a unit state by key
2854
+ */
2855
+ async deleteUnitStateRaw(requestParameters, initOverrides) {
2856
+ if (requestParameters['unitId'] == null) {
2857
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling deleteUnitState().');
2858
+ }
2859
+ if (requestParameters['key'] == null) {
2860
+ throw new RequiredError('key', 'Required parameter "key" was null or undefined when calling deleteUnitState().');
2861
+ }
2862
+ const queryParameters = {};
2863
+ const headerParameters = {};
2864
+ if (this.configuration && this.configuration.apiKey) {
2865
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2866
+ }
2867
+ const response = await this.request({
2868
+ path: `/api/1/units/{unit_id}/states/{key}`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))).replace(`{${"key"}}`, encodeURIComponent(String(requestParameters['key']))),
2869
+ method: 'DELETE',
2870
+ headers: headerParameters,
2871
+ query: queryParameters,
2872
+ }, initOverrides);
2873
+ return new JSONApiResponse(response);
2874
+ }
2875
+ /**
2876
+ * Permanently removes a specific state and its history for a unit **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:delete` permission is required
2877
+ * Delete a unit state by key
2878
+ */
2879
+ async deleteUnitState(requestParameters, initOverrides) {
2880
+ const response = await this.deleteUnitStateRaw(requestParameters, initOverrides);
2881
+ return await response.value();
2882
+ }
2883
+ /**
2884
+ * Downloads a file asset from S3 storage. Optional contentType query parameter to retrieve JSON content inline. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
2885
+ * Download an asset file
2886
+ */
2887
+ async downloadAssetRaw(requestParameters, initOverrides) {
2888
+ if (requestParameters['unitId'] == null) {
2889
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling downloadAsset().');
2890
+ }
2891
+ if (requestParameters['assetId'] == null) {
2892
+ throw new RequiredError('assetId', 'Required parameter "assetId" was null or undefined when calling downloadAsset().');
2893
+ }
2894
+ const queryParameters = {};
2895
+ if (requestParameters['contentType'] != null) {
2896
+ queryParameters['contentType'] = requestParameters['contentType'];
2897
+ }
2898
+ const headerParameters = {};
2899
+ if (this.configuration && this.configuration.apiKey) {
2900
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2901
+ }
2902
+ const response = await this.request({
2903
+ path: `/api/1/units/{unit_id}/assets/{asset_id}`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))).replace(`{${"asset_id"}}`, encodeURIComponent(String(requestParameters['assetId']))),
2904
+ method: 'GET',
2905
+ headers: headerParameters,
2906
+ query: queryParameters,
2907
+ }, initOverrides);
2908
+ return new BlobApiResponse(response);
2909
+ }
2910
+ /**
2911
+ * Downloads a file asset from S3 storage. Optional contentType query parameter to retrieve JSON content inline. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
2912
+ * Download an asset file
2913
+ */
2914
+ async downloadAsset(requestParameters, initOverrides) {
2915
+ const response = await this.downloadAssetRaw(requestParameters, initOverrides);
2916
+ return await response.value();
2917
+ }
2918
+ /**
2919
+ * Retrieves historical data for a specific unit within a specified time period with optional data sampling **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
2920
+ * Get unit history data
2921
+ */
2922
+ async getUnitHistoryRaw(requestParameters, initOverrides) {
2923
+ if (requestParameters['unitId'] == null) {
2924
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling getUnitHistory().');
2925
+ }
2926
+ const queryParameters = {};
2927
+ if (requestParameters['start'] != null) {
2928
+ queryParameters['start'] = requestParameters['start'];
2929
+ }
2930
+ if (requestParameters['end'] != null) {
2931
+ queryParameters['end'] = requestParameters['end'];
2932
+ }
2933
+ if (requestParameters['ratio'] != null) {
2934
+ queryParameters['ratio'] = requestParameters['ratio'];
2935
+ }
2936
+ const headerParameters = {};
2937
+ if (this.configuration && this.configuration.apiKey) {
2938
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2939
+ }
2940
+ const response = await this.request({
2941
+ path: `/api/1/units/{unit_id}/history`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))),
2942
+ method: 'GET',
2943
+ headers: headerParameters,
2944
+ query: queryParameters,
2945
+ }, initOverrides);
2946
+ return new JSONApiResponse(response);
2947
+ }
2948
+ /**
2949
+ * Retrieves historical data for a specific unit within a specified time period with optional data sampling **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
2950
+ * Get unit history data
2951
+ */
2952
+ async getUnitHistory(requestParameters, initOverrides) {
2953
+ const response = await this.getUnitHistoryRaw(requestParameters, initOverrides);
2954
+ return await response.value();
2955
+ }
2956
+ /**
2957
+ * Retrieves historical state data for a specific unit. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required **Query Parameters** - `keys` is required (comma-separated or array) - `start` and `end` define the time range (ISO8601 format) - `offset` and `limit` control pagination
2958
+ * Get unit state history
2959
+ */
2960
+ async getUnitStateHistoryRaw(requestParameters, initOverrides) {
2961
+ if (requestParameters['unitId'] == null) {
2962
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling getUnitStateHistory().');
2963
+ }
2964
+ if (requestParameters['keys'] == null) {
2965
+ throw new RequiredError('keys', 'Required parameter "keys" was null or undefined when calling getUnitStateHistory().');
2966
+ }
2967
+ const queryParameters = {};
2968
+ if (requestParameters['keys'] != null) {
2969
+ queryParameters['keys'] = requestParameters['keys'];
2970
+ }
2971
+ if (requestParameters['start'] != null) {
2972
+ queryParameters['start'] = requestParameters['start'];
2973
+ }
2974
+ if (requestParameters['end'] != null) {
2975
+ queryParameters['end'] = requestParameters['end'];
2976
+ }
2977
+ if (requestParameters['offset'] != null) {
2978
+ queryParameters['offset'] = requestParameters['offset'];
2979
+ }
2980
+ if (requestParameters['limit'] != null) {
2981
+ queryParameters['limit'] = requestParameters['limit'];
2982
+ }
2983
+ const headerParameters = {};
2984
+ if (this.configuration && this.configuration.apiKey) {
2985
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
2986
+ }
2987
+ const response = await this.request({
2988
+ path: `/api/1/units/{unit_id}/states/history`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))),
2989
+ method: 'GET',
2990
+ headers: headerParameters,
2991
+ query: queryParameters,
2992
+ }, initOverrides);
2993
+ return new JSONApiResponse(response);
2994
+ }
2995
+ /**
2996
+ * Retrieves historical state data for a specific unit. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required **Query Parameters** - `keys` is required (comma-separated or array) - `start` and `end` define the time range (ISO8601 format) - `offset` and `limit` control pagination
2997
+ * Get unit state history
2998
+ */
2999
+ async getUnitStateHistory(requestParameters, initOverrides) {
3000
+ const response = await this.getUnitStateHistoryRaw(requestParameters, initOverrides);
3001
+ return await response.value();
3002
+ }
3003
+ /**
3004
+ * Retrieves all state key-value pairs for a specific unit. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
3005
+ * Get unit states
3006
+ */
3007
+ async getUnitStatesRaw(requestParameters, initOverrides) {
3008
+ if (requestParameters['unitId'] == null) {
3009
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling getUnitStates().');
3010
+ }
3011
+ const queryParameters = {};
3012
+ const headerParameters = {};
3013
+ if (this.configuration && this.configuration.apiKey) {
3014
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
3015
+ }
3016
+ const response = await this.request({
3017
+ path: `/api/1/units/{unit_id}/states`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))),
3018
+ method: 'GET',
3019
+ headers: headerParameters,
3020
+ query: queryParameters,
3021
+ }, initOverrides);
3022
+ return new JSONApiResponse(response);
3023
+ }
3024
+ /**
3025
+ * Retrieves all state key-value pairs for a specific unit. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
3026
+ * Get unit states
3027
+ */
3028
+ async getUnitStates(requestParameters, initOverrides) {
3029
+ const response = await this.getUnitStatesRaw(requestParameters, initOverrides);
3030
+ return await response.value();
3031
+ }
3032
+ /**
3033
+ * Retrieves historical data from Cassandra with double-parsed JSON data format and summary statistics (count, tail_date) **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
3034
+ * Load unit data with parsed format
3035
+ */
3036
+ async loadUnitDataRaw(requestParameters, initOverrides) {
3037
+ if (requestParameters['unitId'] == null) {
3038
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling loadUnitData().');
3039
+ }
3040
+ const queryParameters = {};
3041
+ if (requestParameters['start'] != null) {
3042
+ queryParameters['start'] = requestParameters['start'];
3043
+ }
3044
+ if (requestParameters['end'] != null) {
3045
+ queryParameters['end'] = requestParameters['end'];
3046
+ }
3047
+ if (requestParameters['ratio'] != null) {
3048
+ queryParameters['ratio'] = requestParameters['ratio'];
3049
+ }
3050
+ const headerParameters = {};
3051
+ if (this.configuration && this.configuration.apiKey) {
3052
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
3053
+ }
3054
+ const response = await this.request({
3055
+ path: `/api/1/units/{unit_id}/load`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))),
3056
+ method: 'GET',
3057
+ headers: headerParameters,
3058
+ query: queryParameters,
3059
+ }, initOverrides);
3060
+ return new JSONApiResponse(response);
3061
+ }
3062
+ /**
3063
+ * Retrieves historical data from Cassandra with double-parsed JSON data format and summary statistics (count, tail_date) **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:read` permission is required
3064
+ * Load unit data with parsed format
3065
+ */
3066
+ async loadUnitData(requestParameters, initOverrides) {
3067
+ const response = await this.loadUnitDataRaw(requestParameters, initOverrides);
3068
+ return await response.value();
3069
+ }
3070
+ /**
3071
+ * Inserts or updates state key-value pairs for a specific unit. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:write` permission is required **Note** - Multiple key-value pairs can be updated in a single request - Each state change is recorded with a timestamp in history
3072
+ * Update unit states
3073
+ */
3074
+ async updateUnitStatesRaw(requestParameters, initOverrides) {
3075
+ if (requestParameters['unitId'] == null) {
3076
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling updateUnitStates().');
3077
+ }
3078
+ if (requestParameters['requestBody'] == null) {
3079
+ throw new RequiredError('requestBody', 'Required parameter "requestBody" was null or undefined when calling updateUnitStates().');
3080
+ }
3081
+ const queryParameters = {};
3082
+ const headerParameters = {};
3083
+ headerParameters['Content-Type'] = 'application/json';
3084
+ if (this.configuration && this.configuration.apiKey) {
3085
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
3086
+ }
3087
+ const response = await this.request({
3088
+ path: `/api/1/units/{unit_id}/states`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))),
3089
+ method: 'POST',
3090
+ headers: headerParameters,
3091
+ query: queryParameters,
3092
+ body: requestParameters['requestBody'],
3093
+ }, initOverrides);
3094
+ return new JSONApiResponse(response);
3095
+ }
3096
+ /**
3097
+ * Inserts or updates state key-value pairs for a specific unit. **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:write` permission is required **Note** - Multiple key-value pairs can be updated in a single request - Each state change is recorded with a timestamp in history
3098
+ * Update unit states
3099
+ */
3100
+ async updateUnitStates(requestParameters, initOverrides) {
3101
+ const response = await this.updateUnitStatesRaw(requestParameters, initOverrides);
3102
+ return await response.value();
3103
+ }
3104
+ /**
3105
+ * Uploads a file asset to S3 storage for a specific unit. Supports two methods: 1. multipart/form-data: For file uploads 2. application/json: For direct JSON content with {filename, content} **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:write` permission is required
3106
+ * Upload an asset file
3107
+ */
3108
+ async uploadAssetRaw(requestParameters, initOverrides) {
3109
+ if (requestParameters['unitId'] == null) {
3110
+ throw new RequiredError('unitId', 'Required parameter "unitId" was null or undefined when calling uploadAsset().');
3111
+ }
3112
+ const queryParameters = {};
3113
+ const headerParameters = {};
3114
+ if (this.configuration && this.configuration.apiKey) {
3115
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiToken authentication
3116
+ }
3117
+ const consumes = [
3118
+ { contentType: 'multipart/form-data' },
3119
+ { contentType: 'application/json' },
3120
+ ];
3121
+ // @ts-ignore: canConsumeForm may be unused
3122
+ const canConsumeForm$1 = canConsumeForm(consumes);
3123
+ let formParams;
3124
+ let useForm = false;
3125
+ // use FormData to transmit files using content-type "multipart/form-data"
3126
+ useForm = canConsumeForm$1;
3127
+ if (useForm) {
3128
+ formParams = new FormData();
3129
+ }
3130
+ else {
3131
+ formParams = new URLSearchParams();
3132
+ }
3133
+ if (requestParameters['file'] != null) {
3134
+ formParams.append('file', requestParameters['file']);
3135
+ }
3136
+ const response = await this.request({
3137
+ path: `/api/1/units/{unit_id}/assets`.replace(`{${"unit_id"}}`, encodeURIComponent(String(requestParameters['unitId']))),
3138
+ method: 'POST',
3139
+ headers: headerParameters,
3140
+ query: queryParameters,
3141
+ body: formParams,
3142
+ }, initOverrides);
3143
+ return new JSONApiResponse(response);
3144
+ }
3145
+ /**
3146
+ * Uploads a file asset to S3 storage for a specific unit. Supports two methods: 1. multipart/form-data: For file uploads 2. application/json: For direct JSON content with {filename, content} **Authorization** - API token is required in the `Authorization` header **Permissions** - `units:write` permission is required
3147
+ * Upload an asset file
3148
+ */
3149
+ async uploadAsset(requestParameters, initOverrides) {
3150
+ const response = await this.uploadAssetRaw(requestParameters, initOverrides);
3151
+ return await response.value();
3152
+ }
3153
+ }
3154
+
3155
+ /**
3156
+ * Enhanced API error with automatically parsed response data
3157
+ *
3158
+ * All API methods automatically convert ResponseError to ObnizApiError,
3159
+ * so you get parsed error information without manual handling.
3160
+ *
3161
+ * @example
3162
+ * ```typescript
3163
+ * try {
3164
+ * await client.machines.getMachine({ id: 'invalid-id' });
3165
+ * } catch (error) {
3166
+ * if (error instanceof ObnizApiError) {
3167
+ * console.error(`API Error [${error.status}]: ${error.message}`);
3168
+ * console.error('Error data:', error.data);
3169
+ * }
3170
+ * }
3171
+ * ```
3172
+ */
3173
+ class ObnizNowApiError extends Error {
3174
+ constructor(responseError, status, statusText, data) {
3175
+ const message = data?.error || data?.message || statusText || `HTTP ${status}`;
3176
+ super(message);
3177
+ this.name = "ObnizApiError";
3178
+ this.status = status;
3179
+ this.statusText = statusText;
3180
+ this.data = data;
3181
+ // Store originalError as non-enumerable property to keep it out of console.log
3182
+ // but still accessible for advanced use cases
3183
+ Object.defineProperty(this, 'originalError', {
3184
+ value: responseError,
3185
+ writable: false,
3186
+ enumerable: false, // Не будет засирать console.log!
3187
+ configurable: false
3188
+ });
3189
+ // Maintain proper stack trace (ES2015+)
3190
+ if (Error.captureStackTrace) {
3191
+ Error.captureStackTrace(this, ObnizNowApiError);
3192
+ }
3193
+ }
3194
+ /**
3195
+ * Create ObnizApiError from ResponseError by parsing the response
3196
+ */
3197
+ static async fromResponseError(error) {
3198
+ const status = error.response.status;
3199
+ const statusText = error.response.statusText;
3200
+ let data;
3201
+ try {
3202
+ // Try to parse as JSON
3203
+ const text = await error.response.text();
3204
+ data = JSON.parse(text);
3205
+ }
3206
+ catch {
3207
+ // If not JSON, wrap as error object
3208
+ try {
3209
+ data = { error: await error.response.text() };
3210
+ }
3211
+ catch {
3212
+ data = { error: statusText };
3213
+ }
3214
+ }
3215
+ return new ObnizNowApiError(error, status, statusText, data);
3216
+ }
3217
+ /**
3218
+ * Get response headers (useful for rate limiting, caching, etc.)
3219
+ *
3220
+ * @example
3221
+ * ```typescript
3222
+ * const rateLimit = error.getResponseHeaders().get('x-ratelimit-remaining');
3223
+ * ```
3224
+ */
3225
+ getResponseHeaders() {
3226
+ return this.originalError.response.headers;
3227
+ }
3228
+ /**
3229
+ * Get full request URL
3230
+ */
3231
+ getRequestUrl() {
3232
+ return this.originalError.response.url;
3233
+ }
3234
+ /**
3235
+ * Control JSON serialization - don't include originalError
3236
+ */
3237
+ toJSON() {
3238
+ return {
3239
+ name: this.name,
3240
+ message: this.message,
3241
+ status: this.status,
3242
+ statusText: this.statusText,
3243
+ data: this.data,
3244
+ stack: this.stack,
3245
+ };
3246
+ }
3247
+ }
3248
+ /**
3249
+ * Wraps an API object to automatically convert ResponseError to ObnizApiError
3250
+ */
3251
+ function wrapApiWithErrorHandling(api) {
3252
+ return new Proxy(api, {
3253
+ get(target, prop) {
3254
+ const original = target[prop];
3255
+ // Only wrap functions
3256
+ if (typeof original !== 'function') {
3257
+ return original;
3258
+ }
3259
+ // Return wrapped function that auto-converts errors
3260
+ return async function (...args) {
3261
+ try {
3262
+ return await original.apply(this, args);
3263
+ }
3264
+ catch (error) {
3265
+ // Convert ResponseError to ObnizApiError
3266
+ if (error instanceof ResponseError) {
3267
+ throw await ObnizNowApiError.fromResponseError(error);
3268
+ }
3269
+ // Re-throw other errors as-is
3270
+ throw error;
3271
+ }
3272
+ };
3273
+ }
3274
+ });
3275
+ }
3276
+
3277
+ /**
3278
+ * ObnizNow SDK main class
3279
+ *
3280
+ * Provides access to all Obniz Now API endpoints.
3281
+ *
3282
+ * @example
3283
+ * ```typescript
3284
+ * import { ObnizNow } from '@obniz/sdk';
3285
+ *
3286
+ * // Initialize with your API token
3287
+ * const client = new ObnizNow({
3288
+ * token: 'your-api-token'
3289
+ * });
3290
+ *
3291
+ * // List machines
3292
+ * const machines = await client.machines.listMachines({ limit: 10 });
3293
+ *
3294
+ * // Get analytics results
3295
+ * const analytics = await client.analytics.getAnalyticsResults(
3296
+ * 'basic_statistics',
3297
+ * 'machine-123'
3298
+ * );
3299
+ * ```
3300
+ *
3301
+ * @example
3302
+ * ```typescript
3303
+ * // Custom base URL for local development
3304
+ * const devClient = new ObnizNow({
3305
+ * token: 'your-token',
3306
+ * baseUrl: 'http://localhost:8080'
3307
+ * });
3308
+ * ```
3309
+ */
3310
+ class ObnizNow {
3311
+ /**
3312
+ * Creates a new ObnizNow SDK client instance
3313
+ *
3314
+ * @param options - Configuration options
3315
+ * @param options.token - API authentication token (required)
3316
+ * @param options.baseUrl - Base URL for API requests (optional, defaults to 'https://api.obniz.com')
3317
+ * @param options.fetch - Custom fetch implementation (optional, for Node.js < 18 or custom scenarios)
3318
+ *
3319
+ * @throws {Error} When token is not provided
3320
+ *
3321
+ * @example
3322
+ * ```typescript
3323
+ * const client = new ObnizNow({ token: 'your-api-token' });
3324
+ * ```
3325
+ */
3326
+ constructor(options) {
3327
+ const token = options.token;
3328
+ const cookies = options.cookies;
3329
+ const baseUrl = options.baseUrl ?? "https://api.obniz.com";
3330
+ const fetchApi = options.fetch || (typeof fetch !== "undefined" ? fetch : undefined);
3331
+ if (!token && !cookies) {
3332
+ throw new Error("Either 'token' or 'cookies' must be provided");
3333
+ }
3334
+ if (token && cookies) {
3335
+ throw new Error("Only one of 'token' or 'cookies' can be provided, not both");
3336
+ }
3337
+ let customFetch;
3338
+ if (cookies) {
3339
+ customFetch = async (url, init) => {
3340
+ const finalInit = {
3341
+ ...init,
3342
+ credentials: "include",
3343
+ headers: {
3344
+ ...init?.headers,
3345
+ Cookie: `token=${cookies.token}; account_id=${cookies.accountId}`,
3346
+ },
3347
+ };
3348
+ return (fetchApi || fetch)(url, finalInit);
3349
+ };
3350
+ }
3351
+ const config = new Configuration({
3352
+ basePath: baseUrl,
3353
+ apiKey: token ? `Bearer ${token}` : undefined,
3354
+ fetchApi: customFetch || fetchApi,
3355
+ credentials: cookies ? "include" : undefined,
3356
+ });
3357
+ // Wrap all APIs with automatic error handling
3358
+ this.analytics = wrapApiWithErrorHandling(new AnalyticsApi(config));
3359
+ this.connectionModels = wrapApiWithErrorHandling(new ConnectionModelsApi(config));
3360
+ this.connections = wrapApiWithErrorHandling(new ConnectionsApi(config));
3361
+ this.events = wrapApiWithErrorHandling(new EventsApi(config));
3362
+ this.groups = wrapApiWithErrorHandling(new GroupsApi(config));
3363
+ this.inboundConnections = wrapApiWithErrorHandling(new InboundConnectionsApi(config));
3364
+ this.inboundSources = wrapApiWithErrorHandling(new InboundSourcesApi(config));
3365
+ this.integrations = wrapApiWithErrorHandling(new IntegrationsApi(config));
3366
+ this.intelligences = wrapApiWithErrorHandling(new IntelligencesApi(config));
3367
+ this.issues = wrapApiWithErrorHandling(new IssuesApi(config));
3368
+ this.machine = wrapApiWithErrorHandling(new MachineApi(config));
3369
+ this.machines = wrapApiWithErrorHandling(new MachinesApi(config));
3370
+ this.notifications = wrapApiWithErrorHandling(new NotificationsApi(config));
3371
+ this.reports = wrapApiWithErrorHandling(new ReportsApi(config));
3372
+ this.threads = wrapApiWithErrorHandling(new ThreadsApi(config));
3373
+ this.units = wrapApiWithErrorHandling(new UnitsApi(config));
3374
+ }
3375
+ }
3376
+
3377
+ exports.ObnizNow = ObnizNow;
3378
+ exports.ObnizNowApiError = ObnizNowApiError;
3379
+ //# sourceMappingURL=index.js.map