tipi-services
Version:
Node.js library to access wrapping REST API of tipi backend services
24 lines (18 loc) • 621 B
JavaScript
const Service = require('../../../Service')
const Endpoints = require('./Endpoints')
class MessagesService extends Service {
constructor (baseUrl) {
super()
this.endpoints = Endpoints(baseUrl)
}
async create (data) {
return this.sendRequest({ endpoint: this.endpoints.create, body: data })
}
async seen (id, data) {
return this.sendRequest({ endpoint: this.endpoints.seen, params: { id }, body: data })
}
async unseen (id, data) {
return this.sendRequest({ endpoint: this.endpoints.unseen, params: { id }, body: data })
}
}
module.exports = MessagesService