UNPKG

@chazepps/homebridge-hejhome

Version:

The Hejhome plugin allows you to access your Hejhome device(s) from HomeKit.

19 lines 590 B
import ky from 'ky'; export const hejRequest = async (platform, method, path, data = undefined, json = true) => { const url = `https://square.hej.so/${path}`; const response = await ky(url, { headers: { authorization: `Bearer ${platform.token}`, 'x-requested-with': 'XMLHttpRequest', Referer: 'https://square.hej.so/square', }, json: data, method, }); const text = await response.text(); if (json) { return JSON.parse(text || '[]'); } return text; }; //# sourceMappingURL=request.js.map