Repository navigation
Expand file tree
/
Copy pathapi.js
More file actions
68 lines (53 loc) · 1.89 KB
/
Copy pathapi.js
File metadata and controls
68 lines (53 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'use strict';
// App API at /api/app/dev.schweiger.dashboard/…
// Only the routes marked "public" in app.json are reachable without signing in: two let a new browser ask for a
// code and pick up the API key once its code is approved, three let a dashboard say which screen it is and read and
// close its widget highlight (saying hello and closing check the dashboard's key). Everything else needs a signed-in Homey session with app control, which the
// settings page in the Homey app has.
module.exports = {
async requestPairing({ homey, body }) {
return homey.app.requestPairing(body ?? {});
},
async getPairing({ homey, params }) {
return homey.app.getPairing(params.id);
},
async listPairings({ homey }) {
return homey.app.listPairings();
},
async approvePairing({ homey, params, body }) {
return homey.app.approvePairing(params.id, body ?? {});
},
async declinePairing({ homey, params }) {
return homey.app.declinePairing(params.id);
},
async getApiKeyStatus({ homey }) {
return homey.app.getApiKeyStatus();
},
async setApiKey({ homey, body }) {
return homey.app.setApiKey(body?.key);
},
async listScreens({ homey }) {
return homey.app.listScreens();
},
async renameScreen({ homey, params, body }) {
return homey.app.renameScreen(params.id, body ?? {});
},
async forgetScreen({ homey, params }) {
return homey.app.forgetScreen(params.id);
},
async screenHello({ homey, body }) {
return homey.app.screenHello(body ?? {});
},
async getHighlight({ homey, query }) {
return homey.app.getHighlight(query?.screen);
},
async closeHighlight({ homey, body }) {
return homey.app.closeHighlightFromScreen(body ?? {});
},
async getWidgetModes({ homey }) {
return homey.app.widgetModes();
},
async setWidgetMode({ homey, params, body }) {
return homey.app.setWidgetMode(params.id, body ?? {});
},
};