UNPKG

tipi-services

Version:

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

61 lines (45 loc) 1.72 kB
const Service = require('../../../Service') const Endpoints = require('./Endpoints') class StaffsService extends Service { constructor (baseUrl) { super() this.endpoints = Endpoints(baseUrl) } async signup (data) { return this.sendRequest({ endpoint: this.endpoints.signup, body: data }) } async login (data) { return this.sendRequest({ endpoint: this.endpoints.login, body: data }) } async details (id, join) { return this.sendRequest({ endpoint: this.endpoints.details, params: { id }, query: { join } }) } async batchDetails (data) { return this.sendRequest({ endpoint: this.endpoints.batchDetails, body: data }) } async update (id, data) { return this.sendRequest({ endpoint: this.endpoints.update, params: { id }, body: data }) } async setAvatar (id, data) { return this.sendRequest({ endpoint: this.endpoints.setAvatar, params: { id }, formData: data }) } async changePassword (id, data) { return this.sendRequest({ endpoint: this.endpoints.changePassword, params: { id }, body: data }) } async verify (data) { return this.sendRequest({ endpoint: this.endpoints.verify, body: data }) } async merge (data) { return this.sendRequest({ endpoint: this.endpoints.merge, body: data }) } async list (query) { return this.sendRequest({ endpoint: this.endpoints.list, query }) } async remove (id) { return this.sendRequest({ endpoint: this.endpoints.remove, params: { id } }) } async checkAccess (id, data) { return this.sendRequest({ endpoint: this.endpoints.checkAccess, params: { id }, body: data }) } } module.exports = StaffsService