-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
A Node.js wrapper for the Backpack.tf economy Web API.
When you require()
the module, the EconomyWrapper
class is returned. This page lists all methods (properties are private) available from that class.
However, you'll first need to instantiate a new instance of the module and supply it with your Backpack.tf developer API key.
Below is a CommonJS
example:
// Require the module
const bptfprices = require('bptf-prices');
// and supplying your API key
const bptf = new bptfprices({ apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXX' });
All methods support both callbacks
and async
/await
.
Also, please note: Function parameters are all supplied in a single object. If one or more are omitted, the function resorts to its default values.
-
options
- An object containing validbptf-prices
constructor options.-
apiKey
- Your Backpack.tf API key (This option isrequired
for performing all the requests).
-
Constructs a new EconomyWrapper
instance.
-
raw
- If set, modifies the raw value for the price index objects by allowing or preventing averaging behavior. -
callback
- Optional, called when a response is available. If omitted the function returns apromise
.-
error
- AnError
object on failure, ornull
on success. -
response
- The response object.
-
Returns a GetCurrenciesResponse object with Backpack.tf's internal currency
data for Team Fortress 2.
-
appid
- The app that owns the item (defaults to 440). -
item
- The item's base or market_hash_name (defaults to The Team Captain). -
quality
- The item's quality property (defaults to Unique). -
tradable
- The item's tradeable state (defaults to Tradable). -
craftable
- The item's craftable state (defaults to Craftable). -
priceindex
- The item's price index as a number (defaults to 0). -
callback
- Optional, called when a response is available. If omitted the function returns apromise
.-
error
- AnError
object on failure, ornull
on success. -
response
- The response object.
-
Returns a GetPriceHistoryResponse object with the price history corresponding to the item
parameter.
-
raw
- If set, modifies the raw value for the price index objects by allowing or preventing averaging behavior. -
since
- If set, only returns prices that have alast_update
value greater than or equal to this UNIX time. -
callback
- Optional, called when a response is available. If omitted the function returns apromise
.-
error
- AnError
object on failure, ornull
on success. -
response
- The response object.
-
Returns a GetPricesResponse object with the Team Fortress 2 price
schema.
-
appid
- The app that owns the item (defaults to 440). -
callback
- Optional, called when a response is available. If omitted the function returns apromise
.-
error
- AnError
object on failure, ornull
on success. -
response
- The response object.
-
Returns a GetSpecialItemsResponse object with Backpack.tf's internal item placeholders corresponding to the appid
parameter.
For now, there are some examples available in the test directory.
Feel free to create an issue if you need to report any bugs or have a suggestion for a new feature.