@dabblelab/twilio-datastore

1.0.0-beta.3 • Public • Published

Twilio Autopilot Datastore

A persistent data storage solution designed for use with Twilio Functions and Twilio Autopilot.

Requirements

Install twilio-datastore

$ npm install @dabblelab/twilio-datastore

Usage

const datastore = require('@dabblelab/twilio-datastore');

const client = new datastore.TwilioDatastoreApiClient({
    tableName : '<table-name>',
    accountSid : '<twilio-account-sid>',
    authToken : '<twilio-auth-token>'
});

Find Query

client.find({})
    .then((data) => {
        console.log(data);
    })
    .catch(error => console.log(error));

Note

Twilio Autopilot Datastore provides same syntax that are used in MongoDB find query

Insert Query

client.insert(
    { 
        item: "card", 
        qty: 15 
    })
    .then((data) => {
        console.log(data);
    })
    .catch(error => console.log(error));

Note

Twilio Autopilot Datastore provides same syntax that are used in MongoDB insertOne query

Update Query

client.update(
    {
        item: "card"
    }, 
    {
        $set : 
        {
            qty: 40
        }
    })
    .then((data) => {
        console.log(data);
    })
    .catch(error => console.log(error));

Note

Twilio Autopilot Datastore provides same syntax that are used in MongoDB updateMany query

Remove Query

client.remove(
    {
        item: "card"
    })
    .then((data) => {
        console.log(data);
    })
    .catch(error => console.log(error));

Note

Twilio Autopilot Datastore provides same syntax that are used in MongoDB deleteMany query

Package Sidebar

Install

npm i @dabblelab/twilio-datastore

Weekly Downloads

0

Version

1.0.0-beta.3

License

MIT

Unpacked Size

9.54 kB

Total Files

5

Last publish

Collaborators

  • stevetingiris
  • khalid0807