operandsdkv4
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Operand v4 SDK

WIP.

Creating a client:

import { OperandV4 } from 'operandsdkv4';

const operand = new OperandV4('API_KEY');

Creating a Collection/Object/Searching:

// Create a collection
const collection = await operand.upsertObject({
  object_type: ObjectType.OBJECT_TYPE_COLLECTION,
  metadata: {
    collection: {},
  },
  label: 'blue',
});

console.log('Created collection', collection);
// Add a text object to our collection
const textObject = await operand.upsertObject({
  parent_id: collection.object.id,
  object_type: ObjectType.OBJECT_TYPE_TEXT,
  metadata: {
    text: {
      text: 'Hello World',
    },
  },
  properties: {
    properties: {
      color: { text: 'blue' },
    },
  },
});
console.log('Created text object', textObject);

// Search over the collection for everything with size 12
const results = await operand.search({
  query: 'Hello',
  roots: [collection.object.id],
  filter: {
    conditions: [
      {
        property: {
          key: 'color',
          property: {
            text: 'blue',
          },
        },
      },
    ],
  },
});
console.log(results);

Readme

Keywords

none

Package Sidebar

Install

npm i operandsdkv4

Weekly Downloads

3

Version

0.1.2

License

MIT

Unpacked Size

84.1 kB

Total Files

16

Last publish

Collaborators

  • donwauchopex