UNPKG

nuki-web-api

Version:

Node.js implementation (using promises) of the Nuki Web API

24 lines (20 loc) 738 B
'use strict'; /** * This function returns the notifications of all smartlocks. * * @memberof Nuki * @description Get a list of notifications for all of your smartlocks * @param {Integer} [notificationId] The notification id * @returns {Promise} * @see https://api.nuki.io/#!/Notification */ module.exports.getNotification = function(notificationId) { return this ._req('notification' + (notificationId ? '/' + notificationId : '')) .then(function(notifications) { if ((!notificationId && !Array.isArray(notifications)) || (notificationId && typeof notifications != 'object')) { throw new Error('Did not receive notifications!'); } return notifications; }); };