UNPKG

tipi-services

Version:

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

53 lines (39 loc) 1.6 kB
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class IntegrationsService extends Service { constructor (baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async subscribe (ownerId) { return this.sendRequest({ endpoint: this.endpoints.subscribe, params: { ownerId } }) } async unSubscribe (ownerId) { return this.sendRequest({ endpoint: this.endpoints.unSubscribe, params: { ownerId } }) } async resetSubscriptions (ownerId) { return this.sendRequest({ endpoint: this.endpoints.resetSubscriptions, params: { ownerId } }) } async details (ownerId) { return this.sendRequest({ endpoint: this.endpoints.details, params: { ownerId } }) } async checkHealth (ownerId) { return this.sendRequest({ endpoint: this.endpoints.checkHealth, params: { ownerId } }) } async disconnect (ownerId) { return this.sendRequest({ endpoint: this.endpoints.disconnect, params: { ownerId } }) } async getRooms (ownerId) { return this.sendRequest({ endpoint: this.endpoints.getRooms, params: { ownerId } }) } async getWebhooks (ownerId) { return this.sendRequest({ endpoint: this.endpoints.getWebhooks, params: { ownerId } }) } async update (ownerId, data) { return this.sendRequest({ endpoint: this.endpoints.update, params: { ownerId }, body: data }) } async syncData (ownerId, data) { return this.sendRequest({ endpoint: this.endpoints.syncData, params: { ownerId }, body: data }) } } module.exports = IntegrationsService