-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.js
41 lines (41 loc) · 919 Bytes
/
actions.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
export default function (self) {
self.setActionDefinitions({
set_syncer: {
name: 'Set Syncer State',
options: [
{
id: 'groupId',
type: 'textinput',
label: 'Remote Group ID',
required: true,
regex: '^[a-z0-9-]+$',
},
{
id: 'show',
type: 'dropdown',
label: 'Show',
default: 'true',
choices: [
{ id: 'true', label: 'True' },
{ id: 'false', label: 'False' },
{ id: 'toggle', label: 'Toggle' },
],
required: true,
},
],
callback: async (event) => {
const res = await fetch(`https://syncer.live/control?groupId=${event.options.groupId}`, {
method: 'POST',
body: JSON.stringify({
show: event.options.show,
}),
headers: {
'Content-Type': 'application/json',
},
})
const data = await res.json()
self.log('debug', `Received ${JSON.stringify(data)}`)
},
},
})
}