![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
twitter-rest-lite
Advanced tools
A lite Twitter's API library for Node.js. It has two interfaces: a simple API interface for interacting via GET
and POST
requests with Twitter's API and an OAuth interface that takes care of authentication related stuff with Twitter's API.
var tlite = require('twitter-rest-lite');
var twitter = new tlite.API(variableWithDevTwitterKeys);
// You could use new tlite(keys) too but you would need to access to object in the form
// 'twitter.api.get' instead of 'twitter.get'.
twitter.get(url, params, callback);
twitter.post(url, data, callback);
The constructor expects to receive the keys in a JSON that will be used to interact with the API, this includes consumer_key
, consumer_secret
, token
and token_secret
. The last two can be found as well in the developers website of Twitter for doing requests with the app's credentials.
The get
method expects to receive an URL for the API as first parameter, then the parameters that the URL accepts in a JSON and a callback as third parameters with the regular «Error first, response after».
This is an example of how it would look with a call to URL https://api.twitter.com/1.1/statuses/mentions_timeline.json
:
twitter.get('/statuses/mentions_timeline.json', {
count: 100
}, function (err, response) {
// do whatever you want
});
The post
method expects to receive an URL for the API as first parameter, then the data (at the moment only JSON) to be sent and a callback as third paramenter with the regular «Error first, response after».
This is an example of how it would look with a call to the URL https://api.twitter.com/1.1/statuses/update.json
:
twitter.post('/statuses/update.json', {
status: 'I\'m tweeting!'
}, function (err, response) {
// do whatever you want
});
In order to get full testing done (with gulp test-all
), 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 or 'oob' if is a desktop app"
}
Now run:
gulp test-all
OAuth.proto.accessToken
but the example uses it.var tlite = require('twitter-rest-lite');
var keys = { consumer_key: 'blahblahblah', consumer_secret: 'blahblahblah', callback: '...' };
var tt = new Twitter(keys);
// Just Twitter's OAuth REST interface
var TwitterOAuth = new Twitter.OAuth(keys);
// Using API module required 'token' and 'token_secret' on 'keys'.
keys['token'] = '...';
keys['token_secret'] = '...';
// Just Twitter's basic GET/POST interface
var twitter = new Twitter.API(keys);
twitter.get('/statuses/mentions_timeline.json', params, function(err, response) {
...
});
http://ghostbar.github.io/twitter-rest-lite and/or
docs/
and/or the code itself. It's the same documentation.
© 2013-2014, Jose Luis Rivas <me@ghostbar.co>
.
Licensed under the MIT terms. A copy of the license is on the file LICENSE
.
FAQs
Twitter's REST API Lite
The npm package twitter-rest-lite receives a total of 6 weekly downloads. As such, twitter-rest-lite popularity was classified as not popular.
We found that twitter-rest-lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.