[![codecov](https://codecov.io/gh/takenet/blip-services/branch/master/graph/badge.svg?token=E2GD7CRUGH)](https://codecov.io/gh/takenet/blip-services)
# Introduction

This project aims to implement aditional features to BlipSdk client, commands and connection. Here you can find the main implementation for BLiP SDK connection and its extensions, like account, contacts, artificial intelligence

# Objective

The goal of this project is to share all services in the same library, as we can have multiple project stacks.

# Usage

## Blip Service

Connecting with blip.ai domain:

```javascript
import { BlipService } from 'blip-services';

const blipService = new BlipService({
    tenant: 'tenant-id',
    blipDomainUrl: 'http://localhost:8080/',
    blipDomain: 'blip.ai',
    blipAccountIssuer: 'account.blip.ai',
    blipWebsocketPort: '443',
    blipWebsocketScheme: 'wss',
    blipWebsocketHostName: 'hmg-ws.blip.ai',
    blipWebsocketHostNameTenant: 'hmg-ws.blip.ai',
    applicationName: 'my-micro-frontend' // Optional, but recommended. Default value is 'portal'
});

//authentication example: "user.mail@take.net"
await blipService.connect(userIdentifier, userToken, authentication);
```

Connecting with msging.net domain:

```javascript
import { BlipService } from 'blip-services';

const blipService = new BlipService({
    tenant: 'tenant-id',
    blipDomainUrl: 'http://localhost:8080/',
    blipDomain: 'msging.net',
    blipWebsocketPort: '443',
    blipWebsocketScheme: 'wss',
    blipWebsocketHostName: 'hmg-ws.msging.net',
    blipWebsocketHostNameTenant: 'hmg-ws.msging.net',
    applicationName: 'my-micro-frontend' // Optional, but recommended. Default value is 'portal'
});

//authentication example: "user.mail@take.net"
await blipService.connect(botIdentifier, botAccessKey, authentication);
```


## Acquisition Service

```javascript
import { AcquisitionService } from 'blip-services';

const acquisitionService = new AcquisitionService({
    acquisitionServiceApiUrl: 'http://localhost:5000'
});

acquisitionService.connect(userToken);
```

### connect

| Param | Type | Description | Required |
|---|---|---|---|
| *identifier* | **string** | The identifier used to connect to blip.ai domain (it's normally used with user email) or bot identifier (without domain) to connect to msging.net domain. | **true** |
| *token* | **string** | The same user token used to login into BlipAccount to connect to blip.ai domain or bot access key to connect to msging.net domain. | **true**  |
| *authentication* | **string** | User email, that will be used to track user actions like SET, MERGE and DELETE commands. Ex: ```blipuser@take.net``` | **true** |
