0.3.0 • Published 2 months ago

@jifeline/customer-connectors v0.3.0

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

Customer Connectors library

The Customer Connectors library is an implementation of the connectors domain within the Customer API. With this library, after setting the config in the core auth module, the connectors of the logged-in user can be managed.

Usage of the library

Import the customerConnectors library to make use of the different features.

import { auth } from '@jifeline/core';
import { customerConnectors } from '@jifeline/customer-connectors';

// Configure the core lib and authenticate by login in with connector / pin or username / password.
auth.configure(config);
auth.loginPin().subscribe();
auth.loginUsername().subscribe();

// After authentication - use the customer connectors library. Eg;
customerConnectors
  .connectors
  .getAllConnectors$()
  .subscribe();

Features

The Customer Connectors library provides the following features:

  • connector state
  • connector ticket
  • connectors
  • sort connectors

Connector state

The connector state feature gives access to updates of connectors through a Websocket. On an interval base, the state of the connector will be pushed from the server to the client.

The following functions are supported:

  • get connection quality
  • get round trip time
  • is voltage measured
  • get voltage info
  • get vin

Connector Ticket

The connector ticket feature checks if a given connector by id has an active ticket at that moment in time. It can also determine if a given connector ticket is in an active state and retrieve the current active ticket of a connector.

The following functions are supported:

  • get active ticket of connector
  • has connector active ticket
  • is ticket active

Connectors

The connectors feature gives access to the connectors of the logged-in user. All the connectors can be retrieved, and with the polling flag enabled it will give an update of the connectors on an interval base. When a connector-id is known, it can be fetched to get the details of the connector.

The connector component, which is returned by getting a connector through this feature, provides info about the specifications of the connector and real time updates of different properties.

The following functions are supported:

  • get all connectors
  • get connector

Sort connectors

The sort connectors feature sorts connectors by type and state. The provided array of connectors will be sorted by online / offline state, and wifi or usb connector and then sorted by id.

The following functions are supported:

  • sort connectors by type and state