added weapon-stats endpoint

This commit is contained in:
2021-10-13 17:30:17 +02:00
parent ddd9b79ebb
commit d74b8e3447
3 changed files with 207 additions and 100 deletions

View File

@@ -83,6 +83,73 @@ type MatchStats struct {
Loss int `json:"loss,omitempty"`
}
type MultiKills struct {
Duo uint `json:"duo,omitempty"`
Triple uint `json:"triple,omitempty"`
Quad uint `json:"quad,omitempty"`
Pent uint `json:"pent,omitempty"`
}
type Rank struct {
Old int `json:"old,omitempty"`
New int `json:"new,omitempty"`
}
type HitGroup struct {
Head uint `json:"head,omitempty"`
Chest uint `json:"chest,omitempty"`
Stomach uint `json:"stomach,omitempty"`
LeftArm uint `json:"left_arm,omitempty"`
RightArm uint `json:"right_arm,omitempty"`
LeftLeg uint `json:"left_leg,omitempty"`
RightLeg uint `json:"right_leg,omitempty"`
Gear uint `json:"gear,omitempty"`
}
type UD struct {
HE uint `json:"he,omitempty"`
Flames uint `json:"flames,omitempty"`
Flash uint `json:"flash,omitempty"`
Decoy uint `json:"decoy,omitempty"`
Smoke uint `json:"smoke,omitempty"`
}
type Damage struct {
Enemy uint `json:"enemy,omitempty"`
Team uint `json:"team,omitempty"`
UD *UD `json:"ud,omitempty"`
HitGroup *HitGroup `json:"hit_group,omitempty"`
}
type SelfTeamEnemy struct {
Self interface{} `json:"self,omitempty"`
Team interface{} `json:"team,omitempty"`
Enemy interface{} `json:"enemy,omitempty"`
}
type Flash struct {
Duration *SelfTeamEnemy `json:"duration,omitempty"`
Total *SelfTeamEnemy `json:"total,omitempty"`
}
type StatsResponse struct {
TeamID int `json:"team_id"`
Kills int `json:"kills"`
Deaths int `json:"deaths"`
Assists int `json:"assists"`
Headshot int `json:"headshot"`
MVP uint `json:"mvp"`
Score int `json:"score"`
Player interface{} `json:"player,omitempty"`
Rank *Rank `json:"rank,omitempty"`
MultiKills *MultiKills `json:"multi_kills,omitempty"`
Dmg *Damage `json:"dmg,omitempty"`
Flash *Flash `json:"flash,omitempty"`
Crosshair string `json:"crosshair,omitempty"`
Color string `json:"color,omitempty"`
KAST int `json:"kast,omitempty"`
}
const (
steamID64Entry = "https://steamcommunity.com/profiles/%d?xml=1"
steamVanityURLEntry = "https://steamcommunity.com/id/%s?xml=1"