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

Add endpoint to lists invited groups of a project #2000

Merged
merged 2 commits into from
Aug 30, 2024
Merged
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
38 changes: 38 additions & 0 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,44 @@ func (s *ProjectsService) StarProject(pid interface{}, options ...RequestOptionF
return p, resp, nil
}

// ListProjectInvidedGroupOptions represents the available
// ListProjectsInvitedGroups() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups
type ListProjectInvidedGroupOptions struct {
ListOptions
Search *string `url:"search,omitempty" json:"search,omitempty"`
MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
Relation *[]string `url:"relation,omitempty" json:"relation,omitempty"`
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
}

// ListProjectsInvitedGroups lists invited groups of a project
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups
func (s *ProjectsService) ListProjectsInvitedGroups(pid interface{}, opt *ListProjectInvidedGroupOptions, options ...RequestOptionFunc) (*ProjectGroup, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/invited_groups", PathEscape(project))

req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

pg := new(ProjectGroup)
resp, err := s.client.Do(req, pg)
if err != nil {
return nil, resp, err
}

return pg, resp, nil
}

// UnstarProject unstars a given project.
//
// GitLab API docs:
Expand Down