1.1.0 • Published 7 years ago

leankit-events v1.1.0

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

LeanKit Events for Node.js

The LeanKit Events for Node.js provides an easy-to-use set of functions designed to simplify the integration of external systems and utilities with your LeanKit account. This module is for subscribing to events, such as when cards are created, moved, assigned, and so forth.

To access specific LeanKit APIs from Node.js, see the LeanKit Node.js Client.

Requirements

Installing the client

npm install leankit-events

Subscribe to events

The LeanKit Client includes a module for monitoring a board for events, such as when cards are created, moved, assigned, and so forth.

Events usage

const LeanKitEvents = require( "leankit-events" );
const events = new LeanKitEvents( auth, boardId [, version] [, pollInterval] [, resumeAfterError] );
events.on( "event-name", function( e ) {
	// Do something with the event
} );
events.start();

Constructor options

ParameterDescription
authA JavaScript object with account, email, and password properties. An additional options property may be used for proxy support. See proxy section below.
boardIdThe ID of the LeanKit Board to subscribe to.
versionOptional Board version number. If events have occurred since the given version, those will be returned immediately.
pollIntervalOptional polling interval in seconds. The default is 30 seconds.
resumeAfterErrorOptional handling of errors. If an error occurs with resumeAfterError = false the client will stop polling for changes. The default is true.

Sample

const LeanKitEvents = require( "leankit-events" );
const auth = { account: "account-name", email: "your@email.com", password: "your-p@ssw0rd" };
const boardId = 445566789; // The board ID to subscribe to
const events = new LeanKitEvents( auth, boardId );
events.on( "card-creation", function( e ) {
	console.log( e );
} );
events.start();

Sample output when a card is added to the subscribed board:

{ cardId: 123456789,
  eventType: 'card-creation',
  eventDateTime: '11/06/2015 03:38:05 PM',
  message: 'David Neal created the Card [Sample Card 1] within Lane [ToDo].',
  toLaneId: 456789123,
  fromLaneId: null,
  requiresBoardRefresh: false,
  isBlocked: false,
  blockedComment: null,
  userId: 62984826,
  assignedUserId: 0,
  isUnassigning: false,
  commentText: null,
  wipOverrideComment: null,
  wipOverrideLane: 0,
  wipOverrideUser: 0,
  taskboardParentCardId: 0,
  taskboardId: 0,
  boardVersion: 2 }

Card events

EventDescription
card-creationOccurs when a new card is added to a board.
card-moveOccurs when a card is moved on the board.
card-fields-changedOccurs when a card's fields are modified (e.g. Title, Description, and so forth)
comment-postOccurs when a user posts a comment on a card.
user-assignmentOccurs when users are assigned or unassigned from a card. Check the isUnassigning property to know whether the user is being assigned or unassigned.
attachment-changeOccurs when an attachment is added to a card.
card-blockedOccurs when a card is blocked or unblocked. Check the isBlocked property to know whether the card was blocked or unblocked.
card-move-from-boardOccurs when a card is moved from the board being monitored to another board.
card-move-to-boardOccurs when a card is moved from another board to the board being monitored.
card-deletedOccurs when a card is deleted.

Board events

EventDescription
board-editOccurs when the board layout/structure is modified.
activity-types-changedOccurs when custom icons are modified.
board-card-types-changedOccurs when card types for the board are modified.

Proxy support

To use the LeanKit Events behind a proxy server, include an options object in the authentication argument that includes the proxy server. For example:

const LeanKitEvents = require( "leankit-events" );
const auth = {
	account: "account-name",
	email: "your@email.com",
	password: "your-p@ssw0rd",
	options: {
		proxy: "http://localproxy.com"
	}
};

const events = new LeanKitEvents( auth, 123456789 );

This options object is the same object used by the request module.

Questions?

Visit support.leankit.com.

License

The LeanKit Events module is licensed under MIT. Refer to the license for more information.