-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmatches.go
More file actions
84 lines (75 loc) · 3.06 KB
/
matches.go
File metadata and controls
84 lines (75 loc) · 3.06 KB
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
package rlapi
import "context"
type MatchEntry struct {
ReplayUrl string `json:"ReplayUrl"`
Match Match `json:"Match"`
}
type Match struct {
MatchGUID string `json:"MatchGUID"`
RecordStartTimestamp int64 `json:"RecordStartTimestamp"`
MapName string `json:"MapName"`
Playlist int `json:"Playlist"`
SecondsPlayed float64 `json:"SecondsPlayed"`
OvertimeSecondsPlayed float64 `json:"OvertimeSecondsPlayed"`
WinningTeam int `json:"WinningTeam"`
Team0Score int `json:"Team0Score"`
Team1Score int `json:"Team1Score"`
OverTime bool `json:"bOverTime"`
NoContest bool `json:"bNoContest"`
Forfeit bool `json:"bForfeit"`
CustomMatchCreatorPlayerID string `json:"CustomMatchCreatorPlayerID,omitempty"`
ClubVsClub bool `json:"bClubVsClub"`
Mutators []string `json:"Mutators"`
Players []MatchPlayer `json:"Players"`
}
type MatchPlayer struct {
PlayerID string `json:"PlayerID"`
PlayerName string `json:"PlayerName"`
ConnectTimestamp int64 `json:"ConnectTimestamp"`
JoinTimestamp int64 `json:"JoinTimestamp"`
LeaveTimestamp int64 `json:"LeaveTimestamp"`
PartyLeaderID string `json:"PartyLeaderID"`
InParty bool `json:"InParty"`
Abandoned bool `json:"bAbandoned"`
MVP bool `json:"bMvp"`
LastTeam int `json:"LastTeam"`
TeamColor string `json:"TeamColor"`
SecondsPlayed float64 `json:"SecondsPlayed"`
Score int `json:"Score"`
Goals int `json:"Goals"`
Assists int `json:"Assists"`
Saves int `json:"Saves"`
Shots int `json:"Shots"`
Demolishes int `json:"Demolishes"`
OwnGoals int `json:"OwnGoals"`
Skills MatchSkills `json:"Skills"`
}
type MatchSkills struct {
Mu float64 `json:"Mu"`
Sigma float64 `json:"Sigma"`
Tier int `json:"Tier"`
Division int `json:"Division"`
PrevMu float64 `json:"PrevMu"`
PrevSigma float64 `json:"PrevSigma"`
PrevTier int `json:"PrevTier"`
PrevDivision int `json:"PrevDivision"`
Valid bool `json:"bValid"`
}
type GetMatchHistoryRequest struct {
PlayerID PlayerID `json:"PlayerID"`
}
type GetMatchHistoryResponse struct {
Matches []MatchEntry `json:"Matches"`
}
// GetMatchHistory retrieves match history for the authenticated player.
func (p *PsyNetRPC) GetMatchHistory(ctx context.Context) ([]MatchEntry, error) {
request := GetMatchHistoryRequest{
PlayerID: p.localPlayerID,
}
var result GetMatchHistoryResponse
err := p.sendRequestSync(ctx, "Matches/GetMatchHistory v1", request, &result)
if err != nil {
return nil, err
}
return result.Matches, nil
}