Skip to content

netpoetica/co-node-trello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

co-node-trello

This module is a co and generator compatible wrapper around the node-trello module by adunkman.

The only difference between this module and the node-trello module (aside from working with generators) is that you need to instantiate it upon require, like so:

var settings = require("./settings.js");
var trello = require('co-node-trello')(settings.key, settings.token);

Where settings is a file that exports a two Strings, your key and your token (instructions for generating below).

Additionally, you must run node with the --harmony flag, and it will only work on node v0.11.7 and up.

View Trello’s API documentation online. For information on Trello’s API development, visit their Trello board, of course.

Install

npm install co-node-trello

Getting your key and token

  • Generate your developer key and supply it as the first constructor parameter.
  • To read a user’s private information, get a token by directing them to https://trello.com/1/connect?key=<PUBLIC_KEY>&name=MyApp&response_type=token replacing, of course, <PUBLIC_KEY> with the public key obtained in the first step.
  • If you never want the token to expire, include &expiration=never in the url from the previous step.
  • If you need write access as well as read, &scope=read,write to the request for your user token.

Example Code

var co = require('co');
var settings = require('./settings.js');
var trello = require('co-node-trello')(settings.key, settings.token);

co(function* () {
  var member = yield trello.get("/1/members/me");
  console.log(member);

  // URL arguments are passed in as an object.
  var openCards = yield trello.get("/1/members/me", { cards: "open" });
  console.log(openCards);
})();

License

Released under MIT.

Thank you to..

Tj for Co library

adunkman's node-trello library

leukhin's co-request for the example of how to wrap

About

Co wrapper for the node-trello module

Resources

License

Stars

Watchers

Forks

Packages

No packages published