tipi-services
Version:
Node.js library to access wrapping REST API of tipi backend services
93 lines (69 loc) • 2.75 kB
JavaScript
const Service = require('../../../Service')
const Endpoints = require('./Endpoints')
class TravelersService 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 setAvatar (id, data) {
return this.sendRequest({ endpoint: this.endpoints.setAvatar, params: { id }, formData: data })
}
async update (id, data) {
return this.sendRequest({ endpoint: this.endpoints.update, body: data, params: { id } })
}
async details (id, query) {
return this.sendRequest({ endpoint: this.endpoints.details, query, params: { id } })
}
async batchDetails (data) {
return this.sendRequest({ endpoint: this.endpoints.batchDetails, body: data })
}
async batchFind (data) {
return this.sendRequest({ endpoint: this.endpoints.batchFind, body: data })
}
async list (query) {
return this.sendRequest({ endpoint: this.endpoints.list, query })
}
async deactive (id) {
return this.sendRequest({ endpoint: this.endpoints.deactive, params: { id } })
}
async verify (data) {
return this.sendRequest({ endpoint: this.endpoints.verify, body: data })
}
async resendVerification (data) {
return this.sendRequest({ endpoint: this.endpoints.resendVerification, body: data })
}
async generatePinCode (data) {
return this.sendRequest({ endpoint: this.endpoints.generatePinCode, body: data })
}
async verifyPin (data) {
return this.sendRequest({ endpoint: this.endpoints.verifyPin, body: data })
}
async remove (id) {
return this.sendRequest({ endpoint: this.endpoints.remove, params: { id } })
}
async find (query, interactionState) {
return this.sendRequest({ endpoint: this.endpoints.find, query }, interactionState)
}
async getVerificationStatus (id) {
return this.sendRequest({ endpoint: this.endpoints.getVerificationStatus, params: { id } })
}
async getVerification (query) {
return this.sendRequest({ endpoint: this.endpoints.getVerification, query })
}
async updateHealth (id, data) {
return this.sendRequest({ endpoint: this.endpoints.updateHealth, body: data, params: { id } })
}
async acceptTerms (id, data) {
return this.sendRequest({ endpoint: this.endpoints.acceptTerms, params: { id }, body: data })
}
async verifyFirebaseToken (data) {
return this.sendRequest({ endpoint: this.endpoints.verifyFirebaseToken, body: data })
}
}
module.exports = TravelersService