Skip to content

sandeepdabade/skyflow-node-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skyflow Node SDK

Node.js API Client for the Skyflow Platform API.

Requires node version 6.9.0 or higher.

Installation

npm install skyflow-node

Usage

All usage of this SDK begins with the creation of a client, the client handles the authentication and communication with the Skyflow API.

To get started create a skyflow client in one of the following ways

import {connect} from 'skyflow-node';

const client = connect(accountName, workspaceName, vaultId, credentials, options) 
// credentials is your service account json file which can be downloaded from skyflow studio
//options are optional parameters

Options object can include

{
    accessToken : 'your access token', // your access jwt. Defaults to generating a new token from given credentials
    browser : true, // if you are using this client from front end, Defaults to false
}

All interactions with the Skyflow Platform API is done through client methods.

Table of Contents

Auth

client.getAccessToken()
.then(res => {
    //returns access token if credentials are valid
})
.catch(err => {
     
})

Records

Insert Records

client.bulkInsertRecords('<your table name', 
   [
        {
            "field1": "<field value>",
            "field2": "<field value>",
        }
    ]
    
)
    .then(res => {
        console.log(res) // returns the token id and tokens of each column values
    })
    .catch(err => console.log(err.data.error))

Get All Records

To get the record values back pass in the id token of respective rows,

client.bulkGetRecords('<table name>')
    .then(res => {
        console.log(res)
    })
    .catch(err => console.log(err));

Get Record

To get the record values back pass in the id token of respective rows,

client.getRecord('<table name>', '<skyflow-id>')
    .then(res => {
        console.log(res)
    })
    .catch(err => console.log(err));

Delete Record

This api deletes the record permanently from the vault.

client.deleteRecord('<table name>', '<skyflow-id>')
    .then(res => {
        console.log(res) //returns back the id if operation is successful
    })
    .catch(err => console.log(err));

Delete Records

This api deletes all the records permanently from the vault.

client.bulkDeleteRecords('<table name>')
    .then(res => {
        console.log(res) //returns back the id if operation is successful
    })
    .catch(err => console.log(err));

Update Records

This api can be used to update some or all the ros of the record.

let recordFields = [
    {
    name : 'field name',
    value : 'field new value'
    }
]

client.updateRecord('<table name>', '<skyflow-id>', recordFields)
    .then(res => {
        console.log(res) //updated token values
    })
    .catch(err => console.log(err));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%