Our InventoryAPI, extends EventEmitter to have an in-built EventEmitter for logging under 'log'.
Kind: global class
Extends: EventEmitter
- InventoryAPI ⇐
EventEmitter
- new InventoryAPI([options])
- instance
- static
- .CEconItem :
CEconItem
- .CEconItem :
An Inventory API instance
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
Contains optional settings for the inventory API | |
[options.proxy] | Array.<String> | String |
An array holding a list of proxies, each will be cycled based on proxyRepeat | |
[options.proxyRepeat] | number |
1 |
Sets how many times a proxy will be repeated for a request before being cycled. A proxy will be used proxyRepeat times + 1 (default: 1) |
[options.retryDelay] | number |
0 |
Time in ms for how long we should wait before retrying a request if retries are available (default: 0) |
[options.requestOptions] | Object |
Options that can override the default settings for any inventory HTTP request. Useful if you are using another endpoint to fetch inventories (such as steamapis). See doc for the request module on what options can be parsed in | |
[options.requestOptions.uri] | function |
A function with parameters (steamid, appid, contextid) which should return the correct format for the uri. e.g. (steamid, appid, contextid) => https://api.steamapis.com/steam/inventory/${steamid}/${appid}/${contextid} |
|
[options.requestOptions.url] | function |
Same as requestOptions.uri | |
[options.requestTimeout] | number |
Time in ms for the timeout of any request (default: 9000) |
Get the contents of a users inventory. Designed to be the same as DoctorMcKay's getUserInventoryContents from node-steamcommunity (with retries)
Kind: instance method of InventoryAPI
Returns: Promise
- Promise object containing an object with keys: inventory, currency and total_inventory_count - with inventory and currency being an array of CEconItem objects.
Param | Type | Default | Description |
---|---|---|---|
steamid | SteamID | string |
SteamID object from node-steamid or a string which can be parsed into a SteamID object | |
appid | int |
The Steam application ID of the app | |
contextid | int |
The ID of the context within the app you wish to retrieve | |
[tradableOnly] | boolean |
true to get only tradeable items and currencies | |
[retries] | number |
1 |
How many calls to make to an inventory before rejecting. If an inventory is private or not found this value is ignored and an error is thrown after the first request. |
[language] | string |
"'english'" |
The language of item descriptions to return (default: 'english') |
CEconItem - the class used to represent an item. https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem
Kind: static property of InventoryAPI