dota2api

package module
v0.0.0-...-430bfaf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2014 License: MIT Imports: 11 Imported by: 1

README

dota2-api

golang dota2-api

Usage

//TODO

Steam Api

ResolveVanityURL

Url

http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/

Arguments

key: Your Steam API Key

vanityurl: The user's vanity URL that you would like to retrieve a steam ID for, e.g. http://steamcommunity.com/id/gabelogannewell would use "gabelogannewell"

Result Data

success: The status of the request. 1 if successful, 42 if there was no match.

steamid (Optional): The 64 bit Steam ID the vanity URL resolves to. Not returned on resolution failures.

message (Optional): The message associated with the request status. Currently only used on resolution failures.

GetPlayerSummaries

Url

http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/

Arguments

key: Your Steam API Key

steamids

Result Data

A list of profile objects. Contained information varies depending on whether or not the user has their profile set to Friends only or Private.

steamid: The user's 64 bit ID

communityvisibilitystate: An integer that describes the access setting of the profile

1 - Private

2 - Friends only

3 - Friends of Friends

4 - Users Only

5 - Public

profilestate: If set to 1 the user has configured the profile.

personaname: User's display name.

lastlogoff: A unix timestamp of when the user was last online.

profileurl: The URL to the user's Steam Community profile.

avatar: A 32x32 image

avatarmedium: A 64x64 image

avatarfull: A 184x184 image

personastate: The user's status

0 - Offline (Also set when the profile is Private)

1 - Online

2 - Busy

3 - Away

4 - Snooze

5 - Looking to trade

6 - Looking to play

commentpermission (Optional): If present the profile allows public comments.

realname (Optional): The user's real name.

primaryclanid (Optional): The 64 bit ID of the user's primary group.

timecreated (Optional): A unix timestamp of the date the profile was created.

loccountrycode (Optional): ISO 3166 code of where the user is located.

locstatecode (Optional): Variable length code representing the state the user is located in.

loccityid (Optional): An integer ID internal to Steam representing the user's city.

gameid (Optional): If the user is in game this will be set to it's app ID as a string.

gameextrainfo (Optional): The title of the game.

gameserverip (Optional): The server URL given as an IP address and port number separated by a colon, this will not be present or set to "0.0.0.0:0" if none is available.

GetFriendList

Url

http://api.steampowered.com/ISteamUser/GetFriendList/v0001/

Arguments

key:

steamid: The 64 bit ID of the user to retrieve a list for.

relationship: Filter by a given role.

all - All roles

friend

Result Data

If the profile is not public or there are no available entries for the given relationship only an empty object will be returned.

friends - A list of objects for each list entry.

steamid: The 64 bit ID of the friend.

relationship: Role in relation to the given steamid

friend_since: A unix timestamp of when the friend was added to the list.

Dota2 Api

GetMatchHistory

Url

https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/v001/

Arguments

key: Your Steam API Key

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) (string): Amount of matches to include in results (default: 25).

tournament_games_only (Optional) (string): Whether to limit results to tournament matches

Result Data

status:

num_result:

total_results:

results_remaining:

matches

match_id:

match_seq_num:

start_time:

lobby_type:

radiant_team_id:

dire_team_id:

players:

account_id:

player_slot:

hero_id:

GetMatchDetails

Url

https://api.steampowered.com/IDOTA2Match_570/GetMatchDetails/v001/

Arguments

match_id: Match id

key: Your Steam API Key

Result Data

players: List of players in the match.

account_id: 32-bit account ID

player_slot:

hero_id: The hero's unique ID. A list of hero IDs can be found via the GetHeroes method.

item_0: ID of the top-left inventory item.

item_1: ID of the top-center inventory item.

item_2: ID of the top-right inventory item.

item_3: ID of the bottom-left inventory item.

item_4: ID of the bottom-center inventory item.

item_5: ID of the bottom-right inventory item.

kills: The amount of kills attributed to this player.

deaths: The amount of times this player died during the match.

assists: The amount of assists attributed to this player.

leaver_status: What the values here represent are not yet known.

gold: The amount of gold the player had remaining at the end of the match.

last_hits: The amount of last-hits the player got during the match.

denies: The amount of denies the player got during the match.

gold_per_min: The player's overall gold/minute.

xp_per_min: The player's overall experience/minute.

gold_spent: The amount of gold the player spent during the match.

hero_damage: The amount of damage the player dealt to heroes.

tower_damage: The amount of damage the player dealt to towers.

hero_healing: The amount of health the player had healed on heroes.

level: The player's level at match end.

ability_upgrades: A list detailing a player's ability upgrades.

ability: ID of the ability upgraded.

time: Time since match start that the ability was upgraded.

level: The level of the player at time of upgrading.

additional_units: Additional playable units owned by the player.

unitname: The name of the unit

item_0: ID of the top-left inventory item.

item_1: ID of the top-center inventory item.

item_2: ID of the top-right inventory item.

item_3: ID of the bottom-left inventory item.

item_4: ID of the bottom-center inventory item.

item_5: ID of the bottom-right inventory item.

season: The season the game was played in.

radiant_win: Dictates the winner of the match, true for radiant; false for dire.

duration: The length of the match, in seconds since the match began.

start_time: Unix timestamp of when the match began.

match_id: The matches unique ID.

match_seq_num: A 'sequence number', representing the order in which matches were recorded.

tower_status_radiant:

tower_status_dire:

barracks_status_radiant:

barracks_status_dire:

cluster: The server cluster the match was played upon. Used for downloading replays of matches.

first_blood_time: The time in seconds since the match began when first-blood occured.

lobby_type:

-1 - Invalid

0 - Public matchmaking

1 - Practise

2 - Tournament

3 - Tutorial

4 - Co-op with bots.

5 - Team match

6 - Solo Queue

human_players: The amount of human players within the match.

leagueid: The league that this match was a part of. A list of league IDs can be found via the GetLeagueListing method.

positive_votes: The number of thumbs-up the game has received by users.

negative_votes: The number of thumbs-down the game has received by users.

game_mode:

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

picks_bans: A list of the picks and bans in the match, if the game mode is Captains Mode.

is_pick: Whether this entry is a pick (true) or a ban (false).

hero_id: The hero's unique ID. A list of hero IDs can be found via the GetHeroes method.

team: The team who chose the pick or ban; 0 for Radiant, 1 for Dire.

order: The order of which the picks and bans were selected; 0-19.

GetHeroes

Url

https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/

Arguments

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

itemizedonly (Optional) (bool): Return a list of itemized heroes only.

Result Data

heroes: List of heroes.

name: The tokenized string for the name of the hero.

id: ID of the hero.

localized_name: The localized name of the hero for use in name display.

count: Number of results.

GetLeagueListing

Url

https://api.steampowered.com/IDOTA2Match_570/GetLeagueListing/v0001/

Arguments

Result Data

GetLiveLeagueGames

Url

https://api.steampowered.com/IDOTA2Match_570/GetLiveLeagueGames/v0001/

Arguments

Result Data

GetTeamInfoByTeamID

Url

https://api.steampowered.com/IDOTA2Match_570/GetTeamInfoByTeamID/v001/

Arguments

Result Data

GetTournamentPrizePool

Url

https://api.steampowered.com/IEconDOTA2_570/GetTournamentPrizePool/v1/

Arguments

Result Data

GetGameItems

Url

https://api.steampowered.com/IEconDOTA2_570/GetGameItems/v0001/

Arguments

Result Data

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// convert 64-bit steamID to 32-bit steamID
	// STEAMID64 - 76561197960265728 = STEAMID32
	ConvertInt int64 = 76561197960265728
)

Functions

func ArrayIntToStr

func ArrayIntToStr(arr []int64) []string

func Get

func Get(u string) ([]byte, error)

http get

Types

type AbilityUpgrade

type AbilityUpgrade struct {
	Ability int `json:"ability"`
	Level   int `json:"level"`
	Time    int `json:"time"`
}

type Conf

type Conf struct {
	// contains filtered or unexported fields
}

func (*Conf) Int

func (c *Conf) Int(section string, option string) (int, error)

func (*Conf) IntDefault

func (c *Conf) IntDefault(section string, option string, defaultValue int) int

func (*Conf) String

func (c *Conf) String(section string, option string) (string, error)

func (*Conf) StringDefault

func (c *Conf) StringDefault(section string, option string, defaultValue string) string

type Dota2

type Dota2 struct {
	// steam api url
	SteamApi string
	// steam api key: http://steamcommunity.com/dev/apikey
	SteamApiKey string
	//Steam User
	SteamUser string
	// api version
	SteamApiVersion string

	// dota2 name in api
	Dota2Match string
	Dota2Econ  string

	// api version
	Dota2ApiVersion string

	// convert 64-bit steamID to 32-bit steamID
	// STEAMID64 - 76561197960265728 = STEAMID32
	ConvertInt int64

	// http request timeout
	Timeout int

	Dota2MatchUrl string
	Dota2EconUrl  string
	SteamUserUrl  string
}

func LoadConfig

func LoadConfig(file string) (Dota2, error)

func (*Dota2) GetAccountId

func (d *Dota2) GetAccountId(steamId int64) int64

Convert 64-bit steamId to 32-bit steamId

func (*Dota2) GetAllTeamInfo

func (d *Dota2) GetAllTeamInfo() ([]Team, error)

Get all team info

func (*Dota2) GetFriendList

func (d *Dota2) GetFriendList(steamid int64) ([]Friend, error)

Get friend list

func (*Dota2) GetGameItems

func (d *Dota2) GetGameItems()

func (*Dota2) GetHeroes

func (d *Dota2) GetHeroes() ([]Hero, error)

Get all heroes

func (*Dota2) GetLeagueListing

func (d *Dota2) GetLeagueListing()

func (*Dota2) GetLiveLeagueGames

func (d *Dota2) GetLiveLeagueGames()

func (*Dota2) GetMatchDetails

func (d *Dota2) GetMatchDetails(matchId int64) (MatchDetails, error)

Get match details

func (*Dota2) GetMatchHistory

func (d *Dota2) GetMatchHistory(param map[string]interface{}) (MatchHistory, error)

Get match history

func (*Dota2) GetMatchHistoryBySequenceNum

func (d *Dota2) GetMatchHistoryBySequenceNum(param map[string]interface{}) (MatchHistory, error)

Get match history by sequence num

func (*Dota2) GetPlayerSummaries

func (d *Dota2) GetPlayerSummaries(steamIds []int64) ([]Player, error)

Get player summaries

func (*Dota2) GetTeamInfoByTeamID

func (d *Dota2) GetTeamInfoByTeamID(teamId int64) (Team, error)

Get team info by teamId

func (*Dota2) GetTournamentPrizePool

func (d *Dota2) GetTournamentPrizePool()

func (*Dota2) ResolveVanityUrl

func (d *Dota2) ResolveVanityUrl(vanityurl string) (int64, error)

Get steamId by username

type Friend

type Friend struct {
	SteamId      string `json:"steamid"`
	Relationship string `json:"relationship"`
	FriendSince  int64  `bson:"friend_since" json:"friend_since"`
}

type FriendList

type FriendList struct {
	Friendslist struct {
		Friends []Friend `json:"friends"`
	} `json:"friendslist"`
}

type Hero

type Hero struct {
	ID            int    `json:"id"`
	LocalizedName string `bson:"localized_name" json:"localized_name"`
	Name          string `json:"name"`
}

type Heroes

type Heroes struct {
	Result struct {
		Count  int    `json:"count"`
		Heroes []Hero `json:"heroes"`
		Status int    `json:"status"`
	} `json:"result"`
}

type Match

type Match struct {
	DireTeamID            int64    `bson:"dire_team_id" json:"dire_team_id"`
	LobbyType             int      `bson:"lobby_type" json:"lobby_type"`
	MatchID               int64    `bson:"match_id" json:"match_id"`
	MatchSeqNum           int64    `bson:"match_seq_num" json:"match_seq_num"`
	Players               []Player `bson:"players" json:"players"`
	RadiantTeamID         int64    `bson:"radiant_team_id" json:"radiant_team_id"`
	StartTime             int64    `bson:"start_time" json:"start_time"`
	BarracksStatusDire    int      `bson:"barracks_status_dire" json:"barracks_status_dire"`
	BarracksStatusRadiant int      `bson:"barracks_status_radiant" json:"barracks_status_radiant"`
	Cluster               int      `bson:"cluster" json:"cluster"`
	DireCaptain           int64    `bson:"dire_captain" json:"dire_captain"`
	Duration              int      `bson:"duration" json:"duration"`
	FirstBloodTime        int      `bson:"first_blood_time" json:"first_blood_time"`
	GameMode              int      `bson:"game_mode" json:"game_mode"`
	HumanPlayers          int      `bson:"human_players" json:"human_players"`
	Leagueid              int      `bson:"leagueid" json:"leagueid"`
	NegativeVotes         int      `bson:"negative_votes" json:"negative_votes"`
	PositiveVotes         int      `bson:"positive_votes" json:"positive_votes"`
	RadiantCaptain        int64    `bson:"radiant_captain" json:"radiant_captain"`
	RadiantWin            bool     `bson:"radiant_win" json:"radiant_win"`
	TowerStatusDire       int      `bson:"tower_status_dire" json:"tower_status_dire"`
	Tower_StatusRadiant   int      `bson:"tower_status_radiant" json:"tower_status_radiant"`
	Error                 string   `bson:"error" json:"error"`
}

type MatchDetails

type MatchDetails struct {
	Result Match `json:"result"`
}

type MatchHistory

type MatchHistory struct {
	Result MatchResult `json:"result"`
}

type MatchResult

type MatchResult struct {
	Matches          []Match `json:"matches"`
	NumResults       int     `bson:"num_results" json:"num_results"`
	ResultsRemaining int     `bson:"results_remaining" json:"results_remaining"`
	Status           int     `json:"status"`
	TotalResults     int     `bson:"total_results" json:"total_results"`
}

type Player

type Player struct {
	AccountID       int64            `bson:"account_id" json:"account_id"`
	HeroID          int              `bson:"hero_id" json:"hero_id"`
	PlayerSlot      int              `bson:"player_slot" json:"player_slot"`
	AbilityUpgrades []AbilityUpgrade `bson:"ability_upgrades" json:"ability_upgrades"`
	Assists         int              `bson:"assists" json:"assists"`
	Deaths          int              `bson:"deaths" json:"deaths"`
	Denies          int              `bson:"denies" json:"denies"`
	Gold            int              `bson:"gold" json:"gold"`
	GoldPerMin      int              `bson:"gold_per_min" json:"gold_per_min"`
	GoldSpent       int              `bson:"gold_spent" json:"gold_spent"`
	HeroDamage      int              `bson:"hero_damage" json:"hero_damage"`
	HeroHealing     int              `bson:"hero_healing" json:"hero_healing"`
	Item0           int              `bson:"item_0" json:"item_0"`
	Item1           int              `bson:"item_1" json:"item_1"`
	Item2           int              `bson:"item_2" json:"item_2"`
	Item3           int              `bson:"item_3" json:"item_3"`
	Item4           int              `bson:"item_4" json:"item_4"`
	Item5           int              `bson:"item_5" json:"item_5"`
	Kills           int              `bson:"kills" json:"kills"`
	LastHits        int              `bson:"last_hits" json:"last_hits"`
	LeaverStatus    int              `bson:"leaver_status" json:"leaver_status"`
	Level           int              `bson:"level" json:"level"`
	TowerDamage     int              `bson:"tower_damage" json:"tower_damage"`
	XpPerMin        int              `bson:"xp_per_min" json:"xp_per_min"`

	Avatar                   string `bson:"avatar" json:"avatar"`
	Avatarfull               string `bson:"avatarfull" json:"avatarfull"`
	Avatarmedium             string `bson:"avatarmedium" json:"avatarmedium"`
	Communityvisibilitystate int    `bson:"communityvisibilitystate" json:"communityvisibilitystate"`
	Lastlogoff               int64  `bson:"lastlogoff" json:"lastlogoff"`
	Personaname              string `bson:"personaname" json:"personaname"`
	Personastate             int    `bson:"personastate" json:"personastate"`
	Personastateflags        int    `bson:"personastateflags" json:"personastateflags"`
	Primaryclanid            string `bson:"primaryclanid" json:"primaryclanid"`
	Profilestate             int    `bson:"profilestate" json:"profilestate"`
	Profileurl               string `bson:"profileurl" json:"profileurl"`
	Realname                 string `bson:"realname" json:"realname"`
	Steamid                  string `bson:"steamid" json:"steamid"`
	Timecreated              int64  `bson:"timecreated" json:"timecreated"`
}

type PlayerSummaries

type PlayerSummaries struct {
	Response struct {
		Players struct {
			Player []Player `json:"player"`
		} `json:"players"`
	} `json:"response"`
}

type Team

type Team struct {
	AdminAccountID               int64  `bson:"admin_account_id" json:"admin_account_id"`
	CountryCode                  string `bson:"country_code" json:"country_code"`
	GamesPlayedWithCurrentRoster int    `bson:"games_played_with_current_roster" json:"games_played_with_current_roster"`
	LogoSponsor                  int    `bson:"logo_sponsor" json:"logo_sponsor"`
	Name                         string `json:"name"`
	Player0AccountID             int64  `bson:"player_0_account_id" json:"player_0_account_id"`
	Player1AccountID             int64  `bson:"player_1_account_id" json:"player_1_account_id"`
	Player2AccountID             int64  `bson:"player_2_account_id" json:"player_2_account_id"`
	Player3AccountID             int64  `bson:"player_3_account_id" json:"player_3_account_id"`
	Player4AccountID             int64  `bson:"player_4_account_id" json:"player_4_account_id"`
	Player5AccountID             int64  `bson:"player_5_account_id" json:"player_5_account_id"`
	Rating                       string `json:"rating"`
	Tag                          string `json:"tag"`
	TeamID                       int64  `bson:"team_id" json:"team_id"`
	TimeCreated                  int64  `bson:"time_created" json:"time_created"`
	URL                          string `json:"url"`
}

type TeamInfo

type TeamInfo struct {
	Result struct {
		Status float64 `json:"status"`
		Teams  []Team  `json:"teams"`
	} `json:"result"`
}

type Vanity

type Vanity struct {
	Response VanityResp `json:"response"`
}

type VanityResp

type VanityResp struct {
	SteamId string `json:"steamid"`
	Success int    `json:"success"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL