UNPKG

tipi-services

Version:

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

56 lines (42 loc) 1.74 kB
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class ActivitiesService 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 update (id, data) { return this.sendRequest({ endpoint: this.endpoints.update, body: data, params: { id } }) } async remove (id, data) { return this.sendRequest({ endpoint: this.endpoints.remove, body: data, params: { id } }) } async updateStatus (id, data) { return this.sendRequest({ endpoint: this.endpoints.updateStatus, body: data, params: { id } }) } async attend (id, data) { return this.sendRequest({ endpoint: this.endpoints.attend, body: data, params: { id } }) } async unAttend (id, data) { return this.sendRequest({ endpoint: this.endpoints.unAttend, body: data, params: { id } }) } async addImage (id, data) { return this.sendRequest({ endpoint: this.endpoints.addImage, formData: data, params: { id } }) } async removeImage (id, publicId, data) { return this.sendRequest({ endpoint: this.endpoints.removeImage, body: data, params: { id, publicId } }) } async setMainImage (id, publicId, data) { return this.sendRequest({ endpoint: this.endpoints.setMainImage, body: data, params: { id, publicId } }) } } module.exports = ActivitiesService