Add ability to get user aliases

This commit is contained in:
Andrew Dassonville 2016-07-06 16:20:42 -07:00
parent 3ba0a8592e
commit 89a1df67ec
No known key found for this signature in database
GPG Key ID: F59D6BCF0C95C367
2 changed files with 30 additions and 0 deletions

View File

@ -150,6 +150,10 @@ CSteamUser.prototype.inviteToGroup = function(groupID, callback) {
this._community.inviteUserToGroup(this.steamID, groupID, callback);
};
CSteamUser.prototype.getAliases = function(callback) {
this._community.getUserAliases(this.steamID, callback);
};
CSteamUser.prototype.getInventoryContexts = function(callback) {
this._community.getUserInventoryContexts(this.steamID, callback);
};

View File

@ -190,6 +190,32 @@ SteamCommunity.prototype.inviteUserToGroup = function(userID, groupID, callback)
}, "steamcommunity");
};
SteamCommunity.prototype.getUserAliases = function(userID, callback) {
if(typeof userID === 'string') {
userID = new SteamID(userID);
}
var endpoint = "/profiles/" + userID.getSteamID64();
var self = this;
this.httpRequestGet({
"uri": "https://steamcommunity.com" + endpoint + "/ajaxaliases",
"json": true
}, function(err, response, body) {
if (err) {
callback(err);
return;
}
if(typeof body !== 'object') {
callback(new Error("Malformed response"));
return;
}
callback(null, body);
}, "steamcommunity");
};
SteamCommunity.prototype.getUserInventoryContexts = function(userID, callback) {
if(typeof userID === 'string') {
userID = new SteamID(userID);