https://github.com/ghostbar/twitter-rest
Twitter's REST API library for Node.js
https://github.com/ghostbar/twitter-rest
Last synced: 8 months ago
JSON representation
Twitter's REST API library for Node.js
- Host: GitHub
- URL: https://github.com/ghostbar/twitter-rest
- Owner: ghostbar
- License: mit
- Created: 2013-11-02T03:03:12.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-04T14:30:05.000Z (almost 12 years ago)
- Last Synced: 2025-01-29T16:15:54.750Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://ghostbar.github.io/twitter-rest/
- Size: 944 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
twitter-rest [](https://codeclimate.com/github/ghostbar/twitter-rest)
============
Twitter's REST library for Node.js.
Includes the core methods (API & OAuth) from [`twitter-rest-lite`](https://github.com/ghostbar/twitter-rest-lite).
Includes the convenience methods for:
- Timelines
- Tweets
- Search
- More to come...
Timelines Interface
-------------------
### Brief
var tlib = require('twitter-rest');
var timeline = new tlib.timelines(variableWithCredentials);
// could use 'new tlib(variableWithCredentials)' too and use
// twitter.timelines to access this interface.
timeline.mentions(params, callback);
timeline.user(params, callback);
timeline.home(params, callback);
timeline.retweets(params, callback);
Tweets Interface
----------------
### Brief
var tlib = require('twitter-rest');
var tweets = new tlib.tweets(variableWithCredentials);
// could use 'new tlib(VariableWithCredentials)' too and use
// twitter.tweets to access this interface.
tweets.retweets(tweetId, params, callback); // this GETS the retweets of a tweet
tweets.show(tweetId, params, callback);
tweets.destroy(tweetId, params, callback);
tweets.update(params, callback);
tweets.retweet(tweetId, params, callback); // this MAKES a retweet to a tweet
tweets.oembed(params, callback);
tweets.retweeters(params, callback);
Search Interface
----------------
### Brief
var tlib = require('twitter-rest');
var search = new tlib.search(variableWithCredentials);
// could use 'new tlib(variablewithcredentials)' too and use
// twitter.search to access this interface.
search.query(params, callback);
### Search.query
search.query({
q: 'search query goes here'
}, function (err, response) {
// do whatever you want
});
Testing
-------
In order to run tests, first create the file `test/config.json` with the following format:
{
"consumer_key": "Your credential from Twitter's Developer Interface",
"consumer_secret": "Your credential from Twitter's Developer Interface",
"token": "Your credential from Twitter's Developer Interface",
"token_secret": "Your credential from Twitter's Developer Interface",
"callback": "Either your callback URL or `oob` for Desktop Apps"
}
Now run:
npm test
Known Issues
------------
- There's no testing for all the requests that require user context.
Quick usage guide
-----------------
var Twitter = require('twitter-rest'),
keys,
tt, ttoauth, ttapi;
keys = { consumer_key: 'blahblahblah', consumer_secret: 'blahblahblah', callback: '...' };
tt = new Twitter(keys);
// Just Twitter's OAuth REST interface
ttoauth = new Twitter.OAuth(keys);
keys['token'] = '...';
keys['token_secret'] = '...';
// Just Twitter's basic GET/POST interface
ttapi = new Twitter.API(keys);
License and author
------------------
© 2013-2014, Jose Luis Rivas ``.
Licensed under the MIT terms. A copy of the license is on the file `LICENSE`.