<commit_before>oauth-request [![Build Status](https://travis-ci.org/ddo/oauth-request.svg)](https://travis-ci.org/ddo/oauth-request)
=============

> OAuth 1.0a via [request](https://github.com/mikeal/request)

[![NPM version](https://badge.fury.io/js/oauth-request.png)](http://badge.fury.io/js/oauth-request)
[![Dependency Status](https://david-dm.org/ddo/oauth-request.png?theme=shields.io)](https://david-dm.org/ddo/oauth-request)

[![Coverage Status](https://coveralls.io/repos/ddo/oauth-request/badge.png?branch=master)](https://coveralls.io/r/ddo/oauth-request?branch=master)
[![Code Climate](https://codeclimate.com/github/ddo/oauth-request.png)](https://codeclimate.com/github/ddo/oauth-request)

## Installation

```
npm i oauth-request --save
```

## Usage

```js
var OAuth = require('oauth-request');

var twitter = OAuth({
    consumer: {
        public: 'xxxxx',
        secret: 'xxxxx'
    }
});

twitter.setToken({
    public: 'xxxxx',
    secret: 'xxxxx'
});

//list user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, tweets) {
    console.log(tweets);
});

//list user timeline limit 5
twitter.get({
    url: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
    qs: {
        count: 5
    },
    json: true
}, function(err, res, tweets) {
    console.log(tweets);
});
```

## [Example](/example.js)

## API

### ``.get()``

* .get(url, callback)
* .get([request options](https://github.com/mikeal/request#requestoptions-callback), callback)

### ``.post()``

* .post(url, callback)
* .post([request options](https://github.com/mikeal/request#requestoptions-callback), callback)

## TODO

* [ ] ``.stream``<commit_msg>add setToken api<commit_after>oauth-request [![Build Status](https://travis-ci.org/ddo/oauth-request.svg)](https://travis-ci.org/ddo/oauth-request)
=============

> OAuth 1.0a via [request](https://github.com/mikeal/request)

[![NPM version](https://badge.fury.io/js/oauth-request.png)](http://badge.fury.io/js/oauth-request)
[![Dependency Status](https://david-dm.org/ddo/oauth-request.png?theme=shields.io)](https://david-dm.org/ddo/oauth-request)

[![Coverage Status](https://coveralls.io/repos/ddo/oauth-request/badge.png?branch=master)](https://coveralls.io/r/ddo/oauth-request?branch=master)
[![Code Climate](https://codeclimate.com/github/ddo/oauth-request.png)](https://codeclimate.com/github/ddo/oauth-request)

## Installation

```
npm i oauth-request --save
```

## Usage

```js
var OAuth = require('oauth-request');

var twitter = OAuth({
    consumer: {
        public: 'xxxxx',
        secret: 'xxxxx'
    }
});

twitter.setToken({
    public: 'xxxxx',
    secret: 'xxxxx'
});

//list user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, tweets) {
    console.log(tweets);
});

//list user timeline limit 5
twitter.get({
    url: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
    qs: {
        count: 5
    },
    json: true
}, function(err, res, tweets) {
    console.log(tweets);
});
```

## [Example](/example.js)

## API

### ``.get()``

* .get(url, callback)
* .get([request options](https://github.com/mikeal/request#requestoptions-callback), callback)

### ``.post()``

* .post(url, callback)
* .post([request options](https://github.com/mikeal/request#requestoptions-callback), callback)

### ``.setToken(oauth_token)``

* ``oauth_token``: ``String`` token public

```js
twitter.setToken('xxxxx');
```

* ``oauth_token``: ``Object``

```js
twitter.setToken({
    public: 'xxxxx',
    secret: 'xxxxx'
});
```

## TODO

* [ ] ``.stream``
{'fraction_non_alphanumeric': 0.22354241503177674, 'fraction_numerical': 0.004421110804089527, 'mean_word_length': 4.186246418338109, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 28, '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': '2688629', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1344, 'n_words': 174}