Documentation
¶
Overview ¶
RGL api implementation See README for usage and gotchas.
Index ¶
- Constants
- func ToGoTime(str string) time.Time
- type Ban
- type BulkBan
- type CurrTeam
- type CurrentTeams
- type Match
- type MatchMap
- type MatchTeam
- type Player
- type PlayerStatus
- type PlayerTeamHistory
- type PostError
- type RGL
- func (rgl *RGL) BulkPlayers(ids []string) ([]Player, error)
- func (rgl *RGL) GetBans(take int, skip int) ([]BulkBan, error)
- func (rgl *RGL) GetMatch(id int) (Match, error)
- func (rgl *RGL) GetPlayer(steam64 string) (Player, error)
- func (rgl *RGL) GetPlayerTeamHistory(id string) ([]PlayerTeamHistory, error)
- func (rgl *RGL) GetSeason(id int) (Season, error)
- func (rgl *RGL) GetTeam(id int) (Team, error)
- func (rgl *RGL) SearchPlayers(alias string, take int, skip int) (SearchResults, error)
- func (rgl *RGL) SearchTeams(partial string, take int, skip int) (SearchResults, error)
- type SearchResults
- type Season
- type Team
- type TeamPlayer
Constants ¶
const BULK_PLAYER_ENDPOINT = PLAYER_ENDPOINT + "getmany"
const MATCH_ENDPOINT = RGL_ENDPOINT + "matches/"
const PLAYER_ENDPOINT = RGL_ENDPOINT + "profile/"
const RGL_ENDPOINT = "https://api.rgl.gg/v0/"
const SEARCH_ALIAS_ENDPOINT = RGL_ENDPOINT + "search/players"
const SEARCH_TEAM_ENDPOINT = RGL_ENDPOINT + "search/teams"
const SEASON_ENDPOINT = RGL_ENDPOINT + "seasons/"
const TEAM_ENDPOINT = RGL_ENDPOINT + "teams/"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BulkBan ¶
type BulkBan struct {
SteamId string `json:"steamId"`
Alias string `json:"alias"`
Expires string `json:"expiresAt"`
Created string `json:"createdAt"`
Reason string `json:"reason"`
}
Used when receiving paginated bans
type CurrTeam ¶
type CurrTeam struct {
Id int `json:"id"`
Tag string `json:"tag"`
Name string `json:"name"`
Status string `json:"status"`
SeasonId int `json:"seasonId"`
DivId int `json:"divisionId"`
DivName string `json:"divisionName"`
}
Used in Player.CurrentTeams to represent the teams a player is on
type CurrentTeams ¶
type CurrentTeams struct {
Sixes *CurrTeam `json:"sixes"`
Highlander *CurrTeam `json:"highlander"`
Prolander *CurrTeam `json:"prolander"`
}
Used in Player to represent the teams a player is on in each format
type Match ¶
type Match struct {
Id int `json:"matchId"`
SeasonName string `json:"seasonName"`
DivName string `json:"divName"`
SeasonId int `json:"seasonId"`
MatchDate string `json:"matchDate"`
MatchName string `json:"matchName"`
Teams []MatchTeam `json:"teams"`
Maps []MatchMap `json:"maps"`
}
Toplevel endpoint for a match found by id
type MatchMap ¶
type MatchMap struct {
MapName string `json:"mapName"`
HomeScore int `json:"homeScore"`
AwayScore int `json:"awayScore"`
}
Embedded in Match to represent maps played (multiple maps per match for playoffs)
type MatchTeam ¶
type MatchTeam struct {
Id int `json:"teamId"`
TeamName string `json:"teamName"`
TeamTag string `json:"teamTag"`
IsHome bool `json:"isHome"`
Points string `json:"points"`
}
Embedded in Match to represent the teams playing
type Player ¶
type Player struct {
SteamId string `json:"steamId"`
Avatar string `json:"avatar"`
Name string `json:"name"`
Updated string `json:"updatedAt"`
Status PlayerStatus `json:"status"`
Ban *Ban `json:"banInformation"`
CurrentTeams CurrentTeams `json:"currentTeams"`
}
Toplevel endpoint for a player found by id
type PlayerStatus ¶
type PlayerStatus struct {
IsVerified bool `json:"isVerified"`
IsBanned bool `json:"isBanned"`
IsOnProbation bool `json:"isOnProbation"`
}
Used in Player to represent status information
type PlayerTeamHistory ¶
type PlayerTeamHistory struct {
FormatId int `json:"formatId"`
FormatName string `json:"formatName"`
RegionId int `json:"regionId"`
RegionName string `json:"regionName"`
SeasonId int `json:"seasonId"`
SeasonName string `json:"seasonName"`
Started string `json:"startedAt"`
DivisionId int `json:"divisionId"`
DivisionName string `json:"divisionName"`
Left string `json:"leftAt"` //Can be empty to indicate a null value (player hasn't left team)
TeamName string `json:"teamName"`
TeamTag string `json:"teamTag"`
TeamId int `json:"teamId"`
Stats struct {
Wins int `json:"wins"`
WinsWithout int `json:"winsWithout"`
Loses int `json:"loses"`
LosesWithout int `json:"losesWithout"`
GamesPlayed int `json:"gamesPlayed"`
GamesWithout int `json:"gamesWithout"`
} `json:"stats"`
}
Used when finding the past teams of a specific player ID
type PostError ¶
type PostError struct {
StatusCode int `json:"statusCode"`
Error string `json:"error"`
Message []struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"message"`
}
An error that comes from POSTing (at least to /search/players. Message has varying fields, but the important ones are constant.
type RGL ¶
type RGL struct {
// contains filtered or unexported fields
}
The RGL type contains all endpoints as methods. Create one with rgl.DefaultRateLimit() or use RGL{rl: *rate.Limiter} or use RGL{} if you don't want to use the ratelimiter object at all (you will have to implement your own)
func DefaultRateLimit ¶
func DefaultRateLimit() RGL
Create an RGL instance with a default rate limiter based on present ratelimits (2 calls per 1 second)>
func (*RGL) BulkPlayers ¶
Search multiple IDs for RGL players
func (*RGL) GetBans ¶
A paginated look at RGL bans. (Newest first). This is a historic record and includes expired bans, as far as I can tell.
func (*RGL) GetPlayerTeamHistory ¶
func (rgl *RGL) GetPlayerTeamHistory(id string) ([]PlayerTeamHistory, error)
Get a player's teams (past and present). Current teams have the Left field as ""
func (*RGL) SearchPlayers ¶
Search for players whose aliases contain the string. Take the first `take` results, skipping the first `skip`.
func (*RGL) SearchTeams ¶
Bulk search for teams whose names or tags contain the partial string.
type SearchResults ¶
type SearchResults struct {
Results []string `json:"results"` //A slice of Steam64 IDs (Steam64s for Players, RGL Team IDs for Teams)
Count int `json:"int"`
TotalHitCount int `json:"totalHitCount"`
}
To check if this is empty, use len(SearchResults.Results) == 0 instead of equality checking == SearchResults{} (If you want to equality check the results of rgl.SearchPlayers, you'd have to use SearchResults{Results: make([]string, 0)}
type Season ¶
type Season struct {
Name string `json:"name"`
Format *string `json:"formatName"`
Region *string `json:"regionName"`
Maps []string `json:"maps"`
Teams []int `json:"participatingTeams"`
Matches []int `json:"matchesPlayedDuringSeason"`
}
Toplevel endpoint for a season found by id
type Team ¶
type Team struct {
Id int `json:"teamId"`
LinkedTeams []int `json:"linkedTeams"`
SeasonId int `json:"seasonId"`
DivId int `json:"divisionId"`
DivName string `json:"divisionName"`
TeamLeader string `json:"teamLeader"`
Created string `json:"createdAt"`
Updated string `json:"updatedAt"`
Tag string `json:"tag"`
Name string `json:"name"`
FinalRank *int `json:"finalRank"`
Players []TeamPlayer `json:"players"`
}
Toplevel endpoint for a team found by id