UNPKG

tipi-services

Version:

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

37 lines (27 loc) 1.01 kB
const Service = require('../../../Service'); const Endpoints = require('./Endpoints') class SettingsService extends Service { constructor(baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async create(data) { return this.sendRequest({ endpoint: this.endpoints.create, body: data }) } async details(id) { return this.sendRequest({ endpoint: this.endpoints.details, params: { id } }) } async batchDetails (ids, asObject = false, withMissedItems = false) { return this.sendRequest({ endpoint: this.endpoints.batchDetails, body: { ids, asObject, withMissedItems } }) } async list(query) { return this.sendRequest({ endpoint: this.endpoints.list, query }) } async update(id, data) { return this.sendRequest({ endpoint: this.endpoints.update, params: { id }, body: data }) } async remove(id) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { id } }) } } module.exports = SettingsService