node-hue-api
Version:
Philips Hue API Library for Node.js
27 lines (26 loc) • 884 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.nupnp = void 0;
const HttpClientFetch_1 = require("../http/HttpClientFetch");
const ca_chain_1 = require("./ca-chain");
const ApiError_1 = require("../../ApiError");
function nupnp() {
return (0, HttpClientFetch_1.request)({
url: 'https://discovery.meethue.com',
json: true,
httpsAgent: (0, ca_chain_1.getDiscoveryMeetHueHttpsAgent)(),
method: 'GET',
})
.catch(err => {
throw new ApiError_1.ApiError(`Problems resolving hue bridges, ${err.message}`);
})
.then(response => {
if (response.status === 200) {
return response.data;
}
else {
throw new ApiError_1.ApiError(`Status code unexpected when using N-UPnP endpoint: ${response.status}`);
}
});
}
exports.nupnp = nupnp;