yoto-nodejs-client 0.0.2 → 0.0.4
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/README.md +523 -30
- package/bin/auth.js +36 -46
- package/bin/content.js +0 -0
- package/bin/device-model.d.ts +3 -0
- package/bin/device-model.d.ts.map +1 -0
- package/bin/device-model.js +360 -0
- package/bin/device-tui.TODO.md +125 -0
- package/bin/device-tui.d.ts +31 -0
- package/bin/device-tui.d.ts.map +1 -0
- package/bin/device-tui.js +1123 -0
- package/bin/devices.js +166 -28
- package/bin/groups.js +0 -0
- package/bin/icons.js +0 -0
- package/bin/lib/cli-helpers.d.ts +1 -1
- package/bin/lib/cli-helpers.d.ts.map +1 -1
- package/bin/lib/cli-helpers.js +5 -5
- package/bin/refresh-token.js +6 -6
- package/bin/token-info.js +3 -3
- package/index.d.ts +4 -585
- package/index.d.ts.map +1 -1
- package/index.js +11 -689
- package/lib/api-client.d.ts +576 -0
- package/lib/api-client.d.ts.map +1 -0
- package/lib/api-client.js +681 -0
- package/lib/api-endpoints/auth.d.ts +199 -8
- package/lib/api-endpoints/auth.d.ts.map +1 -1
- package/lib/api-endpoints/auth.js +224 -7
- package/lib/api-endpoints/auth.test.js +54 -2
- package/lib/api-endpoints/constants.d.ts +14 -8
- package/lib/api-endpoints/constants.d.ts.map +1 -1
- package/lib/api-endpoints/constants.js +17 -10
- package/lib/api-endpoints/content.test.js +1 -1
- package/lib/api-endpoints/devices.d.ts +405 -117
- package/lib/api-endpoints/devices.d.ts.map +1 -1
- package/lib/api-endpoints/devices.js +114 -52
- package/lib/api-endpoints/devices.test.js +1 -1
- package/lib/api-endpoints/{test-helpers.d.ts → endpoint-test-helpers.d.ts} +1 -1
- package/lib/api-endpoints/endpoint-test-helpers.d.ts.map +1 -0
- package/lib/api-endpoints/family-library-groups.test.js +1 -1
- package/lib/api-endpoints/family.test.js +1 -1
- package/lib/api-endpoints/icons.test.js +1 -1
- package/lib/helpers/power-state.d.ts +53 -0
- package/lib/helpers/power-state.d.ts.map +1 -0
- package/lib/helpers/power-state.js +73 -0
- package/lib/helpers/power-state.test.js +100 -0
- package/lib/helpers/temperature.d.ts +24 -0
- package/lib/helpers/temperature.d.ts.map +1 -0
- package/lib/helpers/temperature.js +61 -0
- package/lib/helpers/temperature.test.js +58 -0
- package/lib/helpers/typed-keys.d.ts +7 -0
- package/lib/helpers/typed-keys.d.ts.map +1 -0
- package/lib/helpers/typed-keys.js +8 -0
- package/lib/mqtt/client.d.ts +348 -22
- package/lib/mqtt/client.d.ts.map +1 -1
- package/lib/mqtt/client.js +213 -31
- package/lib/mqtt/factory.d.ts +22 -4
- package/lib/mqtt/factory.d.ts.map +1 -1
- package/lib/mqtt/factory.js +27 -5
- package/lib/mqtt/mqtt.test.js +85 -28
- package/lib/mqtt/topics.d.ts +41 -13
- package/lib/mqtt/topics.d.ts.map +1 -1
- package/lib/mqtt/topics.js +54 -20
- package/lib/pkg.d.cts +8 -0
- package/lib/token.d.ts +21 -6
- package/lib/token.d.ts.map +1 -1
- package/lib/token.js +30 -23
- package/lib/yoto-account.d.ts +163 -0
- package/lib/yoto-account.d.ts.map +1 -0
- package/lib/yoto-account.js +340 -0
- package/lib/yoto-device.d.ts +656 -0
- package/lib/yoto-device.d.ts.map +1 -0
- package/lib/yoto-device.js +2850 -0
- package/package.json +21 -15
- package/lib/api-endpoints/test-helpers.d.ts.map +0 -1
- /package/lib/api-endpoints/{test-helpers.js → endpoint-test-helpers.js} +0 -0
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Default OAuth client ID for testing and development
|
|
3
|
-
* This is a public client ID
|
|
3
|
+
* This is a public client ID for the app "yoto-nodejs-client".
|
|
4
|
+
* Generate a new one at https://dashboard.yoto.dev or use the default.
|
|
4
5
|
* @constant {string}
|
|
5
6
|
*/
|
|
6
7
|
export const DEFAULT_CLIENT_ID = 'ix91Qy0B4uA8187JhI0tQbQQ5I5nUKYh'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Yoto API base URL
|
|
10
11
|
* @constant {string}
|
|
11
12
|
*/
|
|
12
|
-
export const
|
|
13
|
+
export const YOTO_API_URL = 'https://api.yotoplay.com'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
* Includes OpenID Connect, profile information, and offline access (refresh tokens)
|
|
16
|
+
* Yoto login/authentication base URL
|
|
17
17
|
* @constant {string}
|
|
18
18
|
*/
|
|
19
|
-
export const
|
|
19
|
+
export const YOTO_LOGIN_URL = 'https://login.yotoplay.com'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Yoto API
|
|
22
|
+
* Default OAuth audience for Yoto API
|
|
23
23
|
* @constant {string}
|
|
24
24
|
*/
|
|
25
|
-
export const
|
|
25
|
+
export const DEFAULT_AUDIENCE = YOTO_API_URL
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Default OAuth scope for Yoto API
|
|
29
|
+
* Includes OpenID Connect, profile information, and offline access (refresh tokens)
|
|
29
30
|
* @constant {string}
|
|
30
31
|
*/
|
|
31
|
-
export const
|
|
32
|
+
export const DEFAULT_SCOPE = 'openid profile offline_access'
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* OAuth device code grant type
|
|
36
|
+
* @constant {string}
|
|
37
|
+
*/
|
|
38
|
+
export const DEVICE_CODE_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code'
|
|
@@ -2,7 +2,7 @@ import test from 'node:test'
|
|
|
2
2
|
import assert from 'node:assert'
|
|
3
3
|
import { getContent, getUserMyoContent } from './content.js'
|
|
4
4
|
import { YotoAPIError } from './helpers.js'
|
|
5
|
-
import { loadTestTokens, logResponse } from './test-helpers.js'
|
|
5
|
+
import { loadTestTokens, logResponse } from './endpoint-test-helpers.js'
|
|
6
6
|
|
|
7
7
|
const { accessToken } = loadTestTokens()
|
|
8
8
|
|