<commit_before>
Bandiera Client (Node)
======================

This is a client for talking to the [Bandiera][bandiera] feature flagging service from a [Node.js][node] application.
This client currently only implements the read methods of the [Bandiera API][bandiera-api].

**Current Version:** *0.0.0*  
**Node Support:** *0.10.x, 0.11.x*  
**License:** [GPL3][gpl]  
**Build Status:** [![Build Status][travis-img]][travis]


Installation
------------

```sh
npm install bandiera-client
```

or add `bandiera-client` to your `package.json` file.


Examples
--------

Create an instance of the bandiera client:

```js
var bandiera = require('bandiera-client');
var client = bandiera.createClient('http://your-bandiera-server.com');
```

Each method of the client requires a callback. These callbacks accept two arguments, the first is an error object or `null` the second contains the response.

Get features for all groups:

```js
client.getAll(function (err, groups) {
    /*
    groups = {
        'group name': [
            {group: 'group name', name: String, description: String, enabled: Boolean}, 
            ...
        ],
        ... 
    }
	 */
});
```

Get features for a group:

```js
client.getFeaturesForGroup('group name', function (err, features) {
	/*
    features = [
        {group: 'group name', name: String, description: String, enabled: Boolean}, 
        ...
    ]
     */
});
```

Get an individual feature:

```js
client.getFeature('group name', 'feature name', function (err, feature) {
    /*
    feature = {group: 'group name', name: 'feature name', description: String, enabled: Boolean}
     */
});
```

Get the status of an individual feature:

```js
client.isEnabled('group name', 'feature name', function (err, enabled) {<commit_msg>Document new method signatures<commit_after>
Bandiera Client (Node)
======================

This is a client for talking to the [Bandiera][bandiera] feature flagging service from a [Node.js][node] application.
This client currently only implements the read methods of the [Bandiera API][bandiera-api].

**Current Version:** *0.0.0*  
**Node Support:** *0.10.x, 0.11.x*  
**License:** [GPL3][gpl]  
**Build Status:** [![Build Status][travis-img]][travis]


Installation
------------

```sh
npm install bandiera-client
```

or add `bandiera-client` to your `package.json` file.


Examples
--------

Create an instance of the bandiera client:

```js
var bandiera = require('bandiera-client');
var client = bandiera.createClient('http://your-bandiera-server.com');
```

Each method of the client requires a callback. These callbacks accept two arguments, the first is an error object or `null` the second contains the response.

In the examples below, `params` is an object containing query parameters to send as part of the request to Bandiera. See the [API documentation][bandiera-api] for available parameters.

Get features for all groups:

```js
client.getAll(params, function (err, groups) {
    /*
    groups = {
        'group name': [
            {group: 'group name', name: String, description: String, enabled: Boolean}, 
            ...
        ],
        ... 
    }
	 */
});
```

Get features for a group:

```js
client.getFeaturesForGroup('group name', params, function (err, features) {
	/*
    features = [
        {group: 'group name', name: String, description: String, enabled: Boolean}, 
        ...
    ]
     */
});
```

Get an individual feature:

```js
client.getFeature('group name', 'feature name', params, function (err, feature) {
    /*
    feature = {group: 'group name', name: 'feature name', description: String, enabled: Boolean}
     */
});
```

Get the status of an individual feature:

```js
client.isEnabled('group name', 'feature name', params, function (err, enabled) {
{'fraction_non_alphanumeric': 0.1616750596342433, 'fraction_numerical': 0.005300821627352239, 'mean_word_length': 3.414035087719298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '693750', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1081, 'n_words': 390}