Added restorePackage & removePackage

This commit is contained in:
Revadike 2021-03-19 15:22:41 +01:00
parent 2bbdbf36ad
commit e6995e337e

View File

@ -535,6 +535,70 @@ SteamCommunity.prototype._myProfile = function(endpoint, form, callback) {
}
};
/**
* Restore a previously removed steam package from your steam account.
* @param {int|string} packageID
* @param {function} callback
*/
SteamCommunity.prototype.restorePackage = function(packageID, callback) {
this.httpRequestPost({
"uri": "https://help.steampowered.com/wizard/AjaxDoPackageRestore",
"form": {
"packageid": packageID,
"sessionid": this.getSessionID(),
"wizard_ajax": 1
},
"json": true
}, (err, res, body) => {
if (err) {
callback(err);
return;
}
if (body.success && body.success != SteamCommunity.EResult.OK) {
let err = new Error(body.errorMsg || SteamCommunity.EResult[body.success]);
err.eresult = err.code = body.success;
callback(err);
return;
}
callback(null);
});
};
/**
* Remove a steam package from your steam account.
* @param {int|string} packageID
* @param {function} callback
*/
SteamCommunity.prototype.removePackage = function(packageID, callback) {
this.httpRequestPost({
"uri": "https://help.steampowered.com/wizard/AjaxDoPackageRemove",
"form": {
"packageid": packageID,
"sessionid": this.getSessionID(),
"wizard_ajax": 1
},
"json": true
}, (err, res, body) => {
if (err) {
callback(err);
return;
}
if (body.success && body.success != SteamCommunity.EResult.OK) {
let err = new Error(body.errorMsg || SteamCommunity.EResult[body.success]);
err.eresult = err.code = body.success;
callback(err);
return;
}
callback(null);
});
};
require('./components/http.js');
require('./components/chat.js');
require('./components/profile.js');