This package has been deprecated

Author message:

No longer maintained

cher-api

0.6.3 • Public • Published

Quick Start

 
  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

Readme

Keywords

none

Package Sidebar

Install

npm i cher-api

Weekly Downloads

1

Version

0.6.3

License

MIT

Last publish

Collaborators

  • istrategylabs