npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

market-csgo-api

v0.4.18

Published

A module for interacting with the market.csgo.com API

Downloads

25

Readme

market.csgo.com API

This is a node module for interacting with the market.csgo.com API. Docs for endpoints are available here

Installation

npm install market-csgo-api

Usage

const MarketAPI = require('market-csgo-api');
const api = new MarketAPI(options);

or

import MarketAPI from 'market-csgo-api';

Constructor params

Params:

  • options[apiKey]: your API key required
  • options[baseUrl]: url to API. Default: https://market.csgo.com/.
  • options[apiPath]: relative path to API. Default: api.
  • options[extendedError]: Should module return full response and got options on market error. Default: false.
  • options[useLimiter]: enable bottleneck limiter. Default: true.
  • options[gotOptions]: options for got module that would be applied for all API-call methods (except static). Default: {}.
  • options[defaultGotOptions]: default options for got module for all API-call methods without gotOptions param(except static). Default: {}.
  • options[limiterOptions]: options for bottleneck limiter. Default:
{
    maxConcurrent: 1,
    minTime: 200,
    highWater: -1,
    strategy: Bottleneck.strategy.LEAK,
    rejectOnDrop: true
}

Properties

Dynamic

  • options: merged object of your passed options and default ones
  • apiUrl: composed api url from base url and api path

Static

  • defaultAppId: CS:GO Steam AppId - 730
  • defaultBaseUrl: https://market.csgo.com/
  • LANGUAGES: languages, supported by csgo.tm
  • CREATE_TRADE_REQUEST_TYPE: available types of trade requests
  • MASS_INFO_SELL_BUY: available types of 'SELL' and 'BUY' param in 'MassInfo' request
  • MASS_INFO_HISTORY: available types of 'HISTORY' param in 'MassInfo' request
  • MASS_INFO_INFO: available types of 'INFO' param in MassInfo request
  • DEFAULT_MASS_INFO_PARAMS: default params that will be substituted, when you did not provide some of them

Methods

All API-call methods return Promise, and they have gotOptions param for got module

All methods are divided into blocks with a special prefix (except static) like in docs

  • account
  • item
  • sell
  • buy
  • order
  • notification
  • search
  • quick
  • additional

Static Methods

  • requestJSON(url, gotOptions)
  • dbName(appId, baseUrl, gotOptions)
  • itemDb(dbName, baseUrl, gotOptions)
  • currentItemDb(appId, baseUrl, gotOptions)
  • history(baseUrl, gotOptions)
  • getItemIds(item, asNumbers)
  • formatItem(item, symbol)

Many of methods require item in the params. It should be an object with properties:

  • i_classid or classid or classId
  • i_instanceid or instanceid or instanceId or ui_real_instance

Example

const MarketAPI = require('market-csgo-api');
const instance = new MarketAPI({apiKey: 'xxxx'});

(async () => {
    let trades = await instance.accountGetTrades();
})()