UNPKG

dirigera

Version:

A TypeScript client for IKEA's DIRIGERA smart home hub

70 lines (69 loc) 1.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (got) => { return { async list() { const home = await got.get(`home`).json(); return home.deviceSets; }, async create({ name, icon }) { return await got .post(`device-set`, { json: { name, icon, }, }) .json(); }, async delete({ id }) { await got.delete(`device-set/${id}`); }, async update({ id, name, icon }) { await got .put(`device-set/${id}`, { json: { name, icon, }, }) .json(); }, async updateConfiguration({ id, deviceIds, roomId, remoteLinkIds, }) { await got .patch(`device-set/${id}/configuration`, { json: { deviceIds, roomId, remoteLinkIds, }, }) .json(); }, async setIsOn({ id, isOn }) { await got .patch(`devices/set/${id}`, { json: [ { attributes: { isOn, }, }, ], }) .json(); }, async setAttributes({ id, attributes, transitionTime, }) { await got .patch(`devices/set/${id}`, { json: [ { attributes, transitionTime, }, ], }) .json(); }, }; };