1
0
mirror of https://github.com/taigrr/wtf synced 2026-04-02 01:18:43 -07:00

Update dependencies

This commit is contained in:
Chris Cummer
2018-08-19 14:33:19 -07:00
parent 7936b5f261
commit 099fa58b39
308 changed files with 35205 additions and 1075 deletions

View File

@@ -23,8 +23,8 @@ to add new and/or missing endpoints. Currently the following services are suppor
- [x] Award Emojis
- [x] Branches
- [x] Broadcast Messages
- [ ] Project-level Variables
- [ ] Group-level Variables
- [x] Project-level Variables
- [x] Group-level Variables
- [x] Commits
- [ ] Custom Attributes
- [x] Deployments
@@ -42,8 +42,9 @@ to add new and/or missing endpoints. Currently the following services are suppor
- [x] Group Members
- [x] Issues
- [x] Issue Boards
- [x] Group Issue Boards
- [x] Jobs
- [ ] Keys
- [x] Keys
- [x] Labels
- [ ] License
- [x] Merge Requests

View File

@@ -459,6 +459,32 @@ func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCo
return cs, resp, err
}
// GetMergeRequestsByCommit gets merge request associated with a commit.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/merge_requests",
url.QueryEscape(project), url.QueryEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
var mrs []*MergeRequest
resp, err := s.client.Do(req, &mrs)
if err != nil {
return nil, resp, err
}
return mrs, resp, err
}
// CherryPickCommitOptions represents the available options for cherry-picking a commit.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit

View File

@@ -122,15 +122,15 @@ func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionE
return cs, resp, err
}
// ListProjectContributionEvents gets a list currently authenticated user's events
// ListProjectVisibleEvents gets a list of visible events for a particular project
//
// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#list-a-project-39-s-visible-events
func (s *EventsService) ListProjectContributionEvents(pid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
// GitLab API docs: https://docs.gitlab.com/ee/api/events.html#list-a-project-s-visible-events
func (s *EventsService) ListProjectVisibleEvents(pid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("%s/events", url.QueryEscape(project))
u := fmt.Sprintf("projects/%s/events", url.QueryEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {

View File

@@ -285,11 +285,14 @@ type Client struct {
Features *FeaturesService
GitIgnoreTemplates *GitIgnoreTemplatesService
Groups *GroupsService
GroupIssueBoards *GroupIssueBoardsService
GroupMembers *GroupMembersService
GroupMilestones *GroupMilestonesService
GroupVariables *GroupVariablesService
Issues *IssuesService
IssueLinks *IssueLinksService
Jobs *JobsService
Keys *KeysService
Boards *IssueBoardsService
Labels *LabelsService
MergeRequests *MergeRequestsService
@@ -305,6 +308,7 @@ type Client struct {
Projects *ProjectsService
ProjectMembers *ProjectMembersService
ProjectSnippets *ProjectSnippetsService
ProjectVariables *ProjectVariablesService
ProtectedBranches *ProtectedBranchesService
Repositories *RepositoriesService
RepositoryFiles *RepositoryFilesService
@@ -415,11 +419,14 @@ func newClient(httpClient *http.Client) *Client {
c.Features = &FeaturesService{client: c}
c.GitIgnoreTemplates = &GitIgnoreTemplatesService{client: c}
c.Groups = &GroupsService{client: c}
c.GroupIssueBoards = &GroupIssueBoardsService{client: c}
c.GroupMembers = &GroupMembersService{client: c}
c.GroupMilestones = &GroupMilestonesService{client: c}
c.GroupVariables = &GroupVariablesService{client: c}
c.Issues = &IssuesService{client: c, timeStats: timeStats}
c.IssueLinks = &IssueLinksService{client: c}
c.Jobs = &JobsService{client: c}
c.Keys = &KeysService{client: c}
c.Boards = &IssueBoardsService{client: c}
c.Labels = &LabelsService{client: c}
c.MergeRequests = &MergeRequestsService{client: c, timeStats: timeStats}
@@ -435,6 +442,7 @@ func newClient(httpClient *http.Client) *Client {
c.Projects = &ProjectsService{client: c}
c.ProjectMembers = &ProjectMembersService{client: c}
c.ProjectSnippets = &ProjectSnippetsService{client: c}
c.ProjectVariables = &ProjectVariablesService{client: c}
c.ProtectedBranches = &ProtectedBranchesService{client: c}
c.Repositories = &RepositoriesService{client: c}
c.RepositoryFiles = &RepositoryFilesService{client: c}

262
vendor/github.com/xanzy/go-gitlab/group_boards.go generated vendored Normal file
View File

@@ -0,0 +1,262 @@
//
// Copyright 2018, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package gitlab
import (
"fmt"
"net/url"
)
// GroupIssueBoardsService handles communication with the group issue board
// related methods of the GitLab API.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html
type GroupIssueBoardsService struct {
client *Client
}
// GroupIssueBoard represents a GitLab group issue board.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html
type GroupIssueBoard struct {
ID int `json:"id"`
Name string `json:"name"`
Group *Group `json:"group"`
Milestone *Milestone `json:"milestone"`
Lists []*BoardList `json:"lists"`
}
func (b GroupIssueBoard) String() string {
return Stringify(b)
}
// ListGroupIssueBoardsOptions represents the available
// ListGroupIssueBoards() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#group-board
type ListGroupIssueBoardsOptions ListOptions
// ListGroupIssueBoards gets a list of all issue boards in a group.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#group-board
func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *ListGroupIssueBoardsOptions, options ...OptionFunc) ([]*GroupIssueBoard, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/boards", url.QueryEscape(group))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var gs []*GroupIssueBoard
resp, err := s.client.Do(req, &gs)
if err != nil {
return nil, resp, err
}
return gs, resp, err
}
// GetGroupIssueBoard gets a single issue board of a group.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#single-board
func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, options ...OptionFunc) (*GroupIssueBoard, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/boards/%d", url.QueryEscape(group), board)
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
gib := new(GroupIssueBoard)
resp, err := s.client.Do(req, gib)
if err != nil {
return nil, resp, err
}
return gib, resp, err
}
// ListGroupIssueBoardListsOptions represents the available
// ListGroupIssueBoardLists() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists
type ListGroupIssueBoardListsOptions ListOptions
// ListGroupIssueBoardLists gets a list of the issue board's lists. Does not include
// backlog and closed lists.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists
func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, board int, opt *ListGroupIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/boards/%d/lists", url.QueryEscape(group), board)
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var gbl []*BoardList
resp, err := s.client.Do(req, &gbl)
if err != nil {
return nil, resp, err
}
return gbl, resp, err
}
// GetGroupIssueBoardList gets a single issue board list.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#single-board-list
func (s *GroupIssueBoardsService) GetGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
url.QueryEscape(group),
board,
list,
)
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
gbl := new(BoardList)
resp, err := s.client.Do(req, gbl)
if err != nil {
return nil, resp, err
}
return gbl, resp, err
}
// CreateGroupIssueBoardListOptions represents the available
// CreateGroupIssueBoardList() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#new-board-list
type CreateGroupIssueBoardListOptions struct {
LabelID *int `url:"label_id" json:"label_id"`
}
// CreateGroupIssueBoardList creates a new issue board list.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#new-board-list
func (s *GroupIssueBoardsService) CreateGroupIssueBoardList(gid interface{}, board int, opt *CreateGroupIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/boards/%d/lists", url.QueryEscape(group), board)
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
gbl := new(BoardList)
resp, err := s.client.Do(req, gbl)
if err != nil {
return nil, resp, err
}
return gbl, resp, err
}
// UpdateGroupIssueBoardListOptions represents the available
// UpdateGroupIssueBoardList() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list
type UpdateGroupIssueBoardListOptions struct {
Position *int `url:"position" json:"position"`
}
// UpdateIssueBoardList updates the position of an existing
// group issue board list.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list
func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, list int, opt *UpdateGroupIssueBoardListOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
url.QueryEscape(group),
board,
list,
)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
var gbl []*BoardList
resp, err := s.client.Do(req, gbl)
if err != nil {
return nil, resp, err
}
return gbl, resp, err
}
// DeleteGroupIssueBoardList soft deletes a group issue board list.
// Only for admins and group owners.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/group_boards.html#delete-a-board-list
func (s *GroupIssueBoardsService) DeleteGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
url.QueryEscape(group),
board,
list,
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

171
vendor/github.com/xanzy/go-gitlab/group_variables.go generated vendored Normal file
View File

@@ -0,0 +1,171 @@
//
// Copyright 2018, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package gitlab
import (
"fmt"
"net/url"
)
// GroupVariablesService handles communication with the
// group variables related methods of the GitLab API.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html
type GroupVariablesService struct {
client *Client
}
// GroupVariable represents a GitLab group Variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html
type GroupVariable struct {
Key string `json:"key"`
Value string `json:"value"`
Protected bool `json:"protected"`
}
func (v GroupVariable) String() string {
return Stringify(v)
}
// ListVariables gets a list of all variables for a group.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#list-group-variables
func (s *GroupVariablesService) ListVariables(gid interface{}, options ...OptionFunc) ([]*GroupVariable, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/variables", url.QueryEscape(group))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
var vs []*GroupVariable
resp, err := s.client.Do(req, &vs)
if err != nil {
return nil, resp, err
}
return vs, resp, err
}
// GetVariable gets a variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#show-variable-details
func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options ...OptionFunc) (*GroupVariable, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/variables/%s", url.QueryEscape(group), url.QueryEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
v := new(GroupVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// CreateVariable creates a new group variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable
func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/variables", url.QueryEscape(group))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
v := new(GroupVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// UpdateVariable updates the position of an existing
// group issue board list.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#update-variable
func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt *UpdateVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/variables/%s",
url.QueryEscape(group),
url.QueryEscape(key),
)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
v := new(GroupVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// RemoveVariable removes a group's variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#remove-variable
func (s *GroupVariablesService) RemoveVariable(gid interface{}, key string, options ...OptionFunc) (*Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s/variables/%s",
url.QueryEscape(group),
url.QueryEscape(key),
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

70
vendor/github.com/xanzy/go-gitlab/keys.go generated vendored Normal file
View File

@@ -0,0 +1,70 @@
//
// Copyright 2018, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package gitlab
import (
"fmt"
"net/url"
"time"
)
// KeysService handles communication with the
// keys related methods of the GitLab API.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/keys.html
type KeysService struct {
client *Client
}
// Key represents a GitLab user's SSH key.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/keys.html
type Key struct {
ID int `json:"id"`
Title string `json:"title"`
Key string `json:"key"`
CreatedAt *time.Time `json:"created_at"`
User User `json:"user"`
}
// GetKeyWithUser gets a single key by id along with the associated
// user information.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/keys.html#get-ssh-key-with-user-by-id-of-an-ssh-key
func (s *KeysService) GetKeyWithUser(kid interface{}, options ...OptionFunc) (*Key, *Response, error) {
key, err := parseID(kid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("keys/%s", url.QueryEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
k := new(Key)
resp, err := s.client.Do(req, k)
if err != nil {
return nil, resp, err
}
return k, resp, err
}

View File

@@ -403,12 +403,17 @@ func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequ
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
type CreateMergeRequestOptions struct {
Title *string `url:"title,omitempty" json:"title,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
TargetProjectID *int `url:"target_project_id,omitempty" json:"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,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"`
Squash *bool `url:"squash,omitempty" json:"squash,omitempty"`
AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"`
}
// CreateMergeRequest creates a new merge request.

196
vendor/github.com/xanzy/go-gitlab/project_variables.go generated vendored Normal file
View File

@@ -0,0 +1,196 @@
//
// Copyright 2018, Patrick Webster
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package gitlab
import (
"fmt"
"net/url"
)
// ProjectVariablesService handles communication with the
// project variables related methods of the GitLab API.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html
type ProjectVariablesService struct {
client *Client
}
// ProjectVariable represents a GitLab Project Variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html
type ProjectVariable struct {
Key string `json:"key"`
Value string `json:"value"`
Protected bool `json:"protected"`
EnvironmentScope string `json:"environment_scope"`
}
func (v ProjectVariable) String() string {
return Stringify(v)
}
// ListVariables gets a list of all variables in a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#list-project-variables
func (s *ProjectVariablesService) ListVariables(pid interface{}, options ...OptionFunc) ([]*ProjectVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
var vs []*ProjectVariable
resp, err := s.client.Do(req, &vs)
if err != nil {
return nil, resp, err
}
return vs, resp, err
}
// GetVariable gets a variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#show-variable-details
func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, options ...OptionFunc) (*ProjectVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables/%s", url.QueryEscape(project), url.QueryEscape(key))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
v := new(ProjectVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// CreateVariableOptions represents the available
// CreateVariable() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable
type CreateVariableOptions struct {
Key *string `url:"key,omitempty" json:"key,omitempty"`
Value *string `url:"value,omitempty" json:"value,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
}
// CreateVariable creates a new project variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable
func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables", url.QueryEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
v := new(ProjectVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// UpdateVariableOptions represents the available
// UpdateVariable() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
type UpdateVariableOptions struct {
Key *string `url:"key,omitempty" json:"key,omitempty"`
Value *string `url:"value,omitempty" json:"value,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
}
// UpdateVariable updates the position of an existing
// group issue board list.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, opt *UpdateVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables/%s",
url.QueryEscape(project),
url.QueryEscape(key),
)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
v := new(ProjectVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// RemoveVariable removes a project's variable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#remove-variable
func (s *ProjectVariablesService) RemoveVariable(pid interface{}, key string, options ...OptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/variables/%s",
url.QueryEscape(project),
url.QueryEscape(key),
)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

View File

@@ -185,8 +185,9 @@ func (c Compare) String() string {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
type CompareOptions struct {
From *string `url:"from,omitempty" json:"from,omitempty"`
To *string `url:"to,omitempty" json:"to,omitempty"`
From *string `url:"from,omitempty" json:"from,omitempty"`
To *string `url:"to,omitempty" json:"to,omitempty"`
Straight *bool `url:"straight,omitempty" json:"straight,omitempty"`
}
// Compare compares branches, tags or commits.