@rc-ex/discovery
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

Discovery Extension

Entry Point Discovery.

Install

yarn add @rc-ex/discovery

Usage

import RingCentral from '@rc-ex/core';
import DiscoveryExtension from '@rc-ex/discovery';

const rc = new RingCentral();
// install Discovery Extension
const discoveryExtension = new DiscoveryExtension({
    discoveryServer: process.env.RINGCENTRAL_DISCOVERY_SERVER!,
    brandId: '1210',
});
rc.installExtension(discoveryExtension);
await discoveryExtension.discover(); // discover entry points

console.log(discoveryExtension.initialEntryPoints)

// Then you don't have to manually configure the platform API server

With @ringcentral/sdk

const rc = new RingCentral();

// install Discovery Extension
const discoveryExtension = new DiscoveryExtension({
    discoveryServer: process.env.RINGCENTRAL_DISCOVERY_SERVER!,
    brandId: '1210',
});
rc.installExtension(discoveryExtension);
await discoveryExtension.discover(); // discover entry points

// install RingCentral Extension
const sdk = new SDK({
    clientId: process.env.RINGCENTRAL_CLIENT_ID!,
    clientSecret: process.env.RINGCENTRAL_CLIENT_SECRET!,
    server: discoveryExtension.initialEntryPoints!.coreApi.baseUri, // use the discovered entry point
});
await sdk.login({
    username: process.env.RINGCENTRAL_USERNAME!,
    extension: process.env.RINGCENTRAL_EXTENSION!,
    password: process.env.RINGCENTRAL_PASSWORD!,
});
const ringCentralExtension = new RingCentralExtension(sdk);
await rc.installExtension(ringCentralExtension);

const extInfo = await rc.restapi().account().extension().get();

Readme

Keywords

none

Package Sidebar

Install

npm i @rc-ex/discovery

Weekly Downloads

4

Version

1.1.3

License

MIT

Unpacked Size

10.8 kB

Total Files

7

Last publish

Collaborators

  • tylerlong