MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / ListAllTeams

Method ListAllTeams

cli/internal/team/team.go:58–80  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

56}
57
58func (c *Client) ListAllTeams(ctx context.Context) ([]Team, error) {
59 page := cloudquery_api.Page(1)
60 perPage := cloudquery_api.PerPage(100)
61 teams := make([]Team, 0)
62 for {
63 resp, err := c.api.ListTeamsWithResponse(ctx, &cloudquery_api.ListTeamsParams{
64 PerPage: &perPage,
65 Page: &page,
66 })
67 if err != nil {
68 return nil, err
69 }
70 if resp.StatusCode() != http.StatusOK || resp.JSON200 == nil {
71 return nil, hub.ErrorFromHTTPResponse(resp.HTTPResponse, resp)
72 }
73 teams = append(teams, resp.JSON200.Items...)
74 if resp.JSON200.Metadata.LastPage == nil || *resp.JSON200.Metadata.LastPage <= int(page) {
75 break
76 }
77 page++
78 }
79 return teams, nil
80}
81
82func (c *Client) ListAllTeamNames(ctx context.Context) ([]string, error) {
83 teams, err := c.ListAllTeams(ctx)

Callers 6

getAvailableUserTeamsFunction · 0.95
GetTeamForTokenFunction · 0.95
ValidateTeamMethod · 0.95
ListAllTeamNamesMethod · 0.95
setTeamOnLoginFunction · 0.95
runSwitchFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected