JSPM

@localazy/generic-connector-client

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 142
  • Score
    100M100P100Q86745F
  • License MIT

Node.js module that allows to interact with the Localazy Generic Connector.

Package Exports

  • @localazy/generic-connector-client

Readme

📦 Localazy Generic Connector Client

Node.js module that allows to interact with the Localazy Generic Connector.

🔧 Install

npm install @localazy/generic-connector-client
# or you can use yarn or pnpm

🚀 Usage

ESM
import { GenericConnectorClient, getOAuthAuthorizationUrl } from '@localazy/generic-connector-client';

const api = new GenericConnectorClient({ pluginId: 99 }); // Create Api client with your `pluginId`

const keys = await GenericConnectorClient.public.keys(); // Get read and write keys for OAuth.
const url = getOAuthAuthorizationUrl({
  clientId: 'your-client-id',
  customId: 'your-write-key',
}); // Get OAuth authorization URL.
window.open(url);
const pollResult = await GenericConnectorClient.oauth.continuousPoll({
  readKey: keys.readKey,
}); // Poll for the result.

console.log(pollResult); // Print the result with access token.
TypeScript
import { GenericConnectorClient, getOAuthAuthorizationUrl, GeneratedKeys, PollResponseCompleted } from '@localazy/generic-connector-client';

const api: GenericConnectorClient = new GenericConnectorClient({ pluginId: 99 });             // Create Api client with your `pluginId`

const keys: GeneratedKeys = await GenericConnectorClient.public.keys();              // Get read and write keys for OAuth.
const url: string = getOAuthAuthorizationUrl({
  clientId: 'your-client-id',
  customId: 'your-write-key',
});                                                                   // Get OAuth authorization URL.
window.open(url);
const pollResult: PollResponseCompleted = await GenericConnectorClient.oauth.continuousPoll({
  readKey: keys.readKey,
});                                                                   // Poll for the result.

console.log(pollResult);                                              // Print the result with access token.