@builder6/sdk
TypeScript icon, indicating that this package has built-in type declarations

6.0.3 • Public • Published

Builder Core SDK

This SDK is largely a wrapper over our Content API

import { builder } from '@builder6/sdk';

builder.init(YOUR_KEY);

// Optional custom targeting
builder.setUserAttributes({
  userIsLoggedIn: true,
  whateverKey: 'whatever value',
});

builder
  .get(YOUR_MODEL_NAME, {
    // Optional custom query
    query: {
      'data.customField.$gt': 100,
    },
  })
  .promise()
  .then(({ data }) => {
    // Do something with the data
  });

// The options that you can send to builder.get and builder.getAll
// are defined here: https://forum.builder.io/t/what-are-the-options-for-the-methods-builder-get-and-builder-getall/1036
builder
  .getAll(YOUR_MODEL_NAME, {
    limit: 10,
  })
  .then(results => {
    // Do something with the results
  });

// Turn of cookies/tracking
builder.canTrack = false;

View all options for builder.get here

Learn more about how to use the Builder core SDK:

Readme

Keywords

none

Package Sidebar

Install

npm i @builder6/sdk

Weekly Downloads

41

Version

6.0.3

License

MIT

Unpacked Size

1.75 MB

Total Files

100

Last publish

Collaborators

  • steedos-zhuangjianguo
  • steedos-baozhoutao
  • yinlianghui
  • steedos-sunhaolin