tipi-services
Version:
Node.js library to access wrapping REST API of tipi backend services
28 lines (21 loc) • 771 B
JavaScript
const Service = require('../../../Service')
const Endpoints = require('./Endpoints')
class ShortLinksService extends Service {
constructor (baseUrl) {
super()
this.endpoints = Endpoints(baseUrl)
}
async createOrUpdate (data) {
return this.sendRequest({ endpoint: this.endpoints.createOrUpdate, body: data })
}
async update (shortId, data) {
return this.sendRequest({ endpoint: this.endpoints.update, body: data, params: { shortId } })
}
async details (shortId) {
return this.sendRequest({ endpoint: this.endpoints.details, params: { shortId } })
}
async remove (shortId) {
return this.sendRequest({ endpoint: this.endpoints.remove, params: { shortId } })
}
}
module.exports = ShortLinksService