Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flatsheet-api-client

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flatsheet-api-client

javascript client for flatsheet

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

flatsheet-api-client

JavaScript/node API client for http://github.com/flatsheet/flatsheet

Todos

Create, update, and destroy methods.

Install

npm install --save flatsheet-api-client

Example usage

var Flatsheet = require('flatsheet-api-client');

var flatsheet = new Flatsheet();

/* list of sheets */
flatsheet.sheets.list(function(err, res){
  console.log(err, res)
});

/* specific sheet */
flatsheet.sheets.get(sheetID, function (err, res){
  console.log(err, res);
});

API

Create flatsheet object

var Flatsheet = require('flatsheet-api-client');

var flatsheet = new Flatsheet({
  host: 'https://app.flatsheet.io',
  token: 'YOUR_API_KEY'
});

The host argument is optional, only use it if you aren't using the hosted version of Flatsheet. The token argument is not needed for GET requests, only for PUT, POST, and DELETE requests.

Get list of sheets

flatsheet.sheets.list(function(err, res){
  console.log(err, res)
});

Get a specific sheet

flatsheet.sheets.get(sheetID, function (err, res){
  console.log(err, res);
});

Create a sheet

/* Set sheet properties */
var sheet = {
  name: 'pizza sheet!',
  description: 'womp womp womp',
  rows: [
    {
      pizza: 'pizza is really awesome!'
    }
  ],
}

/* create a new sheet */
flatsheet.sheets.create(sheet, function(err, res){
  console.log(err, res)
});

Update a sheet

flatsheet.sheets.get(sheetID, function (err, res) {
  res.name = 'change the name of the sheet to this';

  flatsheet.sheets.update(res, function (err, res) {
    console.log(err, res)
  });
});

Add a row to a sheet

var row = { pizza: 'wooaaaadddddaaaaoooo' };

flatsheet.sheets.addRow(sheetID, row, function (err, res) {
  console.log(err, res);
});

Destroy a sheet

flatsheet.sheets.delete(sheetID, function () {
  flatsheet.sheets.get(sheetID, function (err, res) {
    console.log(err) /* { error: 404 } */
  });
});

Tests

  • Clone repository
  • Run npm install
  • Run npm test

Tests are currently located in the test.js file.

FAQs

Package last updated on 09 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc