Cleaned up help.js

This commit is contained in:
Alex Corn 2021-07-22 04:10:20 -04:00
parent d093466d27
commit 8ffa0b50d4
No known key found for this signature in database
GPG Key ID: E51989A3E7A27FDF

View File

@ -1,7 +1,5 @@
const SteamCommunity = require('../index.js');
const Helpers = require('./helpers.js');
/**
* Restore a previously removed steam package from your steam account.
* @param {int|string} packageID
@ -9,13 +7,13 @@ const Helpers = require('./helpers.js');
*/
SteamCommunity.prototype.restorePackage = function(packageID, callback) {
this.httpRequestPost({
"uri": "https://help.steampowered.com/wizard/AjaxDoPackageRestore",
"form": {
"packageid": packageID,
"sessionid": this.getSessionID('https://help.steampowered.com'),
"wizard_ajax": 1
uri: 'https://help.steampowered.com/wizard/AjaxDoPackageRestore',
form: {
packageid: packageID,
sessionid: this.getSessionID('https://help.steampowered.com'),
wizard_ajax: 1
},
"json": true
json: true
}, (err, res, body) => {
if (!callback) {
return;
@ -27,7 +25,7 @@ SteamCommunity.prototype.restorePackage = function(packageID, callback) {
}
if (!body.success) {
callback(body.errorMsg ? new Error(body.errorMsg) : Helpers.eresultError(body.success));
callback(new Error(body.errorMsg || 'Unexpected error'));
return;
}
@ -42,13 +40,13 @@ SteamCommunity.prototype.restorePackage = function(packageID, callback) {
*/
SteamCommunity.prototype.removePackage = function(packageID, callback) {
this.httpRequestPost({
"uri": "https://help.steampowered.com/wizard/AjaxDoPackageRemove",
"form": {
"packageid": packageID,
"sessionid": this.getSessionID('https://help.steampowered.com'),
"wizard_ajax": 1
uri: 'https://help.steampowered.com/wizard/AjaxDoPackageRemove',
form: {
packageid: packageID,
sessionid: this.getSessionID('https://help.steampowered.com'),
wizard_ajax: 1
},
"json": true
json: true
}, (err, res, body) => {
if (!callback) {
return;
@ -60,7 +58,7 @@ SteamCommunity.prototype.removePackage = function(packageID, callback) {
}
if (!body.success) {
callback(body.errorMsg ? new Error(body.errorMsg) : Helpers.eresultError(body.success));
callback(new Error(body.errorMsg || 'Unexpected error'));
return;
}