# leankit-events

> Node.js client for subscribing to LeanKit board events

Latest version **1.1.0** (published 2017-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install leankit-events
pnpm add leankit-events
yarn add leankit-events
bun add leankit-events
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-06-26 |
| First published | 2017-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | David Neal |
| Maintainers | reverentgeek |
| Keywords | leankit, api, client, kanban, events, subscribe |

## Links

- npm: https://www.npmjs.com/package/leankit-events
- Repository: https://github.com/leankit/leankit-node-events
- Issues: https://github.com/leankit/leankit-node-events/issues
- npm.io page: https://npm.io/package/leankit-events

## Dependencies (2)

- [change-case](https://npm.io/package/change-case.md) ^3.0.1
- [leankit-client](https://npm.io/package/leankit-client.md) ^2.0.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-06-26
- 1.0.1 — 2017-06-23
- 1.0.0 — 2017-06-23

## README

## 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](https://github.com/LeanKit/leankit-node-client).

### Requirements

* [Node.js](http://nodejs.org) 4.x or higher
* A [LeanKit](http://leankit.com) account

### 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**

|Parameter|Description|
|:---|:---|
|`auth`|A JavaScript object with `account`, `email`, and `password` properties. An additional `options` property may be used for proxy support. See proxy section below.|
|`boardId`|The ID of the LeanKit Board to subscribe to.|
|`version`|Optional Board version number. If events have occurred since the given `version`, those will be returned immediately.|
|`pollInterval`|Optional polling interval in seconds. The default is 30 seconds.|
|`resumeAfterError`|Optional 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**

|Event|Description|
|:---|:---|
|`card-creation`|Occurs when a new card is added to a board.|
|`card-move`|Occurs when a card is moved on the board.|
|`card-fields-changed`|Occurs when a card's fields are modified (e.g. Title, Description, and so forth)|
|`comment-post`|Occurs when a user posts a comment on a card.|
|`user-assignment`|Occurs when users are assigned or unassigned from a card. Check the `isUnassigning` property to know whether the user is being assigned or unassigned.|
|`attachment-change`|Occurs when an attachment is added to a card.|
|`card-blocked`|Occurs when a card is blocked or unblocked. Check the `isBlocked` property to know whether the card was blocked or unblocked.|
|`card-move-from-board`|Occurs when a card is moved from the board being monitored to another board.|
|`card-move-to-board`|Occurs when a card is moved from another board to the board being monitored.|
|`card-deleted`|Occurs when a card is deleted.|

**Board events**

|Event|Description|
|:---|:---|
|`board-edit`|Occurs when the board layout/structure is modified.|
|`activity-types-changed` |Occurs when custom icons are modified.|
|`board-card-types-changed`|Occurs 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](https://github.com/mikeal/request#requestoptions-callback).

### Questions?

Visit [support.leankit.com](http://support.leankit.com).

### License

The LeanKit Events module is licensed under [MIT](http://www.opensource.org/licenses/mit-license.php). Refer to the [license](https://github.com/LeanKit/leankit-node-events/blob/master/LICENSE) for more information.

---
_Source: https://npm.io/package/leankit-events · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
