Update data structure

This commit is contained in:
Chris Sexton 2023-12-02 00:28:42 -05:00
parent e4b21fc080
commit 1b2a337b79
1 changed files with 44 additions and 21 deletions

View File

@ -17,13 +17,13 @@ func GetInput(session string, year, day int) (string, error) {
return "", err
}
r.AddCookie(&http.Cookie{
Name: "session",
Value: session,
Path: "",
Domain: ".adventofcode.com",
Secure: false,
HttpOnly: false,
SameSite: 0,
Name: "session",
Value: session,
Path: "",
Domain: ".adventofcode.com",
Secure: false,
HttpOnly: false,
SameSite: 0,
})
c := http.Client{}
resp, err := c.Do(r)
@ -44,13 +44,13 @@ func GetLeaderboard(session string, year, id int) (LeaderBoard, error) {
return board, err
}
r.AddCookie(&http.Cookie{
Name: "session",
Value: session,
Path: "",
Domain: ".adventofcode.com",
Secure: false,
HttpOnly: false,
SameSite: 0,
Name: "session",
Value: session,
Path: "",
Domain: ".adventofcode.com",
Secure: false,
HttpOnly: false,
SameSite: 0,
})
c := http.Client{}
resp, err := c.Do(r)
@ -67,15 +67,38 @@ func GetLeaderboard(session string, year, id int) (LeaderBoard, error) {
}
type Member struct {
ID string `json:"id"`
Stars int `json:"stars"`
GlobalScore int `json:"global_score"`
Name string `json:"name"`
LocalScore int `json:"local_score"`
GlobalScore int `json:"global_score"`
Stars int `json:"stars"`
LocalScore int `json:"local_score"`
LastStarTs int `json:"last_star_ts"`
ID int `json:"id"`
CompletionDayLevel struct {
Num1 struct {
Num1 struct {
GetStarTs int `json:"get_star_ts"`
StarIndex int `json:"star_index"`
} `json:"1"`
Num2 struct {
GetStarTs int `json:"get_star_ts"`
StarIndex int `json:"star_index"`
} `json:"2"`
} `json:"1"`
Num2 struct {
Num1 struct {
GetStarTs int `json:"get_star_ts"`
StarIndex int `json:"star_index"`
} `json:"1"`
Num2 struct {
GetStarTs int `json:"get_star_ts"`
StarIndex int `json:"star_index"`
} `json:"2"`
} `json:"2"`
} `json:"completion_day_level"`
Name string `json:"name"`
}
type LeaderBoard struct {
Event string `json:"event"`
OwnerID string `json:"owner_id"`
Event string `json:"event"`
OwnerID int `json:"owner_id"`
Members map[string]Member `json:"members"`
}