UNPKG

tipi-services

Version:

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

40 lines (30 loc) 1.22 kB
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class MailgunIntegrationsService extends Service { constructor (baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async create (data) { return this.sendRequest({ endpoint: this.endpoints.create, body: data }) } async update (ownerId, data) { return this.sendRequest({ endpoint: this.endpoints.update, params: { ownerId }, body: data }) } async details (ownerId, query) { return this.sendRequest({ endpoint: this.endpoints.details, params: { ownerId }, query }) } async remove (ownerId) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { ownerId } }) } async listTemplates (ownerId, query) { return this.sendRequest({ endpoint: this.endpoints.listTemplates, params: { ownerId }, query }) } async listDomains (query) { return this.sendRequest({ endpoint: this.endpoints.listDomains, query }) } async overwriteTemplate (ownerId, data) { return this.sendRequest({ endpoint: this.endpoints.overwriteTemplate, params: { ownerId }, body: data }) } } module.exports = MailgunIntegrationsService