dt-common-device 1.2.13 → 1.3.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.
@@ -7,7 +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
+ getPropertyDeviceIds(propertyId: string, selectDeviceId: boolean | undefined, manufacturer: string): Promise<any>;
11
11
  getState(deviceId: string): Promise<any>;
12
12
  getStatus(deviceId: string): Promise<Record<string, any>>;
13
13
  getBatteryLevel(deviceId: string): Promise<Record<string, any>>;
@@ -71,19 +71,22 @@ let DeviceRepository = (() => {
71
71
  }
72
72
  }
73
73
  async getDevices(deviceIds, withHubDetails = false) {
74
- return await axios_1.default.get(`${this.baseUrl}/devices`, {
74
+ const response = await axios_1.default.get(`${this.baseUrl}/devices`, {
75
75
  params: { deviceIds, withHubDetails },
76
76
  });
77
+ return response.data;
77
78
  }
78
79
  async getPropertyDevices(propertyId, selectDeviceId = false, type, withHubDetails = false) {
79
- return await axios_1.default.get(`${this.baseUrl}/devices`, {
80
+ const response = await axios_1.default.get(`${this.baseUrl}/devices`, {
80
81
  params: { propertyId, selectDeviceId, type, withHubDetails },
81
82
  });
83
+ return response.data;
82
84
  }
83
85
  async getPropertyDeviceIds(propertyId, selectDeviceId = false, manufacturer) {
84
- return await axios_1.default.get(`${this.baseUrl}/devices`, {
86
+ const response = await axios_1.default.get(`${this.baseUrl}/devices`, {
85
87
  params: { propertyId, selectDeviceId, manufacturer },
86
88
  });
89
+ return response.data;
87
90
  }
88
91
  async getState(deviceId) {
89
92
  return await axios_1.default.get(`${this.baseUrl}/devices/${deviceId}/state`);
@@ -8,7 +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
+ getPropertyDeviceIds(propertyId: string, selectDeviceId: boolean | undefined, type: string): Promise<any>;
12
12
  updateDevice(deviceId: string, body: any): Promise<any>;
13
13
  deleteDevice(deviceId: string): Promise<any>;
14
14
  getState(deviceId: string): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "1.2.13",
3
+ "version": "1.3.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -39,9 +39,10 @@ export class DeviceRepository {
39
39
  deviceIds: string[],
40
40
  withHubDetails: boolean = false
41
41
  ): Promise<IDevice[]> {
42
- return await axios.get(`${this.baseUrl}/devices`, {
42
+ const response = await axios.get(`${this.baseUrl}/devices`, {
43
43
  params: { deviceIds, withHubDetails },
44
44
  });
45
+ return response.data;
45
46
  }
46
47
 
47
48
  async getPropertyDevices(
@@ -50,9 +51,10 @@ export class DeviceRepository {
50
51
  type?: string,
51
52
  withHubDetails: boolean = false
52
53
  ): Promise<IDevice[]> {
53
- return await axios.get(`${this.baseUrl}/devices`, {
54
+ const response = await axios.get(`${this.baseUrl}/devices`, {
54
55
  params: { propertyId, selectDeviceId, type, withHubDetails },
55
56
  });
57
+ return response.data;
56
58
  }
57
59
 
58
60
  async getPropertyDeviceIds(
@@ -60,9 +62,10 @@ export class DeviceRepository {
60
62
  selectDeviceId: boolean = false,
61
63
  manufacturer: string
62
64
  ) {
63
- return await axios.get(`${this.baseUrl}/devices`, {
65
+ const response = await axios.get(`${this.baseUrl}/devices`, {
64
66
  params: { propertyId, selectDeviceId, manufacturer },
65
67
  });
68
+ return response.data;
66
69
  }
67
70
 
68
71
  async getState(deviceId: string): Promise<any> {