Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@orbis-systems/orbis-api-client

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbis-systems/orbis-api-client

This library comes comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

  • 1.0.9
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created

This is in early development and is not ready for implementation.

This library comes comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

Installation

npm install orbis-api-client --save

Inclusion

Node
const APIClient = require("orbis-api-client");

or

import APIClient from 'orbis-api-client';
Browser
<script src="browser-bundle.js"></script>

Usage

Node
const config = {
   cert: fs.readFileSync('./cert.pem'), //Obtained from Orbis
   token: '123456', //Obtained from Orbis. Must be string (not int)
   domain: 'https://example.com/', //Obtained from Orbis
   base_url: 'https://example.com/', //Obtained from Orbis
};

(async () => 
{
    let client = new APIClient(config);
    await client.login('username', 'password');
});
Browser
const config = {
   cert: fs.readFileSync('./cert.pem'), //Obtained from Orbis
   token: '123456', //Obtained from Orbis. Must be string (not int)
   domain: 'https://example.com/', //Obtained from Orbis
   base_url: 'https://example.com/', //Obtained from Orbis
};

var client = new APIClient(config)
client.login('username', 'password');

Session Stores

By default, the session store will use LocalStorage. In the browser, LocalStorage will utilize localStorage, and in NodeJS it will store them in ./session.

You can create a custom session store by extending the SessionStore class. To use it, pass it as the session_store on the config like:

const config = {
   ...
   session_store: CustomStore,
   ...
};

You must implement the methods:

  • get(key)
  • set(key, value, expiration_in_minutes)
  • has(key) (Returns boolean. Should also return false if it has expired)

FAQs

Package last updated on 19 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts