# cher-api

> API for Cher

Latest version **0.6.3** (published 2015-12-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install cher-api
pnpm add cher-api
yarn add cher-api
bun add cher-api
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.6.3 |
| Published | 2015-12-07 |
| First published | 2015-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^4.2.1 |
| Dependencies | 10 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | ISL |
| Maintainers | istrategylabs |

## Links

- npm: https://www.npmjs.com/package/cher-api
- Repository: https://github.com/istrategylabs/cher-api
- Homepage: https://github.com/istrategylabs/cher-api#readme
- Issues: https://github.com/istrategylabs/cher-api/issues
- npm.io page: https://npm.io/package/cher-api

## Dependencies (10)

- [co](https://npm.io/package/co.md) ^4.6.0
- [karl](https://npm.io/package/karl.md) ^0.2.1
- [async](https://npm.io/package/async.md) ^1.4.2
- [dotenv](https://npm.io/package/dotenv.md) ^1.2.0
- [bluebird](https://npm.io/package/bluebird.md) ^2.9.34
- [cher-tools](https://npm.io/package/cher-tools.md) 0.3.0
- [json-2-csv](https://npm.io/package/json-2-csv.md) ^2.0.3
- [event-stream](https://npm.io/package/event-stream.md) ^3.3.1
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^5.0.5
- [stream-combiner2](https://npm.io/package/stream-combiner2.md) ^1.0.2

## Recent versions

- 0.6.3 (latest) — 2015-12-07
- 0.6.2 — 2015-12-04
- 0.6.1 — 2015-12-03
- 0.6.0 — 2015-12-03
- 0.4.6 — 2015-11-07
- 0.4.5 — 2015-11-07
- 0.4.4 — 2015-11-07
- 0.4.3 — 2015-11-07
- 0.4.2 — 2015-11-07
- 0.4.1 — 2015-11-07
- 0.4.0 — 2015-11-06
- 0.3.16 — 2015-11-05
- 0.3.15 — 2015-11-04
- 0.3.14 — 2015-11-03
- 0.3.13 — 2015-11-03
- … 30 more at https://npm.io/package/cher-api/versions

## README

### Quick Start

```javascript

  var CherAPI = require( 'cher-api' );
  var opts    = {};
  var env     = {};
  var cher    = // ... obtain a cher instance

  var adminApi  = CherAPI( cher, env, opts ).admin();

  adminApi.start( 'twitter' )
    .spread( ( twitterDataChannel, twitterSettings ) => {
      // twitterDataChannel is a plain old nodejs stream
      twitterDataChannel.on( 'data', ( data ) => {
        console.log(data) // { ... }
      });
    });

  // If you want stats on the data you can get them on demand
  adminApi.fetchStats()
    .then( ( stats ) => {
      console.log(stats); // { unmoderated: { twitter: 10 } }
    });

  // To run stats in the background and get updated when they're available
  var statsChannel = adminApi.getStatsChannel();

  // channel is a plain old nodejs stream
  statsChannel.on( 'data', ( data ) => {
    console.log( data ); // { ... }
  });

  adminApi.startStatsEngine();

  // To be notified when a source's state changes...
  var metaChannel = adminApi.getMetaChannel();
  metaChannel.on( 'sourceStateChange', ( data ) => {
    console.log(data): // { source: 'twitter', change: 'stopped' }
  });
```

Full API documentation can be found on the [wiki](https://github.com/istrategylabs/cher-api/wiki/API-Docs)

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