homey-api 3.4.32 → 3.4.33
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/lib/HomeyAPI/HomeyAPI.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
const Util = require('../Util');
|
|
4
4
|
const EventEmitter = require('../EventEmitter');
|
|
5
5
|
|
|
6
|
+
const tierCache = {};
|
|
7
|
+
const versionCache = {};
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* An authenticated Homey API. Do not construct this class manually.
|
|
8
11
|
* @class
|
|
@@ -49,6 +52,18 @@ class HomeyAPI extends EventEmitter {
|
|
|
49
52
|
}) {
|
|
50
53
|
super();
|
|
51
54
|
|
|
55
|
+
Object.defineProperty(this, '__tierCache', {
|
|
56
|
+
value: tierCache,
|
|
57
|
+
enumerable: false,
|
|
58
|
+
writable: false,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
Object.defineProperty(this, '__versionCache', {
|
|
62
|
+
value: versionCache,
|
|
63
|
+
enumerable: false,
|
|
64
|
+
writable: false,
|
|
65
|
+
});
|
|
66
|
+
|
|
52
67
|
// Set Debug Enabled
|
|
53
68
|
Object.defineProperty(this, '__debugFunction', {
|
|
54
69
|
value: debug,
|
|
@@ -16,9 +16,6 @@ const ManagerUsers = require('./HomeyAPIV3/ManagerUsers');
|
|
|
16
16
|
// eslint-disable-next-line no-unused-vars
|
|
17
17
|
const Manager = require('./HomeyAPIV3/Manager');
|
|
18
18
|
|
|
19
|
-
const tierCache = {};
|
|
20
|
-
const versionCache = {};
|
|
21
|
-
|
|
22
19
|
/**
|
|
23
20
|
* An authenticated Homey API. Do not construct this class manually.
|
|
24
21
|
* @class
|
|
@@ -138,14 +135,6 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
138
135
|
})();
|
|
139
136
|
}
|
|
140
137
|
|
|
141
|
-
get tier() {
|
|
142
|
-
return tierCache[this.id];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
get version() {
|
|
146
|
-
return versionCache[this.id];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
138
|
get strategyId() {
|
|
150
139
|
return this.__strategyId;
|
|
151
140
|
}
|
|
@@ -472,11 +461,11 @@ class HomeyAPIV3 extends HomeyAPI {
|
|
|
472
461
|
const resHeadersContentType = res.headers.get('Content-Type');
|
|
473
462
|
const version = res.headers.get('x-homey-version');
|
|
474
463
|
if (version) {
|
|
475
|
-
|
|
464
|
+
this.__versionCache[this.id] = version;
|
|
476
465
|
}
|
|
477
466
|
const tier = res.headers.get('x-homey-tier');
|
|
478
467
|
if (tier) {
|
|
479
|
-
|
|
468
|
+
this.__tierCache[this.id] = tier;
|
|
480
469
|
}
|
|
481
470
|
|
|
482
471
|
const resBodyText = await res.text();
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const HomeyAPIV3 = require('./HomeyAPIV3');
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* This class is returned by {@link AthomCloudAPI.Homey#authenticate} for a Homey with `platform: 'cloud'` and `platformVersion: 1`.
|
|
7
8
|
*
|
|
@@ -33,6 +34,14 @@ class HomeyAPIV3Cloud extends HomeyAPIV3 {
|
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
get tier() {
|
|
38
|
+
return this.__tierCache[this.id];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get version() {
|
|
42
|
+
return this.__versionCache[this.id];
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
get platform() {
|
|
37
46
|
return 'cloud';
|
|
38
47
|
}
|