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