1
0
Fork 0
forked from forgejo/forgejo

Update Vendor (#16325)

* Add Dependencie Update Script

* update gitea.com/lunny/levelqueue

* update github.com/PuerkitoBio/goquery

* update github.com/alecthomas/chroma

* update github.com/blevesearch/bleve/v2

* update github.com/caddyserver/certmagic

* update github.com/go-enry/go-enry/v2

* update github.com/go-redis/redis/v8

* update github.com/hashicorp/golang-lru

* update github.com/klauspost/compress

* update github.com/markbates/goth

* update github.com/mholt/archiver/v3

* update github.com/microcosm-cc/bluemonday

* update github.com/minio/minio-go/v7

* update github.com/olivere/elastic/v7

* update github.com/xanzy/go-gitlab

* update github.com/yuin/goldmark
This commit is contained in:
6543 2021-07-04 04:06:10 +02:00 committed by GitHub
parent 65ae46bc20
commit fae07cbc8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
319 changed files with 33568 additions and 21050 deletions

64
vendor/github.com/xanzy/go-gitlab/avatar.go generated vendored Normal file
View file

@ -0,0 +1,64 @@
//
// Copyright 2021, Pavel Kostohrys
//
// 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 (
"net/http"
)
// AvatarRequestsService handles communication with the avatar related methods
// of the GitLab API.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/avatar.html
type AvatarRequestsService struct {
client *Client
}
// Avatar represents a GitLab avatar.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/avatar.html
type Avatar struct {
AvatarURL string `json:"avatar_url"`
}
// GetAvatarOptions represents the available GetAvatar() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/avatar.html#get-a-single-avatar-url
type GetAvatarOptions struct {
Email *string `url:"email,omitempty" json:"email,omitempty"`
Size *int `url:"size,omitempty" json:"size,omitempty"`
}
// GetAvatar gets the avatar URL for a user with the given email address.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/avatar.html#get-a-single-avatar-url
func (s *AvatarRequestsService) GetAvatar(opt *GetAvatarOptions, options ...RequestOptionFunc) (*Avatar, *Response, error) {
req, err := s.client.NewRequest(http.MethodGet, "avatar", opt, options)
if err != nil {
return nil, nil, err
}
avatar := new(Avatar)
response, err := s.client.Do(req, avatar)
if err != nil {
return nil, response, err
}
return avatar, response, nil
}

View file

@ -61,7 +61,7 @@ func (b BoardList) String() string {
//
// GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#create-a-board-starter
type CreateIssueBoardOptions struct {
Name *string `url:"name" json:"name"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
}
// CreateIssueBoard creates a new issue board.

View file

@ -40,7 +40,8 @@ func WithCustomBackoff(backoff retryablehttp.Backoff) ClientOptionFunc {
}
}
// WithCustomLogger can be used to configure a custom retryablehttp leveled logger
// WithCustomLeveledLogger can be used to configure a custom retryablehttp
// leveled logger.
func WithCustomLeveledLogger(leveledLogger retryablehttp.LeveledLogger) ClientOptionFunc {
return func(c *Client) error {
c.client.Logger = leveledLogger
@ -58,7 +59,7 @@ func WithCustomLimiter(limiter RateLimiter) ClientOptionFunc {
}
}
// WithCustomLogger can be used to configure a custom retryablehttp logger
// WithCustomLogger can be used to configure a custom retryablehttp logger.
func WithCustomLogger(logger retryablehttp.Logger) ClientOptionFunc {
return func(c *Client) error {
c.client.Logger = logger

View file

@ -72,12 +72,18 @@ type Deployment struct {
// https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
type ListProjectDeploymentsOptions struct {
ListOptions
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
Environment *string `url:"environment,omitempty" json:"environment,omitempty"`
Status *string `url:"status,omitempty" json:"status,omitempty"`
// Only for Gitlab versions less than 14
UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
Environment *string `url:"environment,omitempty" json:"environment,omitempty"`
Status *string `url:"status,omitempty" json:"status,omitempty"`
// Only for Gitlab 14 or higher
FinishedAfter *time.Time `url:"finished_after,omitempty" json:"finished_after,omitempty"`
FinishedBefore *time.Time `url:"finished_before,omitempty" json:"finished_before,omitempty"`
}
// ListProjectDeployments gets a list of deployments in a project.

View file

@ -28,27 +28,23 @@ import (
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#build-events
type BuildEvent struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
BeforeSHA string `json:"before_sha"`
SHA string `json:"sha"`
BuildID int `json:"build_id"`
BuildName string `json:"build_name"`
BuildStage string `json:"build_stage"`
BuildStatus string `json:"build_status"`
BuildStartedAt string `json:"build_started_at"`
BuildFinishedAt string `json:"build_finished_at"`
BuildDuration float64 `json:"build_duration"`
BuildAllowFailure bool `json:"build_allow_failure"`
ProjectID int `json:"project_id"`
ProjectName string `json:"project_name"`
User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
} `json:"user"`
Commit struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
BeforeSHA string `json:"before_sha"`
SHA string `json:"sha"`
BuildID int `json:"build_id"`
BuildName string `json:"build_name"`
BuildStage string `json:"build_stage"`
BuildStatus string `json:"build_status"`
BuildStartedAt string `json:"build_started_at"`
BuildFinishedAt string `json:"build_finished_at"`
BuildDuration float64 `json:"build_duration"`
BuildAllowFailure bool `json:"build_allow_failure"`
ProjectID int `json:"project_id"`
ProjectName string `json:"project_name"`
User *EventUser `json:"user"`
Commit struct {
ID int `json:"id"`
SHA string `json:"sha"`
Message string `json:"message"`
@ -151,16 +147,11 @@ type DeploymentEvent struct {
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
} `json:"project"`
ShortSHA string `json:"short_sha"`
User struct {
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
} `json:"user"`
UserURL string `json:"user_url"`
CommitURL string `json:"commit_url"`
CommitTitle string `json:"commit_title"`
ShortSHA string `json:"short_sha"`
User *EventUser `json:"user"`
UserURL string `json:"user_url"`
CommitURL string `json:"commit_url"`
CommitTitle string `json:"commit_title"`
}
// IssueCommentEvent represents a comment on an issue event.
@ -237,8 +228,8 @@ type IssueCommentEvent struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#issues-events
type IssueEvent struct {
ObjectKind string `json:"object_kind"`
User *User `json:"user"`
ObjectKind string `json:"object_kind"`
User *EventUser `json:"user"`
Project struct {
ID int `json:"id"`
Name string `json:"name"`
@ -274,18 +265,10 @@ type IssueEvent struct {
URL string `json:"url"`
Action string `json:"action"`
} `json:"object_attributes"`
Assignee struct {
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
} `json:"assignee"`
Assignees []struct {
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
} `json:"assignees"`
Labels []Label `json:"labels"`
Changes struct {
Assignee *EventUser `json:"assignee"`
Assignees *[]EventUser `json:"assignees"`
Labels []Label `json:"labels"`
Changes struct {
Description struct {
Previous string `json:"previous"`
Current string `json:"current"`
@ -315,29 +298,25 @@ type IssueEvent struct {
// TODO: link to docs instead of src once they are published.
// https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/data_builder/build.rb
type JobEvent struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
BeforeSHA string `json:"before_sha"`
SHA string `json:"sha"`
BuildID int `json:"build_id"`
BuildName string `json:"build_name"`
BuildStage string `json:"build_stage"`
BuildStatus string `json:"build_status"`
BuildStartedAt string `json:"build_started_at"`
BuildFinishedAt string `json:"build_finished_at"`
BuildDuration float64 `json:"build_duration"`
BuildAllowFailure bool `json:"build_allow_failure"`
BuildFailureReason string `json:"build_failure_reason"`
PipelineID int `json:"pipeline_id"`
ProjectID int `json:"project_id"`
ProjectName string `json:"project_name"`
User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
} `json:"user"`
Commit struct {
ObjectKind string `json:"object_kind"`
Ref string `json:"ref"`
Tag bool `json:"tag"`
BeforeSHA string `json:"before_sha"`
SHA string `json:"sha"`
BuildID int `json:"build_id"`
BuildName string `json:"build_name"`
BuildStage string `json:"build_stage"`
BuildStatus string `json:"build_status"`
BuildStartedAt string `json:"build_started_at"`
BuildFinishedAt string `json:"build_finished_at"`
BuildDuration float64 `json:"build_duration"`
BuildAllowFailure bool `json:"build_allow_failure"`
BuildFailureReason string `json:"build_failure_reason"`
PipelineID int `json:"pipeline_id"`
ProjectID int `json:"project_id"`
ProjectName string `json:"project_name"`
User *EventUser `json:"user"`
Commit struct {
ID int `json:"id"`
SHA string `json:"sha"`
Message string `json:"message"`
@ -363,9 +342,9 @@ type JobEvent struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-merge-request
type MergeCommentEvent struct {
ObjectKind string `json:"object_kind"`
User *User `json:"user"`
ProjectID int `json:"project_id"`
ObjectKind string `json:"object_kind"`
User *EventUser `json:"user"`
ProjectID int `json:"project_id"`
Project struct {
Name string `json:"name"`
Description string `json:"description"`
@ -466,8 +445,8 @@ type MergeCommentEvent struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#merge-request-events
type MergeEvent struct {
ObjectKind string `json:"object_kind"`
User *User `json:"user"`
ObjectKind string `json:"object_kind"`
User *EventUser `json:"user"`
Project struct {
ID int `json:"id"`
Name string `json:"name"`
@ -530,27 +509,28 @@ type MergeEvent struct {
Email string `json:"email"`
} `json:"author"`
} `json:"last_commit"`
WorkInProgress bool `json:"work_in_progress"`
URL string `json:"url"`
Action string `json:"action"`
OldRev string `json:"oldrev"`
Assignee MergeAssignee `json:"assignee"`
WorkInProgress bool `json:"work_in_progress"`
URL string `json:"url"`
Action string `json:"action"`
OldRev string `json:"oldrev"`
Assignee *EventUser `json:"assignee"`
} `json:"object_attributes"`
Repository *Repository `json:"repository"`
Assignee MergeAssignee `json:"assignee"`
Labels []Label `json:"labels"`
Repository *Repository `json:"repository"`
Assignee *EventUser `json:"assignee"`
Assignees []*EventUser `json:"assignees"`
Labels []*Label `json:"labels"`
Changes struct {
Assignees struct {
Previous []MergeAssignee `json:"previous"`
Current []MergeAssignee `json:"current"`
Previous []*EventUser `json:"previous"`
Current []*EventUser `json:"current"`
} `json:"assignees"`
Description struct {
Previous string `json:"previous"`
Current string `json:"current"`
} `json:"description"`
Labels struct {
Previous []Label `json:"previous"`
Current []Label `json:"current"`
Previous []*Label `json:"previous"`
Current []*Label `json:"current"`
} `json:"labels"`
SourceBranch struct {
Previous string `json:"previous"`
@ -587,11 +567,13 @@ type MergeEvent struct {
} `json:"changes"`
}
// MergeAssignee represents a merge assignee.
type MergeAssignee struct {
// EventUser represents a user record in an event and is used as an even initiator or a merge assignee.
type EventUser struct {
ID int `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
}
// MergeParams represents the merge params.
@ -664,11 +646,7 @@ type PipelineEvent struct {
MergeRequestStatus string `json:"merge_status"`
URL string `json:"url"`
} `json:"merge_request"`
User struct {
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
} `json:"user"`
User *EventUser `json:"user"`
Project struct {
ID int `json:"id"`
Name string `json:"name"`
@ -697,21 +675,17 @@ type PipelineEvent struct {
} `json:"author"`
} `json:"commit"`
Builds []struct {
ID int `json:"id"`
Stage string `json:"stage"`
Name string `json:"name"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
StartedAt string `json:"started_at"`
FinishedAt string `json:"finished_at"`
When string `json:"when"`
Manual bool `json:"manual"`
User struct {
Name string `json:"name"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
} `json:"user"`
Runner struct {
ID int `json:"id"`
Stage string `json:"stage"`
Name string `json:"name"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
StartedAt string `json:"started_at"`
FinishedAt string `json:"finished_at"`
When string `json:"when"`
Manual bool `json:"manual"`
User *EventUser `json:"user"`
Runner struct {
ID int `json:"id"`
Description string `json:"description"`
Active bool `json:"active"`
@ -837,9 +811,9 @@ type ReleaseEvent struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-code-snippet
type SnippetCommentEvent struct {
ObjectKind string `json:"object_kind"`
User *User `json:"user"`
ProjectID int `json:"project_id"`
ObjectKind string `json:"object_kind"`
User *EventUser `json:"user"`
ProjectID int `json:"project_id"`
Project struct {
Name string `json:"name"`
Description string `json:"description"`
@ -930,8 +904,8 @@ type TagEvent struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#wiki-page-events
type WikiPageEvent struct {
ObjectKind string `json:"object_kind"`
User *User `json:"user"`
ObjectKind string `json:"object_kind"`
User *EventUser `json:"user"`
Project struct {
Name string `json:"name"`
Description string `json:"description"`

View file

@ -101,6 +101,7 @@ type Client struct {
AccessRequests *AccessRequestsService
Applications *ApplicationsService
AuditEvents *AuditEventsService
Avatar *AvatarRequestsService
AwardEmoji *AwardEmojiService
Boards *IssueBoardsService
Branches *BranchesService
@ -274,6 +275,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
c.AccessRequests = &AccessRequestsService{client: c}
c.Applications = &ApplicationsService{client: c}
c.AuditEvents = &AuditEventsService{client: c}
c.Avatar = &AvatarRequestsService{client: c}
c.AwardEmoji = &AwardEmojiService{client: c}
c.Boards = &IssueBoardsService{client: c}
c.Branches = &BranchesService{client: c}

View file

@ -19,6 +19,7 @@ package gitlab
import (
"fmt"
"net/http"
"time"
)
// GroupMembersService handles communication with the group members
@ -50,7 +51,8 @@ type GroupMember struct {
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
ExpiresAt *ISOTime `json:"expires_at"`
CreatedAt *time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at"`
AccessLevel AccessLevelValue `json:"access_level"`
GroupSAMLIdentity *GroupMemberSAMLIdentity `json:"group_saml_identity"`
}
@ -202,6 +204,25 @@ func (s *GroupsService) ListBillableGroupMembers(gid interface{}, opt *ListBilla
return bgm, resp, err
}
// RemoveBillableGroupMember removes a given group members that count as billable.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/members.html#remove-a-billable-member-from-a-group
func (s *GroupsService) RemoveBillableGroupMember(gid interface{}, user int, options ...RequestOptionFunc) (*Response, error) {
group, err := parseID(gid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("groups/%s/billable_members/%d", pathEscape(group), user)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}
// AddGroupMember adds a user to the list of group members.
//
// GitLab API docs:

View file

@ -58,7 +58,7 @@ func (m GroupMilestone) String() string {
// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
type ListGroupMilestonesOptions struct {
ListOptions
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`

View file

@ -85,44 +85,42 @@ type IssueLinks struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
type Issue struct {
ID int `json:"id"`
IID int `json:"iid"`
ExternalID string `json:"external_id"`
State string `json:"state"`
Description string `json:"description"`
Author *IssueAuthor `json:"author"`
Milestone *Milestone `json:"milestone"`
ProjectID int `json:"project_id"`
Assignees []*IssueAssignee `json:"assignees"`
Assignee *IssueAssignee `json:"assignee"`
UpdatedAt *time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"`
ClosedBy *IssueCloser `json:"closed_by"`
Title string `json:"title"`
CreatedAt *time.Time `json:"created_at"`
MovedToID int `json:"moved_to_id"`
Labels Labels `json:"labels"`
LabelDetails []*LabelDetails `json:"label_details"`
Upvotes int `json:"upvotes"`
Downvotes int `json:"downvotes"`
DueDate *ISOTime `json:"due_date"`
WebURL string `json:"web_url"`
References *IssueReferences `json:"references"`
TimeStats *TimeStats `json:"time_stats"`
Confidential bool `json:"confidential"`
Weight int `json:"weight"`
DiscussionLocked bool `json:"discussion_locked"`
Subscribed bool `json:"subscribed"`
UserNotesCount int `json:"user_notes_count"`
Links *IssueLinks `json:"_links"`
IssueLinkID int `json:"issue_link_id"`
MergeRequestCount int `json:"merge_requests_count"`
EpicIssueID int `json:"epic_issue_id"`
Epic *Epic `json:"epic"`
TaskCompletionStatus struct {
Count int `json:"count"`
CompletedCount int `json:"completed_count"`
} `json:"task_completion_status"`
ID int `json:"id"`
IID int `json:"iid"`
ExternalID string `json:"external_id"`
State string `json:"state"`
Description string `json:"description"`
Author *IssueAuthor `json:"author"`
Milestone *Milestone `json:"milestone"`
ProjectID int `json:"project_id"`
Assignees []*IssueAssignee `json:"assignees"`
Assignee *IssueAssignee `json:"assignee"`
UpdatedAt *time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at"`
ClosedBy *IssueCloser `json:"closed_by"`
Title string `json:"title"`
CreatedAt *time.Time `json:"created_at"`
MovedToID int `json:"moved_to_id"`
Labels Labels `json:"labels"`
LabelDetails []*LabelDetails `json:"label_details"`
Upvotes int `json:"upvotes"`
Downvotes int `json:"downvotes"`
DueDate *ISOTime `json:"due_date"`
WebURL string `json:"web_url"`
References *IssueReferences `json:"references"`
TimeStats *TimeStats `json:"time_stats"`
Confidential bool `json:"confidential"`
Weight int `json:"weight"`
DiscussionLocked bool `json:"discussion_locked"`
IssueType *string `json:"issue_type,omitempty"`
Subscribed bool `json:"subscribed"`
UserNotesCount int `json:"user_notes_count"`
Links *IssueLinks `json:"_links"`
IssueLinkID int `json:"issue_link_id"`
MergeRequestCount int `json:"merge_requests_count"`
EpicIssueID int `json:"epic_issue_id"`
Epic *Epic `json:"epic"`
TaskCompletionStatus *TasksCompletionStatus `json:"task_completion_status"`
}
func (i Issue) String() string {
@ -232,6 +230,7 @@ type ListIssuesOptions struct {
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"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}
// ListIssues gets all issues created by authenticated user. This function
@ -282,6 +281,7 @@ type ListGroupIssuesOptions struct {
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"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}
// ListGroupIssues gets a list of group issues. This function accepts
@ -339,6 +339,7 @@ type ListProjectIssuesOptions struct {
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"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}
// ListProjectIssues gets a list of project issues. This function accepts
@ -406,6 +407,7 @@ type CreateIssueOptions struct {
MergeRequestToResolveDiscussionsOf *int `url:"merge_request_to_resolve_discussions_of,omitempty" json:"merge_request_to_resolve_discussions_of,omitempty"`
DiscussionToResolve *string `url:"discussion_to_resolve,omitempty" json:"discussion_to_resolve,omitempty"`
Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}
// CreateIssue creates a new project issue.
@ -449,6 +451,7 @@ type UpdateIssueOptions struct {
DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"`
IssueType *string `url:"issue_type,omitempty" json:"issue_type,omitempty"`
}
// UpdateIssue updates an existing project issue. This function is also used

View file

@ -60,7 +60,7 @@ type GetIssuesStatisticsOptions struct {
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
AssigneeUsername []string `url:"assignee_username,omitempty" json:"assignee_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,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"`
@ -97,7 +97,7 @@ func (s *IssuesStatisticsService) GetIssuesStatistics(opt *GetIssuesStatisticsOp
// https://docs.gitlab.com/ee/api/issues_statistics.html#get-group-issues-statistics
type GetGroupIssuesStatisticsOptions struct {
Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,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"`
@ -144,7 +144,7 @@ func (s *IssuesStatisticsService) GetGroupIssuesStatistics(gid interface{}, opt
// GitLab API docs:
// https://docs.gitlab.com/ee/api/issues_statistics.html#get-project-issues-statistics
type GetProjectIssuesStatisticsOptions struct {
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
Milestone *Milestone `url:"milestone,omitempty" json:"milestone,omitempty"`
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`

View file

@ -96,18 +96,15 @@ type MergeRequest struct {
HeadSha string `json:"head_sha"`
StartSha string `json:"start_sha"`
} `json:"diff_refs"`
DivergedCommitsCount int `json:"diverged_commits_count"`
RebaseInProgress bool `json:"rebase_in_progress"`
ApprovalsBeforeMerge int `json:"approvals_before_merge"`
Reference string `json:"reference"`
FirstContribution bool `json:"first_contribution"`
TaskCompletionStatus struct {
Count int `json:"count"`
CompletedCount int `json:"completed_count"`
} `json:"task_completion_status"`
HasConflicts bool `json:"has_conflicts"`
BlockingDiscussionsResolved bool `json:"blocking_discussions_resolved"`
Overflow bool `json:"overflow"`
DivergedCommitsCount int `json:"diverged_commits_count"`
RebaseInProgress bool `json:"rebase_in_progress"`
ApprovalsBeforeMerge int `json:"approvals_before_merge"`
Reference string `json:"reference"`
FirstContribution bool `json:"first_contribution"`
TaskCompletionStatus *TasksCompletionStatus `json:"task_completion_status"`
HasConflicts bool `json:"has_conflicts"`
BlockingDiscussionsResolved bool `json:"blocking_discussions_resolved"`
Overflow bool `json:"overflow"`
}
func (m MergeRequest) String() string {

View file

@ -58,7 +58,7 @@ func (m Milestone) String() string {
// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
type ListMilestonesOptions struct {
ListOptions
IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
State *string `url:"state,omitempty" json:"state,omitempty"`
Search *string `url:"search,omitempty" json:"search,omitempty"`

View file

@ -34,11 +34,12 @@ type NotesService struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
type Note struct {
ID int `json:"id"`
Body string `json:"body"`
Attachment string `json:"attachment"`
Title string `json:"title"`
FileName string `json:"file_name"`
ID int `json:"id"`
Type NoteTypeValue `json:"type"`
Body string `json:"body"`
Attachment string `json:"attachment"`
Title string `json:"title"`
FileName string `json:"file_name"`
Author struct {
ID int `json:"id"`
Username string `json:"username"`

View file

@ -46,18 +46,21 @@ type ProjectMirror struct {
URL string `json:"url"`
}
// ListProjectMirrorOptions represents the available ListProjectMirror() options.
type ListProjectMirrorOptions ListOptions
// ListProjectMirror gets a list of mirrors configured on the project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/remote_mirrors.html#list-a-projects-remote-mirrors
func (s *ProjectMirrorService) ListProjectMirror(pid interface{}, options ...RequestOptionFunc) ([]*ProjectMirror, *Response, error) {
func (s *ProjectMirrorService) ListProjectMirror(pid interface{}, opt *ListProjectMirrorOptions, options ...RequestOptionFunc) ([]*ProjectMirror, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/remote_mirrors", pathEscape(project))
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}

View file

@ -126,6 +126,17 @@ type Project struct {
MergeRequestsTemplate string `json:"merge_requests_template"`
}
// BasicProject included in other service responses (such as todos).
type BasicProject struct {
ID int `json:"id"`
Description string `json:"description"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
CreatedAt *time.Time `json:"created_at"`
}
// ContainerExpirationPolicy represents the container expiration policy.
type ContainerExpirationPolicy struct {
Cadence string `json:"cadence"`
@ -270,6 +281,7 @@ type ListProjectsOptions struct {
Membership *bool `url:"membership,omitempty" json:"membership,omitempty"`
Starred *bool `url:"starred,omitempty" json:"starred,omitempty"`
Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
Topic *string `url:"topic,omitempty" json:"topic,omitempty"`
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
WithIssuesEnabled *bool `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"`
WithMergeRequestsEnabled *bool `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"`

View file

@ -54,7 +54,7 @@ func (s *ReleaseLinksService) ListReleaseLinks(pid interface{}, tagName string,
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/releases/%s/assets/links", pathEscape(project), tagName)
u := fmt.Sprintf("projects/%s/releases/%s/assets/links", pathEscape(project), pathEscape(tagName))
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
@ -80,7 +80,7 @@ func (s *ReleaseLinksService) GetReleaseLink(pid interface{}, tagName string, li
}
u := fmt.Sprintf("projects/%s/releases/%s/assets/links/%d",
pathEscape(project),
tagName,
pathEscape(tagName),
link)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
@ -115,7 +115,7 @@ func (s *ReleaseLinksService) CreateReleaseLink(pid interface{}, tagName string,
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/releases/%s/assets/links", pathEscape(project), tagName)
u := fmt.Sprintf("projects/%s/releases/%s/assets/links", pathEscape(project), pathEscape(tagName))
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
@ -153,7 +153,7 @@ func (s *ReleaseLinksService) UpdateReleaseLink(pid interface{}, tagName string,
}
u := fmt.Sprintf("projects/%s/releases/%s/assets/links/%d",
pathEscape(project),
tagName,
pathEscape(tagName),
link)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
@ -180,7 +180,7 @@ func (s *ReleaseLinksService) DeleteReleaseLink(pid interface{}, tagName string,
}
u := fmt.Sprintf("projects/%s/releases/%s/assets/links/%d",
pathEscape(project),
tagName,
pathEscape(tagName),
link,
)

View file

@ -100,7 +100,7 @@ func (s *ReleasesService) GetRelease(pid interface{}, tagName string, options ..
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), tagName)
u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), pathEscape(tagName))
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
@ -192,7 +192,7 @@ func (s *ReleasesService) UpdateRelease(pid interface{}, tagName string, opts *U
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), tagName)
u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), pathEscape(tagName))
req, err := s.client.NewRequest(http.MethodPut, u, opts, options)
if err != nil {
@ -217,7 +217,7 @@ func (s *ReleasesService) DeleteRelease(pid interface{}, tagName string, options
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), tagName)
u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), pathEscape(tagName))
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {

View file

@ -32,7 +32,10 @@ type SearchService struct {
// SearchOptions represents the available options for all search methods.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/search.html
type SearchOptions ListOptions
type SearchOptions struct {
ListOptions
Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
}
type searchOptions struct {
SearchOptions

View file

@ -36,6 +36,7 @@ type Settings struct {
ID int `json:"id"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
AdminMode bool `json:"admin_mode"`
AdminNotificationEmail string `json:"admin_notification_email"`
AfterSignOutPath string `json:"after_sign_out_path"`
AfterSignUpText string `json:"after_sign_up_text"`
@ -228,6 +229,7 @@ func (s *SettingsService) GetSettings(options ...RequestOptionFunc) (*Settings,
// GitLab API docs:
// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
type UpdateSettingsOptions struct {
AdminMode *bool `url:"admin_mode,omitempty" json:"admin_mode,omitempty"`
AdminNotificationEmail *string `url:"admin_notification_email,omitempty" json:"admin_notification_email,omitempty"`
AfterSignOutPath *string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
AfterSignUpText *string `url:"after_sign_up_text,omitempty" json:"after_sign_up_text,omitempty"`

View file

@ -24,7 +24,7 @@ import (
)
// Stringify attempts to create a reasonable string representation of types in
// the GitHub library. It does things like resolve pointers to their values
// the Gitlab library. It does things like resolve pointers to their values
// and omits struct fields with nil values.
func Stringify(message interface{}) string {
var buf bytes.Buffer

View file

@ -30,112 +30,79 @@ type TodosService struct {
client *Client
}
// TodoAction represents the available actions that can be performed on a todo.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
type TodoAction string
// The available todo actions.
const (
TodoAssigned TodoAction = "assigned"
TodoMentioned TodoAction = "mentioned"
TodoBuildFailed TodoAction = "build_failed"
TodoMarked TodoAction = "marked"
TodoApprovalRequired TodoAction = "approval_required"
TodoDirectlyAddressed TodoAction = "directly_addressed"
)
// TodoTarget represents a todo target of type Issue or MergeRequest
type TodoTarget struct {
// TODO: replace both Assignee and Author structs with v4 User struct
Assignee struct {
Name string `json:"name"`
Username string `json:"username"`
ID int `json:"id"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
} `json:"assignee"`
Author struct {
Name string `json:"name"`
Username string `json:"username"`
ID int `json:"id"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
} `json:"author"`
CreatedAt *time.Time `json:"created_at"`
Description string `json:"description"`
Downvotes int `json:"downvotes"`
ID int `json:"id"`
IID int `json:"iid"`
Labels []string `json:"labels"`
Milestone Milestone `json:"milestone"`
ProjectID int `json:"project_id"`
State string `json:"state"`
Subscribed bool `json:"subscribed"`
Title string `json:"title"`
UpdatedAt *time.Time `json:"updated_at"`
Upvotes int `json:"upvotes"`
UserNotesCount int `json:"user_notes_count"`
WebURL string `json:"web_url"`
// Only available for type Issue
Confidential bool `json:"confidential"`
DueDate string `json:"due_date"`
Weight int `json:"weight"`
// Only available for type MergeRequest
ApprovalsBeforeMerge int `json:"approvals_before_merge"`
ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
MergeCommitSHA string `json:"merge_commit_sha"`
MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
MergeStatus string `json:"merge_status"`
SHA string `json:"sha"`
ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int `json:"source_project_id"`
Squash bool `json:"squash"`
TargetBranch string `json:"target_branch"`
TargetProjectID int `json:"target_project_id"`
WorkInProgress bool `json:"work_in_progress"`
}
// Todo represents a GitLab todo.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
type Todo struct {
ID int `json:"id"`
Project struct {
ID int `json:"id"`
HTTPURLToRepo string `json:"http_url_to_repo"`
WebURL string `json:"web_url"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
} `json:"project"`
Author struct {
ID int `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
} `json:"author"`
ActionName TodoAction `json:"action_name"`
TargetType string `json:"target_type"`
Target TodoTarget `json:"target"`
TargetURL string `json:"target_url"`
Body string `json:"body"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
ID int `json:"id"`
Project *BasicProject `json:"project"`
Author *BasicUser `json:"author"`
ActionName TodoAction `json:"action_name"`
TargetType TodoTargetType `json:"target_type"`
Target *TodoTarget `json:"target"`
TargetURL string `json:"target_url"`
Body string `json:"body"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
}
func (t Todo) String() string {
return Stringify(t)
}
// TodoTarget represents a todo target of type Issue or MergeRequest
type TodoTarget struct {
Assignees []*BasicUser `json:"assignees"`
Assignee *BasicUser `json:"assignee"`
Author *BasicUser `json:"author"`
CreatedAt *time.Time `json:"created_at"`
Description string `json:"description"`
Downvotes int `json:"downvotes"`
ID int `json:"id"`
IID int `json:"iid"`
Labels []string `json:"labels"`
Milestone *Milestone `json:"milestone"`
ProjectID int `json:"project_id"`
State string `json:"state"`
Subscribed bool `json:"subscribed"`
TaskCompletionStatus *TasksCompletionStatus `json:"task_completion_status"`
Title string `json:"title"`
UpdatedAt *time.Time `json:"updated_at"`
Upvotes int `json:"upvotes"`
UserNotesCount int `json:"user_notes_count"`
WebURL string `json:"web_url"`
// Only available for type Issue
Confidential bool `json:"confidential"`
DueDate string `json:"due_date"`
HasTasks bool `json:"has_tasks"`
Links *IssueLinks `json:"_links"`
MovedToID int `json:"moved_to_id"`
TimeStats *TimeStats `json:"time_stats"`
Weight int `json:"weight"`
// Only available for type MergeRequest
ApprovalsBeforeMerge int `json:"approvals_before_merge"`
ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
MergeCommitSHA string `json:"merge_commit_sha"`
MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
MergeStatus string `json:"merge_status"`
Reference string `json:"reference"`
Reviewers []*BasicUser `json:"reviewers"`
SHA string `json:"sha"`
ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int `json:"source_project_id"`
Squash bool `json:"squash"`
TargetBranch string `json:"target_branch"`
TargetProjectID int `json:"target_project_id"`
WorkInProgress bool `json:"work_in_progress"`
// Only available for type DesignManagement::Design
FileName string `json:"filename"`
ImageURL string `json:"image_url"`
}
// ListTodosOptions represents the available ListTodos() options.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#get-a-list-of-todos

View file

@ -290,6 +290,25 @@ func MergeMethod(v MergeMethodValue) *MergeMethodValue {
return p
}
// NoteTypeValue represents the type of a Note.
type NoteTypeValue string
// List of available note types.
const (
DiffNote NoteTypeValue = "DiffNote"
DiscussionNote NoteTypeValue = "DiscussionNote"
GenericNote NoteTypeValue = "Note"
LegacyDiffNote NoteTypeValue = "LegacyDiffNote"
)
// NoteType is a helper routine that allocates a new NoteTypeValue to
// store v and returns a pointer to it.
func NoteType(v NoteTypeValue) *NoteTypeValue {
p := new(NoteTypeValue)
*p = v
return p
}
// NotificationLevelValue represents a notification level.
type NotificationLevelValue int
@ -403,6 +422,39 @@ func SubGroupCreationLevel(v SubGroupCreationLevelValue) *SubGroupCreationLevelV
return p
}
// TasksCompletionStatus represents tasks of the issue/merge request.
type TasksCompletionStatus struct {
Count int `json:"count"`
CompletedCount int `json:"completed_count"`
}
// TodoAction represents the available actions that can be performed on a todo.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
type TodoAction string
// The available todo actions.
const (
TodoAssigned TodoAction = "assigned"
TodoMentioned TodoAction = "mentioned"
TodoBuildFailed TodoAction = "build_failed"
TodoMarked TodoAction = "marked"
TodoApprovalRequired TodoAction = "approval_required"
TodoDirectlyAddressed TodoAction = "directly_addressed"
)
// TodoTargetType represents the available target that can be linked to a todo.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
type TodoTargetType string
const (
TodoTargetAlertManagement TodoTargetType = "AlertManagement::Alert"
TodoTargetDesignManagement TodoTargetType = "DesignManagement::Design"
TodoTargetIssue TodoTargetType = "Issue"
TodoTargetMergeRequest TodoTargetType = "MergeRequest"
)
// VariableTypeValue represents a variable type within GitLab.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/