tipi-services
Version:
Node.js library to access wrapping REST API of tipi backend services
25 lines (18 loc) • 668 B
JavaScript
const Service = require('../../../Service');
const Endpoints = require('./Endpoints')
class ImagesService extends Service {
constructor(baseUrl) {
super()
this.endpoints = Endpoints(baseUrl)
}
async add(id, data) {
return this.sendRequest({endpoint: this.endpoints.add, params: {id}, formData: data})
}
async remove(id, publicId) {
return this.sendRequest({endpoint: this.endpoints.remove, params: {id, publicId}})
}
async setMain(id, publicId) {
return this.sendRequest({endpoint: this.endpoints.setMain, params: {id, publicId}})
}
}
module.exports = ImagesService