var reddit = require('../index.js');

// reddit._addSimpleRequest = function(name, endpoint, method, args, constArgs, callback)

reddit._addSimpleRequest("approve", "approve", "POST", ["id"], null, "_noResponse");
reddit._addSimpleRequest("ignoreReports", "ignore_reports", "POST", ["id"], null, "_noResponse");
reddit._addSimpleRequest("unignoreReports", "unignore_reports", "POST", ["id"], null, "_noResponse");
reddit._addSimpleRequest("nsfw", "marknsfw", "POST", ["id"], null, "_noResponse");
reddit._addSimpleRequest("unnsfw", "unmarknsfw", "POST", ["id"], null, "_noResponse");
reddit._addSimpleRequest("remove", "remove", "POST", ["id"], {"spam": false}, "_noResponse");
reddit._addSimpleRequest("spam", "remove", "POST", ["id"], {"spam": true}, "_noResponse");
reddit._addSimpleRequest("contestMode", "set_contest_mode", "POST", ["id", "state"], {"api_type": "json"}, "_noResponse");
reddit._addSimpleRequest("sticky", "set_subreddit_sticky", "POST", ["id", "state"], {"api_type": "json"}, "_noResponse");

reddit.prototype.distinguish = function(thing, distinguish, callback) {
	if(distinguish === true) {
		distinguish = 'yes';
		sticky = false;
	} else if(distinguish === false) {
		distinguish = 'no';
		sticky = false;
	} else if(distinguish === 'sticky') {
		distinguish = 'yes';
		sticky = true;
	}
	
	var self   = this;
	this._apiRequest("distinguish", {"method": "POST", "form": {
		"api_type": "json",
		"how": distinguish,
		"id": thing,
		"sticky": sticky
	}}, function(err, response, body) {
		self._modifySingleItem(err, body, callback);
	});
};

@@ -1095,16 +1095,59 @@
 ack) %7B%0D%0A
+%09var self = this,%0D%0A%09    sticky = false;%0D%0A%0D%0A
 %09if(dist
@@ -1379,30 +1379,8 @@
 %09%7D%0D%0A
-%09%0D%0A%09var self   = this;
 %0D%0A%09t

initialize sticky to prevent it becoming global