<commit_before># vokal-ng-api

> Vokal's common Angular API service. Wraps Angular's `$http` service.

* [Configuration & Usage](#section-config-usage)
* [HTTP Interface](#section-interface)
* [Events](#section-events)


## <a name="section-config-usage"></a>Configuration & Usage

The `API` service returns a constructor function that can be used to instantiate a helper for an HTTP API.

```javascript
var Facebook = new API();
```

The service can be configured by setting individual properties, or by passing an optional configuration object at instantiation.

```javascript
var Facebook = new API();
Facebook.rootPath = "https://graph.facebook.com/";
Facebook.transformHumps = false;
Facebook.setKey( token );
```

```javascript
var Facebook = new API( {
    rootPath: "https://graph.facebook.com/",
    transformHumps: false,
    globalHeaders: { AUTHORIZATION: token }
} );
```

You can instantiate the service on the fly for single usage, but the recommended pattern is to create a dedicated service that returns a pre-configured instance.

```javascript
angular.module( "vokal.Facebook", [ vokal.API ] )

.factory( "Facebook", [ "API",

    function ()
    {
        "use strict";

        var Facebook = new API( {
            rootPath: "https://graph.facebook.com/",
            transformHumps: false,
            globalHeaders: { AUTHORIZATION: token }
        } );

        return Facebook;

    }

] );
```


The following properties can be set directly or via the constructor config object:

* [globalHeaders](#prop-globalHeaders)
* [rootPath](#prop-rootPath)
* [transformHumps](#prop-transformHumps)
* [cancelOnRouteChange](#prop-cancelOnRouteChange)
* [unauthorizedInterrupt](#prop-unauthorizedInterrupt)

Several methods are available during direct configuration:

* [extendHeaders( headers )](#method-extendHeaders)
* [setKey( key )](#method-setKey)
* [getKey()](#method-getKey)
<commit_msg>extra line<commit_after># vokal-ng-api

> Vokal's common Angular API service. Wraps Angular's `$http` service.

* [Configuration & Usage](#section-config-usage)
* [HTTP Interface](#section-interface)
* [Events](#section-events)


## <a name="section-config-usage"></a>Configuration & Usage

The `API` service returns a constructor function that can be used to instantiate a helper for an HTTP API.

```javascript
var Facebook = new API();
```

The service can be configured by setting individual properties, or by passing an optional configuration object at instantiation.

```javascript
var Facebook = new API();
Facebook.rootPath = "https://graph.facebook.com/";
Facebook.transformHumps = false;
Facebook.setKey( token );
```

```javascript
var Facebook = new API( {
    rootPath: "https://graph.facebook.com/",
    transformHumps: false,
    globalHeaders: { AUTHORIZATION: token }
} );
```

You can instantiate the service on the fly for single usage, but the recommended pattern is to create a dedicated service that returns a pre-configured instance.

```javascript
angular.module( "vokal.Facebook", [ vokal.API ] )

.factory( "Facebook", [ "API",

    function ()
    {
        "use strict";

        var Facebook = new API( {
            rootPath: "https://graph.facebook.com/",
            transformHumps: false,
            globalHeaders: { AUTHORIZATION: token }
        } );

        return Facebook;

    }

] );
```

The following properties can be set directly or via the constructor config object:

* [globalHeaders](#prop-globalHeaders)
* [rootPath](#prop-rootPath)
* [transformHumps](#prop-transformHumps)
* [cancelOnRouteChange](#prop-cancelOnRouteChange)
* [unauthorizedInterrupt](#prop-unauthorizedInterrupt)

Several methods are available during direct configuration:

* [extendHeaders( headers )](#method-extendHeaders)
* [setKey( key )](#method-setKey)
* [getKey()](#method-getKey)

{'fraction_non_alphanumeric': 0.1289308176100629, 'fraction_numerical': 0.0, 'mean_word_length': 4.165087956698241, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6138461', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1057, 'n_words': 331}