diff --git a/github/teams.go b/github/teams.go index 0f6cc9d16e4..b44e9418c05 100644 --- a/github/teams.go +++ b/github/teams.go @@ -796,6 +796,14 @@ func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug st return s.client.Do(ctx, req, nil) } +// ListIDPGroupsOptions specifies the optional parameters to the ListIDPGroupsInOrganization method. +type ListIDPGroupsOptions struct { + // Filters the results to return only those that begin with the value specified by this parameter. + Query string `url:"q,omitempty"` + + ListCursorOptions +} + // IDPGroupList represents a list of external identity provider (IDP) groups. type IDPGroupList struct { Groups []*IDPGroup `json:"groups"` @@ -813,7 +821,7 @@ type IDPGroup struct { // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-an-organization // //meta:operation GET /orgs/{org}/team-sync/groups -func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListCursorOptions) (*IDPGroupList, *Response, error) { +func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListIDPGroupsOptions) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/team-sync/groups", org) u, err := addOptions(u, opts) if err != nil { diff --git a/github/teams_test.go b/github/teams_test.go index 516c88f43ae..bb4fa4eac38 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -1302,11 +1302,15 @@ func TestTeamsService_ListIDPGroupsInOrganization(t *testing.T) { testMethod(t, r, "GET") testFormValues(t, r, values{ "page": "url-encoded-next-page-token", + "q": "n", }) fmt.Fprint(w, `{"groups": [{"group_id": "1", "group_name": "n", "group_description": "d"}]}`) }) - opt := &ListCursorOptions{Page: "url-encoded-next-page-token"} + opt := &ListIDPGroupsOptions{ + Query: "n", + ListCursorOptions: ListCursorOptions{Page: "url-encoded-next-page-token"}, + } ctx := context.Background() groups, _, err := client.Teams.ListIDPGroupsInOrganization(ctx, "o", opt) if err != nil {