Commit da0408da authored by Sander van Harmelen's avatar Sander van Harmelen

Merge pull request #26 from metrix-hu/master

Use json encoded request body for payload of POST and PUT
parents 6df79e29 8666683d
...@@ -154,8 +154,8 @@ func (s *BranchesService) UnprotectBranch( ...@@ -154,8 +154,8 @@ func (s *BranchesService) UnprotectBranch(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/branches.html#create-repository-branch // http://doc.gitlab.com/ce/api/branches.html#create-repository-branch
type CreateBranchOptions struct { type CreateBranchOptions struct {
BranchName string `url:"branch_name,omitempty"` BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
Ref string `url:"ref,omitempty"` Ref string `url:"ref,omitempty" json:"ref,omitempty"`
} }
// CreateBranch creates branch from commit SHA or existing branch. // CreateBranch creates branch from commit SHA or existing branch.
......
...@@ -55,7 +55,7 @@ func (c Commit) String() string { ...@@ -55,7 +55,7 @@ func (c Commit) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#list-commits // GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#list-commits
type ListCommitsOptions struct { type ListCommitsOptions struct {
ListOptions ListOptions
RefName string `url:"ref_name,omitempty"` RefName string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
} }
// ListCommits gets a list of repository commits in a project. // ListCommits gets a list of repository commits in a project.
...@@ -212,10 +212,10 @@ func (s *CommitsService) GetCommitComments( ...@@ -212,10 +212,10 @@ func (s *CommitsService) GetCommitComments(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit // http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit
type PostCommitCommentOptions struct { type PostCommitCommentOptions struct {
Note string `url:"note,omitempty"` Note string `url:"note,omitempty" json:"note,omitempty"`
Path string `url:"path"` Path string `url:"path" json:"path"`
Line int `url:"line"` Line int `url:"line" json:"line"`
LineType string `url:"line_type"` LineType string `url:"line_type" json:"line_type"`
} }
// PostCommitComment adds a comment to a commit. Optionally you can post // PostCommitComment adds a comment to a commit. Optionally you can post
......
...@@ -99,8 +99,8 @@ func (s *DeployKeysService) GetDeployKey( ...@@ -99,8 +99,8 @@ func (s *DeployKeysService) GetDeployKey(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/deploy_keys.html#add-deploy-key // http://doc.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
type AddDeployKeyOptions struct { type AddDeployKeyOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Key string `url:"key,omitempty"` Key string `url:"key,omitempty" json:"key,omitempty"`
} }
// AddDeployKey creates a new deploy key for a project. If deploy key already // AddDeployKey creates a new deploy key for a project. If deploy key already
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package gitlab package gitlab
import ( import (
"bytes"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
...@@ -124,10 +125,10 @@ type Client struct { ...@@ -124,10 +125,10 @@ type Client struct {
// support pagination. // support pagination.
type ListOptions struct { type ListOptions struct {
// For paginated result sets, page of results to retrieve. // For paginated result sets, page of results to retrieve.
Page int `url:"page,omitempty"` Page int `url:"page,omitempty" json:"page,omitempty"`
// For paginated result sets, the number of results to include per page. // For paginated result sets, the number of results to include per page.
PerPage int `url:"per_page,omitempty"` PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"`
} }
// NewClient returns a new GitLab API client. If a nil httpClient is // NewClient returns a new GitLab API client. If a nil httpClient is
...@@ -216,6 +217,19 @@ func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request ...@@ -216,6 +217,19 @@ func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request
Host: u.Host, Host: u.Host,
} }
if method == "POST" || method == "PUT" {
bodyBytes, err := json.Marshal(opt)
if err != nil {
return nil, err
}
bodyReader := bytes.NewReader(bodyBytes)
u.RawQuery = ""
req.Body = ioutil.NopCloser(bodyReader)
req.ContentLength = int64(bodyReader.Len())
req.Header.Set("Content-Type", "application/json")
}
req.Header.Set("Accept", "application/json") req.Header.Set("Accept", "application/json")
req.Header.Set("PRIVATE-TOKEN", c.token) req.Header.Set("PRIVATE-TOKEN", c.token)
if c.UserAgent != "" { if c.UserAgent != "" {
......
package gitlab package gitlab
import ( import (
"encoding/json"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
...@@ -74,6 +75,20 @@ func testBody(t *testing.T, r *http.Request, want string) { ...@@ -74,6 +75,20 @@ func testBody(t *testing.T, r *http.Request, want string) {
} }
} }
func testJsonBody(t *testing.T, r *http.Request, want values) {
b, err := ioutil.ReadAll(r.Body)
if err != nil {
t.Errorf("Error reading request body: %v", err)
}
var got values
json.Unmarshal(b, &got)
if !reflect.DeepEqual(got, want) {
t.Errorf("Request parameters: %v, want %v", got, want)
}
}
func responseBody(w http.ResponseWriter, filename string) { func responseBody(w http.ResponseWriter, filename string) {
body, _ := ioutil.ReadFile(filename) body, _ := ioutil.ReadFile(filename)
w.Write([]byte(body)) w.Write([]byte(body))
......
...@@ -45,7 +45,7 @@ type Group struct { ...@@ -45,7 +45,7 @@ type Group struct {
// GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#list-project-groups // GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#list-project-groups
type ListGroupsOptions struct { type ListGroupsOptions struct {
ListOptions ListOptions
Search string `url:"search,omitempty"` Search string `url:"search,omitempty" json:"search,omitempty"`
} }
// ListGroups gets a list of groups. (As user: my groups, as admin: all groups) // ListGroups gets a list of groups. (As user: my groups, as admin: all groups)
...@@ -95,9 +95,9 @@ func (s *GroupsService) GetGroup(gid interface{}) (*Group, *Response, error) { ...@@ -95,9 +95,9 @@ func (s *GroupsService) GetGroup(gid interface{}) (*Group, *Response, error) {
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#new-group // GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#new-group
type CreateGroupOptions struct { type CreateGroupOptions struct {
Name string `url:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
Path string `url:"path,omitempty"` Path string `url:"path,omitempty" json:"path,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
} }
// CreateGroup creates a new project group. Available only for users who can // CreateGroup creates a new project group. Available only for users who can
...@@ -173,7 +173,7 @@ func (s *GroupsService) DeleteGroup(gid interface{}) (*Response, error) { ...@@ -173,7 +173,7 @@ func (s *GroupsService) DeleteGroup(gid interface{}) (*Response, error) {
// GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#search-for-group // GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#search-for-group
func (s *GroupsService) SearchGroup(query string) ([]*Group, *Response, error) { func (s *GroupsService) SearchGroup(query string) ([]*Group, *Response, error) {
var q struct { var q struct {
Search string `url:"search,omitempty"` Search string `url:"search,omitempty" json:"search,omitempty"`
} }
q.Search = query q.Search = query
...@@ -234,8 +234,8 @@ func (s *GroupsService) ListGroupMembers(gid interface{}) ([]*GroupMember, *Resp ...@@ -234,8 +234,8 @@ func (s *GroupsService) ListGroupMembers(gid interface{}) ([]*GroupMember, *Resp
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#add-group-member // GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#add-group-member
type AddGroupMemberOptions struct { type AddGroupMemberOptions struct {
UserID int `url:"user_id,omitempty"` UserID int `url:"user_id,omitempty" json:"user_id,omitempty"`
AccessLevel AccessLevel `url:"access_level,omitempty"` AccessLevel AccessLevel `url:"access_level,omitempty" json:"access_level,omitempty"`
} }
// AddGroupMember adds a user to the list of group members. // AddGroupMember adds a user to the list of group members.
...@@ -271,7 +271,7 @@ func (s *GroupsService) AddGroupMember( ...@@ -271,7 +271,7 @@ func (s *GroupsService) AddGroupMember(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/groups.html#edit-group-team-member // http://doc.gitlab.com/ce/api/groups.html#edit-group-team-member
type UpdateGroupMemberOptions struct { type UpdateGroupMemberOptions struct {
AccessLevel AccessLevel `url:"access_level,omitempty"` AccessLevel AccessLevel `url:"access_level,omitempty" json:"access_level,omitempty"`
} }
// UpdateGroupMember updates a group team member to a specified access level. // UpdateGroupMember updates a group team member to a specified access level.
......
...@@ -81,10 +81,10 @@ func (i Issue) String() string { ...@@ -81,10 +81,10 @@ func (i Issue) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues // GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues
type ListIssuesOptions struct { type ListIssuesOptions struct {
ListOptions ListOptions
State string `url:"state,omitempty"` State string `url:"state,omitempty" json:"state,omitempty"`
Labels []string `url:"labels,omitempty"` Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
OrderBy string `url:"order_by,omitempty"` OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty"` Sort string `url:"sort,omitempty" json:"sort,omitempty"`
} }
// ListIssues gets all issues created by authenticated user. This function // ListIssues gets all issues created by authenticated user. This function
...@@ -111,12 +111,12 @@ func (s *IssuesService) ListIssues(opt *ListIssuesOptions) ([]*Issue, *Response, ...@@ -111,12 +111,12 @@ func (s *IssuesService) ListIssues(opt *ListIssuesOptions) ([]*Issue, *Response,
// GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues // GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues
type ListProjectIssuesOptions struct { type ListProjectIssuesOptions struct {
ListOptions ListOptions
IID int `url:"iid,omitempty"` IID int `url:"iid,omitempty" json:"iid,omitempty"`
State string `url:"state,omitempty"` State string `url:"state,omitempty" json:"state,omitempty"`
Labels []string `url:"labels,omitempty"` Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
Milestone string `url:"milestone,omitempty"` Milestone string `url:"milestone,omitempty" json:"milestone,omitempty"`
OrderBy string `url:"order_by,omitempty"` OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty"` Sort string `url:"sort,omitempty" json:"sort,omitempty"`
} }
// ListProjectIssues gets a list of project issues. This function accepts // ListProjectIssues gets a list of project issues. This function accepts
...@@ -174,11 +174,11 @@ func (s *IssuesService) GetIssue(pid interface{}, issue int) (*Issue, *Response, ...@@ -174,11 +174,11 @@ func (s *IssuesService) GetIssue(pid interface{}, issue int) (*Issue, *Response,
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#new-issues // GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#new-issues
type CreateIssueOptions struct { type CreateIssueOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
AssigneeID int `url:"assignee_id,omitempty"` AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MilestoneID int `url:"milestone_id,omitempty"` MilestoneID int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
Labels []string `url:"labels,omitempty"` Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
} }
// CreateIssue creates a new project issue. // CreateIssue creates a new project issue.
...@@ -216,12 +216,12 @@ func (s *IssuesService) CreateIssue( ...@@ -216,12 +216,12 @@ func (s *IssuesService) CreateIssue(
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#edit-issues // GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#edit-issues
type UpdateIssueOptions struct { type UpdateIssueOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
AssigneeID int `url:"assignee_id,omitempty"` AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MilestoneID int `url:"milestone_id,omitempty"` MilestoneID int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
Labels []string `url:"labels,omitempty"` Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
StateEvent string `url:"state_event,omitempty"` StateEvent string `url:"state_event,omitempty" json:"state_event,omitempty"`
} }
// UpdateIssue updates an existing project issue. This function is also used // UpdateIssue updates an existing project issue. This function is also used
......
...@@ -69,8 +69,8 @@ func (s *LabelsService) ListLabels(pid interface{}) ([]*Label, *Response, error) ...@@ -69,8 +69,8 @@ func (s *LabelsService) ListLabels(pid interface{}) ([]*Label, *Response, error)
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#create-a-new-label // GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#create-a-new-label
type CreateLabelOptions struct { type CreateLabelOptions struct {
Name string `url:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
Color string `url:"color,omitempty"` Color string `url:"color,omitempty" json:"color,omitempty"`
} }
// CreateLabel creates a new label for given repository with given name and // CreateLabel creates a new label for given repository with given name and
...@@ -104,7 +104,7 @@ func (s *LabelsService) CreateLabel( ...@@ -104,7 +104,7 @@ func (s *LabelsService) CreateLabel(
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#delete-a-label // GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#delete-a-label
type DeleteLabelOptions struct { type DeleteLabelOptions struct {
Name string `url:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
} }
// DeleteLabel deletes a label given by its name. // DeleteLabel deletes a label given by its name.
...@@ -134,9 +134,9 @@ func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions) (* ...@@ -134,9 +134,9 @@ func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions) (*
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#delete-a-label // GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#delete-a-label
type UpdateLabelOptions struct { type UpdateLabelOptions struct {
Name string `url:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
NewName string `url:"new_name,omitempty"` NewName string `url:"new_name,omitempty" json:"new_name,omitempty"`
Color string `url:"color,omitempty"` Color string `url:"color,omitempty" json:"color,omitempty"`
} }
// UpdateLabel updates an existing label with new name or now color. At least // UpdateLabel updates an existing label with new name or now color. At least
......
...@@ -98,10 +98,10 @@ func (m MergeRequest) String() string { ...@@ -98,10 +98,10 @@ func (m MergeRequest) String() string {
// http://doc.gitlab.com/ce/api/merge_requests.html#list-merge-requests // http://doc.gitlab.com/ce/api/merge_requests.html#list-merge-requests
type ListMergeRequestsOptions struct { type ListMergeRequestsOptions struct {
ListOptions ListOptions
IID int `url:"iid,omitempty"` IID int `url:"iid,omitempty" json:"iid,omitempty"`
State string `url:"state,omitempty"` State string `url:"state,omitempty" json:"state,omitempty"`
OrderBy string `url:"order_by,omitempty"` OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty"` Sort string `url:"sort,omitempty" json:"sort,omitempty"`
} }
// ListMergeRequests gets all merge requests for this project. The state // ListMergeRequests gets all merge requests for this project. The state
...@@ -195,12 +195,12 @@ func (s *MergeRequestsService) GetMergeRequestChanges( ...@@ -195,12 +195,12 @@ func (s *MergeRequestsService) GetMergeRequestChanges(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#create-mr // http://doc.gitlab.com/ce/api/merge_requests.html#create-mr
type CreateMergeRequestOptions struct { type CreateMergeRequestOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
SourceBranch string `url:"source_branch,omitemtpy"` SourceBranch string `url:"source_branch,omitemtpy" json:"source_branch,omitemtpy"`
TargetBranch string `url:"target_branch,omitemtpy"` TargetBranch string `url:"target_branch,omitemtpy" json:"target_branch,omitemtpy"`
AssigneeID int `url:"assignee_id,omitempty"` AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
TargetProjectID int `url:"target_project_id,omitempty"` TargetProjectID int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
} }
// CreateMergeRequest creates a new merge request. // CreateMergeRequest creates a new merge request.
...@@ -236,11 +236,11 @@ func (s *MergeRequestsService) CreateMergeRequest( ...@@ -236,11 +236,11 @@ func (s *MergeRequestsService) CreateMergeRequest(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#update-mr // http://doc.gitlab.com/ce/api/merge_requests.html#update-mr
type UpdateMergeRequestOptions struct { type UpdateMergeRequestOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
TargetBranch string `url:"target_branch,omitemtpy"` TargetBranch string `url:"target_branch,omitemtpy" json:"target_branch,omitemtpy"`
AssigneeID int `url:"assignee_id,omitempty"` AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
StateEvent string `url:"state_event,omitempty"` StateEvent string `url:"state_event,omitempty" json:"state_event,omitempty"`
} }
// UpdateMergeRequest updates an existing project milestone. // UpdateMergeRequest updates an existing project milestone.
...@@ -364,7 +364,7 @@ func (s *MergeRequestsService) GetMergeRequestComments( ...@@ -364,7 +364,7 @@ func (s *MergeRequestsService) GetMergeRequestComments(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/commits.html#post-comment-to-mr // http://doc.gitlab.com/ce/api/commits.html#post-comment-to-mr
type PostMergeRequestCommentOptions struct { type PostMergeRequestCommentOptions struct {
Note string `url:"note,omitempty"` Note string `url:"note,omitempty" json:"note,omitempty"`
} }
// PostMergeRequestComment dds a comment to a merge request. // PostMergeRequestComment dds a comment to a merge request.
......
...@@ -55,7 +55,7 @@ func (m Milestone) String() string { ...@@ -55,7 +55,7 @@ func (m Milestone) String() string {
// http://doc.gitlab.com/ce/api/milestones.html#list-project-milestones // http://doc.gitlab.com/ce/api/milestones.html#list-project-milestones
type ListMilestonesOptions struct { type ListMilestonesOptions struct {
ListOptions ListOptions
IID int `url:"iid,omitempty"` IID int `url:"iid,omitempty" json:"iid,omitempty"`
} }
// ListMilestones returns a list of project milestones. // ListMilestones returns a list of project milestones.
...@@ -117,9 +117,9 @@ func (s *MilestonesService) GetMilestone( ...@@ -117,9 +117,9 @@ func (s *MilestonesService) GetMilestone(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#create-new-milestone // http://doc.gitlab.com/ce/api/milestones.html#create-new-milestone
type CreateMilestoneOptions struct { type CreateMilestoneOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
DueDate string `url:"due_date,omitempty"` DueDate string `url:"due_date,omitempty" json:"due_date,omitempty"`
} }
// CreateMilestone creates a new project milestone. // CreateMilestone creates a new project milestone.
...@@ -154,10 +154,10 @@ func (s *MilestonesService) CreateMilestone( ...@@ -154,10 +154,10 @@ func (s *MilestonesService) CreateMilestone(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#edit-milestone // http://doc.gitlab.com/ce/api/milestones.html#edit-milestone
type UpdateMilestoneOptions struct { type UpdateMilestoneOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty"` Description string `url:"description,omitempty" json:"description,omitempty"`
DueDate string `url:"due_date,omitempty"` DueDate string `url:"due_date,omitempty" json:"due_date,omitempty"`
StateEvent string `url:"state_event,omitempty"` StateEvent string `url:"state_event,omitempty" json:"state_event,omitempty"`
} }
// UpdateMilestone updates an existing project milestone. // UpdateMilestone updates an existing project milestone.
......
...@@ -42,7 +42,7 @@ func (n Namespace) String() string { ...@@ -42,7 +42,7 @@ func (n Namespace) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/namespaces.html#list-namespaces // GitLab API docs: http://doc.gitlab.com/ce/api/namespaces.html#list-namespaces
type ListNamespacesOptions struct { type ListNamespacesOptions struct {
ListOptions ListOptions
Search string `url:"search,omitempty"` Search string `url:"search,omitempty" json:"search,omitempty"`
} }
// ListNamespaces gets a list of projects accessible by the authenticated user. // ListNamespaces gets a list of projects accessible by the authenticated user.
...@@ -70,7 +70,7 @@ func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions) ([]*Names ...@@ -70,7 +70,7 @@ func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions) ([]*Names
// http://doc.gitlab.com/ce/api/namespaces.html#search-for-namespace // http://doc.gitlab.com/ce/api/namespaces.html#search-for-namespace
func (s *NamespacesService) SearchNamespace(query string) ([]*Namespace, *Response, error) { func (s *NamespacesService) SearchNamespace(query string) ([]*Namespace, *Response, error) {
var q struct { var q struct {
Search string `url:"search,omitempty"` Search string `url:"search,omitempty" json:"search,omitempty"`
} }
q.Search = query q.Search = query
......
...@@ -126,7 +126,7 @@ func (s *NotesService) GetIssueNote( ...@@ -126,7 +126,7 @@ func (s *NotesService) GetIssueNote(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#create-new-issue-note // http://doc.gitlab.com/ce/api/notes.html#create-new-issue-note
type CreateIssueNoteOptions struct { type CreateIssueNoteOptions struct {
Body string `url:"body,omitempty"` Body string `url:"body,omitempty" json:"body,omitempty"`
} }
// CreateIssueNote creates a new note to a single project issue. // CreateIssueNote creates a new note to a single project issue.
...@@ -163,7 +163,7 @@ func (s *NotesService) CreateIssueNote( ...@@ -163,7 +163,7 @@ func (s *NotesService) CreateIssueNote(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#modify-existing-issue-note // http://doc.gitlab.com/ce/api/notes.html#modify-existing-issue-note
type UpdateIssueNoteOptions struct { type UpdateIssueNoteOptions struct {
Body string `url:"body,omitempty"` Body string `url:"body,omitempty" json:"body,omitempty"`
} }
// UpdateIssueNote modifies existing note of an issue. // UpdateIssueNote modifies existing note of an issue.
...@@ -254,7 +254,7 @@ func (s *NotesService) GetSnippetNote( ...@@ -254,7 +254,7 @@ func (s *NotesService) GetSnippetNote(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#create-new-snippet-note // http://doc.gitlab.com/ce/api/notes.html#create-new-snippet-note
type CreateSnippetNoteOptions struct { type CreateSnippetNoteOptions struct {
Body string `url:"body,omitempty"` Body string `url:"body,omitempty" json:"body,omitempty"`
} }
// CreateSnippetNote creates a new note for a single snippet. Snippet notes are // CreateSnippetNote creates a new note for a single snippet. Snippet notes are
...@@ -292,7 +292,7 @@ func (s *NotesService) CreateSnippetNote( ...@@ -292,7 +292,7 @@ func (s *NotesService) CreateSnippetNote(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#modify-existing-snippet-note // http://doc.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
type UpdateSnippetNoteOptions struct { type UpdateSnippetNoteOptions struct {
Body string `url:"body,omitempty"` Body string `url:"body,omitempty" json:"body,omitempty"`
} }
// UpdateSnippetNote modifies existing note of a snippet. // UpdateSnippetNote modifies existing note of a snippet.
...@@ -384,7 +384,7 @@ func (s *NotesService) GetMergeRequestNote( ...@@ -384,7 +384,7 @@ func (s *NotesService) GetMergeRequestNote(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#create-new-merge-request-note // http://doc.gitlab.com/ce/api/notes.html#create-new-merge-request-note
type CreateMergeRequestNoteOptions struct { type CreateMergeRequestNoteOptions struct {
Body string `url:"body,omitempty"` Body string `url:"body,omitempty" json:"body,omitempty"`
} }
// CreateMergeRequestNote creates a new note for a single merge request. // CreateMergeRequestNote creates a new note for a single merge request.
...@@ -421,7 +421,7 @@ func (s *NotesService) CreateMergeRequestNote( ...@@ -421,7 +421,7 @@ func (s *NotesService) CreateMergeRequestNote(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note // http://doc.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
type UpdateMergeRequestNoteOptions struct { type UpdateMergeRequestNoteOptions struct {
Body string `url:"body,omitempty"` Body string `url:"body,omitempty" json:"body,omitempty"`
} }
// UpdateMergeRequestNote modifies existing note of a merge request. // UpdateMergeRequestNote modifies existing note of a merge request.
......
...@@ -120,10 +120,10 @@ func (s *ProjectSnippetsService) GetSnippet( ...@@ -120,10 +120,10 @@ func (s *ProjectSnippetsService) GetSnippet(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/project_snippets.html#create-new-snippet // http://doc.gitlab.com/ce/api/project_snippets.html#create-new-snippet
type CreateSnippetOptions struct { type CreateSnippetOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
FileName string `url:"file_name,omitempty"` FileName string `url:"file_name,omitempty" json:"file_name,omitempty"`
Code string `url:"code,omitempty"` Code string `url:"code,omitempty" json:"code,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"` VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
} }
// CreateSnippet creates a new project snippet. The user must have permission // CreateSnippet creates a new project snippet. The user must have permission
...@@ -159,10 +159,10 @@ func (s *ProjectSnippetsService) CreateSnippet( ...@@ -159,10 +159,10 @@ func (s *ProjectSnippetsService) CreateSnippet(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/project_snippets.html#update-snippet // http://doc.gitlab.com/ce/api/project_snippets.html#update-snippet
type UpdateSnippetOptions struct { type UpdateSnippetOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
FileName string `url:"file_name,omitempty"` FileName string `url:"file_name,omitempty" json:"file_name,omitempty"`
Code string `url:"code,omitempty"` Code string `url:"code,omitempty" json:"code,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"` VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
} }
// UpdateSnippet updates an existing project snippet. The user must have // UpdateSnippet updates an existing project snippet. The user must have
......
This diff is collapsed.
...@@ -177,7 +177,7 @@ func TestCreateProject(t *testing.T) { ...@@ -177,7 +177,7 @@ func TestCreateProject(t *testing.T) {
mux.HandleFunc("/projects", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST") testMethod(t, r, "POST")
testFormValues(t, r, values{ testJsonBody(t, r, values{
"name": "n", "name": "n",
}) })
......
...@@ -75,9 +75,9 @@ func (s *RepositoriesService) ListTags(pid interface{}) ([]*Tag, *Response, erro ...@@ -75,9 +75,9 @@ func (s *RepositoriesService) ListTags(pid interface{}) ([]*Tag, *Response, erro
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#create-a-new-tag // http://doc.gitlab.com/ce/api/repositories.html#create-a-new-tag
type CreateTagOptions struct { type CreateTagOptions struct {
TagName string `url:"tag_name,omitempty"` TagName string `url:"tag_name,omitempty" json:"tag_name,omitempty"`
Ref string `url:"ref,omitempty"` Ref string `url:"ref,omitempty" json:"ref,omitempty"`
Message string `url:"message,omitempty"` Message string `url:"message,omitempty" json:"message,omitempty"`
} }
// CreateTag creates a new tag in the repository that points to the supplied ref. // CreateTag creates a new tag in the repository that points to the supplied ref.
...@@ -127,8 +127,8 @@ func (t TreeNode) String() string { ...@@ -127,8 +127,8 @@ func (t TreeNode) String() string {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#list-repository-tree // http://doc.gitlab.com/ce/api/repositories.html#list-repository-tree
type ListTreeOptions struct { type ListTreeOptions struct {
Path string `url:"path,omitempty"` Path string `url:"path,omitempty" json:"path,omitempty"`
RefName string `url:"ref_name,omitempty"` RefName string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
} }
// ListTree gets a list of repository files and directories in a project. // ListTree gets a list of repository files and directories in a project.
...@@ -163,7 +163,7 @@ func (s *RepositoriesService) ListTree( ...@@ -163,7 +163,7 @@ func (s *RepositoriesService) ListTree(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#raw-file-content // http://doc.gitlab.com/ce/api/repositories.html#raw-file-content
type RawFileContentOptions struct { type RawFileContentOptions struct {
FilePath string `url:"filepath,omitempty"` FilePath string `url:"filepath,omitempty" json:"filepath,omitempty"`
} }
// RawFileContent gets the raw file contents for a file by commit SHA and path // RawFileContent gets the raw file contents for a file by commit SHA and path
...@@ -226,7 +226,7 @@ func (s *RepositoriesService) RawBlobContent( ...@@ -226,7 +226,7 @@ func (s *RepositoriesService) RawBlobContent(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#get-file-archive // http://doc.gitlab.com/ce/api/repositories.html#get-file-archive
type ArchiveOptions struct { type ArchiveOptions struct {
SHA string `url:"sha,omitempty"` SHA string `url:"sha,omitempty" json:"sha,omitempty"`
} }
// Archive gets an archive of the repository. // Archive gets an archive of the repository.
...@@ -277,8 +277,8 @@ func (c Compare) String() string { ...@@ -277,8 +277,8 @@ func (c Compare) String() string {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits // http://doc.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
type CompareOptions struct { type CompareOptions struct {
From string `url:"from,omitempty"` From string `url:"from,omitempty" json:"from,omitempty"`
To string `url:"to,omitempty"` To string `url:"to,omitempty" json:"to,omitempty"`
} }
// Compare compares branches, tags or commits. // Compare compares branches, tags or commits.
......
...@@ -52,8 +52,8 @@ func (r File) String() string { ...@@ -52,8 +52,8 @@ func (r File) String() string {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#get-file-from-respository // http://doc.gitlab.com/ce/api/repository_files.html#get-file-from-respository
type GetFileOptions struct { type GetFileOptions struct {
FilePath string `url:"file_path,omitempty"` FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
Ref string `url:"ref,omitempty"` Ref string `url:"ref,omitempty" json:"ref,omitempty"`
} }
// GetFile allows you to receive information about a file in repository like // GetFile allows you to receive information about a file in repository like
...@@ -101,11 +101,11 @@ func (r FileInfo) String() string { ...@@ -101,11 +101,11 @@ func (r FileInfo) String() string {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository // http://doc.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository
type CreateFileOptions struct { type CreateFileOptions struct {
FilePath string `url:"file_path,omitempty"` FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty"` BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
Encoding string `url:"encoding,omitempty"` Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
Content string `url:"content,omitempty"` Content string `url:"content,omitempty" json:"content,omitempty"`
CommitMessage string `url:"commit_message,omitempty"` CommitMessage string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
} }
// CreateFile creates a new file in a repository. // CreateFile creates a new file in a repository.
...@@ -140,11 +140,11 @@ func (s *RepositoryFilesService) CreateFile( ...@@ -140,11 +140,11 @@ func (s *RepositoryFilesService) CreateFile(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository // http://doc.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository
type UpdateFileOptions struct { type UpdateFileOptions struct {
FilePath string `url:"file_path,omitempty"` FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty"` BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
Encoding string `url:"encoding,omitempty"` Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
Content string `url:"content,omitempty"` Content string `url:"content,omitempty" json:"content,omitempty"`
CommitMessage string `url:"commit_message,omitempty"` CommitMessage string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
} }
// UpdateFile updates an existing file in a repository // UpdateFile updates an existing file in a repository
...@@ -179,9 +179,9 @@ func (s *RepositoryFilesService) UpdateFile( ...@@ -179,9 +179,9 @@ func (s *RepositoryFilesService) UpdateFile(
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository // http://doc.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository
type DeleteFileOptions struct { type DeleteFileOptions struct {
FilePath string `url:"file_path,omitempty"` FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty"` BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
CommitMessage string `url:"commit_message,omitempty"` CommitMessage string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
} }
// DeleteFile deletes an existing file in a repository // DeleteFile deletes an existing file in a repository
......
...@@ -49,8 +49,8 @@ type Service struct { ...@@ -49,8 +49,8 @@ type Service struct {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#edit-gitlab-ci-service // http://doc.gitlab.com/ce/api/services.html#edit-gitlab-ci-service
type SetGitLabCIServiceOptions struct { type SetGitLabCIServiceOptions struct {
Token string `url:"token,omitempty"` Token string `url:"token,omitempty" json:"token,omitempty"`
ProjectURL string `url:"project_url,omitempty"` ProjectURL string `url:"project_url,omitempty" json:"project_url,omitempty"`
} }
// SetGitLabCIService sets GitLab CI service for a project. // SetGitLabCIService sets GitLab CI service for a project.
...@@ -109,8 +109,8 @@ func (s *ServicesService) DeleteGitLabCIService(pid interface{}) (*Response, err ...@@ -109,8 +109,8 @@ func (s *ServicesService) DeleteGitLabCIService(pid interface{}) (*Response, err
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#edit-hipchat-service // http://doc.gitlab.com/ce/api/services.html#edit-hipchat-service
type SetHipChatServiceOptions struct { type SetHipChatServiceOptions struct {
Token string `url:"token,omitempty"` Token string `url:"token,omitempty" json:"token,omitempty" `
Room string `url:"room,omitempty"` Room string `url:"room,omitempty" json:"room,omitempty"`
} }
// SetHipChatService sets HipChat service for a project // SetHipChatService sets HipChat service for a project
...@@ -169,9 +169,9 @@ func (s *ServicesService) DeleteHipChatService(pid interface{}) (*Response, erro ...@@ -169,9 +169,9 @@ func (s *ServicesService) DeleteHipChatService(pid interface{}) (*Response, erro
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#createedit-drone-ci-service // http://doc.gitlab.com/ce/api/services.html#createedit-drone-ci-service
type SetDroneCIServiceOptions struct { type SetDroneCIServiceOptions struct {
Token string `url:"token"` Token string `url:"token" json:"token" `
DroneURL string `url:"drone_url"` DroneURL string `url:"drone_url" json:"drone_url"`
EnableSSLVerification string `url:"enable_ssl_verification,omitempty"` EnableSSLVerification string `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
} }
// SetDroneCIService sets Drone CI service for a project. // SetDroneCIService sets Drone CI service for a project.
...@@ -226,9 +226,9 @@ func (s *ServicesService) DeleteDroneCIService(pid interface{}) (*Response, erro ...@@ -226,9 +226,9 @@ func (s *ServicesService) DeleteDroneCIService(pid interface{}) (*Response, erro
// DroneCIServiceProperties represents Drone CI specific properties. // DroneCIServiceProperties represents Drone CI specific properties.
type DroneCIServiceProperties struct { type DroneCIServiceProperties struct {
Token *string `url:"token"` Token *string `url:"token" json:"token"`
DroneURL *string `url:"drone_url"` DroneURL *string `url:"drone_url" json:"drone_url"`
EnableSSLVerification *string `url:"enable_ssl_verification"` EnableSSLVerification *string `url:"enable_ssl_verification" json:"enable_ssl_verification"`
} }
// DroneCIService represents Drone CI service settings. // DroneCIService represents Drone CI service settings.
......
...@@ -13,7 +13,7 @@ func TestSetDroneCIService(t *testing.T) { ...@@ -13,7 +13,7 @@ func TestSetDroneCIService(t *testing.T) {
mux.HandleFunc("/projects/1/services/drone-ci", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/projects/1/services/drone-ci", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT") testMethod(t, r, "PUT")
testFormValues(t, r, values{ testJsonBody(t, r, values{
"token": "t", "token": "t",
"drone_url": "u", "drone_url": "u",
"enable_ssl_verification": "true", "enable_ssl_verification": "true",
......
...@@ -54,9 +54,9 @@ type Session struct { ...@@ -54,9 +54,9 @@ type Session struct {
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/session.html#session // GitLab API docs: http://doc.gitlab.com/ce/api/session.html#session
type GetSessionOptions struct { type GetSessionOptions struct {
Login string `url:"login,omitempty"` Login string `url:"login,omitempty" json:"login,omitempty"`
Email string `url:"email,omitempty"` Email string `url:"email,omitempty" json:"email,omitempty"`
Password string `url:"password,omitempty"` Password string `url:"password,omitempty" json:"password,omitempty"`
} }
// GetSession logs in to get private token. // GetSession logs in to get private token.
......
...@@ -79,22 +79,22 @@ func (s *SettingsService) GetSettings() (*Settings, *Response, error) { ...@@ -79,22 +79,22 @@ func (s *SettingsService) GetSettings() (*Settings, *Response, error) {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/settings.html#change-application.settings // http://doc.gitlab.com/ce/api/settings.html#change-application.settings
type UpdateSettingsOptions struct { type UpdateSettingsOptions struct {
DefaultProjectsLimit int `url:"default_projects_limit,omitempty"` DefaultProjectsLimit int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"`
SignupEnabled bool `url:"signup_enabled,omitempty"` SignupEnabled bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"`
SigninEnabled bool `url:"signin_enabled,omitempty"` SigninEnabled bool `url:"signin_enabled,omitempty" json:"signin_enabled,omitempty"`
GravatarEnabled bool `url:"gravatar_enabled,omitempty"` GravatarEnabled bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,omitempty"`
SignInText string `url:"sign_in_text,omitempty"` SignInText string `url:"sign_in_text,omitempty" json:"sign_in_text,omitempty"`
HomePageURL string `url:"home_page_url,omitempty"` HomePageURL string `url:"home_page_url,omitempty" json:"home_page_url,omitempty"`
DefaultBranchProtection int `url:"default_branch_protection,omitempty"` DefaultBranchProtection int `url:"default_branch_protection,omitempty" json:"default_branch_protection,omitempty"`
TwitterSharingEnabled bool `url:"twitter_sharing_enabled,omitempty"` TwitterSharingEnabled bool `url:"twitter_sharing_enabled,omitempty" json:"twitter_sharing_enabled,omitempty"`
RestrictedVisibilityLevels []VisibilityLevel `url:"restricted_visibility_levels,omitempty"` RestrictedVisibilityLevels []VisibilityLevel `url:"restricted_visibility_levels,omitempty" json:"restricted_visibility_levels,omitempty"`
MaxAttachmentSize int `url:"max_attachment_size,omitempty"` MaxAttachmentSize int `url:"max_attachment_size,omitempty" json:"max_attachment_size,omitempty"`
SessionExpireDelay int `url:"session_expire_delay,omitempty"` SessionExpireDelay int `url:"session_expire_delay,omitempty" json:"session_expire_delay,omitempty"`
DefaultProjectVisibility int `url:"default_project_visibility,omitempty"` DefaultProjectVisibility int `url:"default_project_visibility,omitempty" json:"default_project_visibility,omitempty"`
DefaultSnippetVisibility int `url:"default_snippet_visibility,omitempty"` DefaultSnippetVisibility int `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,omitempty"`
RestrictedSignupDomains []string `url:"restricted_signup_domains,omitempty"` RestrictedSignupDomains []string `url:"restricted_signup_domains,omitempty" json:"restricted_signup_domains,omitempty"`
UserOauthApplications bool `url:"user_oauth_applications,omitempty"` UserOauthApplications bool `url:"user_oauth_applications,omitempty" json:"user_oauth_applications,omitempty"`
AfterSignOutPath string `url:"after_sign_out_path,omitempty"` AfterSignOutPath string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
} }
// UpdateSettings updates the application settings. // UpdateSettings updates the application settings.
......
...@@ -66,7 +66,7 @@ func (s *SystemHooksService) ListHooks() ([]*Hook, *Response, error) { ...@@ -66,7 +66,7 @@ func (s *SystemHooksService) ListHooks() ([]*Hook, *Response, error) {
// GitLab API docs: // GitLab API docs:
// http://doc.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook // http://doc.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook
type AddHookOptions struct { type AddHookOptions struct {
URL string `url:"url,omitempty"` URL string `url:"url,omitempty" json:"url,omitempty"`
} }
// AddHook adds a new system hook hook. // AddHook adds a new system hook hook.
......
...@@ -62,8 +62,8 @@ type User struct { ...@@ -62,8 +62,8 @@ type User struct {
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#list-users // GitLab API docs: http://doc.gitlab.com/ce/api/users.html#list-users
type ListUsersOptions struct { type ListUsersOptions struct {
ListOptions ListOptions
Active bool `url:"active,omitempty"` Active bool `url:"active,omitempty" json:"active,omitempty"`
Search string `url:"search,omitempty"` Search string `url:"search,omitempty" json:"search,omitempty"`
} }
// ListUsers gets a list of users. // ListUsers gets a list of users.
...@@ -108,21 +108,21 @@ func (s *UsersService) GetUser(user int) (*User, *Response, error) { ...@@ -108,21 +108,21 @@ func (s *UsersService) GetUser(user int) (*User, *Response, error) {
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#user-creation // GitLab API docs: http://doc.gitlab.com/ce/api/users.html#user-creation
type CreateUserOptions struct { type CreateUserOptions struct {
Email string `url:"email,omitempty"` Email string `url:"email,omitempty" json:"email,omitempty"`
Password string `url:"password,omitempty"` Password string `url:"password,omitempty" json:"password,omitempty"`
Username string `url:"username,omitempty"` Username string `url:"username,omitempty" json:"username,omitempty"`
Name string `url:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
Skype string `url:"skype,omitempty"` Skype string `url:"skype,omitempty" json:"skype,omitempty"`
Linkedin string `url:"linkedin,omitempty"` Linkedin string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
Twitter string `url:"twitter,omitempty"` Twitter string `url:"twitter,omitempty" json:"twitter,omitempty"`
WebsiteURL string `url:"website_url,omitempty"` WebsiteURL string `url:"website_url,omitempty" json:"website_url,omitempty"`
ProjectsLimit int `url:"projects_limit,omitempty"` ProjectsLimit int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
ExternUID string `url:"extern_uid,omitempty"` ExternUID string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
Provider string `url:"provider,omitempty"` Provider string `url:"provider,omitempty" json:"provider,omitempty"`
Bio string `url:"bio,omitempty"` Bio string `url:"bio,omitempty" json:"bio,omitempty"`
Admin bool `url:"admin,omitempty"` Admin bool `url:"admin,omitempty" json:"admin,omitempty"`
CanCreateGroup bool `url:"can_create_group,omitempty"` CanCreateGroup bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
Confirm bool `url:"confirm,omitempty"` Confirm bool `url:"confirm,omitempty" json:"confirm,omitempty"`
} }
// CreateUser creates a new user. Note only administrators can create new users. // CreateUser creates a new user. Note only administrators can create new users.
...@@ -147,20 +147,20 @@ func (s *UsersService) CreateUser(opt *CreateUserOptions) (*User, *Response, err ...@@ -147,20 +147,20 @@ func (s *UsersService) CreateUser(opt *CreateUserOptions) (*User, *Response, err
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#user-modification // GitLab API docs: http://doc.gitlab.com/ce/api/users.html#user-modification
type ModifyUserOptions struct { type ModifyUserOptions struct {
Email string `url:"email,omitempty"` Email string `url:"email,omitempty" json:"email,omitempty"`
Password string `url:"password,omitempty"` Password string `url:"password,omitempty" json:"password,omitempty"`
Username string `url:"username,omitempty"` Username string `url:"username,omitempty" json:"username,omitempty"`
Name string `url:"name,omitempty"` Name string `url:"name,omitempty" json:"name,omitempty"`
Skype string `url:"skype,omitempty"` Skype string `url:"skype,omitempty" json:"skype,omitempty"`
Linkedin string `url:"linkedin,omitempty"` Linkedin string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
Twitter string `url:"twitter,omitempty"` Twitter string `url:"twitter,omitempty" json:"twitter,omitempty"`
WebsiteURL string `url:"website_url,omitempty"` WebsiteURL string `url:"website_url,omitempty" json:"website_url,omitempty"`
ProjectsLimit int `url:"projects_limit,omitempty"` ProjectsLimit int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
ExternUID string `url:"extern_uid,omitempty"` ExternUID string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
Provider string `url:"provider,omitempty"` Provider string `url:"provider,omitempty" json:"provider,omitempty"`
Bio string `url:"bio,omitempty"` Bio string `url:"bio,omitempty" json:"bio,omitempty"`
Admin bool `url:"admin,omitempty"` Admin bool `url:"admin,omitempty" json:"admin,omitempty"`
CanCreateGroup bool `url:"can_create_group,omitempty"` CanCreateGroup bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
} }
// ModifyUser modifies an existing user. Only administrators can change attributes // ModifyUser modifies an existing user. Only administrators can change attributes
...@@ -299,8 +299,8 @@ func (s *UsersService) GetSSHKey(kid int) (*SSHKey, *Response, error) { ...@@ -299,8 +299,8 @@ func (s *UsersService) GetSSHKey(kid int) (*SSHKey, *Response, error) {
// //
// GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#add-ssh-key // GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#add-ssh-key
type AddSSHKeyOptions struct { type AddSSHKeyOptions struct {
Title string `url:"title,omitempty"` Title string `url:"title,omitempty" json:"title,omitempty"`
Key string `url:"key,omitempty"` Key string `url:"key,omitempty" json:"key,omitempty"`
} }
// AddSSHKey creates a new key owned by the currently authenticated user. // AddSSHKey creates a new key owned by the currently authenticated user.
......
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