Skip to content

Commit f1b11e1

Browse files
authored
fix!: Add ListSCIMProvisionedGroupsForEnterpriseOptions (#3601)
BREAKING CHANGE: `ListSCIMProvisionedGroupsForEnterprise` now takes `ListSCIMProvisionedGroupsForEnterpriseOptions` instead of `*ListSCIMProvisionedIdentitiesOptions`.
1 parent c21f2be commit f1b11e1

File tree

4 files changed

+113
-2
lines changed

4 files changed

+113
-2
lines changed

github/github-accessors.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/scim.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,26 @@ type ListSCIMProvisionedIdentitiesOptions struct {
108108
Filter *string `url:"filter,omitempty"`
109109
}
110110

111+
// ListSCIMProvisionedGroupsForEnterpriseOptions represents options for ListSCIMProvisionedGroupsForEnterprise.
112+
//
113+
// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise--parameters
114+
type ListSCIMProvisionedGroupsForEnterpriseOptions struct {
115+
// Filter specifies the matching results to return.
116+
// Multiple filters are not supported. Possible filters are externalId, id, and displayName.
117+
// For example: ?filter=externalId eq "9138790-10932-109120392-12321".
118+
// (Optional.)
119+
Filter *string `url:"filter,omitempty"`
120+
// ExcludedAttributes excludes the specified attribute from being returned in the results.
121+
// Using this parameter can speed up response time. (Optional.)
122+
ExcludedAttributes *string `url:"excludedAttributes,omitempty"`
123+
// StartIndex used for pagination: the starting index of the first result to return when paginating through values. (Optional.)
124+
// Default: 1.
125+
StartIndex *int `url:"startIndex,omitempty"`
126+
// Count used for pagination: the number of results to return per page. (Optional.)
127+
// Default: 30.
128+
Count *int `url:"count,omitempty"`
129+
}
130+
111131
// ListSCIMProvisionedIdentities lists SCIM provisioned identities.
112132
//
113133
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#list-scim-provisioned-identities
@@ -252,8 +272,12 @@ func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID
252272
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise
253273
//
254274
//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups
255-
func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, _ *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedGroups, *Response, error) {
275+
func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListSCIMProvisionedGroupsForEnterpriseOptions) (*SCIMProvisionedGroups, *Response, error) {
256276
u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise)
277+
u, err := addOptions(u, opts)
278+
if err != nil {
279+
return nil, nil, err
280+
}
257281

258282
req, err := s.client.NewRequest("GET", u, nil)
259283
if err != nil {

github/scim_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ func TestSCIMService_ListSCIMProvisionedGroups(t *testing.T) {
127127

128128
mux.HandleFunc("/scim/v2/enterprises/o/Groups", func(w http.ResponseWriter, r *http.Request) {
129129
testMethod(t, r, "GET")
130+
testFormValues(t, r, values{
131+
"startIndex": "1",
132+
"excludedAttributes": "members,meta",
133+
"count": "3",
134+
"filter": `externalId eq "00u1dhhb1fkIGP7RL1d8"`,
135+
})
130136
w.WriteHeader(http.StatusOK)
131137
_, _ = w.Write([]byte(`{
132138
"schemas": [
@@ -162,7 +168,12 @@ func TestSCIMService_ListSCIMProvisionedGroups(t *testing.T) {
162168
})
163169

164170
ctx := context.Background()
165-
opts := &ListSCIMProvisionedIdentitiesOptions{}
171+
opts := &ListSCIMProvisionedGroupsForEnterpriseOptions{
172+
StartIndex: Ptr(1),
173+
ExcludedAttributes: Ptr("members,meta"),
174+
Count: Ptr(3),
175+
Filter: Ptr(`externalId eq "00u1dhhb1fkIGP7RL1d8"`),
176+
}
166177
groups, _, err := client.SCIM.ListSCIMProvisionedGroupsForEnterprise(ctx, "o", opts)
167178
if err != nil {
168179
t.Errorf("SCIM.ListSCIMProvisionedIdentities returned error: %v", err)

0 commit comments

Comments
 (0)