ExtraHorizon / javascript-sdk

Extrahorizon Javascript SDK
https://docs.extrahorizon.com/javascript-sdk/
MIT License
4 stars 5 forks source link

Extra Horizon JavaScript SDK

This package serves as a JavaScript wrapper around all Extra Horizon cloud services.

Features

Getting started

To get started with the ExtraHorizon SDK you'll need to install it, and then get credentials which will allow you to access the backend.

Installation

Using npm:

npm install @extrahorizon/javascript-sdk

Using yarn:

yarn add @extrahorizon/javascript-sdk

Quick Start

import { createOAuth2Client } from '@extrahorizon/javascript-sdk';

(async () => {
  const exh = createOAuth2Client({
    host: '',
    clientId: '',
  });

  await exh.auth.authenticate({
    password: '',
    username: '',
  });

  console.log('exh.users.health()', await exh.users.health());
  console.log('exh.users.me()', await exh.users.me());
})();

Please see authentication examples for more options.

Interceptors

The data returned from the backend is mapped using interceptors:

Documentation

🔑 License

The MIT License (MIT). Please see License File for more information.

Developer Notes

Throughout the different services we use this for easy access to other functions in each service. The usage of this as first parameter is explained here: https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function. This parameter is excluded from all exported types.

find(
  this: DataSchemasService,
  options?: { rql?: RQLString }
): Promise<PagedResult<Schema>>;

Migration Guides

Migrating to v8.0.0

Swagger files