Commit 760a3395 authored by Sander van Harmelen's avatar Sander van Harmelen

Make all the Group related calls consistent

parent ef44af32
......@@ -36,15 +36,14 @@ type GroupsService struct {
// GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/groups.md
type Group struct {
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Description string `json:"description"`
VisibilityLevel VisibilityLevelValue `json:"visibility_level"`
LFSEnabled bool `json:"lfs_enabled"`
RequestAccessEnabled bool `json:"request_access_enabled"`
Projects []*Project `json:"projects"`
Statistics *StorageStatistics `json:"statistics"`
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Description string `json:"description"`
LFSEnabled bool `json:"lfs_enabled"`
Projects []*Project `json:"projects"`
Statistics *StorageStatistics `json:"statistics"`
VisibilityLevel VisibilityLevelValue `json:"visibility_level"`
}
// ListGroupsOptions represents the available ListGroups() options.
......@@ -85,7 +84,7 @@ func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s", group)
u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
......@@ -109,9 +108,9 @@ type CreateGroupOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
VisibilityLevel *VisibilityLevelValue `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
VisibilityLevel *VisibilityLevelValue `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
}
// CreateGroup creates a new project group. Available only for users who can
......@@ -177,7 +176,7 @@ func (s *GroupsService) TransferGroup(gid interface{}, project int, options ...O
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/projects/%d", group, project)
u := fmt.Sprintf("groups/%s/projects/%d", url.QueryEscape(group), project)
req, err := s.client.NewRequest("POST", u, nil, options)
if err != nil {
......@@ -202,7 +201,7 @@ func (s *GroupsService) DeleteGroup(gid interface{}, options ...OptionFunc) (*Re
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s", group)
u := fmt.Sprintf("groups/%s", url.QueryEscape(group))
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
......@@ -269,7 +268,7 @@ func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersO
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/members", group)
u := fmt.Sprintf("groups/%s/members", url.QueryEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
......@@ -303,7 +302,7 @@ func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProject
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/projects", group)
u := fmt.Sprintf("groups/%s/projects", url.QueryEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
......@@ -337,7 +336,7 @@ func (s *GroupsService) AddGroupMember(gid interface{}, opt *AddGroupMemberOptio
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/members", group)
u := fmt.Sprintf("groups/%s/members", url.QueryEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
......@@ -371,7 +370,7 @@ func (s *GroupsService) UpdateGroupMember(gid interface{}, user int, opt *Update
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/members/%d", group, user)
u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
......@@ -396,7 +395,7 @@ func (s *GroupsService) RemoveGroupMember(gid interface{}, user int, options ...
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s/members/%d", group, user)
u := fmt.Sprintf("groups/%s/members/%d", url.QueryEscape(group), user)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment