@netvoice/phonelix-client
v0.4.1
Published
Interaction with phonelix api.
Downloads
1
Readme
Phonelix ApiClient JS library
Installation
npm install @netvoice/phonelix-client
Usage
Promise based
var Phonelix = require('@netvoice/phonelix-client');
var client = new Phonelix();
client.login('**username**', '**password**')
.then(() => {
client.getUserInfo()
.then(info => {
console.log(info);
})
.catch(error => {
console.log(error);
});
})
.catch(error => {
console.log(error);
});
Event based
var Phonelix = require('@netvoice/phonelix-client');
var client = new Phonelix();
client.login('**username**', '**password**');
client.on('login-success', () => {
client.getUserInfo()
.then(info => {
console.log(info);
})
.catch(error => {
console.log(error);
});
})
client.on('login-error', (message) => {
console.log(message);
})
| event | description | return | | ---------------- | ----------------------------------------- | -------------------------------- | | login-success | after successfull authetication | token object | | login-error | login failed in client.login function | error message | | refresh-success | token was successfully refreshed | new token object | | refresh-error | refresh failed in token.refresh function | error message | | request-error | api call failed | error message and called request | | token-error | token was not created | error message |