UNPKG

tipi-services

Version:

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

36 lines (27 loc) 991 B
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class SubscriptionsService 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 list (query) { return this.sendRequest({ endpoint: this.endpoints.list, query }) } async details (id, query) { return this.sendRequest({ endpoint: this.endpoints.details, params: { id }, query }) } async remove (id, data) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { id }, body: data }) } async stop (id, data) { return this.sendRequest({ endpoint: this.endpoints.stop, params: { id }, body: data }) } } module.exports = SubscriptionsService