Skip to content

LibreTexts/cxone-expert-node

Repository files navigation

NPM Version NPM Downloads

CXone Expert Node SDK

This package is a custom SDK developed by LibreTexts to interact with the CXone Expert API. It should be noted that this package is NOT developed or maintained by CXone and, as such, does not guarantee 100% compatibility with the latest API updates.

Install

npm install @libretexts/cxone-expert-node

Usage

Recommended

Configure authentication once at the Expert instance level:

import Expert from "@libretexts/cxone-expert-node";

// Option 1: Configure everything in the constructor
const expert = new Expert({
  tld: process.env.SERVER_DOMAIN,
  auth: {
    type: 'server',
    params: {
      key: process.env.SERVER_KEY,
      secret: process.env.SERVER_SECRET,
      user: process.env.SERVER_USER,
    }
  }
});

// Now you can start making API calls!
const page = await expert.pages.getPage(123);
const pages = await expert.pages.getPages();

console.log(page);

Per-call auth override (when needed):

// Global auth is used by default
const page1 = await expert.pages.getPage(123);

// Override with different auth for specific call
const customAuth = { 'X-Deki-Token': 'different-token' };
const page2 = await expert.pages.getPage(456, { auth: customAuth });

License

This package is open-source and free to use under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5