Skip to content
This repository was archived by the owner on May 28, 2024. It is now read-only.

Latest commit

 

History

History
135 lines (115 loc) · 3.33 KB

File metadata and controls

135 lines (115 loc) · 3.33 KB

Notifications

list({userId, start, limit, type, unread, noCache})

List all avaiable notifications for a given userId, type or if unread

Params

Name Type Required Description
userId int Yes ID of the venue
start string Yes Start row
limit string Yes Limit results per request
type string No Filter results by type
unread bool No Filter results by unread
noCache bool No Reset and rebuild cache
const data = await deskbookers.notifications.list(
  {userId: 999999999, start: 0, limit: 10, type: 'blue-corgi', unread: false}
)

Example response

[
  {
    "id": 2457,
    "userId": 999999999,
    "context": "v12345",
    "meta": {
      "userName": "User Name",
      "companyName": "Company"
    },
    "createdDate": "2017-06-27T13:03:42.323Z",
    "readedDate": null,
    "type": "corgi"
  },
  {
    "id": 2458,
    "userId": 999999999,
    "context": "v12345",
    "meta": {
      "userName": "User Name2",
      "companyName": "Company2"
    },
    "createdDate": "2017-06-27T13:03:42.344Z",
    "readedDate": null,
    "type": "blue-corgi"
  }
]

count({userId, type, unread, noCache})

Count all avaiable notifications for a given userId, type or if unread

Params

Name Type Required Description
userId int Yes ID of the venue
type string No Filter results by type
unread bool No Filter results by unread
noCache bool No Reset and rebuild cache
const data = await deskbookers.notifications.count(
  {userId: 999999999, type: 'blue-corgi', unread: false}
)

Example response

[
  {
    "count": "2"
  }
]

create(notification)

Create a new notification for a given Object in the body as a json.

Body

Name Type Required Description
userId int Yes ID of the user
type string Yes Notification type
context string No Venue or Provider id
meta Object No Data to show (type based)
createdDate Timestamp Yes Date notification was created
readedDate Timestamp No Date user read notification
const data = await deskbookers.notifications.create(
  {
    userId: 2, 
    type: 'fluffycorgi',
    context: 'c12345',
    meta:'{"clientName": "Chompers", "companyName": "Lambda3"}',
    createdDate: 1498653156259
  }
)

Example response

{
  "status": "ok"
}

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.

const data = await deskbookers.notifications.flagAsRead({userId: 2, type: 'fluffycorgi'})

Example response

{
  "status": "ok"
}

delete()

Delete notifications created more than 15 days

Example response

{
  "status": "ok"
}