UNPKG

dirigera

Version:

A TypeScript client for IKEA's DIRIGERA smart home hub

18 lines (17 loc) 562 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (got) => { return { async list() { const devices = await got.get(`devices`).json(); return devices.filter((d) => d.type === 'controller'); }, async get({ id }) { const device = await got.get(`devices/${id}`).json(); if (device.type !== 'controller') { throw new Error('The requested device is not a controller'); } return device; }, }; };