Devbook Extension Node.js library
The Devbook Extension Node.js library provides convenient access to the Devbook Extension API from applications written in server-side JavaScript.
Installation
npm install @devbookhq/extension-admin
or
yarn add @devbookhq/extension-admin
Usage
import Devbook, { APIVersion } from '@devbookhq/extension-admin';
const devbook = new Devbook({
secretAPIKey: 'sk_dev_...',
extensionID: 'your-extension-id',
apiVersion: APIVersion.v1,
});
const entries = [
{
id: 'id1',
title: 'Title',
body: 'Content',
},
];
await devbook.index('indexName', entries);
const pageSize = 10;
const pageNumber = 0;
const results = await devbook.search(['index1', 'index2'], query, pageSize, pageNumber);
await devbook.delete('indexName');
const entry = await devbook.entry('indexName', 'entryID');
const pageSize = 100;
const pageID = 'pageID';
const entries = await devbook.entries('indexName', pageSize, pageID);
const info = await devbook.info();
Documentation
TODO: Add a link to documentation.