chirp-rest
v1.0.0
Published
twitter rest apis in nodejs
Downloads
9
Readme
chirp-rest
twitter rest apis in nodejs
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 endpointparameters
:Object
Twitter api parametersoptional
callback