node-twitter-api
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "node-twitter-api", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Simple module for using Twitter's API in node.js", | ||
@@ -5,0 +5,0 @@ "keywords": ["twitter", "oauth", "rest", "streaming"], |
@@ -1,2 +0,2 @@ | ||
var VERSION = "1.3.0", | ||
var VERSION = "1.4.0", | ||
querystring = require("querystring"), | ||
@@ -532,2 +532,41 @@ oauth = require("oauth"), | ||
// Mutes | ||
Twitter.prototype.mutes = function(type, params, accessToken, accessTokenSecret, callback) { | ||
var url = type.toLowerCase(); | ||
var method = "GET"; | ||
switch (url) { | ||
case "users/create": | ||
case "users/destroy": | ||
method = "POST"; | ||
break; | ||
} | ||
if (method == "GET") { | ||
this.oa.get(baseUrl + "mutes/" + url + ".json?" + querystring.stringify(params), accessToken, accessTokenSecret, function(error, data, response) { | ||
if (error) { | ||
callback(error, data, response, baseUrl + "mutes/" + url + ".json?" + querystring.stringify(params)); | ||
} else { | ||
try { | ||
callback(null, JSON.parse(data), response); | ||
} catch (e) { | ||
callback(e, data, response); | ||
} | ||
} | ||
}); | ||
} else { | ||
this.oa.post(baseUrl + "mutes/" + url + ".json", accessToken, accessTokenSecret, params, function(error, data, response) { | ||
if (error) { | ||
callback(error, data, response); | ||
} else { | ||
try { | ||
callback(null, JSON.parse(data), response); | ||
} catch (e) { | ||
callback(e, data, response); | ||
} | ||
} | ||
}); | ||
} | ||
}; | ||
// Users | ||
@@ -534,0 +573,0 @@ Twitter.prototype.users = function(type, params, accessToken, accessTokenSecret, callback) { |
31897
864