-
Notifications
You must be signed in to change notification settings - Fork 959
Add endpoint to lists invited groups of a project #2000
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @habnux, but it seems you missed a few bits. I've made some comments but will also add a commit with the fixes so this one can be merged 👍🏻
projects.go
Outdated
type ListProjectInvidedGroupOptions struct { | ||
ListOptions | ||
Search *string `url:"search,omitempty" json:"search,omitempty"` | ||
SharedMinAccessLevel *AccessLevelValue `url:"shared_min_access_level,omitempty" json:"shared_min_access_level,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs this should be MinAccessLevel
(min_access_level
).
projects.go
Outdated
// ListProjectInvidedGroupOptions represents the available ListProjectsInvitedGroups() options. | ||
// | ||
// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to keep comments below 80 chars:
// ListProjectInvidedGroupOptions represents the available ListProjectsInvitedGroups() options. | |
// | |
// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups | |
// ListProjectInvidedGroupOptions represents the available | |
// ListProjectsInvitedGroups() options. | |
// | |
// GitLab API docs: | |
// https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups |
projects.go
Outdated
Relation []string `url:"relation,omitempty" json:"relation,omitempty"` | ||
WithCustomAttributes bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be pointers and it seems this code is not formatted properly:
Relation []string `url:"relation,omitempty" json:"relation,omitempty"` | |
WithCustomAttributes bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` | |
Relation *[]string `url:"relation,omitempty" json:"relation,omitempty"` | |
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"` |
projects.go
Outdated
// 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) (*Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should also return a *ProjectGroup
instead of only the raw response.
projects.go
Outdated
} | ||
|
||
return s.client.Do(req, nil) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the ordering in the docs, this method should be placed between Star
and Unstar
.
projects_test.go
Outdated
@@ -647,6 +647,21 @@ func TestListProjectForks(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestListProjectsInvitedGroups(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test like this doesn't actually test anything, so probably best to remove it.
Adds following endoint https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups