dirigera
Version:
A TypeScript client for IKEA's DIRIGERA smart home hub
44 lines (43 loc) • 1.17 kB
JavaScript
export default (got) => {
return {
async list() {
return await got.get(`scenes`).json();
},
async get({ id }) {
return await got.get(`scenes/${id}`).json();
},
async trigger({ id }) {
await got.post(`scenes/${id}/trigger`).json();
},
async undo({ id }) {
await got.post(`scenes/${id}/undo`).json();
},
async create({ info, type, actions, triggers, }) {
return await got
.post(`scenes`, {
json: {
info,
type,
actions,
triggers,
},
})
.json();
},
async delete({ id }) {
await got.delete(`scenes/${id}`);
},
async update({ id, info, type, actions, triggers, }) {
await got
.put(`scenes/${id}`, {
json: {
info,
type,
actions,
triggers,
},
})
.json();
},
};
};