opskins-trade-interface

1.4.1 • Public • Published
VGOWIKI

opskins-trade-interface

NodeJS interface for interaction with trade.opskins.com API

Contents

Install

Clone this repo and include index.js or install via npm:

npm install opskins-trade-interface

Usage

const TradeInterface = require('opskins-trade-interface')
 
const interface = new TradeInterface(APIKEY)
 
// Gets apikey user inventory
async function getInventory() {
  try {
    // RECURSIVE: true - Gets all pages of inventory by requesting it multiple times
    const res = await trade.IUser.GetInventory({ app_id: 1, RECURSIVE: true })
 
    console.log(res)
  } catch(err) {
    console.log(err)
  }
}
 
getInventory()

Methods

All the methods use same parameters and produce same result as described in Trade Opskins API Documentation

Calling example method:

const res = await trade.IUser.GetInventory({ app_id: 1, RECURSIVE: true })
// IUser - collection of methods from docs
// GetInventory - one of the methods of this collection
// app_id - one of the method's parameters
// RECURSIVE - one of the module's specific parameters
 
console.log(res)
/* =>
{
  "status": 1,
  "time": 1528135996,
  "response": {
    "total": 123,
    "items": [...],
    "sort_parameters": {...}
  }
}

Module specific parameters

There are several parameters that are added in addition to all other documented parameters all of which are optional

  • RECURSIVE (boolean, false by default) - if true, gets all pages of response of some methods. Works for IUser.GetInventory, ITrade.GetOffers, ITrade.GetUserInventory, ITrade.GetUserInventoryFromSteamId
  • CONCURRENCY (integer, 1 by default) - works in pair with RECURSIVE. Sets concurrency for requests queue. Notice that increasing CONCURRENCY gives faster method execution time, but increases the risk of being ratelimited by opskins.
  • NOVALIDATION (boolean, false by default) - if true, skips parameters validation. Can be usefull if correct parameters unexpectadly rejected by the module

Recommended use

Its recommended to use this module through opskins-trade-manager in order to enhance development experience by having auto polling with events, class based outputs and more

Package Sidebar

Install

npm i opskins-trade-interface

Weekly Downloads

0

Version

1.4.1

License

MIT

Unpacked Size

25.2 kB

Total Files

21

Last publish

Collaborators

  • feed4rz
  • madmad