Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@devbookhq/extension-admin

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devbookhq/extension-admin

NodeJS wrapper around the Devbook extension API

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

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';

// Initialize the API with your secret key and extension ID. You can find both in the Devbook dashboard.
const devbook = new Devbook({
  secretAPIKey: 'sk_dev_...',
  extensionID: 'your-extension-id',
  apiVersion: APIVersion.v1, // Optional.
});

// Index new extension search entries.
// Arguments:
// - Name of the index.
// - Data you want to index.
const entries = [
  {
    id: 'id1', // Optional.
    title: 'Title',
    body: 'Content',
  },
];
await devbook.index('indexName', entries);

// Search extension search data.
// Arguments:
// - Array of indexes you want to search in.
// - Query you want to search for.
// - Page size (optional, default is 10).
// - Page number (optional, default is 0).
const pageSize = 10;
const pageNumber = 0;
const results = await devbook.search(['index1', 'index2'], query, pageSize, pageNumber);

// Delete indexed data.
// Arguments:
// - Data index from where you want to delete the all the data.
await devbook.delete('indexName');

// Read a single entry from an index.
// Arguments:
// - Name of the index.
// - ID of an entry you want to read.
const entry = await devbook.entry('indexName', 'entryID');

// Read multiple entries from an index.
// Arguments:
// - Name of the index.
// - Page size (optional, default is 100).
// - Page ID used for pagination of results 
//   (optional, page ID for retrieving the next page of entries.
//   Is returned from the `devbook.entries` function in the `pageID` field of the return object.).
const pageSize = 100;
const pageID = 'pageID';
const entries = await devbook.entries('indexName', pageSize, pageID);

// Get information about the extension.
const info = await devbook.info();

Documentation

TODO: Add a link to documentation.

FAQs

Package last updated on 17 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc