tipi-services
Version:
Node.js library to access wrapping REST API of tipi backend services
36 lines (27 loc) • 1.05 kB
JavaScript
const Service = require('../../../Service')
const Endpoints = require('./Endpoints')
class NotificationsService extends Service {
constructor (baseUrl) {
super()
this.endpoints = Endpoints(baseUrl)
}
async list (ownerId) {
return this.sendRequest({ endpoint: this.endpoints.list, params: { ownerId } })
}
async seenAll (ownerId) {
return this.sendRequest({ endpoint: this.endpoints.seenAll, params: { ownerId } })
}
async seen (ownerId, id) {
return this.sendRequest({ endpoint: this.endpoints.seen, params: { ownerId }, body: { id } })
}
async delivered (ownerId, id) {
return this.sendRequest({ endpoint: this.endpoints.delivered, params: { ownerId }, body: { id } })
}
async clear (ownerId) {
return this.sendRequest({ endpoint: this.endpoints.clear, params: { ownerId } })
}
async remove (ownerId, id) {
return this.sendRequest({ endpoint: this.endpoints.remove, params: { ownerId }, body: { id } })
}
}
module.exports = NotificationsService