@moonthug/trello

1.0.19 • Public • Published

@moonthug/trello

WARNING

At present, this client relies on a local Redis server running by default

The client interface attempts to map to the Trello API as tightly as possible, providing two methods per API resource.

i.e. Cards

API: GET https://api.trello.com/1/cards/{id}

Client: trello.getCard(id)

API: GET https://api.trello.com/1/cards/{id}/{field}

Client: trello.getCardField(id, field)

Usage

import Trello from '@moonthug/trello';

const trello = new Trello(API_KEY, API_SECRET);

To disable the cache

import Trello from '@moonthug/trello';

const trello = new Trello(API_KEY, API_SECRET, { 
  httpOptions: {
    cache: {
     enabled: false,
   }
  }
});

To configure the cache (see ../packagegs/http-cache)

import Trello from '@moonthug/trello';

const trello = new Trello(API_KEY, API_SECRET, { 
  // Defaults
  httpOptions: {
    cache: {
      // Cache
      enabled: true,
      ns: 'httpcache',
      ttl: 60 * 15,

      // Redis
      port: 6379,
      host: '127.0.0.1',
      db: 0
    }
  }
});

Examples

Get all the boards for a username

const usersBoards = await this.trello.getMemberField('username', 'boards');

Get a card by board ID

const cards = await this.trello.getBoardField(boardId, 'cards');

Readme

Keywords

none

Package Sidebar

Install

npm i @moonthug/trello

Weekly Downloads

1

Version

1.0.19

License

ISC

Unpacked Size

6.13 kB

Total Files

3

Last publish

Collaborators

  • moonthug_user