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

dota2-api

v0.2.1

Published

Dota2 web api node.js version

Downloads

26

Readme

Dota2 Web Api

Build Status Coverage Status

IMPORTANT: API is based on promises from v0.2.0

Dota2 web api node.js version.See detail here

Install

npm install dota2-api

Example:

  const Dota2Api = require('dota2-api');

  const da = Dota2Api.create('a key');

  const options = {game_mode: 1};
  da.getMatchHistory(options).then((result) => {
      console.log(result);
  }, (errorResponseStatusText) => {
      console.log(errorResponseStatusText);
  });

API

Methods relating to Dota 2 matches.

Dota2Api.create(key, [ID])

Create Dota2Api instance,require a key.(if no, see here)

List of IDs:

  • 570 Dota 2 (default)
  • 816 Dota 2 internal test
  • 205790 Dota 2 (beta) test
  const da = Dota2Api.create('a key', 570);

Dota2Api.prototype.getLeagueListing([options])

Information about DotaTV-supported leagues. Options:

  • leagueid (Optional) (int) – The ID of the league to get the prize pool of.

Dota2Api.prototype.getLiveLeagueGames()

A list of in-progress league matches, as well as details of that match as it unfolds.

Dota2Api.prototype.getMatchDetails([options])

Information about a particular match. Options:

  • match_id (string) – Match id

Dota2Api.prototype.getMatchHistory([options])

A list of matches, filterable by various parameters. Options:

  • hero_id (Optional) (uint32) – A list of hero IDs can be found via the GetHeroes method.
  • game_mode (Optional) (uint32)
    • 0 - None
    • 1 - All Pick
    • 2 - Captain's Mode
    • 3 - Random Draft
    • 4 - Single Draft
    • 5 - All Random
    • 6 - Intro
    • 7 - Diretide
    • 8 - Reverse Captain's Mode
    • 9 - The Greeviling
    • 10 - Tutorial
    • 11 - Mid Only
    • 12 - Least Played
    • 13 - New Player Pool
    • 14 - Compendium Matchmaking
    • 16 - Captain's Draft
  • skill (Optional) (uint32) – Skill bracket for the matches (Ignored if an account ID is specified).
    • 0 - Any
    • 1 - Normal
    • 2 - High
    • 3 - Very High
  • date_min (Optional) (uint32) – Minimum date range for returned matches (unix timestamp, rounded to the nearest day).
  • date_max (Optional) (uint32) – Maximum date range for returned matches (unix timestamp, rounded to the nearest day).
  • min_players (Optional) (string) – Minimum amount of players in a match for the match to be returned.
  • account_id (Optional) (string) – 32-bit account ID.
  • league_id (Optional) (string) – Only return matches from this league. A list of league IDs can be found via the GetLeagueListing method.
  • start_at_match_id (Optional) (string) - Start searching for matches equal to or older than this match ID.
  • matches_requested (Optional) (number) – Amount of matches to include in results (default: 25).
  • tournament_games_only (Optional) (string) – Whether to limit results to tournament matches. (0 = false, 1 = true)

Dota2Api.prototype.getMatchHistoryBySequenceNum([options])

A list of matches ordered by their sequence num. Options:

  • start_at_match_seq_num (Optional) (uint64) – The match sequence number to start returning results from.
  • matches_requested (Optional) (uint32) – The amount of matches to return.

Dota2Api.prototype.getScheduledLeagueGames([options])

A list of scheduled league games coming up. Options:

  • date_min (Optional) (uint32) – Unix timestamp
  • date_max (Optional) (uint32) – Unix timestamp

Dota2Api.prototype.getTeamInfoByTeamID([options])

A list of all the teams set up in-game. Options:

  • start_at_team_id (Optional) (uint64) – The team id to start returning results from.
  • teams_requested (Optional) (uint32) – The amount of teams to return.

Dota2Api.prototype.getTournamentPlayerStats([options])

Stats about a particular player within a tournament. Options:

  • account_id (string) – 32-bit account ID.
  • league_id (Optional) (string) – A list of league IDs can be found via the GetLeagueListing method. Will return status 8 - only supports tournament 65006 (The International) unless you provide 65006.
  • hero_id (Optional) (string) – A list of hero IDs can be found via the GetHeroes method.
  • time_frame (Optional) (string) – Only return stats between this time frame (parameter format not yet known).

Dota2Api.prototype.getTopLiveGame([options])

Options:

  • partner (int32) – Which partner's games to use.

Methods relating to Dota 2.

Dota2Api.prototype.getGameItems([options])

Dota 2 In-game items Options:

  • language (Optional) (string) – The language to provide hero names in.

Dota2Api.prototype.getItemIconPath([options])

Options:

  • iconname (string) – The item icon name to get the CDN path of
  • icontype (Optional) (uint32) – The type of image you want.
    • 0 = normal
    • 1 = large
    • 2 = ingame

Dota2Api.prototype.getRarities([options])

Dota 2 item rarity list. Options:

  • language (Optional) (string) – The language to provide hero names in.

Dota2Api.prototype.getHeroes([options])

A list of heroes within Dota 2. Options:

  • language (Optional) (string) – The language to provide hero names in.
  • itemizedonly (Optional) (bool) – Return a list of itemized heroes only.

Dota2Api.prototype.getTournamentPrizePool([options])

The current prizepool for specific tournaments. Options:

  • leagueid (Optional) (int) – The ID of the league to get the prize pool of.

TODO:

Implement this methods(https://wiki.teamfortress.com/wiki/WebAPI#Dota_2):

IEconDOTA2_

  • GetEventStatsForAccount

IDOTA2MatchStats_

  • GetRealtimeStats

IDOTA2Fantasy_

  • GetFantasyPlayerStats
  • GetPlayerOfficialInfo

IDOTA2StreamSystem_

  • GetBroadcasterInfo

IDOTA2Teams_

  • GetTeamInfo

IDOTA2AutomatedTourney_

  • GetActiveTournamentList

IDOTA2Ticket_

  • SetSteamAccountPurchased
  • SteamAccountValidForEvent

License

The MIT License