@a-2-c-2-anpm/sint-sequi-beatae
v1.0.0
Published
A Node.js wrapper for the Backpack.tf economy Web API.
Downloads
7
Maintainers
Keywords
Readme
@a-2-c-2-anpm/sint-sequi-beatae
A Node.js wrapper for the Backpack.tf economy Web API.
Installation
Using npm:
$ npm install @a-2-c-2-anpm/sint-sequi-beatae
Using yarn:
$ yarn add @a-2-c-2-anpm/sint-sequi-beatae
Testing
Note: Make sure you've supplied a valid API key
in the test.js file.
Using npm:
$ npm test
Using yarn:
$ yarn test
Examples
Importing with CommonJS
const bptfprices = require('@a-2-c-2-anpm/sint-sequi-beatae');
or with ES6's import
statement
import bptfprices from '@a-2-c-2-anpm/sint-sequi-beatae';
Instantiating with the apiKey
option
const bptf = new bptfprices({ apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXX' });
Asynchronous requests with callbacks
bptf.getSpecialItems({
appid: 440,
callback: (err, specials) => {
if (err) throw err;
console.log(specials.items);
}
});
Asynchronous requests with async
/await
(async () => {
try {
const data = await bptf.getCurrencies({
raw: 2
});
console.log(data.currencies);
} catch (error) {
console.error('An error occurred: ', error);
}
})();
There are some more examples available in the test directory.
Documentation
See the Wiki pages for further documentation.
License
Copyright 2023, Simon Sørensen