Documentation ¶
Index ¶
- Constants
- type Base
- type BuyItemEvent
- type Client
- func (c *Client) GetMatch(matchID string, shardID string) (*MatchResponse, error)
- func (c *Client) GetMatches(options GetMatchesRequestOptions, shardID string) (*MatchesResponse, error)
- func (c *Client) GetPlayer(id string, shardID string) (*PlayerResponse, error)
- func (c *Client) GetPlayers(options GetPlayersRequestOptions, shardID string) (*PlayersResponse, error)
- func (c *Client) GetStatus() (*StatusResponse, error)
- func (c *Client) GetTelemetry(url string) (*TelemetryResponse, error)
- type DealDamageEvent
- type EarnXPEvent
- type GetMatchesRequestOptions
- type GetPlayersRequestOptions
- type GoldFromTowerKillEvent
- type HealTargetEvent
- type HeroBanEvent
- type HeroSelectEvent
- type HeroSkinSelectEvent
- type KillActorEvent
- type LearnAbilityEvent
- type LevelUpEvent
- type MatchAsset
- type MatchAttributes
- type MatchData
- type MatchDataRelationship
- type MatchDataRelationships
- type MatchParticipant
- type MatchPlayer
- type MatchRelationships
- type MatchResponse
- type MatchRoster
- type MatchStats
- type MatchesResponse
- type NPCkillNPCEvent
- type ParticipantStats
- type PlayerAttributes
- type PlayerData
- type PlayerFirstSpawnEvent
- type PlayerResponse
- type PlayerStats
- type PlayersResponse
- type RESTError
- type RosterStats
- type SellItemEvent
- type StatusAttributes
- type StatusResponse
- type StatusResponseData
- type TelemetryEvent
- type TelemetryResponse
- type UseAbilityEvent
- type UseItemAbilityEvent
- type VampirismEvent
Constants ¶
const ( // China Mobile China region China = "cn" // NorthAmerica Mobile North America region NorthAmerica = "na" // Europe Mobile Europe region Europe = "eu" // SouthAmerica Mobile South America region SouthAmerica = "sa" // EastAsia Mobile East Asia region EastAsia = "ea" // SoutheastAsia Mobile SEA region SoutheastAsia = "sg" // NATournament North America Tournament region NATournament = "tournament-na" // EUTournament Europe Tournament region EUTournament = "tournament-eu" // EATournament East Asia Tournament region EATournament = "tournament-ea" // SEATournament North America Tournament region SEATournament = "tournament-sg" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
Base is the base of all telemetery event types. This information will always be returned.
func (Base) GetTimestamp ¶
GetTimestamp returns the event timestamp.
type BuyItemEvent ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main struct for vainglory
func (*Client) GetMatch ¶
func (c *Client) GetMatch(matchID string, shardID string) (*MatchResponse, error)
GetMatch retrieves the match data for a specified match id and passes back a MatchResponse.
func (*Client) GetMatches ¶
func (c *Client) GetMatches(options GetMatchesRequestOptions, shardID string) (*MatchesResponse, error)
GetMatches retrieves a list of match data and passes back a MatchesResponse.
func (*Client) GetPlayer ¶
func (c *Client) GetPlayer(id string, shardID string) (*PlayerResponse, error)
GetPlayer retrieves player data for a specified player id and passes back a PlayerResponse.
func (*Client) GetPlayers ¶
func (c *Client) GetPlayers(options GetPlayersRequestOptions, shardID string) (*PlayersResponse, error)
GetPlayers retrieves a list of player data and passes back a PlayersResponse.
func (*Client) GetStatus ¶
func (c *Client) GetStatus() (*StatusResponse, error)
GetStatus retrieves status data from the PUBG servers and passes back a StatusResponse.
func (*Client) GetTelemetry ¶
func (c *Client) GetTelemetry(url string) (*TelemetryResponse, error)
GetTelemetry retrieves the telemetry data at a specified url and passes back a TelemetryResponse.
type DealDamageEvent ¶
type DealDamageEvent struct { Base Payload struct { Team string `json:"Team"` Actor string `json:"Actor"` Target string `json:"Target"` Source string `json:"Source"` Damage int `json:"Damage"` Dealt int `json:"Dealt"` IsHero int `json:"IsHero"` TargetIsHero int `json:"TargetIsHero"` } `json:"payload"` }
type EarnXPEvent ¶
type GetMatchesRequestOptions ¶
type GetMatchesRequestOptions struct { // PageOffset Allows paging over results PageOffset int `url:"page[offset],omitempty"` // PageLimit The default (and maximum) is 5. Values less than 5 and greater than 1 are supported. PageLimit int `url:"page[limit],omitempty"` // Sort By default, Matches are sorted by creation time ascending. Sort string `url:"sort,omitempty"` // StartCreationFilter Must occur before end time. Format is iso8601 Usage: filter[createdAt-start]=2017-01-01T08:25:30Z StartCreationFilter time.Time `url:"filter[createdAt-start],omitempty"` // EndCreationFilter Queries search the last 3 hrs. Format is iso8601 i.e.filter[createdAt-end]=2017-01-01T13:25:30Z EndCreationFilter time.Time `url:"filter[createdAt-end],omitempty"` // PlayerNamesFilter Filters by player name. Usage: filter[playerNames]=player1,player2,… PlayerNamesFilter []string `url:"filter[playerNames],comma,omitempty"` // PlayerIDsFilter Filters by player Id. Usage:filter[playerIds]=playerId,playerId,… PlayerIDsFilter []string `url:"filter[playerIds],comma,omitempty"` // TeamNamesFilter Filters by team names. Team names are the same as the in game team tags. Usage: filter[teamNames]=TSM,team2,… TeamNamesFilter []string `url:"filter[teamNames],comma,omitempty"` // GameModeFilter Filter by gameMode Usage: filter[gameMode]=casual,ranked,… GameModeFilter []string `url:"filter[gameMode],comma,omitempty"` // PatchVersionFilter Filter by Vainglory patch version. Usage: filter[patchVersion]=2.10,2.11,… PatchVersionFilter []string `url:"filter[patchVersion],comma,omitempty"` }
GetMatchesRequestOptions Various paging, sorting, and filter options for the get matches endpoint
type GetPlayersRequestOptions ¶
type GetPlayersRequestOptions struct { // PlayerNamesFilter Filters by player name. Usage: filter[playerNames]=player1,player2,… PlayerNamesFilter []string `url:"filter[playerNames],comma,omitempty"` // PlayerIDsFilter Filters by player Id. Usage:filter[playerIds]=playerId,playerId,… PlayerIDsFilter []string `url:"filter[playerIds],comma,omitempty"` }
GetPlayersRequestOptions Filter options for the get players endpoint
type GoldFromTowerKillEvent ¶
type HealTargetEvent ¶
type HealTargetEvent struct { Base Payload struct { Team string `json:"Team"` Actor string `json:"Actor"` TargetActor string `json:"TargetActor"` TargetTeam string `json:"TargetTeam"` Source string `json:"Source"` Heal int `json:"Heal"` Healed int `json:"Healed"` IsHero int `json:"IsHero"` TargetIsHero int `json:"TargetIsHero"` } `json:"payload"` }
type HeroBanEvent ¶
type HeroSelectEvent ¶
type HeroSkinSelectEvent ¶
type KillActorEvent ¶
type KillActorEvent struct { Base Payload struct { Team string `json:"Team"` Actor string `json:"Actor"` Killed string `json:"Killed"` KilledTeam string `json:"KilledTeam"` Gold string `json:"Gold"` IsHero int `json:"IsHero"` TargetIsHero int `json:"TargetIsHero"` Position []float64 `json:"Position"` } `json:"payload"` }
type LearnAbilityEvent ¶
type LevelUpEvent ¶
type MatchAsset ¶
type MatchAttributes ¶
type MatchData ¶
type MatchData struct { Attributes MatchAttributes `json:"attributes"` Relationships MatchRelationships `json:"relationships"` Links struct { Schema string `json:"schema"` Self string `json:"self"` } `json:"links"` // contains filtered or unexported fields }
type MatchDataRelationship ¶
type MatchDataRelationship struct { Data struct { // contains filtered or unexported fields } `json:"data"` }
type MatchDataRelationships ¶
type MatchDataRelationships struct {
Data []typeIDPair `json:"data"`
}
type MatchParticipant ¶
type MatchParticipant struct { Attributes struct { Actor string `json:"actor"` ShardID string `json:"shardId"` Stats ParticipantStats `json:"stats"` } `json:"attributes"` Relationships struct { Player MatchDataRelationship `json:"player"` } `json:"relationships"` // contains filtered or unexported fields }
type MatchPlayer ¶
type MatchPlayer struct { Attributes struct { Name string `json:"name"` PatchVersion string `json:"patchVersion"` ShardID string `json:"shardId"` Stats PlayerStats `json:"stats"` TitleID string `json:"titleId"` } `json:"attributes"` Relationships struct { Assets MatchDataRelationships `json:"assets"` } `json:"relationships"` Links struct { Schema string `json:"schema"` Self string `json:"self"` } `json:"links"` // contains filtered or unexported fields }
type MatchRelationships ¶
type MatchRelationships struct { Assets MatchDataRelationships `json:"assets"` Rosters MatchDataRelationships `json:"rosters"` Rounds MatchDataRelationships `json:"rounds"` Spectators MatchDataRelationships `json:"spectators"` }
type MatchResponse ¶
type MatchResponse struct { Data MatchData `json:"data"` Included []json.RawMessage `json:"included"` Participants []MatchParticipant Rosters []MatchRoster Assets []MatchAsset Players []MatchPlayer Links struct { Self string `json:"self"` } `json:"links"` Meta struct{} `json:"meta"` }
func (*MatchResponse) GetMatchID ¶
func (mr *MatchResponse) GetMatchID() (id string)
GetMatchID Pull match id from a given match response
func (*MatchResponse) GetStatsByName ¶
func (mr *MatchResponse) GetStatsByName() (s map[string]*PlayerStats)
GetStatsByName is a helper function to retrieve player MatchStats from a MatchResponse. A map is more performant than a slice in larger data sets so it is recommended to use this map instead of iterating through the MatchResponse data looking for players
type MatchRoster ¶
type MatchRoster struct { Attributes struct { ShardID string `json:"shardId"` Stats RosterStats `json:"stats"` Won string `json:"won"` } `json:"attributes"` Relationships struct { Participants MatchDataRelationships `json:"participants"` } `json:"relationships"` // contains filtered or unexported fields }
type MatchStats ¶
type MatchesResponse ¶
type MatchesResponse struct { Data []MatchData `json:"data"` Included []json.RawMessage `json:"included"` Participants []MatchParticipant Rosters []MatchRoster Assets []MatchAsset Players []MatchPlayer Links struct { Schema string `json:"schema"` Self string `json:"self"` } `json:"links"` Meta struct{} `json:"meta"` }
type NPCkillNPCEvent ¶
type NPCkillNPCEvent struct { Base Payload struct { Team string `json:"Team"` Actor string `json:"Actor"` Killed string `json:"Killed"` KilledTeam string `json:"KilledTeam"` Gold string `json:"Gold"` IsHero int `json:"IsHero"` TargetIsHero int `json:"TargetIsHero"` Position []float64 `json:"Position"` } `json:"payload"` }
type ParticipantStats ¶
type ParticipantStats struct { Assists int `json:"assists"` CrystalMineCaptures int `json:"crystalMineCaptures"` Deaths int `json:"deaths"` Farm int `json:"farm"` FirstAfkTime float64 `json:"firstAfkTime"` Gold float64 `json:"gold"` GoldMineCaptures int `json:"goldMineCaptures"` ItemGrants map[string]int `json:"itemGrants"` ItemSells map[string]int `json:"itemSells"` ItemUses map[string]int `json:"itemUses"` Items []string `json:"items"` JungleKills int `json:"jungleKills"` KarmaLevel int `json:"karmaLevel"` Kills int `json:"kills"` KrakenCaptures int `json:"krakenCaptures"` Level int `json:"level"` MinionKills int `json:"minionKills"` NonJungleMinionKills int `json:"nonJungleMinionKills"` SkillTier int `json:"skillTier"` SkinKey string `json:"skinKey"` TurretCaptures int `json:"turretCaptures"` WentAfk bool `json:"wentAfk"` Winner bool `json:"winner"` }
type PlayerAttributes ¶
type PlayerAttributes struct { Name string `json:"name"` PatchVersion string `json:"patchVersion"` ShardID string `json:"shardId"` Stats PlayerStats `json:"stats"` TitleID string `json:"titleID"` }
type PlayerData ¶
type PlayerData struct { Attributes PlayerAttributes `json:"attributes"` // contains filtered or unexported fields }
type PlayerFirstSpawnEvent ¶
type PlayerResponse ¶
type PlayerResponse struct {
Data PlayerData `json:"data"`
}
type PlayerStats ¶
type PlayerStats struct { EloEarnedSeason4 int `json:"elo_earned_season_4"` EloEarnedSeason5 int `json:"elo_earned_season_5"` EloEarnedSeason6 int `json:"elo_earned_season_6"` EloEarnedSeason7 int `json:"elo_earned_season_7"` EloEarnedSeason8 int `json:"elo_earned_season_8"` EloEarnedSeason9 int `json:"elo_earned_season_9"` GamesPlayed struct { Aral int `json:"aral"` Blitz int `json:"blitz"` BlitzRounds int `json:"blitz_rounds"` Casual int `json:"casual"` Casual5V5 int `json:"casual_5v5"` Ranked int `json:"ranked"` Ranked5V5 int `json:"ranked_5v5"` } `json:"gamesPlayed"` GuildTag string `json:"guildTag"` KarmaLevel int `json:"karmaLevel"` Level int `json:"level"` LifetimeGold int `json:"lifetimeGold"` LossStreak int `json:"lossStreak"` Played int `json:"played"` PlayedAral int `json:"played_aral"` PlayedBlitz int `json:"played_blitz"` PlayedCasual int `json:"played_casual"` PlayedRanked int `json:"played_ranked"` RankPoints struct { Blitz float64 `json:"blitz"` Ranked float64 `json:"ranked"` Ranked5V5 float64 `json:"ranked_5v5"` } `json:"rankPoints"` SkillTier int `json:"skillTier"` WinStreak int `json:"winStreak"` Wins int `json:"wins"` Xp int `json:"xp"` }
type PlayersResponse ¶
type PlayersResponse struct { Data []PlayerData Links struct { Self string `json:"self"` } `json:"links"` }
type RESTError ¶
RESTError stores error information about a request with a bad response code. Message is not always present, there are cases where api calls can fail without returning a json message.
type RosterStats ¶
type SellItemEvent ¶
type StatusAttributes ¶
type StatusAttributes struct { Released string `json:"releasedAt"` Version string `json:"version"` }
StatusAttributes contains all of the attributes returned in the StatusResponse
type StatusResponse ¶
type StatusResponse struct {
Data StatusResponseData `json:"data"`
}
StatusResponse is the response payload for the status end point
type StatusResponseData ¶
type StatusResponseData struct { Attributes StatusAttributes `json:"attributes"` // contains filtered or unexported fields }
StatusResponseData contains all of the data returned in the StatusResponse
type TelemetryEvent ¶
type TelemetryEvent interface { GetType() string // returns the event type. GetTimestamp() time.Time // returns the Timestamp of the event. }
TelemetryEvent is an interface for TelemetryEvent's.
type TelemetryResponse ¶
type TelemetryResponse struct { Events []TelemetryEvent HeroBanEvents []*HeroBanEvent HeroSelectEvents []*HeroSelectEvent HeroSkinSelectEvents []*HeroSkinSelectEvent PlayerFirstSpawnEvents []*PlayerFirstSpawnEvent LevelUpEvents []*LevelUpEvent BuyItemEvents []*BuyItemEvent LearnAbilityEvents []*LearnAbilityEvent UseAbilityEvents []*UseAbilityEvent UseItemAbilityEvents []*UseItemAbilityEvent DealDamageEvents []*DealDamageEvent HealTargetEvents []*HealTargetEvent EarnXPEvents []*EarnXPEvent KillActorEvents []*KillActorEvent VampirismEvents []*VampirismEvent GoldFromTowerKillEvents []*GoldFromTowerKillEvent SellItemEvents []*SellItemEvent NPCkillNPCEvents []*NPCkillNPCEvent }
TelemetryResponse is the response payload for the telemetry end point
func ParseTelemetry ¶
func ParseTelemetry(b []byte) (*TelemetryResponse, error)
ParseTelemetry reads the telemetry event type from the json and passes it to the unmarshaller
func ReadTelemetryFromFile ¶
func ReadTelemetryFromFile(path string) (tr *TelemetryResponse, err error)
ReadTelemetryFromFile parses json telemetry data from a given file and returns a TelemetryResponse struct. It is more performant to cache telemetry data for future use.
func (*TelemetryResponse) ToFile ¶
func (tr *TelemetryResponse) ToFile(path string) (err error)
ToFile will save a TelemetryResponse to the file at a specified location. These data are always static and so it makes sense to cache/save this somewhere locally to prevent from having to request the large file multiple times
type UseAbilityEvent ¶
type UseItemAbilityEvent ¶
type VampirismEvent ¶
type VampirismEvent struct { Base Payload struct { Actor string `json:"Actor"` Team string `json:"Team"` TargetActor string `json:"TargetActor"` TargetTeam string `json:"TargetTeam"` Source string `json:"Source"` Vamp string `json:"Vamp"` IsHero int `json:"IsHero"` TargetIsHero int `json:"TargetIsHero"` } `json:"payload"` }