dt-common-device 1.2.7 → 1.2.9

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.
@@ -7,6 +7,7 @@ export declare class DeviceRepository {
7
7
  getDevice(deviceId: string, withHubDetails?: boolean): Promise<IDevice>;
8
8
  getDevices(deviceIds: string[], withHubDetails?: boolean): Promise<IDevice[]>;
9
9
  getPropertyDevices(propertyId: string, selectDeviceId?: boolean, type?: string, withHubDetails?: boolean): Promise<IDevice[]>;
10
+ getPropertyDeviceIds(propertyId: string, selectDeviceId: boolean | undefined, manufacturer: string): Promise<import("axios").AxiosResponse<any, any>>;
10
11
  getState(deviceId: string): Promise<any>;
11
12
  getStatus(deviceId: string): Promise<Record<string, any>>;
12
13
  getBatteryLevel(deviceId: string): Promise<Record<string, any>>;
@@ -80,6 +80,11 @@ let DeviceRepository = (() => {
80
80
  params: { propertyId, selectDeviceId, type, withHubDetails },
81
81
  });
82
82
  }
83
+ async getPropertyDeviceIds(propertyId, selectDeviceId = false, manufacturer) {
84
+ return await axios_1.default.get(`${this.baseUrl}/devices`, {
85
+ params: { propertyId, selectDeviceId, manufacturer },
86
+ });
87
+ }
83
88
  async getState(deviceId) {
84
89
  return await axios_1.default.get(`${this.baseUrl}/devices/${deviceId}/state`);
85
90
  }
@@ -8,6 +8,7 @@ export declare class LocalDeviceService {
8
8
  getDevice(deviceId: string, withHubDetails?: boolean): Promise<IDevice>;
9
9
  getDevices(deviceIds: string[], withHubDetails?: boolean): Promise<IDevice[]>;
10
10
  getPropertyDevices(propertyId: string, selectDeviceId?: boolean, type?: string, withHubDetails?: boolean): Promise<IDevice[]>;
11
+ getPropertyDeviceIds(propertyId: string, selectDeviceId: boolean | undefined, type: string): Promise<import("axios").AxiosResponse<any, any>>;
11
12
  updateDevice(deviceId: string, body: any): Promise<any>;
12
13
  deleteDevice(deviceId: string): Promise<any>;
13
14
  getState(deviceId: string): Promise<any>;
@@ -39,6 +39,12 @@ class LocalDeviceService {
39
39
  }
40
40
  return await this.deviceRepository.getPropertyDevices(propertyId, selectDeviceId, type, withHubDetails);
41
41
  }
42
+ async getPropertyDeviceIds(propertyId, selectDeviceId = false, type) {
43
+ if (!propertyId) {
44
+ throw new Error("Property ID is required");
45
+ }
46
+ return await this.deviceRepository.getPropertyDeviceIds(propertyId, selectDeviceId, type);
47
+ }
42
48
  async updateDevice(deviceId, body) {
43
49
  if (!deviceId) {
44
50
  throw new Error("Device ID is required");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -55,6 +55,16 @@ export class DeviceRepository {
55
55
  });
56
56
  }
57
57
 
58
+ async getPropertyDeviceIds(
59
+ propertyId: string,
60
+ selectDeviceId: boolean = false,
61
+ manufacturer: string
62
+ ) {
63
+ return await axios.get(`${this.baseUrl}/devices`, {
64
+ params: { propertyId, selectDeviceId, manufacturer },
65
+ });
66
+ }
67
+
58
68
  async getState(deviceId: string): Promise<any> {
59
69
  return await axios.get(`${this.baseUrl}/devices/${deviceId}/state`);
60
70
  }
@@ -59,6 +59,21 @@ export class LocalDeviceService {
59
59
  );
60
60
  }
61
61
 
62
+ async getPropertyDeviceIds(
63
+ propertyId: string,
64
+ selectDeviceId: boolean = false,
65
+ type: string
66
+ ) {
67
+ if (!propertyId) {
68
+ throw new Error("Property ID is required");
69
+ }
70
+ return await this.deviceRepository.getPropertyDeviceIds(
71
+ propertyId,
72
+ selectDeviceId,
73
+ type
74
+ );
75
+ }
76
+
62
77
  async updateDevice(deviceId: string, body: any): Promise<any> {
63
78
  if (!deviceId) {
64
79
  throw new Error("Device ID is required");