<commit_before>Node Ninja Blocks
===
A simple library to help interacting with the Ninja Blocks Platform.

## Installation
```
npm install ninja-blocks
```

## OAuth 2 Usage
```javascript
var ninjaBlocks = require('ninja-blocks');
// ACCESS_TOKEN acquired via OAuth
var ninja = ninjaBlocks.app({access_token:ACCESS_TOKEN});

ninja.devices(function(err,devices) {
  // ...
});
```

## User Access Token Usage
```javascript
var ninjaBlocks = require('ninja-blocks');
// USER_ACCESS_TOKEN acquired via settings page in Ninja Cloud
var ninja = ninjaBlocks.app({user_access_token:USER_ACCESS_TOKEN});

ninja.devices(function(err,devices) {
  // ...
});
```

## API Overview

### User
```javascript
// Fetch a user's profile anyformation
app.user(function(err, data) { ... }); 

// Fetch a user's activity stream
app.user().stream(function(err,data){ ... }) 

// Fetch a user's pusher channel
app.user().pusher_channel(function(err,data){ ... }) 
```

### Device
```javascript
// Fetch a user's devices, a hash map of guid => metadata
app.devices(function(err, data) { ... });
app.devices('rgbled',function(err,data) { ... });

// Send `command` to device `guid`
app.device(guid).actuate(command,function(err) { ... }) 

// Subscribe to a device's data feed. Ninja Blocks will POST the requested
// device's data to the `url` provided here.
// Optionally `overwrite`s an existing callback `url`
app.device(guid).subscribe(url,overwrite,function(err) { ... }) 

// Unubscribe from a device's data feed.
app.device(guid).unsubscribe(function(err) { ... }) 

// Fetch any historical data about this device. Optionally specify the period's `start` and `end` timestamp.
app.device(guid).data(start, end, function(err, data) { ... })

// Fetch the last heartbeat received by this device.
app.device(guid).last_heartbeat(function(err, data) { ... })
```<commit_msg>Add new filter api to README<commit_after>Node Ninja Blocks
===
A simple library to help interacting with the Ninja Blocks Platform.

## Installation
```
npm install ninja-blocks
```

## OAuth 2 Usage
```javascript
var ninjaBlocks = require('ninja-blocks');
// ACCESS_TOKEN acquired via OAuth
var ninja = ninjaBlocks.app({access_token:ACCESS_TOKEN});

ninja.devices(function(err,devices) {
  // ...
});
```

## User Access Token Usage
```javascript
var ninjaBlocks = require('ninja-blocks');
// USER_ACCESS_TOKEN acquired via settings page in Ninja Cloud
var ninja = ninjaBlocks.app({user_access_token:USER_ACCESS_TOKEN});

ninja.devices(function(err,devices) {
  // ...
});
```

## API Overview

### User
```javascript
// Fetch a user's profile anyformation
app.user(function(err, data) { ... }); 

// Fetch a user's activity stream
app.user().stream(function(err,data){ ... }) 

// Fetch a user's pusher channel
app.user().pusher_channel(function(err,data){ ... }) 
```

### Device
```javascript
/**
 * Fetch all the user's device details.
 * Optionally if an object is passed as the first argument,
 * it will filter by the parameters. If a string is provided, 
 * it will assume it's the device type intended for filtering.     
 */
app.devices(function(err, data) { ... });
app.devices({ device_type:'rgb_led' },function(err,data){ ... })
app.devices({ vid:0, shortName:'On Board RGB LED' },function(err,data){ ... })

// Send `command` to device `guid`
app.device(guid).actuate(command,function(err) { ... }) 

// Subscribe to a device's data feed. Ninja Blocks will POST the requested
// device's data to the `url` provided here.
// Optionally `overwrite`s an existing callback `url`
app.device(guid).subscribe(url,overwrite,function(err) { ... }) 

// Unubscribe from a device's data feed.
app.device(guid).unsubscribe(function(err) { ... }) 

// Fetch any historical data about this device. Optionally specify the period's `start` and `end` timestamp.
app.device(guid).data(start, end, function(err, data) { ... })

// Fetch the last heartbeat received by this device.
app.device(guid).last_heartbeat(function(err, data) { ... })
```
{'fraction_non_alphanumeric': 0.16099148723084628, 'fraction_numerical': 0.0007511266900350526, 'mean_word_length': 4.263504611330698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '37392', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1222, 'n_words': 359}