sajari-sdk-node
Table of contents:
Quickstart
Before you begin
- Create a Sajari account
- Retrieve your account credentials
Install the SDK
npm install @sajari/sdk-node
Use the SDK
The following example shows how to create a collection using the SDK.
⚠️ The function below cleans up after itself by deleting the collection immediately after creation.
const { CollectionsClient, withKeyCredentials } = require("@sajari/sdk-node");
const client = new CollectionsClient(
"account-id",
withKeyCredentials("key-id", "key-secret")
);
async function createCollection(id, displayName) {
const collection = await client.createCollection({ id, displayName });
console.log(`Collection ${collection.displayName} created.`);
await client.deleteCollection(collection.id);
}
createCollection("collection-id", "Collection display name").catch(
console.error
);
Examples
Examples are in the examples/
directory.
Contributing
Contributions are welcome. See the Contributing guide.