Skip to content

Commit b0245f1

Browse files
authored
refactor!: Change GetConsumedLicenses to ListConsumedLicenses (#4226)
BREAKING CHANGE: `EnterpriseService.GetConsumedLicenses` is now `EnterpriseService.ListConsumedLicenses`.
1 parent 4a6d2a9 commit b0245f1

4 files changed

Lines changed: 116 additions & 9 deletions

File tree

github/enterprise_licenses.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ type LastLicenseSyncProperties struct {
8989
Error string `json:"error"`
9090
}
9191

92-
// GetConsumedLicenses collect information about the number of consumed licenses and a collection with all the users with consumed enterprise licenses.
92+
// ListConsumedLicenses collect information about the number of consumed licenses and a collection with all the users with consumed enterprise licenses.
9393
//
9494
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing?apiVersion=2022-11-28#list-enterprise-consumed-licenses
9595
//
9696
//meta:operation GET /enterprises/{enterprise}/consumed-licenses
97-
func (s *EnterpriseService) GetConsumedLicenses(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseConsumedLicenses, *Response, error) {
97+
func (s *EnterpriseService) ListConsumedLicenses(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseConsumedLicenses, *Response, error) {
9898
u := fmt.Sprintf("enterprises/%v/consumed-licenses", enterprise)
9999
u, err := addOptions(u, opts)
100100
if err != nil {

github/enterprise_licenses_test.go

Lines changed: 7 additions & 7 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 TestEnterpriseService_GetConsumedLicenses(t *testing.T) {
17+
func TestEnterpriseService_ListConsumedLicenses(t *testing.T) {
1818
t.Parallel()
1919
client, mux, _ := setup(t)
2020

@@ -49,9 +49,9 @@ func TestEnterpriseService_GetConsumedLicenses(t *testing.T) {
4949

5050
opt := &ListOptions{Page: 2, PerPage: 10}
5151
ctx := t.Context()
52-
licenses, _, err := client.Enterprise.GetConsumedLicenses(ctx, "e", opt)
52+
licenses, _, err := client.Enterprise.ListConsumedLicenses(ctx, "e", opt)
5353
if err != nil {
54-
t.Errorf("Enterprise.GetConsumedLicenses returned error: %v", err)
54+
t.Errorf("Enterprise.ListConsumedLicenses returned error: %v", err)
5555
}
5656

5757
userName := "User One"
@@ -90,17 +90,17 @@ func TestEnterpriseService_GetConsumedLicenses(t *testing.T) {
9090
}
9191

9292
if !cmp.Equal(licenses, want) {
93-
t.Errorf("Enterprise.GetConsumedLicenses returned %+v, want %+v", licenses, want)
93+
t.Errorf("Enterprise.ListConsumedLicenses returned %+v, want %+v", licenses, want)
9494
}
9595

96-
const methodName = "GetConsumedLicenses"
96+
const methodName = "ListConsumedLicenses"
9797
testBadOptions(t, methodName, func() (err error) {
98-
_, _, err = client.Enterprise.GetConsumedLicenses(ctx, "\n", opt)
98+
_, _, err = client.Enterprise.ListConsumedLicenses(ctx, "\n", opt)
9999
return err
100100
})
101101

102102
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
103-
got, resp, err := client.Enterprise.GetConsumedLicenses(ctx, "e", opt)
103+
got, resp, err := client.Enterprise.ListConsumedLicenses(ctx, "e", opt)
104104
if got != nil {
105105
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
106106
}

github/github-iterators.go

Lines changed: 35 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.

0 commit comments

Comments
 (0)