Skip to content

Commit

Permalink
update for new api format
Browse files Browse the repository at this point in the history
  • Loading branch information
robwhitby committed Oct 23, 2024
1 parent 5e5432b commit 29d1326
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/client/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (
"net/url"
)

type TeamsResponse struct {
Teams Teams `json:"teams"`
}

type Teams []Team
type Team struct {
ID string `json:"id"`
Expand All @@ -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
}
Expand All @@ -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 {
Expand Down

0 comments on commit 29d1326

Please sign in to comment.