homey-api 3.14.22 → 3.14.23

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.
@@ -1380,6 +1380,29 @@
1380
1380
  "userId": {
1381
1381
  "type": "string",
1382
1382
  "in": "body"
1383
+ },
1384
+ "tags": {
1385
+ "type": "array",
1386
+ "in": "body"
1387
+ }
1388
+ }
1389
+ },
1390
+ "upsertUserToMailChimp": {
1391
+ "path": "/mail/mailchimp",
1392
+ "method": "put",
1393
+ "private": true,
1394
+ "parameters": {
1395
+ "listId": {
1396
+ "type": "string",
1397
+ "in": "body"
1398
+ },
1399
+ "userId": {
1400
+ "type": "string",
1401
+ "in": "body"
1402
+ },
1403
+ "tags": {
1404
+ "type": "array",
1405
+ "in": "body"
1383
1406
  }
1384
1407
  }
1385
1408
  },
@@ -2291,6 +2291,18 @@ export class APIError extends Error {
2291
2291
 
2292
2292
  message: string;
2293
2293
 
2294
+ message: string;
2295
+
2296
+ statusCode: number;
2297
+
2298
+ message: string;
2299
+
2300
+ message: string;
2301
+ }
2302
+
2303
+ export class APIErrorHomeyInvalidSerialNumber extends APIError {
2304
+ statusCode: number;
2305
+
2294
2306
  statusCode: number;
2295
2307
 
2296
2308
  message: string;
@@ -2551,6 +2563,18 @@ export class APIError extends Error {
2551
2563
 
2552
2564
  message: string;
2553
2565
 
2566
+ message: string;
2567
+
2568
+ statusCode: number;
2569
+
2570
+ message: string;
2571
+
2572
+ message: string;
2573
+ }
2574
+
2575
+ export class APIErrorHomeyInvalidSerialNumber extends APIError {
2576
+ statusCode: number;
2577
+
2554
2578
  statusCode: number;
2555
2579
 
2556
2580
  message: string;
@@ -2356,6 +2356,18 @@ export class APIError extends Error {
2356
2356
 
2357
2357
  message: string;
2358
2358
 
2359
+ message: string;
2360
+
2361
+ statusCode: number;
2362
+
2363
+ message: string;
2364
+
2365
+ message: string;
2366
+ }
2367
+
2368
+ export class APIErrorHomeyInvalidSerialNumber extends APIError {
2369
+ statusCode: number;
2370
+
2359
2371
  statusCode: number;
2360
2372
 
2361
2373
  message: string;
@@ -3802,6 +3814,16 @@ export class AthomCloudAPI {
3802
3814
  listId?: string;
3803
3815
 
3804
3816
  userId?: string;
3817
+
3818
+ tags?: Array<any>;
3819
+ }): Promise<any>;
3820
+
3821
+ upsertUserToMailChimp(opts: {
3822
+ listId?: string;
3823
+
3824
+ userId?: string;
3825
+
3826
+ tags?: Array<any>;
3805
3827
  }): Promise<any>;
3806
3828
 
3807
3829
  addTagToMailChimpUser(opts: {
@@ -4494,6 +4516,16 @@ export class AthomCloudAPI {
4494
4516
  listId?: string;
4495
4517
 
4496
4518
  userId?: string;
4519
+
4520
+ tags?: Array<any>;
4521
+ }): Promise<any>;
4522
+
4523
+ upsertUserToMailChimp(opts: {
4524
+ listId?: string;
4525
+
4526
+ userId?: string;
4527
+
4528
+ tags?: Array<any>;
4497
4529
  }): Promise<any>;
4498
4530
 
4499
4531
  addTagToMailChimpUser(opts: {
@@ -6034,6 +6066,18 @@ export class APIError extends Error {
6034
6066
 
6035
6067
  message: string;
6036
6068
 
6069
+ message: string;
6070
+
6071
+ statusCode: number;
6072
+
6073
+ message: string;
6074
+
6075
+ message: string;
6076
+ }
6077
+
6078
+ export class APIErrorHomeyInvalidSerialNumber extends APIError {
6079
+ statusCode: number;
6080
+
6037
6081
  statusCode: number;
6038
6082
 
6039
6083
  message: string;
@@ -7480,6 +7524,16 @@ export class AthomCloudAPI {
7480
7524
  listId?: string;
7481
7525
 
7482
7526
  userId?: string;
7527
+
7528
+ tags?: Array<any>;
7529
+ }): Promise<any>;
7530
+
7531
+ upsertUserToMailChimp(opts: {
7532
+ listId?: string;
7533
+
7534
+ userId?: string;
7535
+
7536
+ tags?: Array<any>;
7483
7537
  }): Promise<any>;
7484
7538
 
7485
7539
  addTagToMailChimpUser(opts: {
@@ -8172,6 +8226,16 @@ export class AthomCloudAPI {
8172
8226
  listId?: string;
8173
8227
 
8174
8228
  userId?: string;
8229
+
8230
+ tags?: Array<any>;
8231
+ }): Promise<any>;
8232
+
8233
+ upsertUserToMailChimp(opts: {
8234
+ listId?: string;
8235
+
8236
+ userId?: string;
8237
+
8238
+ tags?: Array<any>;
8175
8239
  }): Promise<any>;
8176
8240
 
8177
8241
  addTagToMailChimpUser(opts: {
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ const APIError = require('./APIError');
4
+
5
+ /**
6
+ * Thrown when Homey serial number is invalid.
7
+ * @class
8
+ * @hideconstructor
9
+ * @extends APIError
10
+ */
11
+ class APIErrorHomeyInvalidSerialNumber extends APIError {
12
+ /**
13
+ *
14
+ * @param {string} message
15
+ * @param {number} statusCode
16
+ */
17
+ constructor(message, statusCode) {
18
+ super(message);
19
+
20
+ /**
21
+ * Error message
22
+ * @var {string} APIError#message
23
+ */
24
+
25
+ /**
26
+ * HTTP Status Code
27
+ * @type {number}
28
+ */
29
+ this.statusCode = statusCode;
30
+ }
31
+ }
32
+
33
+ module.exports = APIErrorHomeyInvalidSerialNumber;
@@ -3,6 +3,7 @@
3
3
  const SocketIOClient = require('socket.io-client');
4
4
  const APIErrorHomeyOffline = require('../APIErrorHomeyOffline');
5
5
  const APIErrorHomeySubscriptionInactive = require('../APIErrorHomeySubscriptionInactive');
6
+ const APIErrorHomeyInvalidSerialNumber = require('../APIErrorHomeyInvalidSerialNumber');
6
7
  const Util = require('../Util');
7
8
  const HomeyAPI = require('./HomeyAPI');
8
9
  const HomeyAPIError = require('./HomeyAPIError');
@@ -293,6 +294,12 @@ class HomeyAPIV3 extends HomeyAPI {
293
294
  parsed.statusCode === 403
294
295
  ) {
295
296
  throw new APIErrorHomeySubscriptionInactive(parsed.error, parsed.statusCode);
297
+ } else if (
298
+ parsed.error &&
299
+ parsed.error === 'Invalid Serial Number' &&
300
+ parsed.statusCode === 403
301
+ ) {
302
+ throw new APIErrorHomeyInvalidSerialNumber(parsed.error, parsed.statusCode);
296
303
  }
297
304
  }
298
305
 
@@ -401,7 +408,10 @@ class HomeyAPIV3 extends HomeyAPI {
401
408
  promises.push(pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]);
402
409
  }
403
410
 
404
- if (error instanceof APIErrorHomeySubscriptionInactive) {
411
+ if (
412
+ error instanceof APIErrorHomeySubscriptionInactive ||
413
+ error instanceof APIErrorHomeyInvalidSerialNumber
414
+ ) {
405
415
  throw error;
406
416
  }
407
417
 
@@ -415,14 +425,20 @@ class HomeyAPIV3 extends HomeyAPI {
415
425
  .catch((error) => {
416
426
  if (error instanceof AggregateError) {
417
427
  for (const err of error.errors) {
418
- if (err instanceof APIErrorHomeySubscriptionInactive) {
428
+ if (
429
+ err instanceof APIErrorHomeySubscriptionInactive ||
430
+ err instanceof APIErrorHomeyInvalidSerialNumber
431
+ ) {
419
432
  reject(err);
420
433
  return;
421
434
  }
422
435
  }
423
436
  }
424
437
 
425
- if (error instanceof APIErrorHomeySubscriptionInactive) {
438
+ if (
439
+ error instanceof APIErrorHomeySubscriptionInactive ||
440
+ error instanceof APIErrorHomeyInvalidSerialNumber
441
+ ) {
426
442
  reject(error);
427
443
  return;
428
444
  }
@@ -437,7 +453,10 @@ class HomeyAPIV3 extends HomeyAPI {
437
453
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
438
454
  .then((result) => resolve(result))
439
455
  .catch((err) => {
440
- if (err instanceof APIErrorHomeySubscriptionInactive) {
456
+ if (
457
+ err instanceof APIErrorHomeySubscriptionInactive ||
458
+ err instanceof APIErrorHomeyInvalidSerialNumber
459
+ ) {
441
460
  reject(err);
442
461
  return;
443
462
  }
@@ -454,7 +473,10 @@ class HomeyAPIV3 extends HomeyAPI {
454
473
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
455
474
  .then((result) => resolve(result))
456
475
  .catch((err) => {
457
- if (err instanceof APIErrorHomeySubscriptionInactive) {
476
+ if (
477
+ err instanceof APIErrorHomeySubscriptionInactive ||
478
+ err instanceof APIErrorHomeyInvalidSerialNumber
479
+ ) {
458
480
  reject(err);
459
481
  return;
460
482
  }
@@ -471,7 +493,10 @@ class HomeyAPIV3 extends HomeyAPI {
471
493
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
472
494
  .then((result) => resolve(result))
473
495
  .catch((err) => {
474
- if (err instanceof APIErrorHomeySubscriptionInactive) {
496
+ if (
497
+ err instanceof APIErrorHomeySubscriptionInactive ||
498
+ err instanceof APIErrorHomeyInvalidSerialNumber
499
+ ) {
475
500
  reject(err);
476
501
  return;
477
502
  }
@@ -484,7 +509,10 @@ class HomeyAPIV3 extends HomeyAPI {
484
509
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
485
510
  .then((result) => resolve(result))
486
511
  .catch((err) => {
487
- if (err instanceof APIErrorHomeySubscriptionInactive) {
512
+ if (
513
+ err instanceof APIErrorHomeySubscriptionInactive ||
514
+ err instanceof APIErrorHomeyInvalidSerialNumber
515
+ ) {
488
516
  reject(err);
489
517
  return;
490
518
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.14.22",
3
+ "version": "3.14.23",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "license": "SEE LICENSE",