A Node.js wrapper for the Backpack.tf Classifieds Web API.
Using npm:
$ npm install bptf-classifieds
Using yarn:
$ yarn add bptf-classifieds
Note: Make sure you've supplied a valid user token
and API key
in the test files.
Using npm:
$ npm test
Using yarn:
$ yarn test
const { Classifieds } = require('bptf-classifieds');
import { Classifieds } from 'bptf-classifieds';
const classifieds = new Classifieds({
token: 'XXXXXXXXXXXXXXXXXXXXXXXX',
apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXX'
});
classifieds.getListings({
sku: 'Fizzy Pharmacist',
callback: (err, data) => {
if (err) throw err;
console.log(data.listings);
}
});
(async () => {
try {
const data = await classifieds.getListings({
sku: 'The Bird-Man of Aberdeen'
});
console.log(data.listings);
} catch (error) {
console.error('An error occurred: ', error);
}
})();
There are some more examples available in the test directory.
See the Wiki pages for further documentation.
Copyright 2024, Simon Sørensen