Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

support ListOptions for ListMembershipsForBillableGroupMember #2043

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions group_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,25 @@ 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, 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
}
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
}
Expand Down
2 changes: 1 addition & 1 deletion group_members_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestListMembershipsForBillableGroupMember(t *testing.T) {
]`)
})

memberships, _, err := client.Groups.ListMembershipsForBillableGroupMember(1, 42)
memberships, _, err := client.Groups.ListMembershipsForBillableGroupMember(1, 42, &ListMembershipsForBillableGroupMemberOptions{})
if err != nil {
t.Errorf("Groups.ListMembershipsForBillableGroupMember returned error: %v", err)
}
Expand Down