bptf-prices

    1.2.0 • Public • Published

    bptf-prices

    A Node.js wrapper for the Backpack.tf economy Web API.

    npm version npm downloads dependencies license paypal

    Installation

    Using npm:

    $ npm install bptf-prices

    Using yarn:

    $ yarn add bptf-prices

    Testing

    Note: Make sure you've supplied a valid API key in the test.js file.

    $ npm test

    Examples

    Importing with CommonJS

    const bptfprices = require('bptf-prices');

    or with ES6's import statement

    import bptfprices from 'bptf-prices';

    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);
        }
    })();

    Documentation

    See the Wiki pages for further documentation.

    License

    MIT

    Copyright 2021, Simon S. Sørensen

    Install

    npm i bptf-prices

    DownloadsWeekly Downloads

    2

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    17.4 kB

    Total Files

    6

    Last publish

    Collaborators

    • snabe