Comparing version 0.2.0 to 0.2.1
var Utils = require('./utils'); | ||
var extend = require('extend'); | ||
var Hoek = require('hoek'); | ||
var Joi = require('joi'); | ||
var Event = require('./event'); | ||
@@ -22,2 +25,29 @@ var Subscription = function(_obj) { | ||
Subscription.prototype.notifications = function(_options) { | ||
var self = this; | ||
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {}); | ||
Joi.assert(_options, Utils.paginationOptions); | ||
return Utils.request.get( | ||
'events', | ||
'devices/' + this.deviceId + '/subscriptions/' + this.id + '/notifications', | ||
_options).then(function(resp) { | ||
return Utils.listResponse(resp, 'notifications', self.notifications, self); | ||
}); | ||
}; | ||
Subscription.prototype.events = function(_options) { | ||
var self = this; | ||
_options = Hoek.applyToDefaults({ offset: 0, limit: 20 }, _options || {}); | ||
Joi.assert(_options, Utils.paginationOptions); | ||
return Utils.request.get( | ||
'events', | ||
'devices/' + this.deviceId + '/subscriptions/' + this.id + '/events', | ||
_options).then(function(resp) { | ||
resp.events = resp.events.map(function(v) { return new Event(v); }); | ||
return Utils.listResponse(resp, 'events', self.events, self); | ||
}); | ||
}; | ||
module.exports = Subscription; |
{ | ||
"name": "vinli", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Official Node.js SDK for interacting with the Vinli Platform", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80080
35
1684