JSPM

@nolddor/steam-tradelink

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q34979F
  • License Apache-2.0

This module provides a SteamTradeLink object which makes Steam trade link usage easy

Package Exports

  • @nolddor/steam-tradelink
  • @nolddor/steam-tradelink/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nolddor/steam-tradelink) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SteamTradeLink for Node.js

This module provides a SteamTradeLink object which makes Steam trade link usage easy.

Installation

Install it from npm:

$ npm install @nolddor/steam-tradelink

Brief Overview

A SteamTradeLink is made up of two parts: its token and its partner.

SteamTradeLink Creation

You can create a SteamTradeLink object from a tradelink URL, or from the four parts that make up a SteamTradeLink.

const SteamTradeLink = require('@nolddor/steam-tradelink')
let tradelink = new SteamTradeLink('https://steamcommunity.com/tradeoffer/new/?partner=1022946155&token=gIfL8D7z')
let partner = tradelink.getPartner()
let token = tradelink.getToken()
const SteamTradeLink = require('@nolddor/steam-tradelink')
let tradelink = SteamTradeLink.of(1022946155, 'gIfL8D7z')
let url = tradelink.toURL()

Using a SteamTradeLink

Once you have created a SteamTradeLink object, you can access its properties (token, and partner), or you can render it as URL.

getToken()

Returns this token SteamTradeLink part.

getPartner()

Returns this partner SteamTradeLink part as SteamID class.

isValid()

Returns whether Steam would consider a given tradelink to be "well-formed". This does not check whether the given tradelink belongs to a real account that exists, nor does it check that the given tradelink is valid to send trades.

getURL()

Returns the SteamTradeLink object as URL. Throws an error if the tradelink isn't valid.

Tests

Use npm run test to run the included test suite.