UNPKG

tipi-services

Version:

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

58 lines (42 loc) 1.65 kB
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class CardsService extends Service { constructor (baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async create (data) { return this.sendRequest({ endpoint: this.endpoints.create, body: data }) } async update (id, data) { return this.sendRequest({ endpoint: this.endpoints.update, params: { id }, body: data }) } async set (data) { return this.sendRequest({ endpoint: this.endpoints.set, body: data }) } async details (id, ownerId) { return this.sendRequest({ endpoint: this.endpoints.details, params: { id }, query: { ownerId }}) } async move (id, data) { return this.sendRequest({ endpoint: this.endpoints.move, params: { id }, body: data }) } async assign (id, data) { return this.sendRequest({ endpoint: this.endpoints.assign, params: { id }, body: data }) } async unAssign (id, data) { return this.sendRequest({ endpoint: this.endpoints.unAssign, params: { id }, body: data }) } async remove (id, data) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { id }, body: data }) } async archive (id, data) { return this.sendRequest({ endpoint: this.endpoints.archive, params: { id }, body: data }) } async unArchive (id, data) { return this.sendRequest({ endpoint: this.endpoints.unArchive, params: { id }, body: data }) } async batchArchive (data) { return this.sendRequest({ endpoint: this.endpoints.batchArchive, body: data }) } } module.exports = CardsService