UNPKG

dirigera

Version:

A TypeScript client for IKEA's DIRIGERA smart home hub

46 lines (45 loc) 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.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(); }, }; };