Documentation
¶
Overview ¶
Package gitcode implements the GitCode Provider for the go-git-platform.
It builds on top of the yi-nology/go-gitcode client 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:
- gitcode.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 (PRs): Create/Get/List/Merge/Close/Reopen/Update/UpdateLabels/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
- issues.go: IssueManager: issue CRUD, comments, issue-scoped label ops
- search.go: SearchManager: SearchRepos, SearchIssues, SearchUsers
- labels.go: repository label CRUD (LabelManager)
- reviews.go: ReviewManager: list/get/create/request/dismiss PR reviews
- milestones.go: repository milestone CRUD (MilestoneManager)
Index ¶
- func Divergences() []provider.Divergence
- func New(cfg provider.Config) (provider.Provider, error)
- type Provider
- func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, ...) error
- func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) 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) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, 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) 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) 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) GetWebhook(ctx context.Context, owner, repo string, webhookID int64) (*provider.PlatformWebhook, error)
- func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, 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) 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) 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) 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) 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) 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) 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(ctx context.Context, owner, repo 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) RemoveCollaborator(ctx context.Context, owner, repo, username string) error
- func (p *Provider) RemoveIssueLabel(ctx context.Context, owner, repo, number, name string) error
- func (p *Provider) RemoveIssueLabels(ctx context.Context, owner, repo, number string, labels []string) 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) 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) 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) 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 GitCode backend.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the GitCode implementation of provider.Provider.
func (*Provider) AddCollaborator ¶
func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, opts provider.AddCollaboratorOptions) error
AddCollaborator implements provider.CollaboratorManager.
func (*Provider) AddIssueLabels ¶
func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
AddIssueLabels implements provider.IssueManager.
func (*Provider) Capabilities ¶
func (p *Provider) Capabilities() provider.CapabilitySet
Capabilities implements provider.Provider. GitCode implements the optional IssueManager, SearchManager, LabelManager, ReviewManager, and MilestoneManager interfaces (see issues.go, search.go, labels.go, reviews.go, milestones.go).
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.
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) CreateCR ¶
func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
CreateCR implements provider.ChangeRequestManager.
func (*Provider) CreateDiscussion ¶
func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, opts provider.DiscussionOptions) (string, error)
CreateDiscussion implements provider.DiffManager. Anchored discussions (FilePath set) ride the SDK's inline-comment endpoint — the same wire createInlineComment uses for review comments (issue #86: the anchors used to be silently dropped and every discussion landed as a top-level note). NewLine anchors the RIGHT side, OldLine the LEFT side; CommitID carries HeadSHA. The base/start SHA pair and multi-line ranges have no GitCode wire (registered divergence).
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.
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. GitCode's label API has no description field; opts.Description is ignored.
func (*Provider) CreateMilestone ¶
func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*provider.Milestone, error)
CreateMilestone implements provider.MilestoneManager. The SDK carries title always and description/due_on only when set (omitempty).
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 via CreatePullRequestReview (POST .../pulls/{n}/reviews with body+event). It moved here from DiffManager when the review capability was split out.
The gitcode API's review create accepts only a summary body and an event, so inline comments are posted individually after the review itself; a failed inline comment is logged but does not fail the review. If the review endpoint itself fails, the pre-P3 fallback path posts the inline comments and a plain note instead of giving up.
func (*Provider) CreateWebhook ¶
func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
CreateWebhook implements provider.WebhookManager. Subscriptions ride the documented per-family flags; the default event set matches the other backends ("push" + "pull_request" → push_events + merge_requests_events).
func (*Provider) DeleteBranch ¶
DeleteBranch implements provider.BranchManager.
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. The delete endpoint addresses the comment directly, so number is unused. Deletion is permanent; the platform only lets the comment'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. The note itself is addressed by its numeric platform ID; the change-request number is only validated, as GitCode's delete-comment endpoint does not take it.
func (*Provider) DeleteRelease ¶
DeleteRelease implements provider.ReleaseManager. The delete endpoint is id-addressed, so the tag is resolved through the by-tag endpoint first (exact lookup, no list window) and the release is deleted by ID. The SDK's tag-addressed DeleteRelease is deliberately NOT used: it falls back to deleting the tag itself on any release-delete error — transient 500/401/429 included — which would silently destroy the git tag; the release-object-only semantics every other platform honors rule that out.
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 via DismissPullRequestReview (PUT .../pulls/{n}/reviews/{id}/dismissals with the dismissal message).
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. opts.Name maps onto the fork body's name field (renaming the fork at creation, issue #87); the fork endpoint takes no organization — forks always land under the authenticated user's namespace (registered divergence).
func (*Provider) GetArchive ¶
GetArchive implements provider.ReleaseManager. GitCode serves no archive endpoint — the documented-shaped routes (/repos/{o}/{r}/archive, /archive/{ref.ext}, /archive/status) all 404 live (probe round 2026-11-03; see gitcode_api docs/wire-provenance.md). The method stays for ReleaseManager completeness and fails with ErrNotImplemented so callers can classify; use ListTags/CreateRelease instead.
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. The SDK's ListPullRequestFiles endpoint exposes no pagination parameters, so the call stays single-shot.
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. GitCode exposes a dedicated tag-addressed endpoint.
func (*Provider) GetReview ¶
func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)
GetReview implements provider.ReviewManager via GetPullRequestReview (GET .../pulls/{n}/reviews/{id}).
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) ListBranches ¶
func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
ListBranches implements provider.BranchManager. The SDK's ListBranches endpoint exposes no page parameter (it hard-codes per_page=100), so the call stays single-shot.
func (*Provider) ListCRComments ¶
func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*provider.CRComment, error)
ListCRComments implements provider.ChangeRequestManager. CR comments ride the issue-comment endpoint; the walk goes through ListIssueCommentsWithOptions + backendutil.AllPages — the same shape ListIssueComments uses — because the plain SDK helper delegates with empty options whose defaults pin page/per_page to 1/20 and silently truncate longer threads at 20 (issue #81).
func (*Provider) ListCRCommits ¶
func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*provider.CRCommit, error)
ListCRCommits implements provider.ChangeRequestManager. The SDK's ListPullRequestCommits endpoint exposes no pagination parameters, so the call stays single-shot.
func (*Provider) ListCRs ¶
func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, *int, error)
ListCRs implements provider.ChangeRequestManager. State=merged 是精确集 (issue #59 审计补充):closed 过滤返回 closed∪merged 超集,但 SDK 的 PullRequest.Merged 标志可以后过滤出纯 merged 集——github/gitea/forgejo 的列表 wire 没有等价字段,只能登记近似(见各自台账),这里选择精确化。 代价与 github 的 SourceBranch 客户端过滤(issue #78)同型:caller-driven 页在后过滤后可能短于 PerPage 且仍有后续页(total 本就不上报,调用方以 短页判断分页终点,语义不受影响)。
func (*Provider) ListCollaborators ¶
func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)
ListCollaborators implements provider.CollaboratorManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (GitCode's page-size ceiling is 100).
func (*Provider) ListCommits ¶
func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
ListCommits implements provider.CommitManager.
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page.
func (*Provider) ListContributors ¶
func (p *Provider) ListContributors(ctx context.Context, owner, repo string) ([]*provider.Contributor, error)
ListContributors implements provider.RepoStatsManager. The SDK's ListContributors endpoint exposes no page parameter (it hard-codes per_page=100), so the call stays single-shot.
func (*Provider) ListFailedJobLogs ¶ added in v0.115.0
func (p *Provider) ListFailedJobLogs(ctx context.Context, owner, repo, sha string) ([]provider.JobLog, error)
ListFailedJobLogs implements provider.CILogManager. GitCode 的 CI 线路: FindActionRunByHeadSHA(wire 无 head_sha 过滤,SDK 按最新序客户端扫描)→ run 的失败 job → download-log 拉全量后本地截尾。语义分歧(mapping 已登 记):SDK 只返回单条最新命中 run——同 SHA 其他 workflow 的 run 不归因 (GitHub/Gitea 是每 workflow 取最新);job status 词表为大写(夹具实证 COMPLETED/RUNNING),失败判定大小写不敏感、live 词表待实证。
func (*Provider) ListForks ¶
func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)
ListForks implements provider.RepoStatsManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (GitCode's page-size ceiling is 100).
func (*Provider) ListIssueComments ¶
func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)
ListIssueComments implements provider.IssueManager.
go-gitcode v0.8.0 exposes the documented page/per_page/order/since query on the issue-comment list endpoint, so the walk runs through the SDK.
func (*Provider) ListIssueLabels ¶
func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)
ListIssueLabels implements provider.IssueManager. go-gitcode v0.8.0 exposes the documented page/per_page query on the label-list endpoint, so the walk runs through the SDK (server default is 100 per page).
func (*Provider) ListIssues ¶
func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)
ListIssues implements provider.IssueManager.
Caller-paged family (issue #51 — see provider.NormalizePageOpts): opts.Page == 0 serves the platform's first page in exactly one request; opts.Page > 0 returns exactly that caller-driven page. The int return is len(result), the served rows' count.
func (*Provider) ListLabels ¶
func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)
ListLabels implements provider.LabelManager.
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page. The label-list endpoint takes the documented page/per_page query (server default 100 per page) since go-gitcode v0.8.0.
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 "open"/"closed" (GitCode also accepts "all").
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page.
func (*Provider) ListNotifications ¶
func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
ListNotifications implements provider.NotificationManager. GitCode serves no global notification inbox — the global routes 404 live (probe round 2026-11-03, see gitcode_api docs/wire-provenance.md); only the repo-scoped endpoints exist. The interface couples the two, so the global half fails with ErrNotImplemented; use ListRepoNotifications.
func (*Provider) ListReleases ¶
func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
ListReleases implements provider.ReleaseManager. The SDK's ListReleases endpoint exposes no page parameter (it hard-codes per_page=100), so the call stays single-shot; GitCode's page-size ceiling bounds what one call can return.
func (*Provider) ListRepoNotifications ¶
func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)
ListRepoNotifications implements provider.NotificationManager.
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page.
func (*Provider) ListRepos ¶
func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
ListRepos implements provider.RepoManager. Owner rides the SDK options and is interpolated into the /users/{owner}/repos path, where the SDK escapes it as a path segment (issue #116: the SDK's pathf covers this call site, retiring the #84 pre-escaping).
func (*Provider) ListReviews ¶
func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]provider.Review, error)
ListReviews implements provider.ReviewManager via ListPullRequestReviews (GET .../pulls/{n}/reviews).
func (*Provider) ListStargazers ¶
func (p *Provider) ListStargazers(ctx context.Context, owner, repo string) ([]*provider.CRUser, error)
ListStargazers implements provider.RepoStatsManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (GitCode's page-size ceiling is 100).
func (*Provider) ListTags ¶
ListTags implements provider.ReleaseManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (GitCode's page-size ceiling is 100) through the SDK's paginated ListTagsWithOptions rather than the hard-coded per_page=100 single-shot ListTags helper.
func (*Provider) ListWebhooks ¶
func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
ListWebhooks implements provider.WebhookManager. The SDK's hook-list endpoint takes the documented page/per_page since go-gitcode v0.8.0, so the walk covers every page.
func (*Provider) MarkNotificationRead ¶
MarkNotificationRead implements provider.NotificationManager. The thread-read route hangs off the global inbox GitCode does not serve (live-verified 2026-11-03); it fails with ErrNotImplemented.
func (*Provider) MarkNotificationsRead ¶
func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error
MarkNotificationsRead implements provider.NotificationManager. The global mark-all route 404s live (probe round 2026-11-03); it fails with ErrNotImplemented.
func (*Provider) MarkRepoNotificationsRead ¶
func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, opts provider.MarkNotificationsOptions) error
MarkRepoNotificationsRead implements provider.NotificationManager.
LastReadAt 裸传平台前先经共享解析器校验(issue #129,#52 同族收口的漏网 处):畸形值此前原样触线,而 mark-all 是不可逆的全量副作用——拒绝面必须 与其他后端一致(ErrInvalidInput),合法值照旧透传(GitCode wire 支持 last_read_at)。
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) RemoveCollaborator ¶
RemoveCollaborator implements provider.CollaboratorManager.
func (*Provider) RemoveIssueLabel ¶
RemoveIssueLabel implements provider.IssueManager.
func (*Provider) RemoveIssueLabels ¶ added in v0.138.0
func (p *Provider) RemoveIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
RemoveIssueLabels implements provider.IssueManager(#163):SDK 仅单删面, 内部循环保序收口、首错即停——失败时错误链携带失败单元的 singular op。
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.
func (*Provider) RequestReviewers ¶
func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error
RequestReviewers implements provider.ReviewManager via RequestPullRequestReviewers (POST .../pulls/{n}/requested_reviewers with the reviewer logins under the same "reviewers" wire key as GitHub).
func (*Provider) SearchIssues ¶
func (p *Provider) SearchIssues(ctx context.Context, opts provider.SearchIssuesOptions) ([]*provider.SearchIssueResult, *int, error)
SearchIssues implements provider.SearchManager.
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page.
func (*Provider) SearchRepos ¶
func (p *Provider) SearchRepos(ctx context.Context, opts provider.SearchReposOptions) ([]*provider.SearchRepoResult, *int, error)
SearchRepos implements provider.SearchManager.
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page.
func (*Provider) SearchUsers ¶
func (p *Provider) SearchUsers(ctx context.Context, opts provider.SearchUsersOptions) ([]*provider.SearchUserResult, *int, error)
SearchUsers implements provider.SearchManager.
Dual-mode pagination is handled by backendutil.PageList: opts.Page == 0 walks every page (budget-capped, fails loud); opts.Page > 0 returns exactly that single caller-driven page.
func (*Provider) TestConnection ¶
TestConnection implements provider.Provider.
func (*Provider) UpdateCR ¶
func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)
UpdateCR implements provider.ChangeRequestManager.
三态接线(2A T6):description 是 B 级——pull-update wire 是 string+omitempty,空串不可表达,patch 清空在任何 HTTP 之前返回 provider.ErrClearNotSupported(整调用失败,零请求);AssigneesPatch 任意指定(置值或清空)也是 B 级——pull-update wire 根本没有 assignee 字段(既有 divergence ignore 只登记旧字段 opts.Assignees 的静默丢弃, legacy 路径维持不变:不报错、不上线)。
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.
三态接线(2A T6):body/milestone 是 B 级——issue-update wire 是 string/int64 + omitempty,空值不可表达且没有清空侧端点,patch 清空在 任何 HTTP 之前返回 provider.ErrClearNotSupported(整调用失败,零请 求);labels/assignees 是 A 级——置值进主 update(omitempty 裁零), 清空走侧端点(PUT ReplaceIssueLabels / DELETE RemoveIssueAssignees)。
顺序裁定(brief Step 2):先发主 update(携带全部置值字段),再发侧 端点清空——混合 set+clear 的一次调用两个请求都会到,且侧端点是最后 一条请求(harness dispatchClear 按「最后一条」断言侧端点形态)。
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. The edit endpoint addresses the comment directly, so number is unused. The platform only lets the comment'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. GitCode addresses labels by name natively. Its label API has no description field; opts.Description is ignored.
func (*Provider) UpdateMilestone ¶
func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, opts provider.UpdateMilestoneOptions) (*provider.Milestone, error)
UpdateMilestone implements provider.MilestoneManager. Unset provider fields stay off the wire (SDK omitempty), leaving the milestone unchanged; GitCode addresses the milestone by its ID.
func (*Provider) UpdateRelease ¶
func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, opts provider.UpdateReleaseOptions) (*provider.ReleaseInfo, error)
UpdateRelease implements provider.ReleaseManager. The update endpoint is id-addressed, so the tag is resolved through the by-tag endpoint first (exact lookup, no list window). The SDK's UpdateReleaseOptions carries plain-string name/body fields that would clobber the release when sent empty, so the current values from the resolution fetch backfill every option the caller left nil; draft/prerelease are pointers that pass through untouched.
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. GitCode's edit endpoint is boolean-flag based: omitted flags mean "unchanged", so a non-nil Events slice sets every flag of gitcodeHookEventFlags explicitly (true for members, false for the rest) to express removal.
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.