deskbookers
Advanced tools
Comparing version 3.3.6 to 4.0.0
@@ -253,3 +253,7 @@ (function (global, factory) { | ||
value: function () { | ||
var _ref7 = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(userId, type) { | ||
var _ref7 = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(_ref8) { | ||
var userId = _ref8.userId, | ||
type = _ref8.type, | ||
id = _ref8.id; | ||
var body; | ||
return regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
@@ -259,13 +263,20 @@ while (1) { | ||
case 0: | ||
_context4.next = 2; | ||
body = { | ||
type: type, | ||
id: id | ||
}; | ||
clean(body); | ||
console.log(userId, body); | ||
_context4.next = 5; | ||
return this.request({ | ||
method: 'PUT', | ||
path: 'notifications/' + userId, | ||
body: { type: type } | ||
body: { body: body } | ||
}); | ||
case 2: | ||
case 5: | ||
return _context4.abrupt('return', _context4.sent); | ||
case 3: | ||
case 6: | ||
case 'end': | ||
@@ -278,3 +289,3 @@ return _context4.stop(); | ||
function flagAsRead(_x4, _x5) { | ||
function flagAsRead(_x4) { | ||
return _ref7.apply(this, arguments); | ||
@@ -288,3 +299,3 @@ } | ||
value: function () { | ||
var _ref8 = _asyncToGenerator(regeneratorRuntime.mark(function _callee5() { | ||
var _ref9 = _asyncToGenerator(regeneratorRuntime.mark(function _callee5() { | ||
return regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
@@ -312,3 +323,3 @@ while (1) { | ||
function _delete() { | ||
return _ref8.apply(this, arguments); | ||
return _ref9.apply(this, arguments); | ||
} | ||
@@ -315,0 +326,0 @@ |
@@ -113,8 +113,7 @@ # Notifications | ||
## `flagAsRead(userId, type)` | ||
Mark notification read for a given `type`(optional) in the body as a json and for a given `userId`. | ||
## `flagAsRead({userId, type, id})` | ||
Mark notification read for a given `type`(optional) or notification `id` in the body as a json and for a given `userId`. | ||
```js | ||
const data = await deskbookers.notifications.flagAsRead(2, 'fluffycorgi') | ||
const data = await deskbookers.notifications.flagAsRead({userId: 2, type: 'fluffycorgi'}) | ||
``` | ||
@@ -121,0 +120,0 @@ |
{ | ||
"name": "deskbookers", | ||
"version": "3.3.6", | ||
"version": "4.0.0", | ||
"description": "Deskbookers API JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -74,7 +74,7 @@ # Deskbookers JavaScript SDK | ||
* [`list(userId, start, limit, type, unread, noCache)`](docs/notifications.md#listuserid-start-limit-type-unread-nocache) | ||
* [`count(userId, start, limit, type, unread, noCache)`](docs/notifications.md#countuserid-start-limit-type-unread-nocache) | ||
* [`count(userId, type, unread, noCache)`](docs/notifications.md#countuserid-start-limit-type-unread-nocache) | ||
* [`create(notification)`](docs/notifications.md#createnotification) | ||
* [`update(userId, body)`](docs/notifications.md#updateuserid-body) | ||
* [`flagAsRead(userId, body, id)`](docs/notifications.md#flagasreaduserid-body-id) | ||
* [`delete()`](docs/notifications.md#delete) | ||
* bookings | ||
* [`month(date, venueId)`](docs/bookings.md#monthdate-venueid) |
@@ -158,2 +158,11 @@ import dotenv from 'dotenv' | ||
test('mark notification read by id', async t => { | ||
// Prepare API | ||
const deskbookers = await client(true) | ||
t.truthy(deskbookers.session) | ||
const data = await deskbookers.notifications.flagAsRead({userId: 2, id: 1}) | ||
t.truthy(data) | ||
}) | ||
test('mark notification read by type', async t => { | ||
@@ -164,3 +173,3 @@ // Prepare API | ||
const data = await deskbookers.notifications.flagAsRead(2, 'fluffycorgi') | ||
const data = await deskbookers.notifications.flagAsRead({userId: 2, type: 'fluffycorgi'}) | ||
t.truthy(data) | ||
@@ -174,3 +183,3 @@ }) | ||
const data = await deskbookers.notifications.flagAsRead(3) | ||
const data = await deskbookers.notifications.flagAsRead({userId:3}) | ||
t.truthy(data) | ||
@@ -177,0 +186,0 @@ }) |
299609
4226