open-index/open-npm huggingface dataset:
npm package: @netvoice/js-oauth
Description: Interaction with netvoice oauth2 server.
Author: Jakub Kotek
Latest version: 0.3.0

# NetVoice OAuth2 JS library

## Installation
```
npm install @netvoice/js-oauth
```

## Usage

### Promise based
```
var Client = require('@netvoice/js-oauth');

var client = new Client('**baseUrl**', '**app_secret**');

client.login('**username**', '**password**')
    .then(token => {
        client.get(token, "/account/account")
            .then(info => {
                console.log(info);
            })
            .catch(error => {
                console.log(error);
            });
    })
    .catch(error => {
        console.log(error);
    });
```

### Event based

```
var Client = require('@netvoice/js-oauth');

var client = new Client('**baseUrl**', '**app_secret**');

client.login('**username**', '**password**');

client.on('login-success', (token) => {
	client.get(token, "/account/account")
		.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                    |
npm package: @netvoice/phonelix-client
Description: Interaction with phonelix api.
Author: Jakub Kotek
Latest version: 0.4.1

# 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                    |