All Projects → kwent → Quip.js

kwent / Quip.js

Licence: mit
Simple Node.js wrapper (browser included) and CLI for Quip REST API

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Quip.js

Lor
a fast, minimalist web framework for lua based on OpenResty
Stars: ✭ 930 (+11525%)
Mutual labels:  api
Ghreleases
Interact with the GitHub releases API.
Stars: ✭ 26 (+225%)
Mutual labels:  api
Voyages Sncf Api
A scrapy spider that scraps times and prices from Voyages Sncf. It uses scrapyrt to provide an API interface.
Stars: ✭ 7 (-12.5%)
Mutual labels:  api
Platform Documentation
Core Platform API Documentation & Tutorials
Stars: ✭ 25 (+212.5%)
Mutual labels:  api
Indian Courier Api
API to track parcel from various Indian Logistics Providers
Stars: ✭ 26 (+225%)
Mutual labels:  api
Figma Transformer
A tiny utility library that makes the Figma API more human friendly.
Stars: ✭ 27 (+237.5%)
Mutual labels:  api
Neanderthal
Fast Clojure Matrix Library
Stars: ✭ 927 (+11487.5%)
Mutual labels:  api
Ui
UI for https://www.apibuilder.io
Stars: ✭ 8 (+0%)
Mutual labels:  api
Trumail
✉️ ✅ A Fast and Free Email Verification API written in Go
Stars: ✭ 937 (+11612.5%)
Mutual labels:  api
Date Info
API to let user fetch the events that happen(ed) on a specific date
Stars: ✭ 7 (-12.5%)
Mutual labels:  api
Django apistar
Django App to integrate API Star's routes and views into Django's ecossystem.
Stars: ✭ 25 (+212.5%)
Mutual labels:  api
Offit
Simple but powerful API mocking library. Make mocks great again.
Stars: ✭ 25 (+212.5%)
Mutual labels:  api
Ovopy
Un-official OVO API Wrapper
Stars: ✭ 27 (+237.5%)
Mutual labels:  api
Lambda Api
Lightweight web framework for your serverless applications
Stars: ✭ 929 (+11512.5%)
Mutual labels:  api
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (+10375%)
Mutual labels:  api
Go Base
Go RESTful API Boilerplate with JWT Authentication backed by PostgreSQL
Stars: ✭ 928 (+11500%)
Mutual labels:  api
Homer Api
HOMER 5: Back-End (API) DEPRICATED - use sipcapture/homer-app
Stars: ✭ 26 (+225%)
Mutual labels:  api
Railgun
An extension of the MyAnimeList API.
Stars: ✭ 8 (+0%)
Mutual labels:  api
Hvac
🔒 Python 2.7/3.X client for HashiCorp Vault
Stars: ✭ 839 (+10387.5%)
Mutual labels:  api
Ezplatform Graphql
GraphQL server for eZ Platform, the open source Symfony CMS.
Stars: ✭ 27 (+237.5%)
Mutual labels:  api

quip.js

Simple Node.js wrapper (browser included) and CLI for Quip REST API.

Built with Grunt Build Status npm version Dependency Status devDependency Status

Quip Logo

See Quip API Reference.

Installation

Just install the module using npm.

$ npm install quip.js

If you want to save it as a dependency, just add the --save option.

$ npm install quip.js --save

If you want to install with the CLI executable, just add the --global option.

$ npm install quip.js --global

Quip API

This is a simple presentation of the Quip API and its methods. To get more information (parameters, response data, ...) use the Quip API Reference

Javascript wrapper

var Quip = require('Quip');
var Quip = new Quip({
    // Quip Access Token (required)
    accessToken: 'accessToken'
});

This is how to use an API on the Quip object

Quip.api.method(params, callback);

All arguments are optional by default :

  • params : object hash with request parameters
  • callback : function called with 2 arguments (error, data)

The data arguments passed to the callback is an object hash, holding the response data. (see API documents)

Both the params and callback are optional, so you can call any method these ways :

// Both params and callback
Quip.api.method(params, callback);
// Only params parameter
Quip.api.method(params);
// Only callback parameter
Quip.api.method(callback);
// No parameter
Quip.api.method();

N.B : If the params parameter is not passed, but the method expects required parameters, an Error will be thrown.

Examples

// Threads API - Get recent threads
Quip.th.getRecentThreads(callback);
// Threads API - Create a new document
Quip.th.createDocument({title: 'Title', content: '<h1>Title</h1><p>First paragraph</p>'}, callback);
// Threads API - Edit a document by prepending content
Quip.th.editDocument({thread_id: 'threadId', content: '<p>New Section</p>', location: Quip.Operation.PREPEND}, callback);
// Messages API - Create a new message in a thread_id
Quip.msg.newMessage({thread_id: 'threadId', content: 'New Message'}, callback);
// Folders API - Create a new folder with a green cover
Quip.fdr.newFolder({title: 'My New Folder', color: Quip.Color.GREEN}, callback);
// Folders API - Update folder_id with a red cover
Quip.fdr.updateFolder({folder_id: 'folderId', color: Quip.Color.RED}, callback);
// Users API - Get all user's contacts
Quip.usr.getContacts(callback);

CLI

$ quip --help
Usage: quip [options]

  Quip Rest API Command Line

  Options:

    -h, --help                 output usage information
    -V, --version              output the version number
    -c, --config <path>        Quip Configuration file. Default to ~/.quip-cli/config.yaml
    -t, --accessToken <token>  Quip Access Token
    -d, --debug                Enabling Debugging Output

  Commands:

    threads|th [options] <method> Quip Threads API
    messages|msg [options] <method> Quip Messages API
    folders|fdr [options] <method> Quip Folders API
    users|usr [options] <method> Quip Users API

  Examples:

    $ quip threads|th getRecentThreads
    $ quip messages|msg getMessages --payload '{"thread_id": "threadId"}' --pretty
    $ quip folders|fdr newFolder --payload '{"title": "My New Folder"}' --pretty
    $ quip users|usr getAuthenticatedUser

Examples

# Threads API - Get recent threads
$ quip th getRecentThreads --pretty
# Threads API - Create a new document
$ quip th createDocument --payload '{"title": "Title", "content": "<h1>Title</h1><p>First paragraph</p>"}' --pretty
# Threads API - Edit a document by prepending content
$ quip th editDocument --payload '{"thread_id": "threadId", "content": "<p>New Section</p>", "location": 1}' --pretty
# Messages API - Create a new message in a thread_id
$ quip msg newMessage --payload '{"thread_id": "threadId", "content": "New Message"}' --pretty
# Folders API - Create a new folder with a green cover
$ quip fdr createFolder --payload '{"title": "My New Folder", "color": 3}' --pretty
# Folders API - Update folder_id with a red cover
$ quip fdr updateFolder --payload '{"folder_id": "folderId", "color": 1}' --pretty
# Users API - Get all user's contacts
$ quip usr getContacts --pretty

CLI Authentication

Without a configuration file

$ quip th getRecentThreads --accessToken accessToken --pretty

With a configuration file

# Example config file, by default it should be located at:
# ~/.quip-cli/config.yaml

auth:
  accessToken: accessToken
$ quip th getRecentThreads --pretty

With QUIP_ACCESS_TOKEN environment variable

Notes: Override --accessToken and configuration file.

$ QUIP_ACCESS_TOKEN=accessToken quip th getRecentThreads --pretty

More usage examples in the wiki.

Browser

Note

Be sure to disable same-origin policy in your browser.

Example

<html>
  <head>
  <script src="quip.min.js"></script>
  <script type="text/javascript">
  var Quip = require('quip.Quip');
  var Quip = new Quip({
      // Quip Access Token (required)
      accessToken: 'accessToken'
  });

  Quip.th.getRecentThreads(function(error, data) {
    console.log(data)  
  });
  </script>
  </head>
<html>

Demo

A demo is available online or in the test/browser folder.

Authors

License

Copyright (c) 2015 Quentin Rousseau <[email protected]>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].