chirp-rest

1.0.0 • Public • Published

chirp-rest Build Status

twitter rest apis in nodejs

NPM version Dependency Status

Coverage Status Code Climate

Installation

npm i chirp-rest --save

Usage

var ChirpRest = require('./');
 
var twitter = new ChirpRest({
    consumer: {
        public: 'xxxxx',
        secret: 'xxxxx'
    },
    token: {
        public: 'xxxxx'
        secret: 'xxxxx'
    }
});
 
//get user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
    //body -> tweets
});

Example

  • get user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
    //body -> tweets
});
  • get user timeline limit 5
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', {
    count: 5
}, function(err, body) {
    //body -> tweets
});
  • get user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
    //body -> tweets
});
  • post new status
twitter.post('https://api.twitter.com/1.1/statuses/update.json', {
    status: 'chirp chirp'
}, function(err, body) {
    //body -> tweet data
});

https://dev.twitter.com/docs/api/1.1

API

  • .get(url, parameters, callback)
  • .post(url, parameters, callback)

Option

  • url:String Twitter api endpoint
  • parameters: Object Twitter api parameters optional
  • callback

Readme

Keywords

Package Sidebar

Install

npm i chirp-rest

Weekly Downloads

7

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ddo