UNPKG

tipi-services

Version:

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

33 lines (24 loc) 993 B
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class LabeledPinsService extends Service { constructor (baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async add (id, data) { return this.sendRequest({ endpoint: this.endpoints.add, body: data, params: { id } }) } async setAsDefault (id, index, data) { return this.sendRequest({ endpoint: this.endpoints.setAsDefault, body: data, params: { id, index } }) } async unsetDefault (id, index, data) { return this.sendRequest({ endpoint: this.endpoints.unsetDefault, body: data, params: { id, index } }) } async removeByIndex (id, index, data) { return this.sendRequest({ endpoint: this.endpoints.removeByIndex, body: data, params: { id, index } }) } async removeAll (id, data) { return this.sendRequest({ endpoint: this.endpoints.removeAll, body: data, params: { id } }) } } module.exports = LabeledPinsService