1.4.1 • Published 6 years ago

opskins-trade-interface v1.4.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

1.4.1

6 years ago

1.4.0

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago