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

Commit 000cfc0

Browse files
authored
Merge pull request #2000 from habnux/main
Add endpoint to lists invited groups of a project
2 parents 6404ea3 + e08e7bc commit 000cfc0

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

projects.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,44 @@ func (s *ProjectsService) StarProject(pid interface{}, options ...RequestOptionF
10431043
return p, resp, nil
10441044
}
10451045

1046+
// ListProjectInvidedGroupOptions represents the available
1047+
// ListProjectsInvitedGroups() options.
1048+
//
1049+
// GitLab API docs:
1050+
// https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups
1051+
type ListProjectInvidedGroupOptions struct {
1052+
ListOptions
1053+
Search *string `url:"search,omitempty" json:"search,omitempty"`
1054+
MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
1055+
Relation *[]string `url:"relation,omitempty" json:"relation,omitempty"`
1056+
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
1057+
}
1058+
1059+
// ListProjectsInvitedGroups lists invited groups of a project
1060+
//
1061+
// GitLab API docs:
1062+
// https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups
1063+
func (s *ProjectsService) ListProjectsInvitedGroups(pid interface{}, opt *ListProjectInvidedGroupOptions, options ...RequestOptionFunc) (*ProjectGroup, *Response, error) {
1064+
project, err := parseID(pid)
1065+
if err != nil {
1066+
return nil, nil, err
1067+
}
1068+
u := fmt.Sprintf("projects/%s/invited_groups", PathEscape(project))
1069+
1070+
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
1071+
if err != nil {
1072+
return nil, nil, err
1073+
}
1074+
1075+
pg := new(ProjectGroup)
1076+
resp, err := s.client.Do(req, pg)
1077+
if err != nil {
1078+
return nil, resp, err
1079+
}
1080+
1081+
return pg, resp, nil
1082+
}
1083+
10461084
// UnstarProject unstars a given project.
10471085
//
10481086
// GitLab API docs:

0 commit comments

Comments
 (0)