@edgeiq/edgeiq-api-js 1.8.9 → 1.9.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.
@@ -1,6 +1,6 @@
1
- import { Configuration, Command, Ingestor, PollableAttribute, Rule, Setting } from '..';
1
+ import { Configuration, Command, Ingestor, PollableAttribute, Rule, SettingFilters, PaginatedSettings } from '..';
2
2
  import { BaseModelInterface } from '../core/ModelClass';
3
- import { BulkActionResponse } from '../models';
3
+ import { BulkActionResponse, PaginationFilter } from '../models';
4
4
  import { DeviceType, DeviceTypeInput, DeviceTypesFilters, PaginatedDeviceTypes } from './models';
5
5
  interface DeviceTypesInterface extends BaseModelInterface<DeviceType, DeviceTypeInput, DeviceTypesFilters, PaginatedDeviceTypes> {
6
6
  update(deviceType: DeviceType): Promise<DeviceType>;
@@ -18,7 +18,7 @@ interface DeviceTypesInterface extends BaseModelInterface<DeviceType, DeviceType
18
18
  getConfigurations(id: string): Promise<Configuration[]>;
19
19
  attachConfiguration(id: string, configId: string): Promise<string>;
20
20
  detachConfiguration(id: string, configId: string): Promise<string>;
21
- getSettings(id: string, configId?: string): Promise<Setting[]>;
21
+ getSettings(id: string, filters?: SettingFilters, pagination?: PaginationFilter): Promise<PaginatedSettings>;
22
22
  attachSettings(id: string, settingsId: string): Promise<string>;
23
23
  detachSettings(id: string, settingsId: string): Promise<string>;
24
24
  }
@@ -331,13 +331,23 @@ export const DeviceTypes = class extends BaseModelClass {
331
331
  }
332
332
  });
333
333
  }
334
- static getSettings(id, configId) {
334
+ static getSettings(id, filters, pagination) {
335
+ var _a, _b, _c, _d;
335
336
  return __awaiter(this, void 0, void 0, function* () {
336
337
  try {
337
338
  this.logAction(`Getting settings attached to device type with id ${id}`);
338
339
  const axios = EdgeIQAPI.getAxios();
339
- const result = yield axios.get(`${Endpoints.deviceType}/${id}/${Endpoints.setting}${configId ? `?configuration_id=${configId}` : ''}`);
340
- return result === null || result === void 0 ? void 0 : result.data;
340
+ const result = yield axios.get(`${Endpoints.deviceType}/${id}/${Endpoints.setting}`, {
341
+ params: parseFilters(filters, pagination),
342
+ });
343
+ return {
344
+ settings: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
345
+ pagination: {
346
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
347
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
348
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
349
+ },
350
+ };
341
351
  }
342
352
  catch (error) {
343
353
  if (isApiError(error)) {
@@ -1,4 +1,4 @@
1
- import { Command, EIQFile, Ingestor, Log, Rule, Setting } from '..';
1
+ import { Command, EIQFile, Ingestor, Log, PaginatedSettings, Rule, SettingFilters } from '..';
2
2
  import { BaseModelInterface } from '../core/ModelClass';
3
3
  import { GatewayCommand, GatewayCommandRequest } from '../gatewayCommands/models';
4
4
  import { BulkActionResponse, PaginationFilter } from '../models';
@@ -32,10 +32,10 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
32
32
  [key: string]: string | number;
33
33
  }, generateChildCommandExecutions?: boolean): Promise<BulkActionResponse>;
34
34
  getFiles(id: string): Promise<EIQFile[]>;
35
- getCommandExecutions(id: string, filters: CommandExecutionsFilters, pagination: PaginationFilter): Promise<PaginatedCommandExecutions>;
35
+ getCommandExecutions(id: string, filters?: CommandExecutionsFilters, pagination?: PaginationFilter): Promise<PaginatedCommandExecutions>;
36
36
  startRemoteTerminal(id: string, executable?: string): Promise<string>;
37
37
  stopRemoteTerminal(id: string): Promise<string>;
38
- getSettings(id: string, configId?: string): Promise<Setting[]>;
38
+ getSettings(id: string, filters?: SettingFilters, pagination?: PaginationFilter): Promise<PaginatedSettings>;
39
39
  attachSettings(id: string, settingsId: string): Promise<string>;
40
40
  detachSettings(id: string, settingsId: string): Promise<string>;
41
41
  dryRunCommand(id: string, commandId: string, data?: {
@@ -555,13 +555,23 @@ export const Devices = class extends BaseModelClass {
555
555
  }
556
556
  });
557
557
  }
558
- static getSettings(id, configId) {
558
+ static getSettings(id, filters, pagination) {
559
+ var _a, _b, _c, _d;
559
560
  return __awaiter(this, void 0, void 0, function* () {
560
561
  try {
561
562
  this.logAction(`Getting settings attached to device with id ${id}`);
562
563
  const axios = EdgeIQAPI.getAxios();
563
- const result = yield axios.get(`${Endpoints.device}/${id}/${Endpoints.setting}${configId ? `?configuration_id=${configId}` : ''}`);
564
- return result === null || result === void 0 ? void 0 : result.data;
564
+ const result = yield axios.get(`${Endpoints.device}/${id}/${Endpoints.setting}`, {
565
+ params: parseFilters(filters, pagination),
566
+ });
567
+ return {
568
+ settings: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
569
+ pagination: {
570
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
571
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
572
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
573
+ },
574
+ };
565
575
  }
566
576
  catch (error) {
567
577
  if (isApiError(error)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.8.9",
3
+ "version": "1.9.0",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",