doc.md

September 29, 2020 · View on GitHub

InventoryAPI ⇐ EventEmitter

Our InventoryAPI, extends EventEmitter to have an in-built EventEmitter for logging under 'log'.

Kind: global class
Extends: EventEmitter

new InventoryAPI([options])

An Inventory API instance

ParamTypeDefaultDescription
[options]ObjectContains optional settings for the inventory API
[options.proxy]Array.<String> | StringAn array holding a list of proxies, each will be cycled based on proxyRepeat
[options.proxyRepeat]number1Sets 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]number0Time in ms for how long we should wait before retrying a request if retries are available (default: 0)
[options.requestOptions]ObjectOptions 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]functionA 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]functionSame as requestOptions.uri
[options.requestTimeout]numberTime in ms for the timeout of any request (default: 9000)

inventoryAPI.get(steamid, appid, contextid, [tradableOnly], [retries], [language]) ⇒ Promise

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.

ParamTypeDefaultDescription
steamidSteamID | stringSteamID object from node-steamid or a string which can be parsed into a SteamID object
appidintThe Steam application ID of the app
contextidintThe ID of the context within the app you wish to retrieve
[tradableOnly]booleantrue to get only tradeable items and currencies
[retries]number1How 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')

InventoryAPI.CEconItem : CEconItem

CEconItem - the class used to represent an item. https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem

Kind: static property of InventoryAPI