MCPcopy Index your code
hub / github.com/google/go-github / ListTeams

Method ListTeams

github/teams.go:98–117  ·  view source on GitHub ↗

ListTeams lists all of the teams for an organization. GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-teams meta:operation GET /orgs/{org}/teams

(ctx context.Context, org string, opts *ListOptions)

Source from the content-addressed store, hash-verified

96//
97//meta:operation GET /orgs/{org}/teams
98func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) {
99 u := fmt.Sprintf("orgs/%v/teams", org)
100 u, err := addOptions(u, opts)
101 if err != nil {
102 return nil, nil, err
103 }
104
105 req, err := s.client.NewRequest(ctx, "GET", u, nil)
106 if err != nil {
107 return nil, nil, err
108 }
109
110 var teams []*Team
111 resp, err := s.client.Do(req, &teams)
112 if err != nil {
113 return nil, resp, err
114 }
115
116 return teams, resp, nil
117}
118
119// GetTeamByID fetches a team, given a specified organization ID, by ID.
120//

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45