@polyscale/polyscale-node
TypeScript icon, indicating that this package has built-in type declarations

0.0.23 • Public • Published

@polyscale/polyscale-node

Client for interacting with the PolyScale API.

Example Usage

import PolyScale from "@polyscale/polyscale-node";

const polyscale = new PolyScale({
  url: "https://url-to-api.com",
  apiKey: "some-api-key",
});

/**
 * Basic usage
 */
polyscale.cache
  .create({
    name: "Example Cache",
    host: "localhost",
    port: 4000,
    workspaceId: "some-id",
  })
  .then((cache) => {
    console.dir(cache);

    polyscale.cacheTtl.create(cache.id, {
      type: "TABLE",
      value: 5,
      key: "tableA",
    });
  })
  .catch((error) => {
    console.error(error);
  });

/**
 * Using Async/Await
 */
const init = async () => {
  try {
    const cache = await polyscale.cache.create({
      name: "Example Cache",
      host: "localhost",
      port: 4000,
      workspaceId: "some-id",
    });

    console.dir(cache);

    await polyscale.cacheTtl.create(cache.id, {
      type: "TABLE",
      value: 5,
      key: "tableA",
    });
  } catch (error) {
    console.error(error);
  }
};

init();

License

polyscale-node is MIT licensed.

Readme

Keywords

none

Package Sidebar

Install

npm i @polyscale/polyscale-node

Weekly Downloads

1

Version

0.0.23

License

ISC

Unpacked Size

19.4 kB

Total Files

21

Last publish

Collaborators

  • hpohlmeyer
  • jannikkeye
  • polyscaleai