Help us shape the future of Go! Take the 2026 Go Developer Survey

gitee

package
v0.57.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package gitee implements the Gitee Provider for the git-platform-sdk.

The backend builds on the hand-written go-gitee SDK (github.com/next-bin/go-gitee) which follows go-github patterns: pointer-based model types, functional options for client construction, per-service method groups, and automatic access_token injection via a tokenTransport round-tripper.

All Provider methods are split across the per-responsibility files in this package:

  • gitee.go: constructor + identity (Platform, TestConnection, Capabilities)
  • init.go: provider registration with the global registry
  • methods.go: esc/escPath path escaping helpers
  • 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
  • files.go: GetFileContent, CreateFile, UpdateFile, DeleteFile
  • releases.go: ListTags, ListReleases, CreateRelease, GetArchive
  • labels.go: repository label CRUD (LabelManager)
  • issues.go: issue CRUD, comments, and issue labels (IssueManager)
  • milestones.go: repository milestone CRUD (MilestoneManager)
  • search.go: global repo/issue/user search (SearchManager)
  • types.go: SDK model conversions and deref helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Divergences added in v0.45.0

func Divergences() []provider.Divergence

Divergences returns the registered divergence ledger for the Gitee backend.

func New

New builds a Gitee Provider from the given config.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the Gitee implementation of provider.Provider.

func (*Provider) AddCollaborator added in v0.53.0

func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, opts provider.AddCollaboratorOptions) error

AddCollaborator implements provider.CollaboratorManager.

func (*Provider) AddDeployKey added in v0.55.0

func (p *Provider) AddDeployKey(ctx context.Context, owner, repo string, opts provider.AddDeployKeyOptions) (*provider.DeployKey, error)

AddDeployKey implements provider.DeploymentKeyManager.

func (*Provider) AddIssueLabels added in v0.39.0

func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error

AddIssueLabels implements provider.IssueManager via the SDK.

func (*Provider) Capabilities added in v0.38.0

func (p *Provider) Capabilities() provider.CapabilitySet

Capabilities implements provider.Provider.

func (*Provider) CloseCR

func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)

CloseCR implements provider.ChangeRequestManager.

func (*Provider) CloseIssue added in v0.39.0

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) CreateBranchProtection added in v0.53.0

func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, opts provider.CreateBranchProtectionOptions) (*provider.BranchProtection, error)

CreateBranchProtection implements provider.BranchProtectionManager.

func (*Provider) CreateCR

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. Gitee uses the Checks API (check runs) for CI status reporting.

func (*Provider) CreateDiscussion

func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, opts provider.DiscussionOptions) (string, error)

CreateDiscussion implements provider.DiffManager.

Gitee has no separate discussion endpoint; PR comments are the only option.

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 added in v0.39.0

func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*provider.Issue, error)

CreateIssue implements provider.IssueManager.

func (*Provider) CreateIssueComment added in v0.39.0

func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*provider.IssueComment, error)

CreateIssueComment implements provider.IssueManager via the SDK.

func (*Provider) CreateLabel added in v0.38.0

func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*provider.Label, error)

CreateLabel implements provider.LabelManager.

func (*Provider) CreateMilestone added in v0.40.0

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) CreateWebhook

CreateWebhook implements provider.WebhookManager.

func (*Provider) DeleteBranch

func (p *Provider) DeleteBranch(ctx context.Context, owner, repo, branch string) error

DeleteBranch implements provider.BranchManager.

The new SDK does not expose a DeleteBranch method, so we construct the request manually through the client's NewRequest + Do methods.

func (*Provider) DeleteBranchProtection added in v0.53.0

func (p *Provider) DeleteBranchProtection(ctx context.Context, owner, repo, branch string) error

DeleteBranchProtection implements provider.BranchProtectionManager.

func (*Provider) DeleteDeployKey added in v0.55.0

func (p *Provider) DeleteDeployKey(ctx context.Context, owner, repo string, keyID int64) error

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) DeleteLabel added in v0.38.0

func (p *Provider) DeleteLabel(ctx context.Context, owner, repo, name string) error

DeleteLabel implements provider.LabelManager.

func (*Provider) DeleteMilestone added in v0.40.0

func (p *Provider) DeleteMilestone(ctx context.Context, owner, repo, number string) error

DeleteMilestone implements provider.MilestoneManager.

func (*Provider) DeleteNote

func (p *Provider) DeleteNote(ctx context.Context, owner, repo, number, noteID string) error

DeleteNote implements provider.DiffManager.

func (*Provider) DeleteRelease added in v0.40.0

func (p *Provider) DeleteRelease(ctx context.Context, owner, repo, tag string) error

DeleteRelease implements provider.ReleaseManager.

func (*Provider) DeleteRepo

func (p *Provider) DeleteRepo(ctx context.Context, owner, repo string) error

DeleteRepo implements provider.RepoManager.

func (*Provider) DeleteWebhook

func (p *Provider) DeleteWebhook(ctx context.Context, owner, repo string, webhookID int64) error

DeleteWebhook implements provider.WebhookManager.

func (*Provider) Divergences added in v0.45.0

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

func (p *Provider) GetArchive(ctx context.Context, owner, repo, ref, format string) ([]byte, error)

GetArchive implements provider.ReleaseManager.

func (*Provider) GetBranchProtection added in v0.53.0

func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*provider.BranchProtection, error)

GetBranchProtection implements provider.BranchProtectionManager. Gitee has no get endpoint for branch protections; this returns nil.

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 added in v0.39.0

func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)

GetIssue implements provider.IssueManager via the SDK.

func (*Provider) GetMilestone added in v0.40.0

func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*provider.Milestone, error)

GetMilestone implements provider.MilestoneManager via the SDK.

func (*Provider) GetReleaseByTag added in v0.40.0

func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*provider.ReleaseInfo, error)

GetReleaseByTag implements provider.ReleaseManager.

func (*Provider) GetRepo

func (p *Provider) GetRepo(ctx context.Context, owner, repo string) (*provider.PlatformRepo, error)

GetRepo implements provider.RepoManager.

func (*Provider) ListBranchProtections added in v0.53.0

func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*provider.BranchProtection, error)

ListBranchProtections implements provider.BranchProtectionManager. Gitee has no list endpoint for branch protections; this returns nil.

func (*Provider) ListBranches

func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)

ListBranches implements provider.BranchManager.

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) ListCRs

ListCRs implements provider.ChangeRequestManager.

func (*Provider) ListCollaborators added in v0.53.0

func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)

ListCollaborators implements provider.CollaboratorManager.

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 added in v0.53.0

func (p *Provider) ListContributors(ctx context.Context, owner, repo string) ([]*provider.Contributor, error)

ListContributors implements provider.RepoStatsManager.

func (*Provider) ListDeployKeys added in v0.55.0

func (p *Provider) ListDeployKeys(ctx context.Context, owner, repo string) ([]*provider.DeployKey, error)

ListDeployKeys implements provider.DeploymentKeyManager.

func (*Provider) ListForks added in v0.53.0

func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)

ListForks implements provider.RepoStatsManager.

func (*Provider) ListIssueComments added in v0.39.0

func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)

ListIssueComments implements provider.IssueManager via the SDK.

func (*Provider) ListIssueLabels added in v0.39.0

func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)

ListIssueLabels implements provider.IssueManager: repository-level labels. The SDK's LabelsService.List takes ListOptions with Page/PerPage, so the list is paginated via backendutil.AllPages until an empty page.

func (*Provider) ListIssues added in v0.39.0

func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)

ListIssues implements provider.IssueManager via the SDK.

func (*Provider) ListLabels added in v0.38.0

func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)

ListLabels implements provider.LabelManager.

func (*Provider) ListMilestones added in v0.40.0

func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)

ListMilestones implements provider.MilestoneManager via the SDK.

func (*Provider) ListNotifications added in v0.52.0

func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)

ListNotifications implements provider.NotificationManager.

func (*Provider) ListReleases

func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)

ListReleases implements provider.ReleaseManager.

func (*Provider) ListRepoNotifications added in v0.52.0

func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)

ListRepoNotifications implements provider.NotificationManager.

func (*Provider) ListRepos

ListRepos implements provider.RepoManager.

func (*Provider) ListStargazers added in v0.53.0

func (p *Provider) ListStargazers(ctx context.Context, owner, repo string) ([]*provider.CRUser, error)

ListStargazers implements provider.RepoStatsManager.

The new SDK does not expose a dedicated stargazers endpoint, so we use the client's generic NewRequest + Do pattern to call the API directly.

func (*Provider) ListTags

func (p *Provider) ListTags(ctx context.Context, owner, repo string) ([]*provider.TagInfo, error)

ListTags implements provider.ReleaseManager.

func (*Provider) ListWebhooks

func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)

ListWebhooks implements provider.WebhookManager.

func (*Provider) MarkNotificationRead added in v0.52.0

func (p *Provider) MarkNotificationRead(ctx context.Context, threadID string) error

MarkNotificationRead implements provider.NotificationManager.

func (*Provider) MarkNotificationsRead added in v0.52.0

func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error

MarkNotificationsRead implements provider.NotificationManager.

func (*Provider) MarkRepoNotificationsRead added in v0.52.0

func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, opts provider.MarkNotificationsOptions) error

MarkRepoNotificationsRead implements provider.NotificationManager.

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 (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)

ParseWebhookEvent implements provider.WebhookManager.

func (*Provider) Platform

func (p *Provider) Platform() provider.Platform

Platform implements provider.Provider.

func (*Provider) RemoveCollaborator added in v0.53.0

func (p *Provider) RemoveCollaborator(ctx context.Context, owner, repo, username string) error

RemoveCollaborator implements provider.CollaboratorManager.

func (*Provider) RemoveIssueLabel added in v0.39.0

func (p *Provider) RemoveIssueLabel(ctx context.Context, owner, repo, number, name string) error

RemoveIssueLabel implements provider.IssueManager via the SDK.

func (*Provider) ReopenCR

func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)

ReopenCR implements provider.ChangeRequestManager.

func (*Provider) ReopenIssue added in v0.39.0

func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)

ReopenIssue implements provider.IssueManager.

func (*Provider) SearchIssues added in v0.40.0

SearchIssues implements provider.SearchManager.

func (*Provider) SearchRepos added in v0.40.0

SearchRepos implements provider.SearchManager.

func (*Provider) SearchUsers added in v0.40.0

SearchUsers implements provider.SearchManager.

func (*Provider) TestConnection

func (p *Provider) TestConnection(ctx context.Context) (*provider.TestConnectionResult, error)

TestConnection implements provider.Provider.

func (*Provider) UpdateBranchProtection added in v0.53.0

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 added in v0.39.0

func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, opts provider.UpdateIssueOptions) (*provider.Issue, error)

UpdateIssue implements provider.IssueManager via the SDK.

func (*Provider) UpdateIssueComment added in v0.49.0

func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*provider.IssueComment, error)

UpdateIssueComment implements provider.IssueManager.

func (*Provider) UpdateLabel added in v0.38.0

func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, opts provider.UpdateLabelOptions) (*provider.Label, error)

UpdateLabel implements provider.LabelManager. Gitee addresses labels by name.

func (*Provider) UpdateMilestone added in v0.40.0

func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, opts provider.UpdateMilestoneOptions) (*provider.Milestone, error)

UpdateMilestone implements provider.MilestoneManager.

func (*Provider) UpdateRelease added in v0.40.0

func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, opts provider.UpdateReleaseOptions) (*provider.ReleaseInfo, error)

UpdateRelease implements provider.ReleaseManager.

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) ValidateWebhookSignature

func (p *Provider) ValidateWebhookSignature(r *http.Request, secret string) error

ValidateWebhookSignature implements provider.WebhookManager.

Gitee uses HMAC-SHA256 over the body, sent in the X-Gitee-Token header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL