Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to lists invited groups of a project #2000

Merged
merged 2 commits into from
Aug 30, 2024
Merged

Conversation

habnux
Copy link
Contributor

@habnux habnux commented Aug 28, 2024

Copy link
Member

@svanharmelen svanharmelen left a 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"`
Copy link
Member

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
Comment on lines 1142 to 1144
// ListProjectInvidedGroupOptions represents the available ListProjectsInvitedGroups() options.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#list-a-projects-invited-groups
Copy link
Member

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:

Suggested change
// 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
Comment on lines 1149 to 1150
Relation []string `url:"relation,omitempty" json:"relation,omitempty"`
WithCustomAttributes bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
Copy link
Member

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:

Suggested change
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) {
Copy link
Member

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)
}
Copy link
Member

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) {
Copy link
Member

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.

@svanharmelen svanharmelen merged commit 000cfc0 into xanzy:main Aug 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants