vendor: upgrade github/xanzy/go-gitlab version to 0.20.0

This commit is contained in:
Amine Hilaly 2019-08-17 00:28:45 +02:00
parent 8b00e48d02
commit f6280a22c7
12 changed files with 151 additions and 254 deletions

View File

@ -1,7 +1,6 @@
language: go
go:
- 1.9.x
- 1.10.x
- 1.11.x
- 1.12.x

View File

@ -20,10 +20,6 @@ incompatible changes that were needed to fully support the V4 Gitlab API.
This API client package covers most of the existing Gitlab API calls and is updated regularly
to add new and/or missing endpoints. Currently the following services are supported:
- [ ] Discussions (threaded comments)
- [ ] Epic Issues
- [ ] Epics
- [ ] Geo Nodes
- [x] Award Emojis
- [x] Branches
- [x] Broadcast Messages
@ -32,9 +28,13 @@ to add new and/or missing endpoints. Currently the following services are suppor
- [x] Custom Attributes
- [x] Deploy Keys
- [x] Deployments
- [ ] Discussions (threaded comments)
- [x] Environments
- [ ] Epic Issues
- [ ] Epics
- [x] Events
- [x] Feature Flags
- [ ] Geo Nodes
- [x] GitLab CI Config Templates
- [x] Gitignores Templates
- [x] Group Access Requests

View File

@ -1,172 +0,0 @@
package gitlab
import (
"fmt"
)
// BuildVariablesService handles communication with the project variables related methods
// of the Gitlab API
//
// Gitlab API Docs : https://docs.gitlab.com/ce/api/build_variables.html
type BuildVariablesService struct {
client *Client
}
// BuildVariable represents a variable available for each build of the given project
//
// Gitlab API Docs : https://docs.gitlab.com/ce/api/build_variables.html
type BuildVariable struct {
Key string `json:"key"`
Value string `json:"value"`
Protected bool `json:"protected"`
}
func (v BuildVariable) String() string {
return Stringify(v)
}
// ListBuildVariablesOptions are the parameters to ListBuildVariables()
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#list-project-variables
type ListBuildVariablesOptions ListOptions
// ListBuildVariables gets the a list of project variables in a project
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#list-project-variables
func (s *BuildVariablesService) ListBuildVariables(pid interface{}, opts *ListBuildVariablesOptions, options ...OptionFunc) ([]*BuildVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opts, options)
if err != nil {
return nil, nil, err
}
var v []*BuildVariable
resp, err := s.client.Do(req, &v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// GetBuildVariable gets a single project variable of a project
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#show-variable-details
func (s *BuildVariablesService) GetBuildVariable(pid interface{}, key string, options ...OptionFunc) (*BuildVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), key)
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
v := new(BuildVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// CreateBuildVariableOptions are the parameters to CreateBuildVariable()
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#create-variable
type CreateBuildVariableOptions struct {
Key *string `url:"key" json:"key"`
Value *string `url:"value" json:"value"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
}
// CreateBuildVariable creates a variable for a given project
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#create-variable
func (s *BuildVariablesService) CreateBuildVariable(pid interface{}, opt *CreateBuildVariableOptions, options ...OptionFunc) (*BuildVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
v := new(BuildVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// UpdateBuildVariableOptions are the parameters to UpdateBuildVariable()
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#update-variable
type UpdateBuildVariableOptions struct {
Key *string `url:"key" json:"key"`
Value *string `url:"value" json:"value"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
}
// UpdateBuildVariable updates an existing project variable
// The variable key must exist
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#update-variable
func (s *BuildVariablesService) UpdateBuildVariable(pid interface{}, key string, opt *UpdateBuildVariableOptions, options ...OptionFunc) (*BuildVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), key)
req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
v := new(BuildVariable)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
}
return v, resp, err
}
// RemoveBuildVariable removes a project variable of a given project identified by its key
//
// Gitlab API Docs:
// https://docs.gitlab.com/ce/api/build_variables.html#remove-variable
func (s *BuildVariablesService) RemoveBuildVariable(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", pathEscape(project), key)
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}

View File

@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/url"
"time"
)
@ -150,7 +151,7 @@ func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetComm
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
@ -175,7 +176,7 @@ func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...Optio
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
@ -260,7 +261,7 @@ func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetComm
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/diff", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/diff", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
@ -317,7 +318,7 @@ func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *Get
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
@ -356,7 +357,7 @@ func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *Pos
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
@ -408,7 +409,7 @@ func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *Get
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/statuses", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/statuses", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
@ -444,7 +445,7 @@ func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCo
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/statuses/%s", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/statuses/%s", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
@ -469,7 +470,7 @@ func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, o
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/merge_requests", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/merge_requests", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
@ -500,7 +501,7 @@ func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *Cher
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/cherry_pick", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/cherry_pick", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
@ -531,7 +532,7 @@ func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCo
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/revert", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/revert", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
@ -568,7 +569,7 @@ func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options .
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/signature", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/commits/%s/signature", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {

View File

@ -204,7 +204,7 @@ var notificationLevelTypes = map[string]NotificationLevelValue{
// GitLab API docs: https://docs.gitlab.com/ce/api/
type VisibilityValue string
// List of available visibility levels
// List of available visibility levels.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/
const (
@ -213,6 +213,19 @@ const (
PublicVisibility VisibilityValue = "public"
)
// VariableTypeValue represents a variable type within GitLab.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/
type VariableTypeValue string
// List of available variable types.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/
const (
EnvVariableType VariableTypeValue = "env_var"
FileVariableType VariableTypeValue = "file"
)
// MergeMethodValue represents a project merge type within GitLab.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
@ -291,7 +304,6 @@ type Client struct {
Boards *IssueBoardsService
Branches *BranchesService
BroadcastMessage *BroadcastMessagesService
BuildVariables *BuildVariablesService
CIYMLTemplate *CIYMLTemplatesService
Commits *CommitsService
ContainerRegistry *ContainerRegistryService
@ -441,7 +453,6 @@ func newClient(httpClient *http.Client) *Client {
c.Boards = &IssueBoardsService{client: c}
c.Branches = &BranchesService{client: c}
c.BroadcastMessage = &BroadcastMessagesService{client: c}
c.BuildVariables = &BuildVariablesService{client: c}
c.CIYMLTemplate = &CIYMLTemplatesService{client: c}
c.Commits = &CommitsService{client: c}
c.ContainerRegistry = &ContainerRegistryService{client: c}

View File

@ -35,9 +35,10 @@ type GroupVariablesService struct {
// 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"`
Key string `json:"key"`
Value string `json:"value"`
VariableType VariableTypeValue `json:"variable_type"`
Protected bool `json:"protected"`
}
func (v GroupVariable) String() string {
@ -94,11 +95,23 @@ func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options
return v, resp, err
}
// CreateGroupVariableOptions represents the available CreateVariable()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable
type CreateGroupVariableOptions struct {
Key *string `url:"key,omitempty" json:"key,omitempty"`
Value *string `url:"value,omitempty" json:"value,omitempty"`
VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
}
// 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) {
func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateGroupVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err
@ -119,12 +132,23 @@ func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateVaria
return v, resp, err
}
// UpdateGroupVariableOptions represents the available UpdateVariable()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/group_level_variables.html#update-variable
type UpdateGroupVariableOptions struct {
Value *string `url:"value,omitempty" json:"value,omitempty"`
VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
}
// 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) {
func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt *UpdateGroupVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, nil, err

View File

@ -110,21 +110,23 @@ func (l *Labels) MarshalJSON() ([]byte, error) {
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
type ListIssuesOptions struct {
ListOptions
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,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"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,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"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
}
// ListIssues gets all issues created by authenticated user. This function
@ -199,22 +201,24 @@ func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOpt
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
type ListProjectIssuesOptions struct {
ListOptions
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,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"`
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,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"`
In *string `url:"in,omitempty" json:"in,omitempty"`
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
}
// ListProjectIssues gets a list of project issues. This function accepts

View File

@ -35,11 +35,12 @@ type ProjectVariablesService struct {
// 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"`
Masked bool `json:"masked"`
EnvironmentScope string `json:"environment_scope"`
Key string `json:"key"`
Value string `json:"value"`
VariableType VariableTypeValue `json:"variable_type"`
Protected bool `json:"protected"`
Masked bool `json:"masked"`
EnvironmentScope string `json:"environment_scope"`
}
func (v ProjectVariable) String() string {
@ -96,24 +97,25 @@ func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, optio
return v, resp, err
}
// CreateVariableOptions represents the available
// CreateVariable() options.
// CreateProjectVariableOptions 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"`
Masked *bool `url:"masked,omitempty" json:"masked,omitempty"`
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
type CreateProjectVariableOptions struct {
Key *string `url:"key,omitempty" json:"key,omitempty"`
Value *string `url:"value,omitempty" json:"value,omitempty"`
VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
Masked *bool `url:"masked,omitempty" json:"masked,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) {
func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateProjectVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
@ -134,23 +136,24 @@ func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateVar
return v, resp, err
}
// UpdateVariableOptions represents the available
// UpdateVariable() options.
// UpdateProjectVariableOptions represents the available UpdateVariable()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
type UpdateVariableOptions struct {
Value *string `url:"value,omitempty" json:"value,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
Masked *bool `url:"masked,omitempty" json:"masked,omitempty"`
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
type UpdateProjectVariableOptions struct {
Value *string `url:"value,omitempty" json:"value,omitempty"`
VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
Masked *bool `url:"masked,omitempty" json:"masked,omitempty"`
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
}
// UpdateVariable updates a project's variable
// UpdateVariable updates a project's variable.
//
// 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) {
func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, opt *UpdateProjectVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err

View File

@ -1342,3 +1342,27 @@ func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAll
return pa, resp, err
}
// StartMirroringProject start the pull mirroring process for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/projects.html#start-the-pull-mirroring-process-for-a-project-starter
func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...OptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/mirror/pull", pathEscape(project))
req, err := s.client.NewRequest("POST", u, nil, options)
if err != nil {
return nil, err
}
resp, err := s.client.Do(req, nil)
if err != nil {
return resp, err
}
return resp, err
}

View File

@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
"net/url"
)
// ProtectedBranchesService handles communication with the protected branch
@ -90,7 +91,7 @@ func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch st
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), branch)
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
@ -153,7 +154,7 @@ func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{},
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), branch)
u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {

View File

@ -20,6 +20,7 @@ import (
"bytes"
"fmt"
"io"
"net/url"
)
// RepositoriesService handles communication with the repositories related
@ -91,7 +92,7 @@ func (s *RepositoriesService) Blob(pid interface{}, sha string, options ...Optio
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/blobs/%s", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/blobs/%s", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
@ -116,7 +117,7 @@ func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, option
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/blobs/%s/raw", pathEscape(project), sha)
u := fmt.Sprintf("projects/%s/repository/blobs/%s/raw", pathEscape(project), url.PathEscape(sha))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {

View File

@ -52,6 +52,7 @@ type RunnerDetails struct {
Architecture string `json:"architecture"`
Description string `json:"description"`
ID int `json:"id"`
IPAddress string `json:"ip_address"`
IsShared bool `json:"is_shared"`
ContactedAt *time.Time `json:"contacted_at"`
Name string `json:"name"`