Skip to content

Commit

Permalink
Merge pull request #2000 from habnux/main
Browse files Browse the repository at this point in the history
Add endpoint to lists invited groups of a project
  • Loading branch information
svanharmelen authored Aug 30, 2024
2 parents 6404ea3 + e08e7bc commit 000cfc0
Showing 1 changed file with 38 additions and 0 deletions.
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

0 comments on commit 000cfc0

Please sign in to comment.