Skip to content

Commit 4a6d2a9

Browse files
authored
refactor!: Change GetAllRepositoryRulesets to ListAllRepositoryRulesets (#4227)
BREAKING CHANGE: `OrganizationsService.GetAllRepositoryRulesets` is now `OrganizationsService.ListAllRepositoryRulesets`.
1 parent aeea0d2 commit 4a6d2a9

4 files changed

Lines changed: 118 additions & 15 deletions

File tree

github/github-iterators.go

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

github/github-iterators_test.go

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

github/orgs_rules.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
"fmt"
1111
)
1212

13-
// GetAllRepositoryRulesets gets all the repository rulesets for the specified organization.
13+
// ListAllRepositoryRulesets gets all the repository rulesets for the specified organization.
1414
//
1515
// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#get-all-organization-repository-rulesets
1616
//
1717
//meta:operation GET /orgs/{org}/rulesets
18-
func (s *OrganizationsService) GetAllRepositoryRulesets(ctx context.Context, org string, opts *ListOptions) ([]*RepositoryRuleset, *Response, error) {
18+
func (s *OrganizationsService) ListAllRepositoryRulesets(ctx context.Context, org string, opts *ListOptions) ([]*RepositoryRuleset, *Response, error) {
1919
u := fmt.Sprintf("orgs/%v/rulesets", org)
2020

2121
u, err := addOptions(u, opts)

github/orgs_rules_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/google/go-cmp/cmp"
1515
)
1616

17-
func TestOrganizationsService_GetAllRepositoryRulesets(t *testing.T) {
17+
func TestOrganizationsService_ListAllRepositoryRulesets(t *testing.T) {
1818
t.Parallel()
1919
client, mux, _ := setup(t)
2020

@@ -38,9 +38,9 @@ func TestOrganizationsService_GetAllRepositoryRulesets(t *testing.T) {
3838
})
3939

4040
ctx := t.Context()
41-
rulesets, _, err := client.Organizations.GetAllRepositoryRulesets(ctx, "o", nil)
41+
rulesets, _, err := client.Organizations.ListAllRepositoryRulesets(ctx, "o", nil)
4242
if err != nil {
43-
t.Errorf("Organizations.GetAllRepositoryRulesets returned error: %v", err)
43+
t.Errorf("Organizations.ListAllRepositoryRulesets returned error: %v", err)
4444
}
4545

4646
want := []*RepositoryRuleset{{
@@ -56,20 +56,20 @@ func TestOrganizationsService_GetAllRepositoryRulesets(t *testing.T) {
5656
},
5757
}}
5858
if !cmp.Equal(rulesets, want) {
59-
t.Errorf("Organizations.GetAllRepositoryRulesets returned %+v, want %+v", rulesets, want)
59+
t.Errorf("Organizations.ListAllRepositoryRulesets returned %+v, want %+v", rulesets, want)
6060
}
6161

62-
const methodName = "GetAllRepositoryRulesets"
62+
const methodName = "ListAllRepositoryRulesets"
6363
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
64-
got, resp, err := client.Organizations.GetAllRepositoryRulesets(ctx, "o", nil)
64+
got, resp, err := client.Organizations.ListAllRepositoryRulesets(ctx, "o", nil)
6565
if got != nil {
6666
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
6767
}
6868
return resp, err
6969
})
7070
}
7171

72-
func TestOrganizationsService_GetAllRepositoryRulesets_ListOptions(t *testing.T) {
72+
func TestOrganizationsService_ListAllRepositoryRulesets_ListOptions(t *testing.T) {
7373
t.Parallel()
7474
client, mux, _ := setup(t)
7575

@@ -86,26 +86,26 @@ func TestOrganizationsService_GetAllRepositoryRulesets_ListOptions(t *testing.T)
8686

8787
opts := &ListOptions{Page: 2, PerPage: 35}
8888
ctx := t.Context()
89-
rulesets, _, err := client.Organizations.GetAllRepositoryRulesets(ctx, "o", opts)
89+
rulesets, _, err := client.Organizations.ListAllRepositoryRulesets(ctx, "o", opts)
9090
if err != nil {
91-
t.Errorf("Organizations.GetAllRepositoryRulesets returned error: %v", err)
91+
t.Errorf("Organizations.ListAllRepositoryRulesets returned error: %v", err)
9292
}
9393

9494
want := []*RepositoryRuleset{{
9595
ID: Ptr(int64(21)),
9696
}}
9797
if !cmp.Equal(rulesets, want) {
98-
t.Errorf("Organizations.GetAllRepositoryRulesets returned %+v, want %+v", rulesets, want)
98+
t.Errorf("Organizations.ListAllRepositoryRulesets returned %+v, want %+v", rulesets, want)
9999
}
100100

101-
const methodName = "GetAllRepositoryRulesets"
101+
const methodName = "ListAllRepositoryRulesets"
102102
testBadOptions(t, methodName, func() (err error) {
103-
_, _, err = client.Organizations.GetAllRepositoryRulesets(ctx, "\n", opts)
103+
_, _, err = client.Organizations.ListAllRepositoryRulesets(ctx, "\n", opts)
104104
return err
105105
})
106106

107107
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
108-
got, resp, err := client.Organizations.GetAllRepositoryRulesets(ctx, "o", opts)
108+
got, resp, err := client.Organizations.ListAllRepositoryRulesets(ctx, "o", opts)
109109
if got != nil {
110110
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
111111
}

0 commit comments

Comments
 (0)