-
Notifications
You must be signed in to change notification settings - Fork 6
/
api.js
44 lines (36 loc) · 897 Bytes
/
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
41
42
43
44
'use strict';
module.exports = {
async playSound({ homey, params: { id } }) {
return homey.app.playSound({ id });
},
async getSounds({ homey }) {
const sounds = await homey.app.getSounds();
return sounds.map((sound) => ({
id: sound.id,
type: sound.type,
name: sound.name,
path: sound.path.startsWith('/')
? sound.path.substring(1)
: sound.path,
}));
},
async getSound({ homey, param: { id } }) {
return homey.app.getSound({ id });
},
async createSound({ homey, body: { type, name, buffer } }) {
return homey.app.createSound({
type,
name,
buffer,
});
},
async updateSound({ homey, params: { id }, body: { name } }) {
return homey.app.updateSound({
id,
name,
});
},
async deleteSound({ homey, params: { id } }) {
return homey.app.deleteSound({ id });
},
};