mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2024-12-28 07:30:09 +08:00
Added restorePackage & removePackage
This commit is contained in:
parent
2bbdbf36ad
commit
e6995e337e
64
index.js
64
index.js
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user