Skip to content

Commit 6bba7a4

Browse files
Add ListOptions to GetAdvancedSecurityActiveCommittersOrg (#2720)
1 parent a934ccc commit 6bba7a4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

github/billing.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,14 @@ func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) (
120120

121121
// GetAdvancedSecurityActiveCommittersOrg returns the GitHub Advanced Security active committers for an organization per repository.
122122
//
123-
// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-advanced-security-active-committers-for-an-organization
124-
func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Context, org string) (*ActiveCommitters, *Response, error) {
123+
// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/billing?apiVersion=2022-11-28#get-github-advanced-security-active-committers-for-an-organization
124+
func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Context, org string, opts *ListOptions) (*ActiveCommitters, *Response, error) {
125125
u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org)
126+
u, err := addOptions(u, opts)
127+
if err != nil {
128+
return nil, nil, err
129+
}
130+
126131
req, err := s.client.NewRequest("GET", u, nil)
127132
if err != nil {
128133
return nil, nil, err

github/billing_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ func TestBillingService_GetAdvancedSecurityActiveCommittersOrg(t *testing.T) {
452452
})
453453

454454
ctx := context.Background()
455-
hook, _, err := client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "o")
455+
opts := &ListOptions{Page: 2, PerPage: 50}
456+
hook, _, err := client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "o", opts)
456457
if err != nil {
457458
t.Errorf("Billing.GetAdvancedSecurityActiveCommittersOrg returned error: %v", err)
458459
}
@@ -478,12 +479,12 @@ func TestBillingService_GetAdvancedSecurityActiveCommittersOrg(t *testing.T) {
478479

479480
const methodName = "GetAdvancedSecurityActiveCommittersOrg"
480481
testBadOptions(t, methodName, func() (err error) {
481-
_, _, err = client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "\n")
482+
_, _, err = client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "\n", nil)
482483
return err
483484
})
484485

485486
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
486-
got, resp, err := client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "o")
487+
got, resp, err := client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "o", nil)
487488
if got != nil {
488489
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
489490
}
@@ -496,6 +497,6 @@ func TestBillingService_GetAdvancedSecurityActiveCommittersOrg_invalidOrg(t *tes
496497
defer teardown()
497498

498499
ctx := context.Background()
499-
_, _, err := client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "%")
500+
_, _, err := client.Billing.GetAdvancedSecurityActiveCommittersOrg(ctx, "%", nil)
500501
testURLParseError(t, err)
501502
}

0 commit comments

Comments
 (0)