From 5288cf539536e771a6520d78ef308c8294f859ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Dr=C3=B6=C3=9Fler?= Date: Wed, 16 Oct 2024 15:21:25 +0200 Subject: [PATCH 1/2] support ListOptions for ListMembershipsForBillableGroupMember --- group_members.go | 4 ++-- group_members_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/group_members.go b/group_members.go index c18b180e1..483e50a44 100644 --- a/group_members.go +++ b/group_members.go @@ -258,14 +258,14 @@ func (s *GroupsService) ListBillableGroupMembers(gid interface{}, opt *ListBilla // // GitLab API docs: // https://docs.gitlab.com/ee/api/members.html#list-memberships-for-a-billable-member-of-a-group -func (s *GroupsService) ListMembershipsForBillableGroupMember(gid interface{}, user int, options ...RequestOptionFunc) ([]*BillableUserMembership, *Response, error) { +func (s *GroupsService) ListMembershipsForBillableGroupMember(gid interface{}, user int, opt *ListOptions, options ...RequestOptionFunc) ([]*BillableUserMembership, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err } u := fmt.Sprintf("groups/%s/billable_members/%d/memberships", PathEscape(group), user) - req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + req, err := s.client.NewRequest(http.MethodGet, u, opt, options) if err != nil { return nil, nil, err } diff --git a/group_members_test.go b/group_members_test.go index 98fc0d280..06b43c116 100644 --- a/group_members_test.go +++ b/group_members_test.go @@ -102,7 +102,7 @@ func TestListMembershipsForBillableGroupMember(t *testing.T) { ]`) }) - memberships, _, err := client.Groups.ListMembershipsForBillableGroupMember(1, 42) + memberships, _, err := client.Groups.ListMembershipsForBillableGroupMember(1, 42, &ListOptions{}) if err != nil { t.Errorf("Groups.ListMembershipsForBillableGroupMember returned error: %v", err) } From 0abe52614dce07f1fecd83004c63f03e7795a38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Dr=C3=B6=C3=9Fler?= Date: Thu, 17 Oct 2024 17:05:47 +0200 Subject: [PATCH 2/2] use dedicated type instead of ListOptions --- group_members.go | 8 +++++++- group_members_test.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/group_members.go b/group_members.go index 483e50a44..9c29c10c4 100644 --- a/group_members.go +++ b/group_members.go @@ -253,12 +253,18 @@ func (s *GroupsService) ListBillableGroupMembers(gid interface{}, opt *ListBilla return bgm, resp, nil } +// ListMembershipsForBillableGroupMemberOptions represents the available ListMembershipsForBillableGroupMember() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/members.html#list-memberships-for-a-billable-member-of-a-group +type ListMembershipsForBillableGroupMemberOptions = ListOptions + // ListMembershipsForBillableGroupMember Gets a list of memberships for a billable member of a group. // Lists all projects and groups a user is a member of. Only projects and groups within the group hierarchy are included. // // GitLab API docs: // https://docs.gitlab.com/ee/api/members.html#list-memberships-for-a-billable-member-of-a-group -func (s *GroupsService) ListMembershipsForBillableGroupMember(gid interface{}, user int, opt *ListOptions, options ...RequestOptionFunc) ([]*BillableUserMembership, *Response, error) { +func (s *GroupsService) ListMembershipsForBillableGroupMember(gid interface{}, user int, opt *ListMembershipsForBillableGroupMemberOptions, options ...RequestOptionFunc) ([]*BillableUserMembership, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err diff --git a/group_members_test.go b/group_members_test.go index 06b43c116..ae19374e0 100644 --- a/group_members_test.go +++ b/group_members_test.go @@ -102,7 +102,7 @@ func TestListMembershipsForBillableGroupMember(t *testing.T) { ]`) }) - memberships, _, err := client.Groups.ListMembershipsForBillableGroupMember(1, 42, &ListOptions{}) + memberships, _, err := client.Groups.ListMembershipsForBillableGroupMember(1, 42, &ListMembershipsForBillableGroupMemberOptions{}) if err != nil { t.Errorf("Groups.ListMembershipsForBillableGroupMember returned error: %v", err) }