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(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/branches.html#create-repository-branch
type CreateBranchOptions struct {
BranchName string `url:"branch_name,omitempty"`
Ref string `url:"ref,omitempty"`
BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
Ref string `url:"ref,omitempty" json:"ref,omitempty"`
}
// CreateBranch creates branch from commit SHA or existing branch.
......
......@@ -55,7 +55,7 @@ func (c Commit) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#list-commits
type ListCommitsOptions struct {
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.
......@@ -212,10 +212,10 @@ func (s *CommitsService) GetCommitComments(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit
type PostCommitCommentOptions struct {
Note string `url:"note,omitempty"`
Path string `url:"path"`
Line int `url:"line"`
LineType string `url:"line_type"`
Note string `url:"note,omitempty" json:"note,omitempty"`
Path string `url:"path" json:"path"`
Line int `url:"line" json:"line"`
LineType string `url:"line_type" json:"line_type"`
}
// PostCommitComment adds a comment to a commit. Optionally you can post
......
......@@ -99,8 +99,8 @@ func (s *DeployKeysService) GetDeployKey(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
type AddDeployKeyOptions struct {
Title string `url:"title,omitempty"`
Key string `url:"key,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Key string `url:"key,omitempty" json:"key,omitempty"`
}
// AddDeployKey creates a new deploy key for a project. If deploy key already
......
......@@ -17,6 +17,7 @@
package gitlab
import (
"bytes"
"encoding/json"
"errors"
"fmt"
......@@ -124,10 +125,10 @@ type Client struct {
// support pagination.
type ListOptions struct {
// 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.
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
......@@ -216,6 +217,19 @@ func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request
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("PRIVATE-TOKEN", c.token)
if c.UserAgent != "" {
......
package gitlab
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
......@@ -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) {
body, _ := ioutil.ReadFile(filename)
w.Write([]byte(body))
......
......@@ -45,7 +45,7 @@ type Group struct {
// GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#list-project-groups
type ListGroupsOptions struct {
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)
......@@ -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
type CreateGroupOptions struct {
Name string `url:"name,omitempty"`
Path string `url:"path,omitempty"`
Description string `url:"description,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Path string `url:"path,omitempty" json:"path,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
}
// CreateGroup creates a new project group. Available only for users who can
......@@ -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
func (s *GroupsService) SearchGroup(query string) ([]*Group, *Response, error) {
var q struct {
Search string `url:"search,omitempty"`
Search string `url:"search,omitempty" json:"search,omitempty"`
}
q.Search = query
......@@ -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
type AddGroupMemberOptions struct {
UserID int `url:"user_id,omitempty"`
AccessLevel AccessLevel `url:"access_level,omitempty"`
UserID int `url:"user_id,omitempty" json:"user_id,omitempty"`
AccessLevel AccessLevel `url:"access_level,omitempty" json:"access_level,omitempty"`
}
// AddGroupMember adds a user to the list of group members.
......@@ -271,7 +271,7 @@ func (s *GroupsService) AddGroupMember(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/groups.html#edit-group-team-member
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.
......
......@@ -81,10 +81,10 @@ func (i Issue) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#list-issues
type ListIssuesOptions struct {
ListOptions
State string `url:"state,omitempty"`
Labels []string `url:"labels,omitempty"`
OrderBy string `url:"order_by,omitempty"`
Sort string `url:"sort,omitempty"`
State string `url:"state,omitempty" json:"state,omitempty"`
Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty" json:"sort,omitempty"`
}
// ListIssues gets all issues created by authenticated user. This function
......@@ -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
type ListProjectIssuesOptions struct {
ListOptions
IID int `url:"iid,omitempty"`
State string `url:"state,omitempty"`
Labels []string `url:"labels,omitempty"`
Milestone string `url:"milestone,omitempty"`
OrderBy string `url:"order_by,omitempty"`
Sort string `url:"sort,omitempty"`
IID int `url:"iid,omitempty" json:"iid,omitempty"`
State string `url:"state,omitempty" json:"state,omitempty"`
Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
Milestone string `url:"milestone,omitempty" json:"milestone,omitempty"`
OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty" json:"sort,omitempty"`
}
// ListProjectIssues gets a list of project issues. This function accepts
......@@ -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
type CreateIssueOptions struct {
Title string `url:"title,omitempty"`
Description string `url:"description,omitempty"`
AssigneeID int `url:"assignee_id,omitempty"`
MilestoneID int `url:"milestone_id,omitempty"`
Labels []string `url:"labels,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MilestoneID int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
}
// CreateIssue creates a new project issue.
......@@ -216,12 +216,12 @@ func (s *IssuesService) CreateIssue(
//
// GitLab API docs: http://doc.gitlab.com/ce/api/issues.html#edit-issues
type UpdateIssueOptions struct {
Title string `url:"title,omitempty"`
Description string `url:"description,omitempty"`
AssigneeID int `url:"assignee_id,omitempty"`
MilestoneID int `url:"milestone_id,omitempty"`
Labels []string `url:"labels,omitempty"`
StateEvent string `url:"state_event,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MilestoneID int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
Labels []string `url:"labels,omitempty" json:"labels,omitempty"`
StateEvent string `url:"state_event,omitempty" json:"state_event,omitempty"`
}
// UpdateIssue updates an existing project issue. This function is also used
......
......@@ -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
type CreateLabelOptions struct {
Name string `url:"name,omitempty"`
Color string `url:"color,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Color string `url:"color,omitempty" json:"color,omitempty"`
}
// CreateLabel creates a new label for given repository with given name and
......@@ -104,7 +104,7 @@ func (s *LabelsService) CreateLabel(
//
// GitLab API docs: http://doc.gitlab.com/ce/api/labels.html#delete-a-label
type DeleteLabelOptions struct {
Name string `url:"name,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
}
// DeleteLabel deletes a label given by its name.
......@@ -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
type UpdateLabelOptions struct {
Name string `url:"name,omitempty"`
NewName string `url:"new_name,omitempty"`
Color string `url:"color,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
NewName string `url:"new_name,omitempty" json:"new_name,omitempty"`
Color string `url:"color,omitempty" json:"color,omitempty"`
}
// UpdateLabel updates an existing label with new name or now color. At least
......
......@@ -98,10 +98,10 @@ func (m MergeRequest) String() string {
// http://doc.gitlab.com/ce/api/merge_requests.html#list-merge-requests
type ListMergeRequestsOptions struct {
ListOptions
IID int `url:"iid,omitempty"`
State string `url:"state,omitempty"`
OrderBy string `url:"order_by,omitempty"`
Sort string `url:"sort,omitempty"`
IID int `url:"iid,omitempty" json:"iid,omitempty"`
State string `url:"state,omitempty" json:"state,omitempty"`
OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty" json:"sort,omitempty"`
}
// ListMergeRequests gets all merge requests for this project. The state
......@@ -195,12 +195,12 @@ func (s *MergeRequestsService) GetMergeRequestChanges(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#create-mr
type CreateMergeRequestOptions struct {
Title string `url:"title,omitempty"`
Description string `url:"description,omitempty"`
SourceBranch string `url:"source_branch,omitemtpy"`
TargetBranch string `url:"target_branch,omitemtpy"`
AssigneeID int `url:"assignee_id,omitempty"`
TargetProjectID int `url:"target_project_id,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
SourceBranch string `url:"source_branch,omitemtpy" json:"source_branch,omitemtpy"`
TargetBranch string `url:"target_branch,omitemtpy" json:"target_branch,omitemtpy"`
AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
TargetProjectID int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
}
// CreateMergeRequest creates a new merge request.
......@@ -236,11 +236,11 @@ func (s *MergeRequestsService) CreateMergeRequest(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#update-mr
type UpdateMergeRequestOptions struct {
Title string `url:"title,omitempty"`
Description string `url:"description,omitempty"`
TargetBranch string `url:"target_branch,omitemtpy"`
AssigneeID int `url:"assignee_id,omitempty"`
StateEvent string `url:"state_event,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
TargetBranch string `url:"target_branch,omitemtpy" json:"target_branch,omitemtpy"`
AssigneeID int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
StateEvent string `url:"state_event,omitempty" json:"state_event,omitempty"`
}
// UpdateMergeRequest updates an existing project milestone.
......@@ -364,7 +364,7 @@ func (s *MergeRequestsService) GetMergeRequestComments(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/commits.html#post-comment-to-mr
type PostMergeRequestCommentOptions struct {
Note string `url:"note,omitempty"`
Note string `url:"note,omitempty" json:"note,omitempty"`
}
// PostMergeRequestComment dds a comment to a merge request.
......
......@@ -55,7 +55,7 @@ func (m Milestone) String() string {
// http://doc.gitlab.com/ce/api/milestones.html#list-project-milestones
type ListMilestonesOptions struct {
ListOptions
IID int `url:"iid,omitempty"`
IID int `url:"iid,omitempty" json:"iid,omitempty"`
}
// ListMilestones returns a list of project milestones.
......@@ -117,9 +117,9 @@ func (s *MilestonesService) GetMilestone(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#create-new-milestone
type CreateMilestoneOptions struct {
Title string `url:"title,omitempty"`
Description string `url:"description,omitempty"`
DueDate string `url:"due_date,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
DueDate string `url:"due_date,omitempty" json:"due_date,omitempty"`
}
// CreateMilestone creates a new project milestone.
......@@ -154,10 +154,10 @@ func (s *MilestonesService) CreateMilestone(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#edit-milestone
type UpdateMilestoneOptions struct {
Title string `url:"title,omitempty"`
Description string `url:"description,omitempty"`
DueDate string `url:"due_date,omitempty"`
StateEvent string `url:"state_event,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
DueDate string `url:"due_date,omitempty" json:"due_date,omitempty"`
StateEvent string `url:"state_event,omitempty" json:"state_event,omitempty"`
}
// UpdateMilestone updates an existing project milestone.
......
......@@ -42,7 +42,7 @@ func (n Namespace) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/namespaces.html#list-namespaces
type ListNamespacesOptions struct {
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.
......@@ -70,7 +70,7 @@ func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions) ([]*Names
// http://doc.gitlab.com/ce/api/namespaces.html#search-for-namespace
func (s *NamespacesService) SearchNamespace(query string) ([]*Namespace, *Response, error) {
var q struct {
Search string `url:"search,omitempty"`
Search string `url:"search,omitempty" json:"search,omitempty"`
}
q.Search = query
......
......@@ -126,7 +126,7 @@ func (s *NotesService) GetIssueNote(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#create-new-issue-note
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.
......@@ -163,7 +163,7 @@ func (s *NotesService) CreateIssueNote(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#modify-existing-issue-note
type UpdateIssueNoteOptions struct {
Body string `url:"body,omitempty"`
Body string `url:"body,omitempty" json:"body,omitempty"`
}
// UpdateIssueNote modifies existing note of an issue.
......@@ -254,7 +254,7 @@ func (s *NotesService) GetSnippetNote(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#create-new-snippet-note
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
......@@ -292,7 +292,7 @@ func (s *NotesService) CreateSnippetNote(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
type UpdateSnippetNoteOptions struct {
Body string `url:"body,omitempty"`
Body string `url:"body,omitempty" json:"body,omitempty"`
}
// UpdateSnippetNote modifies existing note of a snippet.
......@@ -384,7 +384,7 @@ func (s *NotesService) GetMergeRequestNote(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#create-new-merge-request-note
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.
......@@ -421,7 +421,7 @@ func (s *NotesService) CreateMergeRequestNote(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
type UpdateMergeRequestNoteOptions struct {
Body string `url:"body,omitempty"`
Body string `url:"body,omitempty" json:"body,omitempty"`
}
// UpdateMergeRequestNote modifies existing note of a merge request.
......
......@@ -120,10 +120,10 @@ func (s *ProjectSnippetsService) GetSnippet(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/project_snippets.html#create-new-snippet
type CreateSnippetOptions struct {
Title string `url:"title,omitempty"`
FileName string `url:"file_name,omitempty"`
Code string `url:"code,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
FileName string `url:"file_name,omitempty" json:"file_name,omitempty"`
Code string `url:"code,omitempty" json:"code,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
}
// CreateSnippet creates a new project snippet. The user must have permission
......@@ -159,10 +159,10 @@ func (s *ProjectSnippetsService) CreateSnippet(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/project_snippets.html#update-snippet
type UpdateSnippetOptions struct {
Title string `url:"title,omitempty"`
FileName string `url:"file_name,omitempty"`
Code string `url:"code,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
FileName string `url:"file_name,omitempty" json:"file_name,omitempty"`
Code string `url:"code,omitempty" json:"code,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
}
// UpdateSnippet updates an existing project snippet. The user must have
......
......@@ -95,11 +95,11 @@ func (s Project) String() string {
// GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-projects
type ListProjectsOptions struct {
ListOptions
Archived bool `url:"archived,omitempty"`
OrderBy string `url:"order_by,omitempty"`
Sort string `url:"sort,omitempty"`
Search string `url:"search,omitempty"`
CIEnabledFirst bool `url:"ci_enabled_first,omitempty"`
Archived bool `url:"archived,omitempty" json:"archived,omitempty"`
OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty" json:"sort,omitempty"`
Search string `url:"search,omitempty" json:"search,omitempty"`
CIEnabledFirst bool `url:"ci_enabled_first,omitempty" json:"ci_enabled_first,omitempty"`
}
// ListProjects gets a list of projects accessible by the authenticated user.
......@@ -192,8 +192,8 @@ func (s *ProjectsService) GetProject(pid interface{}) (*Project, *Response, erro
// http://doc.gitlab.com/ce/api/projects.html#search-for-projects-by-name
type SearchProjectsOptions struct {
ListOptions
OrderBy string `url:"order_by,omitempty"`
Sort string `url:"sort,omitempty"`
OrderBy string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort string `url:"sort,omitempty" json:"sort,omitempty"`
}
// SearchProjects searches for projects by name which are accessible to the
......@@ -303,17 +303,17 @@ func (s *ProjectsService) GetProjectEvents(
//
// GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#create-project
type CreateProjectOptions struct {
Name string `url:"name,omitempty"`
Path string `url:"path,omitempty"`
NamespaceID string `url:"namespace_id,omitempty"`
Description string `url:"description,omitempty"`
IssuesEnabled bool `url:"issues_enabled,omitempty"`
MergeRequestsEnabled bool `url:"merge_requests_enabled,omitempty"`
WikiEnabled bool `url:"wiki_enabled,omitempty"`
SnippetsEnabled bool `url:"snippets_enabled,omitempty"`
Public bool `url:"public,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"`
ImportURL string `url:"import_url,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Path string `url:"path,omitempty" json:"path,omitempty"`
NamespaceID string `url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
IssuesEnabled bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
MergeRequestsEnabled bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
WikiEnabled bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
SnippetsEnabled bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
Public bool `url:"public,omitempty" json:"public,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
ImportURL string `url:"import_url,omitempty" json:"import_url,omitempty"`
}
// CreateProject creates a new project owned by the authenticated user.
......@@ -341,16 +341,16 @@ func (s *ProjectsService) CreateProject(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#create-project-for-user
type CreateProjectForUserOptions struct {
Name string `url:"name,omitempty"`
Description string `url:"description,omitempty"`
DefaultBranch string `url:"default_branch,omitempty"`
IssuesEnabled bool `url:"issues_enabled,omitempty"`
MergeRequestsEnabled bool `url:"merge_requests_enabled,omitempty"`
WikiEnabled bool `url:"wiki_enabled,omitempty"`
SnippetsEnabled bool `url:"snippets_enabled,omitempty"`
Public bool `url:"public,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"`
ImportURL string `url:"import_url,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
DefaultBranch string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
IssuesEnabled bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
MergeRequestsEnabled bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
WikiEnabled bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
SnippetsEnabled bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
Public bool `url:"public,omitempty" json:"public,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
ImportURL string `url:"import_url,omitempty" json:"import_url,omitempty"`
}
// CreateProjectForUser creates a new project owned by the specified user.
......@@ -381,16 +381,16 @@ func (s *ProjectsService) CreateProjectForUser(
//
// GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#edit-project
type EditProjectOptions struct {
Name string `url:"name,omitempty"`
Path string `url:"path,omitempty"`
Description string `url:"description,omitempty"`
DefaultBranch string `url:"default_branch,omitempty"`
IssuesEnabled bool `url:"issues_enabled,omitempty"`
MergeRequestsEnabled bool `url:"merge_requests_enabled,omitempty"`
WikiEnabled bool `url:"wiki_enabled,omitempty"`
SnippetsEnabled bool `url:"snippets_enabled,omitempty"`
Public bool `url:"public,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Path string `url:"path,omitempty" json:"path,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
DefaultBranch string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
IssuesEnabled bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
MergeRequestsEnabled bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
WikiEnabled bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
SnippetsEnabled bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
Public bool `url:"public,omitempty" json:"public,omitempty"`
VisibilityLevel VisibilityLevel `url:"visibility_level,omitempty" json:"visibility_level,omitempty"`
}
// EditProject updates an existing project.
......@@ -489,7 +489,7 @@ type ProjectMember struct {
// http://doc.gitlab.com/ce/api/projects.html#list-project-team-members
type ListProjectMembersOptions struct {
ListOptions
Query string `url:"query,omitempty"`
Query string `url:"query,omitempty" json:"query,omitempty"`
}
// ListProjectMembers gets a list of a project's team members.
......@@ -551,8 +551,8 @@ func (s *ProjectsService) GetProjectMember(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#add-project-team-member
type AddProjectMemberOptions struct {
UserID int `url:"user_id,omitempty"`
AccessLevel AccessLevel `url:"access_level,omitempty"`
UserID int `url:"user_id,omitempty" json:"user_id,omitempty"`
AccessLevel AccessLevel `url:"access_level,omitempty" json:"access_level,omitempty"`
}
// AddProjectMember adds a user to a project team. This is an idempotent
......@@ -590,7 +590,7 @@ func (s *ProjectsService) AddProjectMember(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#edit-project-team-member
type EditProjectMemberOptions struct {
AccessLevel AccessLevel `url:"access_level,omitempty"`
AccessLevel AccessLevel `url:"access_level,omitempty" json:"access_level,omitempty"`
}
// EditProjectMember updates a project team member to a specified access level..
......@@ -725,11 +725,11 @@ func (s *ProjectsService) GetProjectHook(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#add-project-hook
type AddProjectHookOptions struct {
URL string `url:"url,omitempty"`
PushEvents bool `url:"push_events,omitempty"`
IssuesEvents bool `url:"issues_events,omitempty"`
MergeRequestsEvents bool `url:"merge_requests_events,omitempty"`
TagPushEvents bool `url:"tag_push_events,omitempty"`
URL string `url:"url,omitempty" json:"url,omitempty"`
PushEvents bool `url:"push_events,omitempty" json:"push_events,omitempty"`
IssuesEvents bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
MergeRequestsEvents bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
TagPushEvents bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
}
// AddProjectHook adds a hook to a specified project.
......@@ -764,11 +764,11 @@ func (s *ProjectsService) AddProjectHook(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#edit-project-hook
type EditProjectHookOptions struct {
URL string `url:"url,omitempty"`
PushEvents bool `url:"push_events,omitempty"`
IssuesEvents bool `url:"issues_events,omitempty"`
MergeRequestsEvents bool `url:"merge_requests_events,omitempty"`
TagPushEvents bool `url:"tag_push_events,omitempty"`
URL string `url:"url,omitempty" json:"url,omitempty"`
PushEvents bool `url:"push_events,omitempty" json:"push_events,omitempty"`
IssuesEvents bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
MergeRequestsEvents bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
TagPushEvents bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
}
// EditProjectHook edits a hook for a specified project.
......
......@@ -177,7 +177,7 @@ func TestCreateProject(t *testing.T) {
mux.HandleFunc("/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testFormValues(t, r, values{
testJsonBody(t, r, values{
"name": "n",
})
......
......@@ -75,9 +75,9 @@ func (s *RepositoriesService) ListTags(pid interface{}) ([]*Tag, *Response, erro
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#create-a-new-tag
type CreateTagOptions struct {
TagName string `url:"tag_name,omitempty"`
Ref string `url:"ref,omitempty"`
Message string `url:"message,omitempty"`
TagName string `url:"tag_name,omitempty" json:"tag_name,omitempty"`
Ref string `url:"ref,omitempty" json:"ref,omitempty"`
Message string `url:"message,omitempty" json:"message,omitempty"`
}
// CreateTag creates a new tag in the repository that points to the supplied ref.
......@@ -127,8 +127,8 @@ func (t TreeNode) String() string {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#list-repository-tree
type ListTreeOptions struct {
Path string `url:"path,omitempty"`
RefName string `url:"ref_name,omitempty"`
Path string `url:"path,omitempty" json:"path,omitempty"`
RefName string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
}
// ListTree gets a list of repository files and directories in a project.
......@@ -163,7 +163,7 @@ func (s *RepositoriesService) ListTree(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#raw-file-content
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
......@@ -226,7 +226,7 @@ func (s *RepositoriesService) RawBlobContent(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#get-file-archive
type ArchiveOptions struct {
SHA string `url:"sha,omitempty"`
SHA string `url:"sha,omitempty" json:"sha,omitempty"`
}
// Archive gets an archive of the repository.
......@@ -277,8 +277,8 @@ func (c Compare) String() string {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
type CompareOptions struct {
From string `url:"from,omitempty"`
To string `url:"to,omitempty"`
From string `url:"from,omitempty" json:"from,omitempty"`
To string `url:"to,omitempty" json:"to,omitempty"`
}
// Compare compares branches, tags or commits.
......
......@@ -52,8 +52,8 @@ func (r File) String() string {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#get-file-from-respository
type GetFileOptions struct {
FilePath string `url:"file_path,omitempty"`
Ref string `url:"ref,omitempty"`
FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
Ref string `url:"ref,omitempty" json:"ref,omitempty"`
}
// GetFile allows you to receive information about a file in repository like
......@@ -101,11 +101,11 @@ func (r FileInfo) String() string {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository
type CreateFileOptions struct {
FilePath string `url:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty"`
Encoding string `url:"encoding,omitempty"`
Content string `url:"content,omitempty"`
CommitMessage string `url:"commit_message,omitempty"`
FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
Content string `url:"content,omitempty" json:"content,omitempty"`
CommitMessage string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
}
// CreateFile creates a new file in a repository.
......@@ -140,11 +140,11 @@ func (s *RepositoryFilesService) CreateFile(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository
type UpdateFileOptions struct {
FilePath string `url:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty"`
Encoding string `url:"encoding,omitempty"`
Content string `url:"content,omitempty"`
CommitMessage string `url:"commit_message,omitempty"`
FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
Content string `url:"content,omitempty" json:"content,omitempty"`
CommitMessage string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
}
// UpdateFile updates an existing file in a repository
......@@ -179,9 +179,9 @@ func (s *RepositoryFilesService) UpdateFile(
// GitLab API docs:
// http://doc.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository
type DeleteFileOptions struct {
FilePath string `url:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty"`
CommitMessage string `url:"commit_message,omitempty"`
FilePath string `url:"file_path,omitempty" json:"file_path,omitempty"`
BranchName string `url:"branch_name,omitempty" json:"branch_name,omitempty"`
CommitMessage string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
}
// DeleteFile deletes an existing file in a repository
......
......@@ -49,8 +49,8 @@ type Service struct {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#edit-gitlab-ci-service
type SetGitLabCIServiceOptions struct {
Token string `url:"token,omitempty"`
ProjectURL string `url:"project_url,omitempty"`
Token string `url:"token,omitempty" json:"token,omitempty"`
ProjectURL string `url:"project_url,omitempty" json:"project_url,omitempty"`
}
// SetGitLabCIService sets GitLab CI service for a project.
......@@ -109,8 +109,8 @@ func (s *ServicesService) DeleteGitLabCIService(pid interface{}) (*Response, err
// GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#edit-hipchat-service
type SetHipChatServiceOptions struct {
Token string `url:"token,omitempty"`
Room string `url:"room,omitempty"`
Token string `url:"token,omitempty" json:"token,omitempty" `
Room string `url:"room,omitempty" json:"room,omitempty"`
}
// SetHipChatService sets HipChat service for a project
......@@ -169,9 +169,9 @@ func (s *ServicesService) DeleteHipChatService(pid interface{}) (*Response, erro
// GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#createedit-drone-ci-service
type SetDroneCIServiceOptions struct {
Token string `url:"token"`
DroneURL string `url:"drone_url"`
EnableSSLVerification string `url:"enable_ssl_verification,omitempty"`
Token string `url:"token" json:"token" `
DroneURL string `url:"drone_url" json:"drone_url"`
EnableSSLVerification string `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
}
// SetDroneCIService sets Drone CI service for a project.
......@@ -226,9 +226,9 @@ func (s *ServicesService) DeleteDroneCIService(pid interface{}) (*Response, erro
// DroneCIServiceProperties represents Drone CI specific properties.
type DroneCIServiceProperties struct {
Token *string `url:"token"`
DroneURL *string `url:"drone_url"`
EnableSSLVerification *string `url:"enable_ssl_verification"`
Token *string `url:"token" json:"token"`
DroneURL *string `url:"drone_url" json:"drone_url"`
EnableSSLVerification *string `url:"enable_ssl_verification" json:"enable_ssl_verification"`
}
// DroneCIService represents Drone CI service settings.
......
......@@ -13,7 +13,7 @@ func TestSetDroneCIService(t *testing.T) {
mux.HandleFunc("/projects/1/services/drone-ci", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testFormValues(t, r, values{
testJsonBody(t, r, values{
"token": "t",
"drone_url": "u",
"enable_ssl_verification": "true",
......
......@@ -54,9 +54,9 @@ type Session struct {
//
// GitLab API docs: http://doc.gitlab.com/ce/api/session.html#session
type GetSessionOptions struct {
Login string `url:"login,omitempty"`
Email string `url:"email,omitempty"`
Password string `url:"password,omitempty"`
Login string `url:"login,omitempty" json:"login,omitempty"`
Email string `url:"email,omitempty" json:"email,omitempty"`
Password string `url:"password,omitempty" json:"password,omitempty"`
}
// GetSession logs in to get private token.
......
......@@ -79,22 +79,22 @@ func (s *SettingsService) GetSettings() (*Settings, *Response, error) {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/settings.html#change-application.settings
type UpdateSettingsOptions struct {
DefaultProjectsLimit int `url:"default_projects_limit,omitempty"`
SignupEnabled bool `url:"signup_enabled,omitempty"`
SigninEnabled bool `url:"signin_enabled,omitempty"`
GravatarEnabled bool `url:"gravatar_enabled,omitempty"`
SignInText string `url:"sign_in_text,omitempty"`
HomePageURL string `url:"home_page_url,omitempty"`
DefaultBranchProtection int `url:"default_branch_protection,omitempty"`
TwitterSharingEnabled bool `url:"twitter_sharing_enabled,omitempty"`
RestrictedVisibilityLevels []VisibilityLevel `url:"restricted_visibility_levels,omitempty"`
MaxAttachmentSize int `url:"max_attachment_size,omitempty"`
SessionExpireDelay int `url:"session_expire_delay,omitempty"`
DefaultProjectVisibility int `url:"default_project_visibility,omitempty"`
DefaultSnippetVisibility int `url:"default_snippet_visibility,omitempty"`
RestrictedSignupDomains []string `url:"restricted_signup_domains,omitempty"`
UserOauthApplications bool `url:"user_oauth_applications,omitempty"`
AfterSignOutPath string `url:"after_sign_out_path,omitempty"`
DefaultProjectsLimit int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"`
SignupEnabled bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"`
SigninEnabled bool `url:"signin_enabled,omitempty" json:"signin_enabled,omitempty"`
GravatarEnabled bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,omitempty"`
SignInText string `url:"sign_in_text,omitempty" json:"sign_in_text,omitempty"`
HomePageURL string `url:"home_page_url,omitempty" json:"home_page_url,omitempty"`
DefaultBranchProtection int `url:"default_branch_protection,omitempty" json:"default_branch_protection,omitempty"`
TwitterSharingEnabled bool `url:"twitter_sharing_enabled,omitempty" json:"twitter_sharing_enabled,omitempty"`
RestrictedVisibilityLevels []VisibilityLevel `url:"restricted_visibility_levels,omitempty" json:"restricted_visibility_levels,omitempty"`
MaxAttachmentSize int `url:"max_attachment_size,omitempty" json:"max_attachment_size,omitempty"`
SessionExpireDelay int `url:"session_expire_delay,omitempty" json:"session_expire_delay,omitempty"`
DefaultProjectVisibility int `url:"default_project_visibility,omitempty" json:"default_project_visibility,omitempty"`
DefaultSnippetVisibility int `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,omitempty"`
RestrictedSignupDomains []string `url:"restricted_signup_domains,omitempty" json:"restricted_signup_domains,omitempty"`
UserOauthApplications bool `url:"user_oauth_applications,omitempty" json:"user_oauth_applications,omitempty"`
AfterSignOutPath string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
}
// UpdateSettings updates the application settings.
......
......@@ -66,7 +66,7 @@ func (s *SystemHooksService) ListHooks() ([]*Hook, *Response, error) {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook
type AddHookOptions struct {
URL string `url:"url,omitempty"`
URL string `url:"url,omitempty" json:"url,omitempty"`
}
// AddHook adds a new system hook hook.
......
......@@ -62,8 +62,8 @@ type User struct {
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#list-users
type ListUsersOptions struct {
ListOptions
Active bool `url:"active,omitempty"`
Search string `url:"search,omitempty"`
Active bool `url:"active,omitempty" json:"active,omitempty"`
Search string `url:"search,omitempty" json:"search,omitempty"`
}
// ListUsers gets a list of users.
......@@ -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
type CreateUserOptions struct {
Email string `url:"email,omitempty"`
Password string `url:"password,omitempty"`
Username string `url:"username,omitempty"`
Name string `url:"name,omitempty"`
Skype string `url:"skype,omitempty"`
Linkedin string `url:"linkedin,omitempty"`
Twitter string `url:"twitter,omitempty"`
WebsiteURL string `url:"website_url,omitempty"`
ProjectsLimit int `url:"projects_limit,omitempty"`
ExternUID string `url:"extern_uid,omitempty"`
Provider string `url:"provider,omitempty"`
Bio string `url:"bio,omitempty"`
Admin bool `url:"admin,omitempty"`
CanCreateGroup bool `url:"can_create_group,omitempty"`
Confirm bool `url:"confirm,omitempty"`
Email string `url:"email,omitempty" json:"email,omitempty"`
Password string `url:"password,omitempty" json:"password,omitempty"`
Username string `url:"username,omitempty" json:"username,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Skype string `url:"skype,omitempty" json:"skype,omitempty"`
Linkedin string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
Twitter string `url:"twitter,omitempty" json:"twitter,omitempty"`
WebsiteURL string `url:"website_url,omitempty" json:"website_url,omitempty"`
ProjectsLimit int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
ExternUID string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
Provider string `url:"provider,omitempty" json:"provider,omitempty"`
Bio string `url:"bio,omitempty" json:"bio,omitempty"`
Admin bool `url:"admin,omitempty" json:"admin,omitempty"`
CanCreateGroup bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
Confirm bool `url:"confirm,omitempty" json:"confirm,omitempty"`
}
// 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
//
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#user-modification
type ModifyUserOptions struct {
Email string `url:"email,omitempty"`
Password string `url:"password,omitempty"`
Username string `url:"username,omitempty"`
Name string `url:"name,omitempty"`
Skype string `url:"skype,omitempty"`
Linkedin string `url:"linkedin,omitempty"`
Twitter string `url:"twitter,omitempty"`
WebsiteURL string `url:"website_url,omitempty"`
ProjectsLimit int `url:"projects_limit,omitempty"`
ExternUID string `url:"extern_uid,omitempty"`
Provider string `url:"provider,omitempty"`
Bio string `url:"bio,omitempty"`
Admin bool `url:"admin,omitempty"`
CanCreateGroup bool `url:"can_create_group,omitempty"`
Email string `url:"email,omitempty" json:"email,omitempty"`
Password string `url:"password,omitempty" json:"password,omitempty"`
Username string `url:"username,omitempty" json:"username,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Skype string `url:"skype,omitempty" json:"skype,omitempty"`
Linkedin string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
Twitter string `url:"twitter,omitempty" json:"twitter,omitempty"`
WebsiteURL string `url:"website_url,omitempty" json:"website_url,omitempty"`
ProjectsLimit int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
ExternUID string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
Provider string `url:"provider,omitempty" json:"provider,omitempty"`
Bio string `url:"bio,omitempty" json:"bio,omitempty"`
Admin bool `url:"admin,omitempty" json:"admin,omitempty"`
CanCreateGroup bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
}
// ModifyUser modifies an existing user. Only administrators can change attributes
......@@ -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
type AddSSHKeyOptions struct {
Title string `url:"title,omitempty"`
Key string `url:"key,omitempty"`
Title string `url:"title,omitempty" json:"title,omitempty"`
Key string `url:"key,omitempty" json:"key,omitempty"`
}
// 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