0.2.4 • Published 18 days ago

@kbabichau/telescope-integration-client v0.2.4

Weekly downloads
-
License
ISC
Repository
-
Last release
18 days ago

TelescopeClient

TelescopeClient simplifies the process of making requests to the Telescope API by abstracting the complexities of authentication and returning the API response in a simple and useful format.

Installation

npm install @kbabichau/telescope-integration-client

Usage

  1. Import the TelescopeClient class and the required interfaces:
import TelescopeClient, { TelescopeEnvironment } from '@kbabichau/telescope-integration-client';
  1. Instantiate TelescopeClient with the required arguments:
const options = {
  environment: TelescopeEnvironment.Staging,
  host: 'https://telescope-api.example.com',
  clientId: 'client_id',
  clientSecret: 'client_secret',
  telescopeClientId: 'telescope_client_id'
};

const telescopeClient = new TelescopeClient(options);
  1. Make requests to the Telescope API using the available methods:
telescopeClient.getTelescopeConfig('/urn/some-config')
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.log(error);
  });
  1. Enjoy the simplified process of making requests to the Telescope API in your JavaScript applications!

API

TelescopeEnvironment

An enum representing the available Telescope environments.

TelescopeClientOptions

An interface containing the options required to instantiate a new instance of TelescopeClient.

Properties:

  • environment: A required field representing the Telescope environment the client should connect to.
  • host: A required field representing the url of the Telescope host.
  • clientId: A required field representing the client id for the OAuth2 authentication protocol.
  • clientSecret: A required field representing the client secret for the OAuth2 authentication protocol.
  • telescopeClientId: A required field representing the Telescope client id.

TelescopeClient

The class that simplifies the process of making requests to the Telescope API.

Methods:

  • getTelescopeConfig<T>(configUrn: string): Promise<T>: A method that makes a GET request to retrieve a Telescope configuration object by the configUrn ID.

TelescopeError

An error class that extends the Error class to allow for more granular error handling.

Properties:

  • status: A required number property representing the HTTP status code of the error.
  • message: A required string property representing a description of the error.

License

This project is licensed under the MIT License.

0.2.4

18 days ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago