From 1b2a337b799d0b8cedd614c13f89f74e2e889a4d Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Sat, 2 Dec 2023 00:28:42 -0500 Subject: [PATCH] Update data structure --- getaoc.go | 65 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/getaoc.go b/getaoc.go index 687899a..da262fa 100644 --- a/getaoc.go +++ b/getaoc.go @@ -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"` }