From 2d44038f0019465c7e7a5e482d6d98117ac5e670 Mon Sep 17 00:00:00 2001 From: Vennekilde Date: Sun, 6 Oct 2024 19:33:50 +0200 Subject: [PATCH 1/3] Use 2024-07-20 schema for Account endpoint which add wvw team and last_modified fields --- account.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/account.go b/account.go index a271b13..5b3ba8a 100644 --- a/account.go +++ b/account.go @@ -36,11 +36,17 @@ type Account struct { DailyAP int `json:"daily_ap"` MonthlyAP int `json:"monthly_ap"` WvWRank int `json:"wvw_rank"` + LastModified time.Time `json:"last_modified"` + WvW WvW `json:"wvw"` } // Account returns general account information func (s *Session) Account() (account Account, err error) { - err = s.getWithAuth("/v2/account", &account) + err = s.getWithAuth("/v2/account?v=2024-07-20T01:00:00.000Z", &account) + // Backwards compatibility for Account.WvWRank, as that information is now in Account.WvW.Rank + if account.WvW.Rank > 0 { + account.WvWRank = account.WvW.Rank + } return } @@ -291,3 +297,9 @@ func (s *Session) AccountLegendaryArmory() (res []*AccountLegendaryArmoryItem, e err = s.getWithAuth("/v2/account/legendaryarmory", &res) return } + +// WvW is the accounts WvW information +type WvW struct { + TeamID int `json:"team_id"` + Rank int `json:"rank"` +} From 9bd2bde338ff558fcdaac2195493b2d3f10a97b7 Mon Sep 17 00:00:00 2001 From: Vennekilde Date: Wed, 8 Jan 2025 23:28:12 +0100 Subject: [PATCH 2/3] Refactor struct WvW to AccountWvWInfo --- account.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/account.go b/account.go index 5b3ba8a..7eabc39 100644 --- a/account.go +++ b/account.go @@ -23,21 +23,21 @@ type AccountBankItem struct { // Account contains general information type Account struct { - ID string `json:"id"` - Name string `json:"name"` - Age time.Duration `json:"age"` - World int `json:"world"` - Guilds []string `json:"guilds"` - GuildLeader []string `json:"guild_leader"` - Created time.Time `json:"created"` - Access []string `json:"access"` - Commander bool `json:"commander"` - FractalLevel int `json:"fractal_level"` - DailyAP int `json:"daily_ap"` - MonthlyAP int `json:"monthly_ap"` - WvWRank int `json:"wvw_rank"` - LastModified time.Time `json:"last_modified"` - WvW WvW `json:"wvw"` + ID string `json:"id"` + Name string `json:"name"` + Age time.Duration `json:"age"` + World int `json:"world"` + Guilds []string `json:"guilds"` + GuildLeader []string `json:"guild_leader"` + Created time.Time `json:"created"` + Access []string `json:"access"` + Commander bool `json:"commander"` + FractalLevel int `json:"fractal_level"` + DailyAP int `json:"daily_ap"` + MonthlyAP int `json:"monthly_ap"` + WvWRank int `json:"wvw_rank"` + LastModified time.Time `json:"last_modified"` + WvW AccountWvWInfo `json:"wvw"` } // Account returns general account information @@ -298,8 +298,8 @@ func (s *Session) AccountLegendaryArmory() (res []*AccountLegendaryArmoryItem, e return } -// WvW is the accounts WvW information -type WvW struct { +// AccountWvWInfo is the accounts WvW information +type AccountWvWInfo struct { TeamID int `json:"team_id"` - Rank int `json:"rank"` + Rank int `json:"rank"` } From 9395ba98fbb33f23e347dac5767898e8dffce6d5 Mon Sep 17 00:00:00 2001 From: Vennekilde Date: Wed, 8 Jan 2025 23:29:00 +0100 Subject: [PATCH 3/3] Deprecated Account.WvWRank --- account.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/account.go b/account.go index 7eabc39..0a56f99 100644 --- a/account.go +++ b/account.go @@ -23,18 +23,19 @@ type AccountBankItem struct { // Account contains general information type Account struct { - ID string `json:"id"` - Name string `json:"name"` - Age time.Duration `json:"age"` - World int `json:"world"` - Guilds []string `json:"guilds"` - GuildLeader []string `json:"guild_leader"` - Created time.Time `json:"created"` - Access []string `json:"access"` - Commander bool `json:"commander"` - FractalLevel int `json:"fractal_level"` - DailyAP int `json:"daily_ap"` - MonthlyAP int `json:"monthly_ap"` + ID string `json:"id"` + Name string `json:"name"` + Age time.Duration `json:"age"` + World int `json:"world"` + Guilds []string `json:"guilds"` + GuildLeader []string `json:"guild_leader"` + Created time.Time `json:"created"` + Access []string `json:"access"` + Commander bool `json:"commander"` + FractalLevel int `json:"fractal_level"` + DailyAP int `json:"daily_ap"` + MonthlyAP int `json:"monthly_ap"` + // Deprecated: Use WvW.Rank instead WvWRank int `json:"wvw_rank"` LastModified time.Time `json:"last_modified"` WvW AccountWvWInfo `json:"wvw"`