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

tencentcode

package
v0.99.9 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package tencentcode implements the Tencent 工蜂 Provider for the go-git-platform.

Tencent 工蜂 exposes a GitLab-compatible REST API with some platform- specific extensions (native code reviews, branch protection, repository tree/blob). This package implements the cross-platform provider.Provider interface and additionally exposes a TencentCodeExtras interface for the platform-specific capabilities. All Provider methods are split across the per-responsibility files in this package:

  • tencentcode.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, GetReleaseByTag, UpdateRelease, DeleteRelease, GetArchive
  • milestones.go: repository milestone CRUD (MilestoneManager)
  • labels.go: repository label CRUD (LabelManager)
  • issues.go: issue CRUD, state transitions, comments (via notes), and issue-label writes (IssueManager)
  • reviews.go: code reviews over native review notes, reviewer requests (registered ignore), and dismissals (registered stub) (ReviewManager)
  • extras.go: TencentCodeExtras (native code reviews, commit comments, repository tree, branch protection)
  • types.go: gongfeng model -> provider model conversions

Index

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 Tencent Code backend.

func New

New builds a Tencent Code Provider from the given config.

Types

type AddGroupMemberOptions added in v0.99.8

type AddGroupMemberOptions struct {
	UserID      int
	AccessLevel gongfeng.AccessLevelValue
}

AddGroupMemberOptions are the AddGroupMember inputs. AccessLevel uses the gongfeng AccessLevel* constants (0 = platform default).

type BranchInfo added in v0.99.8

type BranchInfo struct {
	Name      string `json:"name"`
	CommitSHA string `json:"commit_sha"`
	Protected bool   `json:"protected"`
}

BranchInfo is a single branch with its head commit and protection flag.

type CodeReview

type CodeReview struct {
	ID           int              `json:"id"`
	IID          int              `json:"iid"`
	ProjectID    int              `json:"project_id"`
	Title        string           `json:"title"`
	Description  string           `json:"description"`
	State        string           `json:"state"`
	SourceBranch string           `json:"source_branch"`
	TargetBranch string           `json:"target_branch"`
	SourceCommit string           `json:"source_commit"`
	TargetCommit string           `json:"target_commit"`
	Author       *provider.CRUser `json:"author"`
	Reviewers    []string         `json:"reviewers"`
	WebURL       string           `json:"web_url"`
	CreatedAt    string           `json:"created_at"`
	UpdatedAt    string           `json:"updated_at"`
}

CodeReview represents a Tencent 工蜂 native code review.

type CommitComment

type CommitComment struct {
	ID        int              `json:"id"`
	Body      string           `json:"body"`
	Author    *provider.CRUser `json:"author"`
	Path      string           `json:"path"`
	Line      int              `json:"line"`
	LineType  string           `json:"line_type"`
	CreatedAt string           `json:"created_at"`
}

CommitComment represents a comment on a commit.

type CommitDiffOptions

type CommitDiffOptions struct {
	Path             string
	IgnoreWhiteSpace bool
}

CommitDiffOptions controls a single-commit diff.

type CommitRefType

type CommitRefType string

CommitRefType selects which refs to return for a commit.

const (
	CommitRefAll    CommitRefType = "all"
	CommitRefBranch CommitRefType = "branch"
	CommitRefTag    CommitRefType = "tag"
)

type CommitRefs

type CommitRefs struct {
	Branches []string `json:"branches"`
	Tags     []string `json:"tags"`
}

CommitRefs lists branches and tags containing a commit.

type CreateCodeReviewOptions

type CreateCodeReviewOptions struct {
	Title                 string
	SourceBranch          string
	TargetBranch          string
	SourceCommit          string
	TargetCommit          string
	Description           string
	ReviewerIDs           string // comma-separated reviewer user IDs
	NecessaryReviewerIDs  string // comma-separated necessary reviewer user IDs
	ApproverRule          int    // -1 = all approve, 1 = single, 2+ = N approve
	NecessaryApproverRule int
}

CreateCodeReviewOptions creates a native code review.

type CreateCommitCommentOptions

type CreateCommitCommentOptions struct {
	Note     string
	Path     string
	Line     int
	LineType string // "old" or "new"
}

CreateCommitCommentOptions creates a comment on a commit.

type CreateGroupOptions added in v0.99.8

type CreateGroupOptions struct {
	Name        string
	Path        string
	Description string
}

CreateGroupOptions are the CreateGroup inputs; Name and Path are required by the platform.

type CreateTagOptions added in v0.99.8

type CreateTagOptions struct {
	TagName string // tag name to create
	Ref     string // commit/branch to point the tag at
	Message string // empty = lightweight tag
}

CreateTagOptions are the CreateTag inputs.

type EditGroupMemberOptions added in v0.99.8

type EditGroupMemberOptions struct {
	AccessLevel gongfeng.AccessLevelValue
}

EditGroupMemberOptions are the EditGroupMember inputs.

type EditGroupOptions added in v0.99.8

type EditGroupOptions struct {
	Name        string
	Description string
}

EditGroupOptions are the EditGroup inputs; zero values stay unchanged.

type EditProjectMemberOptions added in v0.99.8

type EditProjectMemberOptions struct {
	AccessLevel gongfeng.AccessLevelValue
}

EditProjectMemberOptions are the EditProjectMember inputs.

type EmailInfo added in v0.99.8

type EmailInfo struct {
	ID    int    `json:"id"`
	Email string `json:"email"`
}

EmailInfo is a registered email address.

type GroupInfo added in v0.99.8

type GroupInfo struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Path        string `json:"path"`
	WebURL      string `json:"web_url"`
	Description string `json:"description"`
}

GroupInfo is the platform group as the backend surfaces it.

type InviteReviewerOptions

type InviteReviewerOptions struct {
	ReviewerID          string // comma-separated user IDs (code review)
	NecessaryReviewerID string // comma-separated necessary user IDs (code review)
}

InviteReviewerOptions invites one or more reviewers.

type ListCodeReviewsOptions

type ListCodeReviewsOptions struct {
	State    string // approving, change_required, closed
	AuthorID int
	OrderBy  string // created_at, updated_at
	Sort     string // asc, desc
	Page     int
	PerPage  int
}

ListCodeReviewsOptions filters the code review list.

type ListGroupMembersOptions added in v0.99.8

type ListGroupMembersOptions struct {
	Page    int // 0 walks every page
	PerPage int // 0 = platform default
}

ListGroupMembersOptions are the ListGroupMembers knobs.

type ListGroupsOptions added in v0.99.8

type ListGroupsOptions struct {
	Page    int    // 0 walks every page
	PerPage int    // 0 = platform default
	Search  string // empty = no filter
}

ListGroupsOptions are the ListGroups knobs.

type ListNamespacesOptions added in v0.99.8

type ListNamespacesOptions struct {
	Page    int    // 0 walks every page
	PerPage int    // 0 = platform default
	Search  string // empty = no filter
}

ListNamespacesOptions are the ListNamespaces knobs.

type ListProjectEventsOptions added in v0.99.8

type ListProjectEventsOptions struct {
	Page    int
	PerPage int
}

ListProjectEventsOptions are the ListProjectEvents knobs.

type ListUsersOptions added in v0.99.8

type ListUsersOptions struct {
	Page    int    // 0 walks every page
	PerPage int    // 0 = platform default
	Search  string // empty = no filter
}

ListUsersOptions are the ListUsers knobs.

type MRReview

type MRReview struct {
	ID           int              `json:"id"`
	IID          int              `json:"iid"`
	ProjectID    int              `json:"project_id"`
	State        string           `json:"state"`
	Title        string           `json:"title"`
	Description  string           `json:"description"`
	Author       *provider.CRUser `json:"author"`
	SourceBranch string           `json:"source_branch"`
	TargetBranch string           `json:"target_branch"`
	WebURL       string           `json:"web_url"`
	CreatedAt    string           `json:"created_at"`
	UpdatedAt    string           `json:"updated_at"`
}

MRReview represents the review state of a merge request.

type MemberInfo added in v0.99.8

type MemberInfo struct {
	ID          int    `json:"id"`
	Username    string `json:"username"`
	Name        string `json:"name"`
	AccessLevel int    `json:"access_level"`
	State       string `json:"state"`
	WebURL      string `json:"web_url"`
	AvatarURL   string `json:"avatar_url"`
}

MemberInfo is a project/group member with the platform-native access level (gongfeng AccessLevel* constants).

type NamespaceInfo added in v0.99.8

type NamespaceInfo struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Path        string `json:"path"`
	Kind        string `json:"kind"`
	WebURL      string `json:"web_url"`
	Description string `json:"description"`
}

NamespaceInfo is a namespace (user or group) projects can be created in.

type ProjectEventInfo added in v0.99.8

type ProjectEventInfo struct {
	ActionName     string    `json:"action_name"`
	Title          string    `json:"title"`
	TargetType     string    `json:"target_type"`
	TargetTitle    string    `json:"target_title"`
	TargetID       int       `json:"target_id"`
	AuthorUsername string    `json:"author_username"`
	CreatedAt      time.Time `json:"created_at"`
}

ProjectEventInfo is one activity-feed entry.

type ProjectShareInfo added in v0.99.8

type ProjectShareInfo struct {
	ProjectID   int       `json:"project_id"`
	GroupID     int       `json:"group_id"`
	GroupAccess int       `json:"group_access"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

ProjectShareInfo is a project→group access grant.

type ProtectBranchOptions

type ProtectBranchOptions struct {
	MergeAccessLevel          int  `json:"merge_access_level,omitempty"`
	PushAccessLevel           int  `json:"push_access_level,omitempty"`
	AllowForcePush            bool `json:"allow_force_push,omitempty"`
	CodeOwnerApprovalRequired bool `json:"code_owner_approval_required,omitempty"`
}

ProtectBranchOptions configures branch protection rules on Tencent Code (工蜂).

type ProtectedBranchMember

type ProtectedBranchMember struct {
	UserID      int    `json:"user_id"`
	Username    string `json:"username"`
	Name        string `json:"name"`
	AccessLevel int    `json:"access_level"`
}

ProtectedBranchMember represents a member granted access to a protected branch.

type ProtectedBranchMemberOptions

type ProtectedBranchMemberOptions struct {
	UserID      int
	AccessLevel int
}

ProtectedBranchMemberOptions adds/updates a protected branch member.

type Provider

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

Provider is the Tencent 工蜂 implementation of provider.Provider.

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. 工蜂 members are ID-addressed, so the username resolves through the Users API; the read/write/admin permission maps onto the platform's access levels (registered mapping) and empty takes the platform default.

func (*Provider) AddGroupMember added in v0.99.8

func (p *Provider) AddGroupMember(ctx context.Context, groupID int, opts AddGroupMemberOptions) (*MemberInfo, error)

AddGroupMember implements TencentCodeOrgExtras.

func (*Provider) AddIssueLabels

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

AddIssueLabels implements provider.IssueManager. 工蜂's update surface takes the full label set only (no add_labels), so the current set is fetched, unioned with the adds, and rewritten.

func (*Provider) AddProtectedBranchMember

func (t *Provider) AddProtectedBranchMember(ctx context.Context, owner, repo, branch string, opts ProtectedBranchMemberOptions) error

func (*Provider) CancelMRReview

func (t *Provider) CancelMRReview(ctx context.Context, owner, repo string, mrNumber int) error

func (*Provider) Capabilities

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

Capabilities implements provider.Provider. The backend declares the optional capability interfaces it implements (currently Labels, Milestones, Issues, and Reviews).

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

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

CreateBranchProtection implements provider.BranchProtectionManager. The platform's protect PUT is an upsert carrying only access levels and the force-push flag (registered ignores for the rest of the contract options); the PUT response is the protection detail and is converted directly — no read-back round trip.

func (*Provider) CreateCR

CreateCR implements provider.ChangeRequestManager.

func (*Provider) CreateCodeReview

func (t *Provider) CreateCodeReview(ctx context.Context, owner, repo string, opts CreateCodeReviewOptions) (*CodeReview, error)

func (*Provider) CreateCommitComment

func (t *Provider) CreateCommitComment(ctx context.Context, owner, repo, sha string, opts CreateCommitCommentOptions) (*CommitComment, error)

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. The gongfeng SDK does not expose a discussions endpoint, so we use the SDK client's NewRequest/Do for a raw API call.

func (*Provider) CreateEmail added in v0.99.8

func (p *Provider) CreateEmail(ctx context.Context, email string) (*EmailInfo, error)

CreateEmail implements TencentCodeAccountExtras.

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) CreateForkRelation added in v0.99.8

func (p *Provider) CreateForkRelation(ctx context.Context, owner, repo string, forkedFromID int) error

CreateForkRelation implements TencentCodeProjectExtras.

func (*Provider) CreateGroup added in v0.99.8

func (p *Provider) CreateGroup(ctx context.Context, opts CreateGroupOptions) (*GroupInfo, error)

CreateGroup implements TencentCodeOrgExtras.

func (*Provider) CreateIssue

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

CreateIssue implements provider.IssueManager. opts.Assignees resolves to 工蜂's assignee_ids csv through the Users API (see users.go); an unknown username fails the call with a NotFound error.

func (*Provider) CreateIssueComment

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

CreateIssueComment implements provider.IssueManager via the notes API.

func (*Provider) CreateLabel

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

CreateLabel implements provider.LabelManager. 工蜂 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. Registration: the create endpoint carries only tag/title/description, so opts.Target and the draft/prerelease flags have no equivalent here (registered ignores).

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 by posting a merge-request note: the body becomes the note text and the event maps to the note's reviewer_state verdict verb (same vocabulary the reviews/{id} commit-note surface uses — the gongfeng SDK's bundled docs/api/notes.md). See the file doc for the registered unmapped fields (Comments, CommitID) and the verdict vocabulary.

func (*Provider) CreateSSHKey added in v0.99.8

func (p *Provider) CreateSSHKey(ctx context.Context, title, key string) (*SSHKeyInfo, error)

CreateSSHKey implements TencentCodeAccountExtras.

func (*Provider) CreateTag added in v0.99.8

func (p *Provider) CreateTag(ctx context.Context, owner, repo string, opts CreateTagOptions) (*TagDetail, error)

CreateTag implements TencentCodeProjectExtras.

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.

func (*Provider) DeleteBranchProtection added in v0.99.8

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

DeleteBranchProtection implements provider.BranchProtectionManager. The platform's unprotect endpoint is a PUT, not a DELETE.

func (*Provider) DeleteEmail added in v0.99.8

func (p *Provider) DeleteEmail(ctx context.Context, emailID int) error

DeleteEmail implements TencentCodeAccountExtras.

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) DeleteForkRelation added in v0.99.8

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

DeleteForkRelation implements TencentCodeProjectExtras.

func (*Provider) DeleteGroup added in v0.99.8

func (p *Provider) DeleteGroup(ctx context.Context, groupID int) error

DeleteGroup implements TencentCodeOrgExtras.

func (*Provider) DeleteGroupMember added in v0.99.8

func (p *Provider) DeleteGroupMember(ctx context.Context, groupID, userID int) error

DeleteGroupMember implements TencentCodeOrgExtras.

func (*Provider) DeleteLabel

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

DeleteLabel implements provider.LabelManager. The label name travels in the delete body as 工蜂's addressing key.

func (*Provider) DeleteMilestone

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. The gongfeng SDK does not expose a delete-note endpoint, so we use the SDK client's NewRequest/Do for a raw API call.

func (*Provider) DeleteProjectShare added in v0.99.8

func (p *Provider) DeleteProjectShare(ctx context.Context, owner, repo string, groupID int) error

DeleteProjectShare implements TencentCodeProjectExtras.

func (*Provider) DeleteRelease

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

DeleteRelease implements provider.ReleaseManager via the registered list-scan detour: resolve the release ID by tag, then DELETE.

func (*Provider) DeleteRepo

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

DeleteRepo implements provider.RepoManager.

func (*Provider) DeleteSSHKey added in v0.99.8

func (p *Provider) DeleteSSHKey(ctx context.Context, keyID int) error

DeleteSSHKey implements TencentCodeAccountExtras.

func (*Provider) DeleteTag added in v0.99.8

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

DeleteTag implements TencentCodeProjectExtras.

func (*Provider) DeleteWebhook

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

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 as a registered stub — the only registered stub among the optional-capability interfaces (the SDK's other stubs, e.g. ChangeRequestManager.UpdateCRLabels, live on core interfaces).

Registered mapping: STUB. 工蜂's review surface has no dismissal verb: review notes can be created, listed, fetched, and edited (UpdateReviewNote rewrites the body or reviewer_state), but no endpoint removes or voids a review, and the dismissal message has no 工蜂 equivalent. The call fails fast with a platform error wrapping provider.ErrNotImplemented.

func (*Provider) Divergences

func (p *Provider) Divergences() []provider.Divergence

Divergences implements provider.Provider.

func (*Provider) DownloadCompareChangedFiles added in v0.99.8

func (t *Provider) DownloadCompareChangedFiles(ctx context.Context, owner, repo, from, to string, w io.Writer) error

func (*Provider) EditGroup added in v0.99.8

func (p *Provider) EditGroup(ctx context.Context, groupID int, opts EditGroupOptions) (*GroupInfo, error)

EditGroup implements TencentCodeOrgExtras. The platform's edit endpoint is a PUT to the group collection carrying the group ID in the body.

func (*Provider) EditGroupMember added in v0.99.8

func (p *Provider) EditGroupMember(ctx context.Context, groupID, userID int, opts EditGroupMemberOptions) (*MemberInfo, error)

EditGroupMember implements TencentCodeOrgExtras.

func (*Provider) EditProjectMember added in v0.99.8

func (p *Provider) EditProjectMember(ctx context.Context, owner, repo string, userID int, opts EditProjectMemberOptions) (*MemberInfo, error)

EditProjectMember implements TencentCodeProjectExtras.

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

func (t *Provider) GetBlob(ctx context.Context, owner, repo, sha string) ([]byte, error)

func (*Provider) GetBranch added in v0.99.8

func (t *Provider) GetBranch(ctx context.Context, owner, repo, branch string) (*BranchInfo, error)

func (*Provider) GetBranchProtection added in v0.99.8

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

func (t *Provider) GetCodeReview(ctx context.Context, owner, repo string, reviewID int) (*CodeReview, error)

func (*Provider) GetCodeReviewChangedFiles

func (t *Provider) GetCodeReviewChangedFiles(ctx context.Context, owner, repo string, reviewID int) ([]*provider.ChangedFile, error)

func (*Provider) GetCommit

func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)

GetCommit implements provider.CommitManager.

func (*Provider) GetCommitDiff

func (t *Provider) GetCommitDiff(ctx context.Context, owner, repo, sha string, opts CommitDiffOptions) ([]*provider.ChangedFile, error)

func (*Provider) GetCommitRawFile added in v0.99.8

func (t *Provider) GetCommitRawFile(ctx context.Context, owner, repo, sha, path string) ([]byte, error)

func (*Provider) GetCommitRefs

func (t *Provider) GetCommitRefs(ctx context.Context, owner, repo, sha string, refType CommitRefType) (*CommitRefs, error)

func (*Provider) GetCurrentUser added in v0.99.8

func (p *Provider) GetCurrentUser(ctx context.Context) (*UserDetailInfo, error)

GetCurrentUser implements TencentCodeAccountExtras.

func (*Provider) GetEmail added in v0.99.8

func (p *Provider) GetEmail(ctx context.Context, emailID int) (*EmailInfo, error)

GetEmail implements TencentCodeAccountExtras.

func (*Provider) GetFileContent

func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)

GetFileContent implements provider.FileManager.

func (*Provider) GetGroup added in v0.99.8

func (p *Provider) GetGroup(ctx context.Context, groupID int) (*GroupInfo, error)

GetGroup implements TencentCodeOrgExtras.

func (*Provider) GetIssue

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

GetIssue implements provider.IssueManager. 工蜂 addresses issues by IID.

func (*Provider) GetMRReview

func (t *Provider) GetMRReview(ctx context.Context, owner, repo string, mrNumber int) (*MRReview, error)

func (*Provider) GetMilestone

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

GetMilestone implements provider.MilestoneManager.

func (*Provider) GetProjectMember added in v0.99.8

func (p *Provider) GetProjectMember(ctx context.Context, owner, repo string, userID int) (*MemberInfo, error)

GetProjectMember implements TencentCodeProjectExtras.

func (*Provider) GetRawFile added in v0.99.8

func (t *Provider) GetRawFile(ctx context.Context, owner, repo, ref, path string) ([]byte, error)

func (*Provider) GetReleaseByTag

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

GetReleaseByTag implements provider.ReleaseManager via the registered list-scan detour (see findReleaseByTag).

func (*Provider) GetRepo

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

GetRepo implements provider.RepoManager.

func (*Provider) GetRepoTree

func (t *Provider) GetRepoTree(ctx context.Context, owner, repo, path, ref string, recursive bool) ([]*TreeEntryNode, error)

func (*Provider) GetReview

func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)

GetReview implements provider.ReviewManager by fetching the single merge-request note backing the review: reviewID is the note ID — the same identifier CreateReview returns as ReviewResult.ID, so created reviews round-trip through this call.

func (*Provider) GetSSHKey added in v0.99.8

func (p *Provider) GetSSHKey(ctx context.Context, keyID int) (*SSHKeyInfo, error)

GetSSHKey implements TencentCodeAccountExtras.

func (*Provider) GetSession added in v0.99.8

func (p *Provider) GetSession(ctx context.Context, login, password string) (*SessionInfo, error)

GetSession implements TencentCodeAccountExtras.

func (*Provider) GetStarStatus added in v0.99.8

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

GetStarStatus implements TencentCodeProjectExtras.

func (*Provider) GetTag added in v0.99.8

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

GetTag implements TencentCodeProjectExtras.

func (*Provider) GetUser

func (p *Provider) GetUser(ctx context.Context, username string) (*provider.CRUser, error)

GetUser implements provider.UserManager.

func (*Provider) GetUserByEmail added in v0.99.8

func (p *Provider) GetUserByEmail(ctx context.Context, email string) (*provider.CRUser, error)

GetUserByEmail implements TencentCodeAccountExtras.

func (*Provider) GetUserDetail added in v0.99.8

func (p *Provider) GetUserDetail(ctx context.Context, userID int) (*UserDetailInfo, error)

GetUserDetail implements TencentCodeAccountExtras.

func (*Provider) GetWatchStatus added in v0.99.8

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

GetWatchStatus implements TencentCodeProjectExtras.

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

func (t *Provider) InviteCodeReviewer(ctx context.Context, owner, repo string, reviewID int, opts InviteReviewerOptions) error

func (*Provider) InviteMRReviewer

func (t *Provider) InviteMRReviewer(ctx context.Context, owner, repo string, mrNumber int, opts InviteReviewerOptions) error

func (*Provider) ListBranchProtections added in v0.99.8

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

ListBranchProtections implements provider.BranchProtectionManager via the registered detour: 工蜂 exposes no list-protected-branches endpoint, so the branch list is walked and its protected rows returned as summaries. The row payload carries no approval-rule fields — approver rules surface through GetBranchProtection.

func (*Provider) ListBranches

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

ListBranches implements provider.BranchManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListCRComments

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

ListCRComments implements provider.ChangeRequestManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListCRCommits

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

ListCRCommits implements provider.ChangeRequestManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListCRs

ListCRs implements provider.ChangeRequestManager.

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

func (t *Provider) ListCodeReviews(ctx context.Context, owner, repo string, opts ListCodeReviewsOptions) ([]*CodeReview, error)

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 工蜂's project-members API. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListCommitComments

func (t *Provider) ListCommitComments(ctx context.Context, owner, repo, sha string, page, perPage int) ([]*CommitComment, error)

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.

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(_ context.Context, _, _ string) ([]*provider.Contributor, error)

ListContributors implements provider.RepoStatsManager.

TencentCode does not expose a contributors list endpoint; this method always returns ErrNotImplemented.

func (*Provider) ListEmails added in v0.99.8

func (p *Provider) ListEmails(ctx context.Context) ([]*EmailInfo, error)

ListEmails implements TencentCodeAccountExtras.

func (*Provider) ListForks

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

ListForks implements provider.RepoStatsManager.

TencentCode does not expose a forks list endpoint; this method always returns ErrNotImplemented.

func (*Provider) ListGroupMembers added in v0.99.8

func (p *Provider) ListGroupMembers(ctx context.Context, groupID int, opts ListGroupMembersOptions) ([]*MemberInfo, error)

ListGroupMembers implements TencentCodeOrgExtras.

func (*Provider) ListGroups added in v0.99.8

func (p *Provider) ListGroups(ctx context.Context, opts ListGroupsOptions) ([]*GroupInfo, error)

ListGroups implements TencentCodeOrgExtras.

func (*Provider) ListIssueComments

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

ListIssueComments implements provider.IssueManager via the notes API, exhausting 工蜂's pagination (the loop 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 (labels.go owns the model conversion; IDs stay zero because the gongfeng Label model has none), exhausting pagination.

func (*Provider) ListIssues

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

ListIssues implements provider.IssueManager. State and the Labels csv pass through as filters (open→opened per 工蜂's vocabulary; inbound convertIssue maps back); the Assignee filter is not carried (registered above — the endpoint takes no assignee filter).

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

func (*Provider) ListMilestones

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

ListMilestones implements provider.MilestoneManager.

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) ListNamespaces added in v0.99.8

func (p *Provider) ListNamespaces(ctx context.Context, opts ListNamespacesOptions) ([]*NamespaceInfo, error)

ListNamespaces implements TencentCodeOrgExtras.

func (*Provider) ListNotes added in v0.99.8

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

ListNotes implements provider.NoteManager: every merge-request note, oldest first across all pages. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListOwnedProjects added in v0.99.8

func (p *Provider) ListOwnedProjects(ctx context.Context, page, perPage int) ([]*provider.PlatformRepo, error)

ListOwnedProjects implements TencentCodeAccountExtras.

func (*Provider) ListProjectEvents added in v0.99.8

func (p *Provider) ListProjectEvents(ctx context.Context, owner, repo string, opts ListProjectEventsOptions) ([]*ProjectEventInfo, error)

ListProjectEvents implements TencentCodeProjectExtras.

func (*Provider) ListProjectShares added in v0.99.8

func (p *Provider) ListProjectShares(ctx context.Context, owner, repo string) ([]*ProjectShareInfo, error)

ListProjectShares implements TencentCodeProjectExtras.

func (*Provider) ListProjectStars added in v0.99.8

func (p *Provider) ListProjectStars(ctx context.Context, owner, repo string, page, perPage int) ([]*StarInfo, error)

ListProjectStars implements TencentCodeProjectExtras.

func (*Provider) ListProtectedBranchMembers

func (t *Provider) ListProtectedBranchMembers(ctx context.Context, owner, repo, branch string) ([]*ProtectedBranchMember, error)

func (*Provider) ListReleases

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

ListReleases implements provider.ReleaseManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListRepos

ListRepos implements provider.RepoManager.

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

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

ListReviews implements provider.ReviewManager by listing the change request's merge-request notes. The collection can mix in 工蜂's system bookkeeping notes ("milestone removed" and the like); those are not reviews and are filtered out. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100) — the same fetch ListCRComments uses.

func (*Provider) ListSSHKeys added in v0.99.8

func (p *Provider) ListSSHKeys(ctx context.Context) ([]*SSHKeyInfo, error)

ListSSHKeys implements TencentCodeAccountExtras.

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 (工蜂's page-size ceiling is 100).

func (*Provider) ListTags

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

ListTags implements provider.ReleaseManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

func (*Provider) ListUsers added in v0.99.8

func (p *Provider) ListUsers(ctx context.Context, opts ListUsersOptions) ([]*provider.CRUser, error)

ListUsers implements TencentCodeAccountExtras.

func (*Provider) ListWatchedProjects added in v0.99.8

func (p *Provider) ListWatchedProjects(ctx context.Context, page, perPage int) ([]*provider.PlatformRepo, error)

ListWatchedProjects implements TencentCodeAccountExtras.

func (*Provider) ListWatchers added in v0.99.8

func (p *Provider) ListWatchers(ctx context.Context, owner, repo string, page, perPage int) ([]*WatcherInfo, error)

ListWatchers implements TencentCodeProjectExtras.

func (*Provider) ListWebhooks

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

ListWebhooks implements provider.WebhookManager. The endpoint has no caller-facing pagination knobs, so every page is fetched via AllPages (工蜂's page-size ceiling is 100).

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)

func (*Provider) Platform

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

Platform implements provider.Provider.

func (*Provider) ProtectBranch

func (t *Provider) ProtectBranch(ctx context.Context, owner, repo, branch string, opts ProtectBranchOptions) error

func (*Provider) RemoveCodeReviewer

func (t *Provider) RemoveCodeReviewer(ctx context.Context, owner, repo string, reviewID int, reviewerID string) error

func (*Provider) RemoveCollaborator added in v0.99.8

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

RemoveCollaborator implements provider.CollaboratorManager via the username→ID resolution (the members API is ID-addressed).

func (*Provider) RemoveIssueLabel

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

RemoveIssueLabel implements provider.IssueManager. 工蜂's update surface takes the full label set only (no remove_labels), so the current set is fetched, the name filtered out, and the remainder rewritten. Registered limitation: removing the issue's only label yields an empty csv that omitempty drops from the PUT body, so the update is a no-op and the label stays.

func (*Provider) RemoveMRReviewer

func (t *Provider) RemoveMRReviewer(ctx context.Context, owner, repo string, mrNumber int, reviewerID int) error

func (*Provider) RemoveProtectedBranchMember

func (t *Provider) RemoveProtectedBranchMember(ctx context.Context, owner, repo, branch string, userID int) error

func (*Provider) ReopenCR

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

ReopenCR implements provider.ChangeRequestManager.

func (*Provider) ReopenCodeReview

func (t *Provider) ReopenCodeReview(ctx context.Context, owner, repo string, reviewID int) error

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

func (t *Provider) ReopenMRReview(ctx context.Context, owner, repo string, mrNumber int) error

func (*Provider) RequestReviewers

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

RequestReviewers implements provider.ReviewManager as a registered ignore.

Registered mapping: IGNORED. 工蜂's merge-request update surface cannot add reviewers (gongfeng's UpdateMergeRequestOptions carries no reviewer field), and the native invite endpoint addresses reviewers by numeric user ID (InviteMRReviewer's reviewer_id) while the SDK's callers supply usernames — the Users API offers no by-username lookup to bridge them (the same class of limitation as CreateIssue's ignored Assignees). The call therefore succeeds without effect and touches no wire.

func (*Provider) ResolveUsernames

func (p *Provider) ResolveUsernames(ctx context.Context, usernames []string) ([]*provider.CRUser, error)

ResolveUsernames implements provider.UserManager.

func (*Provider) ShareProject added in v0.99.8

func (p *Provider) ShareProject(ctx context.Context, owner, repo string, opts ShareProjectOptions) error

ShareProject implements TencentCodeProjectExtras.

func (*Provider) StarProject added in v0.99.8

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

StarProject implements TencentCodeProjectExtras.

func (*Provider) SubmitCodeReview

func (t *Provider) SubmitCodeReview(ctx context.Context, owner, repo string, reviewID int, opts SubmitReviewOptions) error

func (*Provider) SubmitMRReview

func (t *Provider) SubmitMRReview(ctx context.Context, owner, repo string, mrNumber int, opts SubmitReviewOptions) error

func (*Provider) TestConnection

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

TestConnection implements provider.Provider.

func (*Provider) UnprotectBranch

func (t *Provider) UnprotectBranch(ctx context.Context, owner, repo, branch string) error

func (*Provider) UnstarProject added in v0.99.8

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

UnstarProject implements TencentCodeProjectExtras.

func (*Provider) UnwatchProject added in v0.99.8

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

UnwatchProject implements TencentCodeProjectExtras.

func (*Provider) UpdateBranchProtection added in v0.99.8

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

UpdateBranchProtection implements provider.BranchProtectionManager via the same protect PUT (upsert). Nil fields stay off the wire so they are left unchanged; AllowForcePushes is write-only on this platform — a successful update cannot be read back through the detail payload.

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.

Tencent Code's API no longer supports setting labels via UpdateMergeRequest.

func (*Provider) UpdateCodeReview

func (t *Provider) UpdateCodeReview(ctx context.Context, owner, repo string, reviewID int, opts UpdateCodeReviewOptions) (*CodeReview, error)

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. Empty option fields stay absent from the PUT body, leaving the issue unchanged; state changes travel as 工蜂's state_event verbs. opts.Assignees resolves to the assignee_ids csv through the Users API (see CreateIssue).

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 via the notes API. 工蜂 addresses issue notes through the issue, so number must carry the issue's number; 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. The current name travels in the update body as 工蜂's addressing key; nil fields in opts stay absent from the PUT body, leaving the label unchanged.

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 gongfeng's state_event verb.

func (*Provider) UpdateNote added in v0.99.8

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

UpdateNote implements provider.NoteManager. 工蜂 is GitLab-family: MR notes and issue notes live in separate iid namespaces, and IssueManager's comment methods target the Issues Notes API, which 404s for merge requests — CR comment edits must go through the MergeRequest Notes API.

func (*Provider) UpdateProtectedBranchMember

func (t *Provider) UpdateProtectedBranchMember(ctx context.Context, owner, repo, branch string, userID int, opts ProtectedBranchMemberOptions) error

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 the registered list-scan detour: resolve the release ID by tag, then PUT. Registration: the platform's update surface accepts only a description, so UpdateReleaseOptions.Name, .Draft, and .Prerelease are ignored on this platform — only Body is carried. An update carrying nothing (Body nil, the only field forwarded) short-circuits to the GetReleaseByTag result instead of PUTting an empty update body.

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. 工蜂'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 families).

func (*Provider) ValidateWebhookSignature

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

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.

func (*Provider) WatchProject added in v0.99.8

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

WatchProject implements TencentCodeProjectExtras.

type ReviewerEvent

type ReviewerEvent string

ReviewerEvent is the verdict a reviewer submits for a code review or MR review.

const (
	ReviewEventComment       ReviewerEvent = "comment"
	ReviewEventApprove       ReviewerEvent = "approve"
	ReviewEventRequireChange ReviewerEvent = "require_change"
	ReviewEventDeny          ReviewerEvent = "deny"
)

type SSHKeyInfo added in v0.99.8

type SSHKeyInfo struct {
	ID        int       `json:"id"`
	Title     string    `json:"title"`
	Key       string    `json:"key"`
	CreatedAt time.Time `json:"created_at"`
}

SSHKeyInfo is a registered SSH public key.

type SessionInfo added in v0.99.8

type SessionInfo struct {
	ID           int    `json:"id"`
	Username     string `json:"username"`
	Email        string `json:"email"`
	Name         string `json:"name"`
	PrivateToken string `json:"private_token"`
	AvatarURL    string `json:"avatar_url"`
}

SessionInfo is the session payload returned by a successful login; the PrivateToken is the credential the rest of the API authenticates with.

type ShareProjectOptions added in v0.99.8

type ShareProjectOptions struct {
	GroupID     int
	GroupAccess gongfeng.AccessLevelValue
}

ShareProjectOptions are the ShareProject inputs. GroupAccess uses the gongfeng AccessLevel* constants.

type StarInfo added in v0.99.8

type StarInfo struct {
	Username string `json:"username"`
	Name     string `json:"name"`
}

StarInfo is a project stargazer as the backend surfaces it.

type SubmitReviewOptions

type SubmitReviewOptions struct {
	Event   ReviewerEvent
	Summary string
}

SubmitReviewOptions submits a reviewer verdict with a summary.

type TagDetail added in v0.99.8

type TagDetail struct {
	Name      string    `json:"name"`
	Message   string    `json:"message"`
	CommitSHA string    `json:"commit_sha"`
	CreatedAt time.Time `json:"created_at"`
}

TagDetail is a single tag with its message and target commit.

type TencentCodeAccountExtras added in v0.99.8

type TencentCodeAccountExtras interface {
	// GetSession exchanges a login (username or email) + password for the
	// account's private token. Bootstrap only — see above.
	GetSession(ctx context.Context, login, password string) (*SessionInfo, error)
	// GetCurrentUser returns the token owner's detailed profile.
	GetCurrentUser(ctx context.Context) (*UserDetailInfo, error)
	// GetUserDetail returns one user's detailed profile by numeric ID.
	GetUserDetail(ctx context.Context, userID int) (*UserDetailInfo, error)
	// ListWatchedProjects lists the projects the token's user watches
	// (0 = all pages, budget-capped), as PlatformRepo summaries.
	ListWatchedProjects(ctx context.Context, page, perPage int) ([]*provider.PlatformRepo, error)

	// ListSSHKeys lists the account's registered SSH keys.
	ListSSHKeys(ctx context.Context) ([]*SSHKeyInfo, error)
	// CreateSSHKey registers an SSH public key under a display title.
	CreateSSHKey(ctx context.Context, title, key string) (*SSHKeyInfo, error)
	// DeleteSSHKey removes an SSH key by numeric ID.
	DeleteSSHKey(ctx context.Context, keyID int) error

	// ListEmails lists the account's registered email addresses.
	ListEmails(ctx context.Context) ([]*EmailInfo, error)
	// CreateEmail registers an email address.
	CreateEmail(ctx context.Context, email string) (*EmailInfo, error)
	// GetEmail fetches one email address by numeric ID.
	GetEmail(ctx context.Context, emailID int) (*EmailInfo, error)
	// DeleteEmail removes an email address by numeric ID.
	DeleteEmail(ctx context.Context, emailID int) error

	// ListUsers walks the platform user directory (0 = all pages,
	// budget-capped); Search narrows by username/name.
	ListUsers(ctx context.Context, opts ListUsersOptions) ([]*provider.CRUser, error)
	// GetUserByEmail resolves one user by registered email address.
	GetUserByEmail(ctx context.Context, email string) (*provider.CRUser, error)

	// ListOwnedProjects walks the projects the token's user owns
	// (0 = all pages, budget-capped), as PlatformRepo summaries.
	ListOwnedProjects(ctx context.Context, page, perPage int) ([]*provider.PlatformRepo, error)
}

TencentCodeAccountExtras exposes the 工蜂 account surface: the session login that exchanges credentials for a private token, the current user's detail, watched projects, and SSH-key/email management. Consumers type-assert:

if ax, ok := p.(tencentcode.TencentCodeAccountExtras); ok { ... }

GetSession handles credentials directly and exists only for bootstrap flows (a consumer provisioning its first token); callers that already hold a token should never route passwords through it.

type TencentCodeExtras

type TencentCodeExtras interface {
	// --- Native code review (/review) ---
	CreateCodeReview(ctx context.Context, owner, repo string, opts CreateCodeReviewOptions) (*CodeReview, error)
	ListCodeReviews(ctx context.Context, owner, repo string, opts ListCodeReviewsOptions) ([]*CodeReview, error)
	GetCodeReview(ctx context.Context, owner, repo string, reviewID int) (*CodeReview, error)
	UpdateCodeReview(ctx context.Context, owner, repo string, reviewID int, opts UpdateCodeReviewOptions) (*CodeReview, error)
	InviteCodeReviewer(ctx context.Context, owner, repo string, reviewID int, opts InviteReviewerOptions) error
	RemoveCodeReviewer(ctx context.Context, owner, repo string, reviewID int, reviewerID string) error
	SubmitCodeReview(ctx context.Context, owner, repo string, reviewID int, opts SubmitReviewOptions) error
	ReopenCodeReview(ctx context.Context, owner, repo string, reviewID int) error
	GetCodeReviewChangedFiles(ctx context.Context, owner, repo string, reviewID int) ([]*provider.ChangedFile, error)

	// --- MR review workflow (/merge_request/{iid}/review*) ---
	GetMRReview(ctx context.Context, owner, repo string, mrNumber int) (*MRReview, error)
	InviteMRReviewer(ctx context.Context, owner, repo string, mrNumber int, opts InviteReviewerOptions) error
	RemoveMRReviewer(ctx context.Context, owner, repo string, mrNumber int, reviewerID int) error
	CancelMRReview(ctx context.Context, owner, repo string, mrNumber int) error
	SubmitMRReview(ctx context.Context, owner, repo string, mrNumber int, opts SubmitReviewOptions) error
	ReopenMRReview(ctx context.Context, owner, repo string, mrNumber int) error

	// --- Commit-level ops (/repository/commits/{sha}) ---
	GetCommitDiff(ctx context.Context, owner, repo, sha string, opts CommitDiffOptions) ([]*provider.ChangedFile, error)
	ListCommitComments(ctx context.Context, owner, repo, sha string, page, perPage int) ([]*CommitComment, error)
	CreateCommitComment(ctx context.Context, owner, repo, sha string, opts CreateCommitCommentOptions) (*CommitComment, error)
	GetCommitRefs(ctx context.Context, owner, repo, sha string, refType CommitRefType) (*CommitRefs, error)
	// GetCommitRawFile streams the raw content of one file as of a commit
	// (commit-scoped variant of GetRawFile).
	GetCommitRawFile(ctx context.Context, owner, repo, sha, path string) ([]byte, error)

	// --- Repository tree & blob ---
	GetRepoTree(ctx context.Context, owner, repo, path, ref string, recursive bool) ([]*TreeEntryNode, error)
	GetBlob(ctx context.Context, owner, repo, sha string) ([]byte, error)
	// GetBranch fetches a single branch with its head commit and
	// protection flag (the core BranchManager only lists).
	GetBranch(ctx context.Context, owner, repo, branch string) (*BranchInfo, error)
	// GetRawFile streams the raw (undecoded) file content at a ref —
	// unlike GetFileContent, no base64 round trip and no size decode.
	GetRawFile(ctx context.Context, owner, repo, ref, path string) ([]byte, error)
	// DownloadCompareChangedFiles streams a zip of the changed files
	// between two refs.
	DownloadCompareChangedFiles(ctx context.Context, owner, repo, from, to string, w io.Writer) error

	// --- Branch protection ---
	ProtectBranch(ctx context.Context, owner, repo, branch string, opts ProtectBranchOptions) error
	UnprotectBranch(ctx context.Context, owner, repo, branch string) error
	ListProtectedBranchMembers(ctx context.Context, owner, repo, branch string) ([]*ProtectedBranchMember, error)
	AddProtectedBranchMember(ctx context.Context, owner, repo, branch string, opts ProtectedBranchMemberOptions) error
	UpdateProtectedBranchMember(ctx context.Context, owner, repo, branch string, userID int, opts ProtectedBranchMemberOptions) error
	RemoveProtectedBranchMember(ctx context.Context, owner, repo, branch string, userID int) error
}

TencentCodeExtras exposes Tencent 工蜂-specific capabilities that are not part of the cross-platform Provider interface (native code reviews, MR review workflow, commit-level comments/diff, repository tree/blob and branch protection). Obtain it via type assertion:

p, _ := provider.NewProvider(provider.Config{Platform: provider.PlatformTencentCode, Token: t})
if tc, ok := p.(provider.TencentCodeExtras); ok {
    tc.SubmitCodeReview(ctx, owner, repo, reviewID, opts)
}

type TencentCodeOrgExtras added in v0.99.8

type TencentCodeOrgExtras interface {
	// ListGroups walks the group list (0 = all pages, budget-capped).
	ListGroups(ctx context.Context, opts ListGroupsOptions) ([]*GroupInfo, error)
	// GetGroup fetches one group by numeric ID.
	GetGroup(ctx context.Context, groupID int) (*GroupInfo, error)
	// CreateGroup creates a project group.
	CreateGroup(ctx context.Context, opts CreateGroupOptions) (*GroupInfo, error)
	// EditGroup updates a group's editable fields.
	EditGroup(ctx context.Context, groupID int, opts EditGroupOptions) (*GroupInfo, error)
	// DeleteGroup removes a group.
	DeleteGroup(ctx context.Context, groupID int) error
	// ListGroupMembers walks a group's member list (0 = all pages).
	ListGroupMembers(ctx context.Context, groupID int, opts ListGroupMembersOptions) ([]*MemberInfo, error)
	// AddGroupMember adds a user to the group at the given access level
	// (gongfeng AccessLevel* constants).
	AddGroupMember(ctx context.Context, groupID int, opts AddGroupMemberOptions) (*MemberInfo, error)
	// EditGroupMember changes a member's access level.
	EditGroupMember(ctx context.Context, groupID, userID int, opts EditGroupMemberOptions) (*MemberInfo, error)
	// DeleteGroupMember removes a member from the group.
	DeleteGroupMember(ctx context.Context, groupID, userID int) error
	// ListNamespaces walks the namespaces visible to the token
	// (0 = all pages); Search narrows by name/path.
	ListNamespaces(ctx context.Context, opts ListNamespacesOptions) ([]*NamespaceInfo, error)
}

TencentCodeOrgExtras exposes the 工蜂 organization surface the unified provider contract does not model: project-group (项目组) CRUD plus group member management, and namespace lookup for resolving where new projects can live. Consumers type-assert:

if ox, ok := p.(tencentcode.TencentCodeOrgExtras); ok { ... }

Group IDs are the platform's numeric group identifiers (visible in the web URL), not "owner" strings. Member mutations take numeric user IDs — resolve usernames through provider.UsersManager.ResolveUsernames first.

type TencentCodeProjectExtras added in v0.99.8

type TencentCodeProjectExtras interface {
	// ListWatchers lists a project's watchers.
	ListWatchers(ctx context.Context, owner, repo string, page, perPage int) ([]*WatcherInfo, error)
	// GetWatchStatus reports whether the token's user watches the project.
	GetWatchStatus(ctx context.Context, owner, repo string) (bool, error)
	// WatchProject makes the token's user watch the project.
	WatchProject(ctx context.Context, owner, repo string) (*WatcherInfo, error)
	// UnwatchProject removes the token's user's watch.
	UnwatchProject(ctx context.Context, owner, repo string) error

	// StarProject stars the project (reports the previous state).
	StarProject(ctx context.Context, owner, repo string) (bool, error)
	// UnstarProject removes the token's user's star.
	UnstarProject(ctx context.Context, owner, repo string) error
	// GetStarStatus reports whether the token's user starred the project.
	GetStarStatus(ctx context.Context, owner, repo string) (bool, error)
	// ListProjectStars lists the project's stargazers.
	ListProjectStars(ctx context.Context, owner, repo string, page, perPage int) ([]*StarInfo, error)

	// CreateForkRelation links this project to the upstream project ID it
	// was forked from; DeleteForkRelation removes the link.
	CreateForkRelation(ctx context.Context, owner, repo string, forkedFromID int) error
	DeleteForkRelation(ctx context.Context, owner, repo string) error

	// CreateTag creates a lightweight/annotated tag at Ref; GetTag fetches
	// one tag; DeleteTag removes it. (ReleaseManager.ListTags only reads.)
	CreateTag(ctx context.Context, owner, repo string, opts CreateTagOptions) (*TagDetail, error)
	GetTag(ctx context.Context, owner, repo, tag string) (*TagDetail, error)
	DeleteTag(ctx context.Context, owner, repo, tag string) error

	// ShareProject grants a group access to the project; ListProjectShares
	// lists the grants; DeleteProjectShare revokes one by group ID.
	ShareProject(ctx context.Context, owner, repo string, opts ShareProjectOptions) error
	ListProjectShares(ctx context.Context, owner, repo string) ([]*ProjectShareInfo, error)
	DeleteProjectShare(ctx context.Context, owner, repo string, groupID int) error

	// ListProjectEvents lists the project's activity feed.
	ListProjectEvents(ctx context.Context, owner, repo string, opts ListProjectEventsOptions) ([]*ProjectEventInfo, error)

	// GetProjectMember fetches one member by numeric user ID.
	GetProjectMember(ctx context.Context, owner, repo string, userID int) (*MemberInfo, error)
	// EditProjectMember changes a member's access level (gongfeng
	// AccessLevel* constants).
	EditProjectMember(ctx context.Context, owner, repo string, userID int, opts EditProjectMemberOptions) (*MemberInfo, error)
}

TencentCodeProjectExtras exposes the 工蜂 project-level surfaces the unified provider contract does not model: watchers (关注人), stars, fork-relation management, direct tag writes, project↔group shares, and the activity feed. Consumers type-assert:

if px, ok := p.(tencentcode.TencentCodeProjectExtras); ok { ... }

All list methods take page/perPage ints; perPage <= 0 uses the platform default and page <= 0 is treated as 1 by the platform.

type TreeEntryNode

type TreeEntryNode struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"` // "tree" or "blob"
	Mode string `json:"mode"`
	Path string `json:"path"`
}

TreeEntryNode represents a single entry in a repository tree listing.

type UpdateCodeReviewOptions

type UpdateCodeReviewOptions struct {
	Title       string
	Description string
}

UpdateCodeReviewOptions updates a code review's title/description.

type UserDetailInfo added in v0.99.8

type UserDetailInfo struct {
	ID         int       `json:"id"`
	Username   string    `json:"username"`
	Name       string    `json:"name"`
	Email      string    `json:"email"`
	Bio        string    `json:"bio"`
	Admin      bool      `json:"admin"`
	State      string    `json:"state"`
	WebURL     string    `json:"web_url"`
	AvatarURL  string    `json:"avatar_url"`
	CreatedAt  time.Time `json:"created_at"`
	ProjectLim int       `json:"projects_limit"`
}

UserDetailInfo is a user profile with the detail-only fields.

type WatcherInfo added in v0.99.8

type WatcherInfo struct {
	Username string `json:"username"`
	Name     string `json:"name"`
	Mute     bool   `json:"mute"`
}

WatcherInfo is a project watcher as the backend surfaces it.

Jump to

Keyboard shortcuts

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