-
Notifications
You must be signed in to change notification settings - Fork 6
SteamBadgeUnlocker
node-steam-badge-unlocker
is a lib extension with multiple classes for simple usage. This page lists all methods and properties available from the root of the module.
At first, you need an instance of node-steamcommunity
. Example:
const SteamCommunity = require('steamcommunity');
let community = new SteamCommunity();
Then you can create new instance of node-steam-badge-unlocker
. Example:
const SteamBadgeUnlocker = require('steam-badge-unlocker');
let badgeUnlocker = new SteamBadgeUnlocker(community);
No public properties defined at the moment.
-
community
- Required. An object ofnode-steamcommunity
instance with logged in user.SteamCommunity instance will be used for communication with steam platform.
-
options
- Optional. An object with possible properties:-
apiKey
- steam web api key, in case if you already fetched api key, you can save the request and define it as property. -
apiToken
- steam web api token from points shop. In case if you already fetched api token, you can save the request. -
customUrl
- customUrl from profile. For better quality of request based on profile url, you can predefine it here.
-
: CCommunityLeader
Returns CCommunityLeader
instance.
-
options
-<Object>
- Required. SeeCCommunityLeader.options
.
: SteamCommunity
Returns a community instance.
It will be used from extended methods to access SteamCommunity functions.
: string
Returns a used language. Default is english.
It is important to use english, because most of parsers are using english textes to analyse the response results.
: string
Returns a link to logged in steam profile. Default is https://steamcommunity.com/profiles/{steamId}
Will be used to call profile based urls.
: string
Returns steamcommunity web session id.
SteamCommunity normally copy same cookies to api, community and store pages. One session id should be enough for all requests.
: string
Returns steam id.
SteamCommunity.steamID will be copied as string and saved as internal static variable, that will be used with this method.
: Promise<string>
Returns steam api key if possible. It is empty string for limited accounts.
This is one time request if api key is not defined with constructor options. The response will be cached and used for second calls.
: Promise<string>
Returns steam api token. Promise will be rejected on failure.
This is one time request if api token is not defined with constructor options. The response will be cached and used for second calls.
: Promise<string | json>
Returns html result or json object in case of json: true. Promise will be rejected on http or steam errors.
-
options
- request module options.-
url
-string
- Required. Fully qualified url for requests. -
json
-boolean
. Returns json object on true or html string on false. -
qs
-Object
. Get parameters forurl
. -
headers
-Object
. Headers.
-
Examples:
// lets check new inventory items
badgeUnlocker.get({
url: 'https://steamcommunity.com/actions/GetNotificationCounts',
json: true,
}).then(json => {
if (json && json.notifications) {
console.log('New items:', json.notifications['5']);
} else {
console.log('New items:', null);
}
}, error => console.log(error));
// or you have async function:
const json = await badgeUnlocker.get({
url: 'https://steamcommunity.com/actions/GetNotificationCounts',
json: true,
}).catch(() => {});
if (json && json.notifications) {
console.log('New trade offers:', json.notifications['1']);
console.log('New invites:', json.notifications['6']);
}
: Promise<string | json>
Returns html result or json object in case of json: true. Promise will be rejected on http or steam errors.
-
options
- request module options.-
url
-<string>
- Required. Fully qualified url for requests. -
json
-<boolean>
. Returns json object on true or html string on false. -
qs
-<Object>
. Get parameters forurl
. -
headers
-<Object>
. Headers. -
form
-<Object>
. Post parameters. -
followRedirect
-<boolean>
. Follow non-GET HTTP redirects. -
followOriginalHttpMethod
-<boolean>
. Follow redirects its original HTTP method.
-
Examples:
// lets unsubscribe from all steam emails
badgeUnlocker.post({
url: 'https://store.steampowered.com/account/emailoptout',
form: {
action: 'save',
sessionid: badgeUnlocker.getSessionId(),
opt_out_all: 1,
},
followAllRedirects: true,
}).then(() => console.log('done'), error => console.log(error));
// or you have async function:
// lets subscribe only to wishlist sales
await badgeUnlocker.post({
url: 'https://store.steampowered.com/account/emailoptout',
form: {
action: 'save',
sessionid: badgeUnlocker.getSessionId(),
opt_out_all: 0,
opt_out_wishlist_inverse: 1,
},
followAllRedirects: true,
}).catch(error => console.log(error));
: Promise<Array<html>>
Create new discovery queue and clear for all game ids automatically.
Examples:
badgeUnlocker.finishDiscoveryQueue().then(() => console.log('discovery queue done'), e => console.log(e));
: Promise<html>
Clear discovery queue for single app id.
-
appId
-<number>
- Required. Game id. -
queueAppId
-<number>
. Default: 10. App id for clearing requests.
: Promise<{queue: Array<number>}>
Generate new discovery queue of 11 games.
-
eQueueType
-<number>
. Default: 0. Unknown queue type.
: Promise<html>
Returns short html content of last 10 entries for specific sub section.
-
subSection
-<string>
- Required. Possible values see in ESubSection. -
params
-<{qs: Object, headers: Object}>
.-
qs
: Get query parameters like:p
for page number orbrowsefilter
. -
headers
: are headers object.
-
: Promise<{response: {quests?: Array<{questid: number, completed: boolean}>}>
Gets all the quests needed to get the specified badge, and which are completed.
-
apiKey
-<string>
- Required. -
badgeId
-<number>
. Default: 2 - Steam Community Badge.
: Promise<{response: {quests?: Array<{questid: number, completed: boolean}>}>
Gets all the quests needed to get the specified badge, and which are completed.
-
badgeId
-<number>
. Default: 2 - Steam Community Badge.
This option works only for mapped badges. At the moment it is only Steam Community Badge with id: 2.