UNPKG

tipi-services

Version:

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

33 lines (24 loc) 888 B
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class KeyboardsService extends Service { constructor (baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async create (data) { return this.sendRequest({ endpoint: this.endpoints.create, body: data }) } async details (id, extend) { return this.sendRequest({ endpoint: this.endpoints.details, params: { id }, query: { extend } }) } async list (query) { return this.sendRequest({ endpoint: this.endpoints.list, query }) } async remove (id, data) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { id }, body: data }) } async updateBattery (mac, data) { return this.sendRequest({ endpoint: this.endpoints.updateBattery, params: { mac }, body: data }) } } module.exports = KeyboardsService