From 29d1326b5d895d631a9c9a154955566e21ee677c Mon Sep 17 00:00:00 2001 From: Rob Whitby Date: Wed, 23 Oct 2024 11:45:34 +0100 Subject: [PATCH] update for new api format --- internal/client/platform.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/client/platform.go b/internal/client/platform.go index 0c58217..980ff75 100644 --- a/internal/client/platform.go +++ b/internal/client/platform.go @@ -12,6 +12,10 @@ import ( "net/url" ) +type TeamsResponse struct { + Teams Teams `json:"teams"` +} + type Teams []Team type Team struct { ID string `json:"id"` @@ -33,7 +37,7 @@ func (t platformClient) GetTeams() (teams Teams, err error) { return } - response, err := http.Get(u.JoinPath("/api/teams").String()) + response, err := http.Get(u.JoinPath("/api/v1/teams").String()) if err != nil { return } @@ -49,8 +53,9 @@ func (t platformClient) GetTeams() (teams Teams, err error) { log.Fatal(err) } - err = json.Unmarshal(body, &teams) - return + teamsResponse := TeamsResponse{} + err = json.Unmarshal(body, &teamsResponse) + return teamsResponse.Teams, err } func NewPlatformClient(teamsEndpoint string) PlatformClient {