lib/api.js
function(token,o){
      /*
        o.troop
        o.scout
        o.reports = [led,..]
        o.start = now
        o.end = then
        o.tail defaults true with no end
      */

      o.token = token;

      var obj = {
        type:"rest"
        ,args:{ 
          url: '/v1/stats',
          data: o,
          method: 'get' 
        }
      };
      var s = through();
      repipe(s,function(err,last,done){
        if(err && err.code != 'E_MDM') return done(err);

        if(last) o.start = last.key;
        getConnection(function(err,con){
          if(err) return done(err);

          done(false,con.mdm.createReadStream(obj));
        });
      });

      return s; // resume!
    }
function(token,o){
      /*
        o.troop
        o.scout
        o.reports = [led,..]
        o.start = now
        o.end = then
        o.tail defaults true with no end
      */

      o.token = token;

      var obj = {
        type:"rest"
        ,args:{ 
          url: '/v1/stats',
          data: o,
          method: 'get' 
        }
      };
      var s = through();
      repipe(s,function(err,last,done){
        if(err && err.code != 'E_MDM') return done(err);

        if(last) o.start = last.key;
        getConnection(function(err,con){
          if(err) return done(err);

          done(false,con.mdm.createReadStream(obj));
        });
      });

      return s; // resume!
    }
function ( token , o ) { /*
        o.troop
        o.scout
        o.reports = [led,..]
        o.start = now
        o.end = then
        o.tail defaults true with no end
      */ o . token = token ; var obj = { type : "rest" , args : { url : '/v1/stats' , data : o , method : 'get' } } ; var s = through ( ) ; repipe ( s , function ( err , last , done ) { if ( err && err . code != 'E_MDM' ) return done ( err ) ; if ( last ) o . start = last . key ; getConnection ( function ( err , con ) { if ( err ) return done ( err ) ; done ( false , con . mdm . createReadStream ( obj ) ) ; } ) ; } ) ; return s ; // resume! }
stream stats data
stream stats data