-
Notifications
You must be signed in to change notification settings - Fork 8
/
api.js
40 lines (35 loc) · 1.1 KB
/
api.js
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
module.exports = {
async testBroker({ homey, params, body }) {
console.log("API: Incoming POST on /set/broker/");
const result = await homey.app.testBroker(params);
return result;
},
async updateSettings({ homey, params, body }) {
console.log("API: Incoming POST on /test/settingschange/");
const result = homey.app.changedSettings(body);
return result;
},
async getLoglines({ homey, query }) {
console.log("API: Incoming POST on /test/getloglines/");
const result = homey.app.getLogLines();
return result;
},
async sendMessage({ homey, params, body }) {
console.log("API: Incoming POST on /send/ ");
if (!homey.app) {
console.log("API: App not yet available");
return ("too soon");
}
const result = homey.app.sendMessage(body);
return result;
},
async subscribeTopic({ homey, params, body }) {
console.log("API: Incoming POST on /subscribe/");
if (!homey.app) {
console.log("API: App not yet available");
return ("too soon");
}
const result = homey.app.subscribeToTopic(body.topic);
return result;
},
};