generated from theflyingcodr/go-lib-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
leaderboards.go
85 lines (75 loc) · 2.42 KB
/
leaderboards.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package official
// Region is used for constants when filtering.
type Region int
// Region constants used by the api.
const (
RegionEurope Region = 0
RegionMiddleEast Region = 1
RegionAsia Region = 2
RegionNorthAmerica Region = 3
RegionSouthAmerica Region = 4
RegionOceana Region = 5
RegionAfrica Region = 6
RegionGlobal Region = 7
)
// TeamSize is used for constants when filtering.
type TeamSize string
// TeamSize constants used by the api.
const (
TeamSizeAll TeamSize = ""
TeamSize1v1 TeamSize = "1v1"
TeamSize2v2 TeamSize = "2v2"
TeamSize3v3 TeamSize = "3v3"
TeamSize4v4 TeamSize = "4v4"
)
// MatchType is used for constants when filtering.
type MatchType string
// MatchType constants used by the api.
const (
MatchTypeUnranked MatchType = "unranked"
MatchTypeCustom MatchType = "custom"
MatchTypeAIEasy MatchType = "aieasy"
MatchTypeAIIntermediate MatchType = "aimedium"
MatchTypeAIHard MatchType = "aihard"
MatchTypeAIExpert MatchType = "aiexpert"
)
// Versus is used for constants when filtering.
type Versus string
// Versus constants used by the API.
const (
VersusAll Versus = ""
VersusPlayers Versus = "players"
VersusAI Versus = "ai"
)
// LeaderboardArgs are used to query the leaderboard api.
type LeaderboardArgs struct {
Region Region `json:"region"`
Versus Versus `json:"versus"`
MatchType MatchType `json:"matchType"`
TeamSize TeamSize `json:"teamSize"`
SearchPlayer string `json:"searchPlayer"`
Page int `json:"page"`
Count int `json:"count"`
}
// Leaderboard is returned from the official leaderboard
// api call. IT has a count of all players as well as a paged
// list of
type Leaderboard struct {
Count int `json:"count"`
Items []struct {
GameID interface{} `json:"gameId"`
UserID interface{} `json:"userId"`
RlUserID int `json:"rlUserId"`
UserName string `json:"userName"`
AvatarURL string `json:"avatarUrl"`
PlayerNumber interface{} `json:"playerNumber"`
Elo int `json:"elo"`
EloRating int `json:"eloRating"`
Rank int `json:"rank"`
Region string `json:"region"`
Wins int `json:"wins"`
WinPercent float64 `json:"winPercent"`
Losses int `json:"losses"`
WinStreak int `json:"winStreak"`
} `json:"items"`
}