Export request

This commit is contained in:
Alexander Corn 2015-06-09 14:45:07 -04:00
parent e789d07833
commit 2a2947344f
3 changed files with 23 additions and 23 deletions

View File

@ -12,7 +12,7 @@ SteamCommunity.prototype.getSteamGroup = function(id, callback) {
}
var self = this;
this._request("https://steamcommunity.com/" + (typeof id === 'string' ? "groups/" + id : "gid/" + id.toString()) + "/memberslistxml/?xml=1", function(err, response, body) {
this.request("https://steamcommunity.com/" + (typeof id === 'string' ? "groups/" + id : "gid/" + id.toString()) + "/memberslistxml/?xml=1", function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || "HTTP error " + response.statusCode);
return;
@ -65,7 +65,7 @@ CSteamGroup.prototype.getMembers = function(callback, members, link) {
link = link || "http://steamcommunity.com/gid/" + this.steamID.toString() + "/memberslistxml/?xml=1";
var self = this;
this._community._request(link, function(err, response, body) {
this._community.request(link, function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || "HTTP error " + response.statusCode);
return;
@ -97,7 +97,7 @@ CSteamGroup.prototype.join = function(callback) {
};
var self = this;
this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString(), {"form": form}, function(err, response, body) {
this._community.request.post("https://steamcommunity.com/gid/" + this.steamID.toString(), {"form": form}, function(err, response, body) {
if(!callback) {
return;
}
@ -149,7 +149,7 @@ CSteamGroup.prototype.postAnnouncement = function(headline, content, callback) {
"body": content
};
this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/announcements", {"form": form}, function(err, response, body) {
this._community.request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/announcements", {"form": form}, function(err, response, body) {
if(!callback) {
return;
}
@ -208,7 +208,7 @@ CSteamGroup.prototype.scheduleEvent = function(name, type, description, time, se
}
var self = this;
this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/eventEdit", {"form": form}, function(err, response, body) {
this._community.request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/eventEdit", {"form": form}, function(err, response, body) {
if(!callback) {
return;
}
@ -235,7 +235,7 @@ CSteamGroup.prototype.setPlayerOfTheWeek = function(steamID, callback) {
};
var self = this;
this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/potwEdit", {"form": form}, function(err, response, body) {
this._community.request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/potwEdit", {"form": form}, function(err, response, body) {
if(!callback) {
return;
}
@ -269,7 +269,7 @@ CSteamGroup.prototype.kick = function(steamID, callback) {
};
var self = this;
this._community._request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/membersManage", {"form": form}, function(err, response, body) {
this._community.request.post("https://steamcommunity.com/gid/" + this.steamID.toString() + "/membersManage", {"form": form}, function(err, response, body) {
if(!callback) {
return;
}

View File

@ -12,7 +12,7 @@ SteamCommunity.prototype.getSteamUser = function(id, callback) {
}
var self = this;
this._request("http://steamcommunity.com/" + (typeof id === 'string' ? "id/" + id : "profiles/" + id.toString()) + "/?xml=1", function(err, response, body) {
this.request("http://steamcommunity.com/" + (typeof id === 'string' ? "id/" + id : "profiles/" + id.toString()) + "/?xml=1", function(err, response, body) {
if(err || response.statusCode != 200) {
callback(err || "HTTP error " + response.statusCode);
return;
@ -104,7 +104,7 @@ CSteamUser.prototype.getAvatarURL = function(size, protocol) {
};
CSteamUser.prototype.addFriend = function(callback) {
this._community._request.post('https://steamcommunity.com/actions/AddFriendAjax', {"form": {"accept_invite": 0, "sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
this._community.request.post('https://steamcommunity.com/actions/AddFriendAjax', {"form": {"accept_invite": 0, "sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
@ -131,7 +131,7 @@ CSteamUser.prototype.addFriend = function(callback) {
};
CSteamUser.prototype.acceptFriendRequest = function(callback) {
this._community._request.post('https://steamcommunity.com/actions/AddFriendAjax', {"form": {"accept_invite": 1, "sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
this._community.request.post('https://steamcommunity.com/actions/AddFriendAjax', {"form": {"accept_invite": 1, "sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
@ -146,7 +146,7 @@ CSteamUser.prototype.acceptFriendRequest = function(callback) {
};
CSteamUser.prototype.removeFriend = function(callback) {
this._community._request.post('https://steamcommunity.com/actions/RemoveFriendAjax', {"form": {"sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
this._community.request.post('https://steamcommunity.com/actions/RemoveFriendAjax', {"form": {"sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
@ -161,7 +161,7 @@ CSteamUser.prototype.removeFriend = function(callback) {
};
CSteamUser.prototype.blockCommunication = function(callback) {
this._community._request.post('https://steamcommunity.com/actions/BlockUserAjax', {"form": {"sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
this._community.request.post('https://steamcommunity.com/actions/BlockUserAjax', {"form": {"sessionID": this._community.getSessionID(), "steamid": this.steamID.toString()}}, function(err, response, body) {
if(!callback) {
return;
}
@ -194,7 +194,7 @@ CSteamUser.prototype.unblockCommunication = function(callback) {
};
CSteamUser.prototype.comment = function(message, callback) {
this._community._request.post('https://steamcommunity.com/comment/Profile/post/' + this.steamID.toString() + '/-1/', {"form": {
this._community.request.post('https://steamcommunity.com/comment/Profile/post/' + this.steamID.toString() + '/-1/', {"form": {
"comment": message,
"count": 6,
"sessionid": this._community.getSessionID()

View File

@ -9,7 +9,7 @@ SteamCommunity.SteamID = SteamID;
function SteamCommunity() {
this._jar = Request.jar();
this._request = Request.defaults({"jar": this._jar});
this.request = Request.defaults({"jar": this._jar});
}
SteamCommunity.prototype.login = function(details, callback) {
@ -19,7 +19,7 @@ SteamCommunity.prototype.login = function(details, callback) {
}
var self = this;
this._request.post("https://steamcommunity.com/login/getrsakey/", {"form": {"username": details.accountName}}, function(err, response, body) {
this.request.post("https://steamcommunity.com/login/getrsakey/", {"form": {"username": details.accountName}}, function(err, response, body) {
if(err) {
callback(err);
return;
@ -49,7 +49,7 @@ SteamCommunity.prototype.login = function(details, callback) {
"username": details.accountName
};
self._request.post("https://steamcommunity.com/login/dologin/", {"form": form}, function(err, response, body) {
self.request.post("https://steamcommunity.com/login/dologin/", {"form": form}, function(err, response, body) {
if(err) {
callback(err);
return;
@ -124,7 +124,7 @@ function generateSessionID() {
SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
var self = this;
this._request("https://steamcommunity.com/dev/apikey", function(err, response, body) {
this.request("https://steamcommunity.com/dev/apikey", function(err, response, body) {
if(err || response.statusCode != 200) {
return callback(err.message || "HTTP error " + response.statusCode);
}
@ -139,7 +139,7 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
callback(null, match[1]);
} else {
// We need to register a new API key
self._request.post('https://steamcommunity.com/dev/registerkey', {
self.request.post('https://steamcommunity.com/dev/registerkey', {
"form": {
"domain": domain,
"agreeToTerms": "agreed",
@ -158,7 +158,7 @@ SteamCommunity.prototype.getWebApiKey = function(domain, callback) {
};
SteamCommunity.prototype.parentalUnlock = function(pin, callback) {
this._request.post("https://steamcommunity.com/parental/ajaxunlock", {
this.request.post("https://steamcommunity.com/parental/ajaxunlock", {
"json": true,
"form": {
"pin": pin
@ -185,7 +185,7 @@ SteamCommunity.prototype.parentalUnlock = function(pin, callback) {
};
SteamCommunity.prototype.getNotifications = function(callback) {
this._request.get("https://steamcommunity.com/actions/RefreshNotificationArea", function(err, response, body) {
this.request.get("https://steamcommunity.com/actions/RefreshNotificationArea", function(err, response, body) {
if(err || response.statusCode != 200) {
return callback(err.message || "HTTP error " + response.statusCode);
}
@ -220,7 +220,7 @@ SteamCommunity.prototype.getNotifications = function(callback) {
};
SteamCommunity.prototype.resetItemNotifications = function(callback) {
this._request.get("https://steamcommunity.com/my/inventory", function(err, response, body) {
this.request.get("https://steamcommunity.com/my/inventory", function(err, response, body) {
if(!callback) {
return;
}
@ -245,7 +245,7 @@ SteamCommunity.prototype._checkCommunityError = function(html, callback) {
SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
var self = this;
this._request("https://steamcommunity.com/my", {"followRedirect": false}, function(err, response, body) {
this.request("https://steamcommunity.com/my", {"followRedirect": false}, function(err, response, body) {
if(err || response.statusCode != 302) {
callback(err || "HTTP error " + response.statusCode);
return;
@ -257,7 +257,7 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
return;
}
(form ? self._request.post : self._request)("https://steamcommunity.com" + match[1] + "/" + endpoint, form ? {"form": form} : {}, callback);
(form ? self.request.post : self.request)("https://steamcommunity.com" + match[1] + "/" + endpoint, form ? {"form": form} : {}, callback);
});
};