homey-api 3.1.0 → 3.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.
@@ -112,6 +112,70 @@
112
112
  }
113
113
  }
114
114
  },
115
+ "searchZigbeeDriver": {
116
+ "path": "/app/search-zigbee-driver",
117
+ "method": "post",
118
+ "parameters": {
119
+ "language": {
120
+ "in": "query",
121
+ "type": "string"
122
+ },
123
+ "homeyVersion": {
124
+ "type": "string",
125
+ "in": "body"
126
+ },
127
+ "homeyPlatform": {
128
+ "type": "string",
129
+ "in": "body"
130
+ },
131
+ "homeyMinimumSdkVersion": {
132
+ "type": "number",
133
+ "in": "body"
134
+ },
135
+ "productId": {
136
+ "type": "string",
137
+ "in": "body"
138
+ },
139
+ "manufacturerName": {
140
+ "type": "string",
141
+ "in": "body"
142
+ }
143
+ }
144
+ },
145
+ "searchZwaveDriver": {
146
+ "path": "/app/search-zwave-driver",
147
+ "method": "post",
148
+ "parameters": {
149
+ "language": {
150
+ "in": "query",
151
+ "type": "string"
152
+ },
153
+ "homeyVersion": {
154
+ "type": "string",
155
+ "in": "body"
156
+ },
157
+ "homeyPlatform": {
158
+ "type": "string",
159
+ "in": "body"
160
+ },
161
+ "homeyMinimumSdkVersion": {
162
+ "type": "number",
163
+ "in": "body"
164
+ },
165
+ "productId": {
166
+ "type": "number",
167
+ "in": "body"
168
+ },
169
+ "productTypeId": {
170
+ "type": "number",
171
+ "in": "body"
172
+ },
173
+ "manufacturerId": {
174
+ "type": "number",
175
+ "in": "body"
176
+ }
177
+ }
178
+ },
115
179
  "browseApps": {
116
180
  "path": "/app/browse",
117
181
  "method": "get",
@@ -1114,6 +1114,28 @@
1114
1114
  }
1115
1115
  }
1116
1116
  },
1117
+ "removeTagFromMailChimpUser": {
1118
+ "path": "/mail/mailchimp/tag/{tag}/list/{listId}/user/{userId}",
1119
+ "method": "delete",
1120
+ "private": true,
1121
+ "parameters": {
1122
+ "tag": {
1123
+ "in": "path",
1124
+ "type": "string",
1125
+ "required": true
1126
+ },
1127
+ "listId": {
1128
+ "in": "path",
1129
+ "type": "string",
1130
+ "required": true
1131
+ },
1132
+ "userId": {
1133
+ "in": "path",
1134
+ "type": "string",
1135
+ "required": true
1136
+ }
1137
+ }
1138
+ },
1117
1139
  "getAppInstallsStatistics": {
1118
1140
  "path": "/stats/app-installs",
1119
1141
  "method": "get",
@@ -1571,6 +1571,36 @@ export class AthomAppsAPI {
1571
1571
  payload?: Array<any>;
1572
1572
  }): Promise<any>;
1573
1573
 
1574
+ searchZigbeeDriver(opts: {
1575
+ language?: string;
1576
+
1577
+ homeyVersion?: string;
1578
+
1579
+ homeyPlatform?: string;
1580
+
1581
+ homeyMinimumSdkVersion?: number;
1582
+
1583
+ productId?: string;
1584
+
1585
+ manufacturerName?: string;
1586
+ }): Promise<any>;
1587
+
1588
+ searchZwaveDriver(opts: {
1589
+ language?: string;
1590
+
1591
+ homeyVersion?: string;
1592
+
1593
+ homeyPlatform?: string;
1594
+
1595
+ homeyMinimumSdkVersion?: number;
1596
+
1597
+ productId?: number;
1598
+
1599
+ productTypeId?: number;
1600
+
1601
+ manufacturerId?: number;
1602
+ }): Promise<any>;
1603
+
1574
1604
  browseApps(opts: {
1575
1605
  query?: string;
1576
1606
 
@@ -1829,6 +1859,36 @@ export class AthomAppsAPI {
1829
1859
  payload?: Array<any>;
1830
1860
  }): Promise<any>;
1831
1861
 
1862
+ searchZigbeeDriver(opts: {
1863
+ language?: string;
1864
+
1865
+ homeyVersion?: string;
1866
+
1867
+ homeyPlatform?: string;
1868
+
1869
+ homeyMinimumSdkVersion?: number;
1870
+
1871
+ productId?: string;
1872
+
1873
+ manufacturerName?: string;
1874
+ }): Promise<any>;
1875
+
1876
+ searchZwaveDriver(opts: {
1877
+ language?: string;
1878
+
1879
+ homeyVersion?: string;
1880
+
1881
+ homeyPlatform?: string;
1882
+
1883
+ homeyMinimumSdkVersion?: number;
1884
+
1885
+ productId?: number;
1886
+
1887
+ productTypeId?: number;
1888
+
1889
+ manufacturerId?: number;
1890
+ }): Promise<any>;
1891
+
1832
1892
  browseApps(opts: {
1833
1893
  query?: string;
1834
1894
 
@@ -2667,6 +2727,14 @@ export class AthomCloudAPI {
2667
2727
  tag?: string;
2668
2728
  }): Promise<any>;
2669
2729
 
2730
+ removeTagFromMailChimpUser(opts: {
2731
+ tag: string;
2732
+
2733
+ listId: string;
2734
+
2735
+ userId: string;
2736
+ }): Promise<any>;
2737
+
2670
2738
  getAppInstallsStatistics(): Promise<any>;
2671
2739
 
2672
2740
  getAppDriversStatistics(): Promise<any>;
@@ -3199,6 +3267,14 @@ export class AthomCloudAPI {
3199
3267
  tag?: string;
3200
3268
  }): Promise<any>;
3201
3269
 
3270
+ removeTagFromMailChimpUser(opts: {
3271
+ tag: string;
3272
+
3273
+ listId: string;
3274
+
3275
+ userId: string;
3276
+ }): Promise<any>;
3277
+
3202
3278
  getAppInstallsStatistics(): Promise<any>;
3203
3279
 
3204
3280
  getAppDriversStatistics(): Promise<any>;
@@ -4615,6 +4691,36 @@ export class AthomAppsAPI {
4615
4691
  payload?: Array<any>;
4616
4692
  }): Promise<any>;
4617
4693
 
4694
+ searchZigbeeDriver(opts: {
4695
+ language?: string;
4696
+
4697
+ homeyVersion?: string;
4698
+
4699
+ homeyPlatform?: string;
4700
+
4701
+ homeyMinimumSdkVersion?: number;
4702
+
4703
+ productId?: string;
4704
+
4705
+ manufacturerName?: string;
4706
+ }): Promise<any>;
4707
+
4708
+ searchZwaveDriver(opts: {
4709
+ language?: string;
4710
+
4711
+ homeyVersion?: string;
4712
+
4713
+ homeyPlatform?: string;
4714
+
4715
+ homeyMinimumSdkVersion?: number;
4716
+
4717
+ productId?: number;
4718
+
4719
+ productTypeId?: number;
4720
+
4721
+ manufacturerId?: number;
4722
+ }): Promise<any>;
4723
+
4618
4724
  browseApps(opts: {
4619
4725
  query?: string;
4620
4726
 
@@ -4873,6 +4979,36 @@ export class AthomAppsAPI {
4873
4979
  payload?: Array<any>;
4874
4980
  }): Promise<any>;
4875
4981
 
4982
+ searchZigbeeDriver(opts: {
4983
+ language?: string;
4984
+
4985
+ homeyVersion?: string;
4986
+
4987
+ homeyPlatform?: string;
4988
+
4989
+ homeyMinimumSdkVersion?: number;
4990
+
4991
+ productId?: string;
4992
+
4993
+ manufacturerName?: string;
4994
+ }): Promise<any>;
4995
+
4996
+ searchZwaveDriver(opts: {
4997
+ language?: string;
4998
+
4999
+ homeyVersion?: string;
5000
+
5001
+ homeyPlatform?: string;
5002
+
5003
+ homeyMinimumSdkVersion?: number;
5004
+
5005
+ productId?: number;
5006
+
5007
+ productTypeId?: number;
5008
+
5009
+ manufacturerId?: number;
5010
+ }): Promise<any>;
5011
+
4876
5012
  browseApps(opts: {
4877
5013
  query?: string;
4878
5014
 
@@ -5711,6 +5847,14 @@ export class AthomCloudAPI {
5711
5847
  tag?: string;
5712
5848
  }): Promise<any>;
5713
5849
 
5850
+ removeTagFromMailChimpUser(opts: {
5851
+ tag: string;
5852
+
5853
+ listId: string;
5854
+
5855
+ userId: string;
5856
+ }): Promise<any>;
5857
+
5714
5858
  getAppInstallsStatistics(): Promise<any>;
5715
5859
 
5716
5860
  getAppDriversStatistics(): Promise<any>;
@@ -6243,6 +6387,14 @@ export class AthomCloudAPI {
6243
6387
  tag?: string;
6244
6388
  }): Promise<any>;
6245
6389
 
6390
+ removeTagFromMailChimpUser(opts: {
6391
+ tag: string;
6392
+
6393
+ listId: string;
6394
+
6395
+ userId: string;
6396
+ }): Promise<any>;
6397
+
6246
6398
  getAppInstallsStatistics(): Promise<any>;
6247
6399
 
6248
6400
  getAppDriversStatistics(): Promise<any>;
@@ -638,7 +638,17 @@ class HomeyAPIV3 extends HomeyAPI {
638
638
  };
639
639
  }
640
640
 
641
- async connect() {
641
+ async connect({
642
+ onDisconnect = () => {},
643
+ onError = () => {},
644
+ onReconnect = () => {},
645
+ onReconnectAttempt = () => {},
646
+ onReconnecting = () => {},
647
+ onReconnectError = () => {},
648
+ onConnect = () => {},
649
+ onConnectError = () => {},
650
+ reconnect = true
651
+ } = {}) {
642
652
  if (!this.__connectPromise) {
643
653
  this.__connectPromise = Promise.resolve().then(async () => {
644
654
  // Ensure Base URL
@@ -657,40 +667,48 @@ class HomeyAPIV3 extends HomeyAPI {
657
667
  pingTimeout: 8000,
658
668
  pingInterval: 5000,
659
669
  },
660
- reconnection: true,
670
+ reconnection: reconnect,
661
671
  });
662
672
 
663
673
  this.__socket.on('disconnect', reason => {
664
674
  this.__debug('SocketIOClient.onDisconnect', reason);
675
+ onDisconnect(reason);
665
676
  });
666
677
 
667
678
  this.__socket.on('error', err => {
668
679
  this.__debug('SocketIOClient.onError', err.message);
680
+ onError(err);
669
681
  });
670
682
 
671
683
  this.__socket.on('reconnect', () => {
672
684
  this.__debug('SocketIOClient.onReconnect');
685
+ onReconnect();
673
686
  });
674
687
 
675
688
  this.__socket.on('reconnect_attempt', () => {
676
689
  this.__debug(`SocketIOClient.onReconnectAttempt`);
690
+ onReconnectAttempt();
677
691
  });
678
692
 
679
693
  this.__socket.on('reconnecting', attempt => {
680
694
  this.__debug(`SocketIOClient.onReconnecting (Attempt #${attempt})`);
695
+ onReconnecting(attempt);
681
696
  });
682
697
 
683
698
  this.__socket.on('reconnect_error', err => {
684
- this.__debug('SocketIOClient.onReconnectError', err.message);
699
+ this.__debug('SocketIOClient.onReconnectError', err.message, err);
700
+ onReconnectError(err);
685
701
  });
686
702
 
687
703
  this.__socket.on('connect_error', err => {
688
704
  this.__debug('SocketIOClient.onConnectError', err.message);
705
+ onConnectError(err);
689
706
  reject(err);
690
707
  });
691
708
 
692
709
  this.__socket.on('connect', () => {
693
710
  this.__debug('SocketIOClient.onConnect');
711
+ onConnect();
694
712
  this.__handshakeClient()
695
713
  .then(() => {
696
714
  this.__debug('SocketIOClient.onConnect.onHandshakeClientSuccess');
@@ -722,8 +740,12 @@ class HomeyAPIV3 extends HomeyAPI {
722
740
 
723
741
  if (this.__socket) {
724
742
  await new Promise(resolve => {
725
- this.__socket.once('disconnect', () => resolve());
726
- this.__socket.disconnect();
743
+ if (this.__socket.connected) {
744
+ this.__socket.once('disconnect', () => resolve());
745
+ this.__socket.disconnect();
746
+ } else {
747
+ resolve();
748
+ }
727
749
  this.__socket.removeAllListeners();
728
750
  this.__socket = null;
729
751
  });
package/lib/Util.js CHANGED
@@ -93,6 +93,7 @@ class Util {
93
93
  * @returns {boolean}
94
94
  */
95
95
  static isHTTPUnsecureSupported() {
96
+ if (this.isReactNative()) return true;
96
97
  if (typeof window === 'undefined') return true;
97
98
  if (typeof window.location === 'undefined') return false;
98
99
  return window.location.protocol === 'http:';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [