homey-api 3.14.21 → 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.
package/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ - Package may be used freely with Homey products
2
+ - Source code is proprietary to Athom B.V.
3
+ - No warranty provided
@@ -1274,6 +1274,10 @@
1274
1274
  "expiresAt": {
1275
1275
  "type": "string",
1276
1276
  "in": "body"
1277
+ },
1278
+ "shopifyContractId": {
1279
+ "type": "string",
1280
+ "in": "body"
1277
1281
  }
1278
1282
  }
1279
1283
  },
@@ -1376,6 +1380,29 @@
1376
1380
  "userId": {
1377
1381
  "type": "string",
1378
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"
1379
1406
  }
1380
1407
  }
1381
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;
@@ -3758,6 +3770,8 @@ export class AthomCloudAPI {
3758
3770
  type?: string;
3759
3771
 
3760
3772
  expiresAt?: string;
3773
+
3774
+ shopifyContractId?: string;
3761
3775
  }): Promise<any>;
3762
3776
 
3763
3777
  transferHomeySelfHostedServerLifetimeLicense(opts: {
@@ -3800,6 +3814,16 @@ export class AthomCloudAPI {
3800
3814
  listId?: string;
3801
3815
 
3802
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>;
3803
3827
  }): Promise<any>;
3804
3828
 
3805
3829
  addTagToMailChimpUser(opts: {
@@ -4448,6 +4472,8 @@ export class AthomCloudAPI {
4448
4472
  type?: string;
4449
4473
 
4450
4474
  expiresAt?: string;
4475
+
4476
+ shopifyContractId?: string;
4451
4477
  }): Promise<any>;
4452
4478
 
4453
4479
  transferHomeySelfHostedServerLifetimeLicense(opts: {
@@ -4490,6 +4516,16 @@ export class AthomCloudAPI {
4490
4516
  listId?: string;
4491
4517
 
4492
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>;
4493
4529
  }): Promise<any>;
4494
4530
 
4495
4531
  addTagToMailChimpUser(opts: {
@@ -6030,6 +6066,18 @@ export class APIError extends Error {
6030
6066
 
6031
6067
  message: string;
6032
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
+
6033
6081
  statusCode: number;
6034
6082
 
6035
6083
  message: string;
@@ -7432,6 +7480,8 @@ export class AthomCloudAPI {
7432
7480
  type?: string;
7433
7481
 
7434
7482
  expiresAt?: string;
7483
+
7484
+ shopifyContractId?: string;
7435
7485
  }): Promise<any>;
7436
7486
 
7437
7487
  transferHomeySelfHostedServerLifetimeLicense(opts: {
@@ -7474,6 +7524,16 @@ export class AthomCloudAPI {
7474
7524
  listId?: string;
7475
7525
 
7476
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>;
7477
7537
  }): Promise<any>;
7478
7538
 
7479
7539
  addTagToMailChimpUser(opts: {
@@ -8122,6 +8182,8 @@ export class AthomCloudAPI {
8122
8182
  type?: string;
8123
8183
 
8124
8184
  expiresAt?: string;
8185
+
8186
+ shopifyContractId?: string;
8125
8187
  }): Promise<any>;
8126
8188
 
8127
8189
  transferHomeySelfHostedServerLifetimeLicense(opts: {
@@ -8164,6 +8226,16 @@ export class AthomCloudAPI {
8164
8226
  listId?: string;
8165
8227
 
8166
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>;
8167
8239
  }): Promise<any>;
8168
8240
 
8169
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,8 +1,9 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.14.21",
3
+ "version": "3.14.23",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
+ "license": "SEE LICENSE",
6
7
  "files": [
7
8
  "/lib",
8
9
  "/assets/specifications",