UNPKG

tipi-services

Version:

Node.js library to access wrapping REST API of tipi backend services

33 lines (24 loc) 835 B
const Service = require('../../../Service'); const Endpoints = require('./Endpoints') class ReviewsService extends Service { constructor(baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async list (query) { return this.sendRequest({ endpoint: this.endpoints.list, query }) } async seen (id, data) { return this.sendRequest({ endpoint: this.endpoints.seen, params: { id }, body: data }) } async create (data) { return this.sendRequest({ endpoint: this.endpoints.create, body: data }) } async remove (id) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { id } }) } async update (id, data) { return this.sendRequest({ endpoint: this.endpoints.update, params: { id }, body: data }) } } module.exports = ReviewsService