0.2.0 • Published 7 years ago

trello-fetcher v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

trello-fetcher

npm version Build Status

A minimal Promise-based wrapper for easy Trello API calls.

Uses node-fetch for effortless manipulation of requests.

Install with:

npm install --save trello-fetcher

Requires Node 4.0 or newer.

Usage

Require and create an instance with your Trello key and API token:

const TrelloFetcher = require("trello-fetcher");

const fetchTrelloURL = new TrelloFetcher({
    key: "my_secret_trello_key",
    token: "my_secret_trello_token"
});

After this, you're ready to start firing Trello API calls by using the very URLs in the Trello API documentation.

Examples

You should be able to do pretty much all the operations listed in the Trello API, by specifying the method and possible some query arguments.

Get cards in list:

fetchTrelloURL(`lists/53280b9c3a5a1241b8318206/cards`)
    .then(cards => {
        console.log(`Got ${cards.length} cards:`);
        console.log(`${JSON.stringify(cards, null, 2)}`);
    })
    .catch(err => {
        console.error(`Bork! ${err.message}`);
    });

Set a card name:

fetchTrelloURL(`cards/${card.id}/name`, {
    method: "PUT",
    queryArgs: {
        value: card.name
    }
});

Set card position:

fetchTrelloURL(`cards/${card.id}/pos`, {
    method: "PUT",
    queryArgs: {
        value: "bottom"
    }
});

Changelog

  • 0.2.0 Add support for Node 4.
  • 0.1.0 First release.

Acknowledgments

chilicorn

License

MIT