Documentation
¶
Overview ¶
Package gitlab implements the GitLab Provider for the go-git-platform.
It builds on top of the official gitlab-org/api/client-go SDK and adds transport-layer cross-cutting behavior (auth, retry, hooks, logging) provided by the parent project's transport package. All Provider methods are split across the per-responsibility files in this package:
- gitlab.go: constructor + identity (Platform, TestConnection, Capabilities)
- init.go: provider registration with the global registry
- repos.go: ListRepos, GetRepo, CreateRepo, DeleteRepo, UpdateRepo, ForkRepo
- crs.go: Change requests (MRs): Create/Get/List/Close/Merge/Reopen/Update/Comments/Commits
- webhooks.go: webhook CRUD + signature validation + event parsing
- branches.go: ListBranches, CreateBranch, DeleteBranch
- diffs.go: GetCRDiff, GetCRFiles, CreateNote/DeleteNote, CreateDiscussion
- commits.go: GetCommit, ListCommits, CompareCommits, CreateCommitStatus
- files.go: GetFileContent, CreateFile, UpdateFile, DeleteFile
- releases.go: ListTags, ListReleases, CreateRelease, GetArchive
- labels.go: repository label CRUD (LabelManager)
- issues.go: issue CRUD, comments (notes), and issue labels (IssueManager)
- reviews.go: code reviews via approvals mappings (ReviewManager)
- milestones.go: repository milestone CRUD (MilestoneManager)
- search.go: global repo/issue/user search (SearchManager)
- types.go: internal GitLab-API types and conversion helpers
Index ¶
- func Divergences() []provider.Divergence
- func New(cfg provider.Config) (provider.Provider, error)
- type Provider
- func (p *Provider) AddCRCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
- func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, ...) error
- func (p *Provider) AddDeployKey(ctx context.Context, owner, repo string, opts provider.AddDeployKeyOptions) (*provider.DeployKey, error)
- func (p *Provider) AddIssueCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
- func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
- func (p *Provider) AddIssueReaction(ctx context.Context, owner, repo, number, emoji string) (*provider.Reaction, error)
- func (p *Provider) Capabilities() provider.CapabilitySet
- func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
- func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
- func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)
- func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)
- func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, ...) (*provider.BranchProtection, error)
- func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, ...) error
- func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, ...) (string, error)
- func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
- func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*provider.Issue, error)
- func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*provider.IssueComment, error)
- func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*provider.Label, error)
- func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*provider.Milestone, error)
- func (p *Provider) CreateNote(ctx context.Context, owner, repo, number, body string) (string, error)
- func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)
- func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, ...) (*provider.ReviewResult, error)
- func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
- func (p *Provider) DeleteBranch(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteBranchProtection(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteDeployKey(ctx context.Context, owner, repo string, keyID int64) error
- func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)
- func (p *Provider) DeleteIssueComment(ctx context.Context, owner, repo, number string, commentID int64) error
- func (p *Provider) DeleteLabel(ctx context.Context, owner, repo, name string) error
- func (p *Provider) DeleteMilestone(ctx context.Context, owner, repo, number string) error
- func (p *Provider) DeleteNote(ctx context.Context, owner, repo, number, noteID string) error
- func (p *Provider) DeleteRelease(ctx context.Context, owner, repo, tag string) error
- func (p *Provider) DeleteRepo(ctx context.Context, owner, repo string) error
- func (p *Provider) DeleteWebhook(ctx context.Context, owner, repo string, webhookID int64) error
- func (p *Provider) DismissReview(ctx context.Context, owner, repo, number string, reviewID int64, ...) error
- func (p *Provider) Divergences() []provider.Divergence
- func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) GetArchive(ctx context.Context, owner, repo, ref, format string) ([]byte, error)
- func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*provider.BranchProtection, error)
- func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
- func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*provider.MergeDiff, error)
- func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*provider.ChangedFile, error)
- func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)
- func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
- func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
- func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*provider.Milestone, error)
- func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*provider.ReleaseInfo, error)
- func (p *Provider) GetRepo(ctx context.Context, owner, repo string) (*provider.PlatformRepo, error)
- func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)
- func (p *Provider) GetUser(ctx context.Context, username string) (*provider.CRUser, error)
- func (p *Provider) GetWebhook(ctx context.Context, owner, repo string, webhookID int64) (*provider.PlatformWebhook, error)
- func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*provider.BranchProtection, error)
- func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
- func (p *Provider) ListCRCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
- func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*provider.CRComment, error)
- func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*provider.CRCommit, error)
- func (p *Provider) ListCRReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
- func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, *int, error)
- func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)
- func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]provider.CommitStatus, error)
- func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
- func (p *Provider) ListContributors(ctx context.Context, owner, repo string) ([]*provider.Contributor, error)
- func (p *Provider) ListDeployKeys(ctx context.Context, owner, repo string) ([]*provider.DeployKey, error)
- func (p *Provider) ListFailedJobLogs(ctx context.Context, owner, repo, sha string) ([]provider.JobLog, error)
- func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)
- func (p *Provider) ListIssueCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
- func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
- func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)
- func (p *Provider) ListIssueReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
- func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)
- func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)
- func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)
- func (p *Provider) ListNotes(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
- func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
- func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
- func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, ...) ([]*provider.Notification, error)
- func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
- func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]provider.Review, error)
- func (p *Provider) ListStargazers(_ context.Context, _, _ string) ([]*provider.CRUser, error)
- func (p *Provider) ListTags(ctx context.Context, owner, repo string) ([]*provider.TagInfo, error)
- func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
- func (p *Provider) MarkNotificationRead(ctx context.Context, threadID string) error
- func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error
- func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, ...) error
- func (p *Provider) MergeCR(ctx context.Context, owner, repo, number string, opts provider.MergeCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)
- func (p *Provider) Platform() provider.Platform
- func (p *Provider) RemoveCRCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
- func (p *Provider) RemoveCollaborator(ctx context.Context, owner, repo, username string) error
- func (p *Provider) RemoveIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
- func (p *Provider) RemoveIssueLabel(ctx context.Context, owner, repo, number, name string) error
- func (p *Provider) RemoveIssueReaction(ctx context.Context, owner, repo, number string, reactionID int64) error
- func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
- func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
- func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error
- func (p *Provider) ResolveUsernames(ctx context.Context, usernames []string) ([]*provider.CRUser, error)
- func (p *Provider) SearchIssues(ctx context.Context, opts provider.SearchIssuesOptions) ([]*provider.SearchIssueResult, *int, error)
- func (p *Provider) SearchRepos(ctx context.Context, opts provider.SearchReposOptions) ([]*provider.SearchRepoResult, *int, error)
- func (p *Provider) SearchUsers(ctx context.Context, opts provider.SearchUsersOptions) ([]*provider.SearchUserResult, *int, error)
- func (p *Provider) TestConnection(ctx context.Context) (*provider.TestConnectionResult, error)
- func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, ...) (*provider.BranchProtection, error)
- func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo, number string, labels []string) error
- func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
- func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, ...) (*provider.Issue, error)
- func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*provider.IssueComment, error)
- func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, ...) (*provider.Label, error)
- func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, ...) (*provider.Milestone, error)
- func (p *Provider) UpdateNote(ctx context.Context, owner, repo, number, noteID, body string) (*provider.IssueComment, error)
- func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, ...) (*provider.ReleaseInfo, error)
- func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) UpdateWebhook(ctx context.Context, owner, repo string, webhookID int64, ...) (*provider.PlatformWebhook, error)
- func (p *Provider) ValidateWebhookSignature(r *http.Request, secret string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Divergences ¶
func Divergences() []provider.Divergence
Divergences returns the registered divergence ledger for the GitLab backend.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the GitLab implementation of provider.Provider.
func (*Provider) AddCRCommentReaction ¶
func (p *Provider) AddCRCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
AddCRCommentReaction implements provider.ReactionManager.
func (*Provider) AddCollaborator ¶ added in v0.99.8
func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, opts provider.AddCollaboratorOptions) error
AddCollaborator implements provider.CollaboratorManager. GitLab members are ID-addressed and the add-member endpoint requires an explicit access level (no platform default), so an empty permission maps to developer (registered mapping).
func (*Provider) AddDeployKey ¶
func (p *Provider) AddDeployKey(ctx context.Context, owner, repo string, opts provider.AddDeployKeyOptions) (*provider.DeployKey, error)
AddDeployKey implements provider.DeploymentKeyManager.
func (*Provider) AddIssueCommentReaction ¶
func (p *Provider) AddIssueCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)
AddIssueCommentReaction implements provider.ReactionManager.
func (*Provider) AddIssueLabels ¶
func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
AddIssueLabels implements provider.IssueManager via add_labels.
func (*Provider) AddIssueReaction ¶
func (p *Provider) AddIssueReaction(ctx context.Context, owner, repo, number, emoji string) (*provider.Reaction, error)
AddIssueReaction implements provider.ReactionManager.
func (*Provider) Capabilities ¶
func (p *Provider) Capabilities() provider.CapabilitySet
Capabilities implements provider.Provider. GitLab implements the optional LabelManager (see labels.go), IssueManager (see issues.go), ReviewManager (see reviews.go), and SearchManager (see search.go) interfaces.
func (*Provider) CloseCR ¶
func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
CloseCR implements provider.ChangeRequestManager.
func (*Provider) CloseIssue ¶
func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
CloseIssue implements provider.IssueManager via the state_event API.
func (*Provider) CompareCommits ¶
func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)
CompareCommits implements provider.CommitManager.
func (*Provider) CreateBranch ¶
func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)
CreateBranch implements provider.BranchManager.
func (*Provider) CreateBranchProtection ¶
func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, opts provider.CreateBranchProtectionOptions) (*provider.BranchProtection, error)
CreateBranchProtection implements provider.BranchProtectionManager.
func (*Provider) CreateCR ¶
func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
CreateCR implements provider.ChangeRequestManager.
func (*Provider) CreateCommitStatus ¶
func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, opts provider.CommitStatusOptions) error
CreateCommitStatus implements provider.CommitStatusManager.
func (*Provider) CreateDiscussion ¶
func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, opts provider.DiscussionOptions) (string, error)
CreateDiscussion implements provider.DiffManager.
func (*Provider) CreateFile ¶
func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
CreateFile implements provider.FileManager.
func (*Provider) CreateIssue ¶
func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*provider.Issue, error)
CreateIssue implements provider.IssueManager. Assignees are resolved to user IDs via the Users API (cached).
func (*Provider) CreateIssueComment ¶
func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*provider.IssueComment, error)
CreateIssueComment implements provider.IssueManager.
func (*Provider) CreateLabel ¶
func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*provider.Label, error)
CreateLabel implements provider.LabelManager. GitLab requires colors with a leading '#'.
func (*Provider) CreateMilestone ¶
func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*provider.Milestone, error)
CreateMilestone implements provider.MilestoneManager.
func (*Provider) CreateNote ¶
func (p *Provider) CreateNote(ctx context.Context, owner, repo, number, body string) (string, error)
CreateNote implements provider.DiffManager.
func (*Provider) CreateRelease ¶
func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)
CreateRelease implements provider.ReleaseManager.
func (*Provider) CreateRepo ¶
func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)
CreateRepo implements provider.RepoManager.
func (*Provider) CreateReview ¶
func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, opts provider.CreateReviewOptions) (*provider.ReviewResult, error)
CreateReview implements provider.ReviewManager.
Registered mapping (divergence ledger): GitLab has no native review object, so a review is expressed as a comment-style review — a merge-request note via Notes.CreateMergeRequestNote(pid, iid, {Body}), the same shape the pre-ReviewManager DiffManager.CreateReview used for its summary. Inline comments (opts.Comments) and verdicts (opts.Event, opts.CommitID) are not mapped: a note is neither an approval nor a commit report, so the created review is always in the commented state.
v0.65.0 行内评论:opts.Comments 非空时改走 discussions 路径——此前实现丢弃 Comments 只发纯文本 note,调用方(argus poster)的行内评论链路在 GitLab 后端从未生效。position 用 MR diff_refs 三 SHA + new_path/new_line(模型给 的是新文件行号);单条 discussion 失败(行号不在 diff hunk 内等 422)按条 跳过不整单失败;总结 note 照发保留评审事件语义。
func (*Provider) CreateWebhook ¶
func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
CreateWebhook implements provider.WebhookManager.
func (*Provider) DeleteBranch ¶
DeleteBranch implements provider.BranchManager.
func (*Provider) DeleteBranchProtection ¶
DeleteBranchProtection implements provider.BranchProtectionManager.
func (*Provider) DeleteDeployKey ¶
DeleteDeployKey implements provider.DeploymentKeyManager.
func (*Provider) DeleteFile ¶
func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)
DeleteFile implements provider.FileManager.
func (*Provider) DeleteIssueComment ¶ added in v0.114.0
func (p *Provider) DeleteIssueComment(ctx context.Context, owner, repo, number string, commentID int64) error
DeleteIssueComment implements provider.IssueManager. GitLab deletes issue notes through the issue like its edit endpoint, so number must carry the issue's IID. Deletion is permanent; the platform only lets the note's author perform it.
func (*Provider) DeleteLabel ¶
DeleteLabel implements provider.LabelManager.
func (*Provider) DeleteMilestone ¶
DeleteMilestone implements provider.MilestoneManager.
func (*Provider) DeleteNote ¶
DeleteNote implements provider.DiffManager.
func (*Provider) DeleteRelease ¶
DeleteRelease implements provider.ReleaseManager via GitLab's tag-addressed delete. The release's tag is kept; only the release object is removed.
func (*Provider) DeleteRepo ¶
DeleteRepo implements provider.RepoManager.
func (*Provider) DeleteWebhook ¶
DeleteWebhook implements provider.WebhookManager.
func (*Provider) DismissReview ¶
func (p *Provider) DismissReview(ctx context.Context, owner, repo, number string, reviewID int64, message string) error
DismissReview implements provider.ReviewManager.
Registered mapping (divergence ledger): UnapproveMergeRequest(pid, mrIID). GitLab approvals hang off the merge request as a whole (per user), not off individual review objects, so reviewID is not addressable and the dismissal message has no GitLab equivalent (ignored).
func (*Provider) Divergences ¶
func (p *Provider) Divergences() []provider.Divergence
Divergences implements provider.Provider.
func (*Provider) ForkRepo ¶
func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)
ForkRepo implements provider.RepoManager.
func (*Provider) GetArchive ¶
GetArchive implements provider.ReleaseManager.
func (*Provider) GetBranchProtection ¶
func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*provider.BranchProtection, error)
GetBranchProtection implements provider.BranchProtectionManager.
func (*Provider) GetCR ¶
func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
GetCR implements provider.ChangeRequestManager.
func (*Provider) GetCRDiff ¶
func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*provider.MergeDiff, error)
GetCRDiff implements provider.DiffManager.
func (*Provider) GetCRFiles ¶
func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*provider.ChangedFile, error)
GetCRFiles implements provider.DiffManager.
func (*Provider) GetCommit ¶
func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)
GetCommit implements provider.CommitManager.
func (*Provider) GetFileContent ¶
func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
GetFileContent implements provider.FileManager.
func (*Provider) GetIssue ¶
func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
GetIssue implements provider.IssueManager.
func (*Provider) GetMilestone ¶
func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*provider.Milestone, error)
GetMilestone implements provider.MilestoneManager.
func (*Provider) GetReleaseByTag ¶
func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*provider.ReleaseInfo, error)
GetReleaseByTag implements provider.ReleaseManager. GitLab's release endpoints are tag-addressed natively.
func (*Provider) GetReview ¶
func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)
GetReview implements provider.ReviewManager.
Registered mapping (divergence ledger): the same GetApprovalState call as ListReviews. GitLab approvals expose no per-review IDs, so reviewID cannot be matched; this returns the first synthesized approver review as an approximation. When nobody has approved yet the call reports NotFound.
func (*Provider) GetWebhook ¶ added in v0.99.9
func (p *Provider) GetWebhook(ctx context.Context, owner, repo string, webhookID int64) (*provider.PlatformWebhook, error)
GetWebhook implements provider.WebhookConfigManager.
func (*Provider) ListBranchProtections ¶
func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*provider.BranchProtection, error)
ListBranchProtections implements provider.BranchProtectionManager.
func (*Provider) ListBranches ¶
func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
ListBranches implements provider.BranchManager.
func (*Provider) ListCRCommentReactions ¶
func (p *Provider) ListCRCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
ListCRCommentReactions implements provider.ReactionManager.
func (*Provider) ListCRComments ¶
func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*provider.CRComment, error)
ListCRComments implements provider.ChangeRequestManager.
func (*Provider) ListCRCommits ¶
func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*provider.CRCommit, error)
ListCRCommits implements provider.ChangeRequestManager.
func (*Provider) ListCRReactions ¶
func (p *Provider) ListCRReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
ListCRReactions implements provider.ReactionManager.
func (*Provider) ListCRs ¶
func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, *int, error)
ListCRs implements provider.ChangeRequestManager.
func (*Provider) ListCollaborators ¶ added in v0.99.8
func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)
ListCollaborators implements provider.CollaboratorManager over GitLab's project-members API. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (GitLab's page-size ceiling is 100).
func (*Provider) ListCommitStatuses ¶
func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]provider.CommitStatus, error)
ListCommitStatuses implements provider.CommitStatusManager.
func (*Provider) ListCommits ¶
func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
ListCommits implements provider.CommitManager.
func (*Provider) ListContributors ¶
func (p *Provider) ListContributors(ctx context.Context, owner, repo string) ([]*provider.Contributor, error)
ListContributors implements provider.RepoStatsManager.
func (*Provider) ListDeployKeys ¶
func (p *Provider) ListDeployKeys(ctx context.Context, owner, repo string) ([]*provider.DeployKey, error)
ListDeployKeys implements provider.DeploymentKeyManager.
func (*Provider) ListFailedJobLogs ¶ added in v0.67.0
func (p *Provider) ListFailedJobLogs(ctx context.Context, owner, repo, sha string) ([]provider.JobLog, error)
ListFailedJobLogs implements provider.CILogManager: 最近一条 pipeline 的失败 job → trace 尾部。无 pipeline / 全绿 → 空切片。
func (*Provider) ListForks ¶
func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)
ListForks implements provider.RepoStatsManager.
func (*Provider) ListIssueCommentReactions ¶
func (p *Provider) ListIssueCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)
ListIssueCommentReactions implements provider.ReactionManager. On GitLab, issue comments are "notes" on the issue.
func (*Provider) ListIssueComments ¶
func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
ListIssueComments implements provider.IssueManager. GitLab models issue comments as notes; the loop exhausts GitLab's pagination (advances until an empty page), so the result is the complete comment list.
func (*Provider) ListIssueLabels ¶
func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)
ListIssueLabels implements provider.IssueManager: repository-level labels, exhausting pagination (the loop advances until an empty page).
func (*Provider) ListIssueReactions ¶
func (p *Provider) ListIssueReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)
ListIssueReactions implements provider.ReactionManager.
func (*Provider) ListIssues ¶
func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)
ListIssues implements provider.IssueManager.
func (*Provider) ListLabels ¶
func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)
ListLabels implements provider.LabelManager.
func (*Provider) ListMilestones ¶
func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)
ListMilestones implements provider.MilestoneManager. State filters by GitLab's "active"/"closed" (open maps to active); GitLab defaults to all.
func (*Provider) ListNotes ¶ added in v0.67.2
func (p *Provider) ListNotes(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
ListNotes lists every merge-request note, oldest first across all pages (MergeRequest Notes API; v0.67.2). IssueManager.ListIssueComments targets the Issues Notes API and 404s for merge requests.
func (*Provider) ListNotifications ¶
func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
ListNotifications implements provider.NotificationManager. GitLab has no GitHub-style notification inbox; the SDK maps this to the Todos API, which provides the same "unread items that need attention" semantics.
func (*Provider) ListReleases ¶
func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
ListReleases implements provider.ReleaseManager.
func (*Provider) ListRepoNotifications ¶
func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
ListRepoNotifications implements provider.NotificationManager. Filters todos by project ID (resolved from owner/repo via the project API).
func (*Provider) ListRepos ¶
func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
ListRepos implements provider.RepoManager.
func (*Provider) ListReviews ¶
func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]provider.Review, error)
ListReviews implements provider.ReviewManager.
Registered mapping (divergence ledger): GitLab has no per-review list — approvals are a single state on the merge request. ListReviews maps to MergeRequestApprovalsService.GetApprovalState(pid, mrIID) and synthesizes one summary review per approver: Review{ID: MR IID, User: approver username, State: approved}, taken from rules[].approved_by. There is no per-approval ID on the wire, so every synthesized review shares the MR IID as its ID, and an approver listed under several rules yields one review.
func (*Provider) ListStargazers ¶
ListStargazers implements provider.RepoStatsManager.
GitLab does not expose a stargazers list endpoint equivalent to GitHub's; this method always returns ErrNotImplemented.
func (*Provider) ListWebhooks ¶
func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
ListWebhooks implements provider.WebhookManager.
func (*Provider) MarkNotificationRead ¶
MarkNotificationRead implements provider.NotificationManager. Maps to marking a single GitLab todo as done.
func (*Provider) MarkNotificationsRead ¶
func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error
MarkNotificationsRead implements provider.NotificationManager. Maps to marking all GitLab todos as done.
func (*Provider) MarkRepoNotificationsRead ¶
func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, opts provider.MarkNotificationsOptions) error
MarkRepoNotificationsRead implements provider.NotificationManager. GitLab's Todos API has no per-project mark-all-as-done; this returns ErrNotImplemented. Callers should use MarkNotificationsRead instead.
func (*Provider) MergeCR ¶
func (p *Provider) MergeCR(ctx context.Context, owner, repo, number string, opts provider.MergeCROptions) (*provider.ChangeRequest, error)
MergeCR implements provider.ChangeRequestManager.
func (*Provider) ParseWebhookEvent ¶
func (*Provider) RemoveCRCommentReaction ¶
func (p *Provider) RemoveCRCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
RemoveCRCommentReaction implements provider.ReactionManager.
func (*Provider) RemoveCollaborator ¶ added in v0.99.8
RemoveCollaborator implements provider.CollaboratorManager via the username→ID resolution (the members API is ID-addressed).
func (*Provider) RemoveIssueCommentReaction ¶
func (p *Provider) RemoveIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error
RemoveIssueCommentReaction implements provider.ReactionManager.
func (*Provider) RemoveIssueLabel ¶
RemoveIssueLabel implements provider.IssueManager via remove_labels.
func (*Provider) RemoveIssueReaction ¶
func (p *Provider) RemoveIssueReaction(ctx context.Context, owner, repo, number string, reactionID int64) error
RemoveIssueReaction implements provider.ReactionManager.
func (*Provider) ReopenCR ¶
func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)
ReopenCR implements provider.ChangeRequestManager.
func (*Provider) ReopenIssue ¶
func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)
ReopenIssue implements provider.IssueManager via the state_event API.
func (*Provider) RequestReviewers ¶
func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error
RequestReviewers implements provider.ReviewManager. Reviewer usernames are resolved to user IDs via the Users API (cached) and written through UpdateMergeRequest's reviewer_ids.
func (*Provider) ResolveUsernames ¶
func (p *Provider) ResolveUsernames(ctx context.Context, usernames []string) ([]*provider.CRUser, error)
ResolveUsernames implements provider.UserManager.
func (*Provider) SearchIssues ¶
func (p *Provider) SearchIssues(ctx context.Context, opts provider.SearchIssuesOptions) ([]*provider.SearchIssueResult, *int, error)
SearchIssues implements provider.SearchManager.
func (*Provider) SearchRepos ¶
func (p *Provider) SearchRepos(ctx context.Context, opts provider.SearchReposOptions) ([]*provider.SearchRepoResult, *int, error)
SearchRepos implements provider.SearchManager.
func (*Provider) SearchUsers ¶
func (p *Provider) SearchUsers(ctx context.Context, opts provider.SearchUsersOptions) ([]*provider.SearchUserResult, *int, error)
SearchUsers implements provider.SearchManager.
func (*Provider) TestConnection ¶
TestConnection implements provider.Provider.
func (*Provider) UpdateBranchProtection ¶
func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, opts provider.UpdateBranchProtectionOptions) (*provider.BranchProtection, error)
UpdateBranchProtection implements provider.BranchProtectionManager.
func (*Provider) UpdateCR ¶
func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)
UpdateCR implements provider.ChangeRequestManager.
func (*Provider) UpdateCRLabels ¶
func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo, number string, labels []string) error
UpdateCRLabels implements provider.ChangeRequestManager.
func (*Provider) UpdateFile ¶
func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
UpdateFile implements provider.FileManager.
func (*Provider) UpdateIssue ¶
func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, opts provider.UpdateIssueOptions) (*provider.Issue, error)
UpdateIssue implements provider.IssueManager. Assignees are resolved to user IDs via the Users API (cached).
func (*Provider) UpdateIssueComment ¶
func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*provider.IssueComment, error)
UpdateIssueComment implements provider.IssueManager. GitLab addresses issue notes through the issue, so number must carry the issue's IID; the platform only lets the note's author perform the edit.
func (*Provider) UpdateLabel ¶
func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, opts provider.UpdateLabelOptions) (*provider.Label, error)
UpdateLabel implements provider.LabelManager. GitLab addresses labels by numeric ID, so the label is resolved by name first.
func (*Provider) UpdateMilestone ¶
func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, opts provider.UpdateMilestoneOptions) (*provider.Milestone, error)
UpdateMilestone implements provider.MilestoneManager. Nil fields in opts stay absent from the PUT body, leaving the milestone unchanged; state changes travel as GitLab's state_event verb.
func (*Provider) UpdateNote ¶ added in v0.67.2
func (p *Provider) UpdateNote(ctx context.Context, owner, repo, number, noteID, body string) (*provider.IssueComment, error)
UpdateNote updates one merge-request note (MergeRequest Notes API; v0.67.2). IssueManager.UpdateIssueComment targets the Issues Notes API and 404s for merge requests — consumers doing CR-comment maintenance should prefer this.
func (*Provider) UpdateRelease ¶
func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, opts provider.UpdateReleaseOptions) (*provider.ReleaseInfo, error)
UpdateRelease implements provider.ReleaseManager via GitLab's tag-addressed update. Registration: GitLab releases have no draft or prerelease concepts (a release is created from a tag and published immediately), so UpdateReleaseOptions.Draft and .Prerelease are ignored on this platform — only Name and Body are carried.
func (*Provider) UpdateRepo ¶
func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)
UpdateRepo implements provider.RepoManager.
func (*Provider) UpdateWebhook ¶ added in v0.99.9
func (p *Provider) UpdateWebhook(ctx context.Context, owner, repo string, webhookID int64, opts provider.UpdateWebhookOptions) (*provider.PlatformWebhook, error)
UpdateWebhook implements provider.WebhookConfigManager. GitLab's edit endpoint is boolean-flag based: omitted flags mean "unchanged", so a non-nil Events slice must set every derived flag explicitly (true for members, false for the rest) to express removal — mirroring the create mapping's scope (push / merge-request / tag-push / note families).
func (*Provider) ValidateWebhookSignature ¶
ValidateWebhookSignature implements provider.WebhookManager. It delegates to the platform's registered validator so the signature scheme has exactly one implementation (shared with contracttest); notably an empty secret is rejected rather than silently accepted.