@builton/node-sdk

1.1.3 • Public • Published

David GitHub release license

Builton SDK

Builton offers a platform as a service that digitizes core business functions and optimizes resource allocation with baked-in machine learning capabilities. This SDK gives you a machine-to-machine access to our platform's building blocks and will help you implement its API in a Javascript environment. Get instant access to modules like Payments, Messaging Tools, User Management, Webhooks, Resource Allocation and more.

If you are looking for a client SDK, take a look at our Javascript SDK

Builton logo

Requirement

  • A Builton API Key
  • A Builton Service Account Key

Install

From npm

npm install @builton/node-sdk

Getting started

new Builton({ apiKey, bearerToken })

Initialises a new instance of Builton configured with your application apiKey and a bearerToken. The bearerToken is the service account key.

  • apiKey {String}: Your attributed Builton API Key.
  • bearerToken {String}: Your service account key.

Example: Fetching and updating orders

Using a callback:

builton.orders.get({ size: 5 }, function(err, page) {
  const firstOrder = page.current[0];
  firstOrder.update({ delivery_status: 'DONE' });
});

Using promises:

builton.orders.get({ size: 5 }).then((page) => {
  const firstOrder = page.current[0];
  firstOrder.update({ delivery_status: 'DONE' });
});

Using async/await:

// This needs to be within in an `async` function
const page = await builton.orders.get({ size: 5 });
const firstOrder = page.current[0];
firstOrder.update({ delivery_status: 'DONE' });

Example: Updating a product method by id

builton.products.update(':productId:', {
  name: 'New name'
});

Example: Using the set methods:

The set method allows you to create an object without fetching it from the api. I can be useful when working with stored data for example.

const product = builton.products.set(':productId:');
product.update({
  name: 'New name'
});

With multiple payment methods:

const paymentMethods = builton.paymentMethods.set([':paymentMethodId1:', ':paymentMethodId2:']);
paymentMethods[0].update({
  token: ':StripeTokenId:'
});

With full props:

const paymentMethod = builton.paymentMethods.set({<paymentMethodJsonObject>});
paymentMethod.update({
  token: ':StripeTokenId:'
});

Issue Reporting

If you have found a bug or if you have a feature request, please report them to this repository's issues section.

License

This project is licensed under the MIT license. See the LICENSE file for more info.

Package Sidebar

Install

npm i @builton/node-sdk

Weekly Downloads

2

Version

1.1.3

License

MIT

Unpacked Size

723 kB

Total Files

91

Last publish

Collaborators

  • lazreg87
  • nicolas_bonduel