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 ¶
- func Divergences() []provider.Divergence
- func New(cfg provider.Config) (provider.Provider, error)
- type AddGroupMemberOptions
- type BranchInfo
- type CodeReview
- type CommitComment
- type CommitDiffOptions
- type CommitRefType
- type CommitRefs
- type CreateCodeReviewOptions
- type CreateCommitCommentOptions
- type CreateGroupOptions
- type CreateTagOptions
- type EditGroupMemberOptions
- type EditGroupOptions
- type EditProjectMemberOptions
- type EmailInfo
- type GroupInfo
- type InviteReviewerOptions
- type ListCodeReviewsOptions
- type ListGroupMembersOptions
- type ListGroupsOptions
- type ListNamespacesOptions
- type ListProjectEventsOptions
- type ListUserIssuesOptions
- type ListUsersOptions
- type MRReview
- type MemberInfo
- type NamespaceInfo
- type ProjectEventInfo
- type ProjectShareInfo
- type ProtectBranchOptions
- type ProtectedBranchMember
- type ProtectedBranchMemberOptions
- type Provider
- func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, ...) error
- func (p *Provider) AddGroupMember(ctx context.Context, groupID int, opts AddGroupMemberOptions) (*MemberInfo, error)
- func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
- func (t *Provider) AddProtectedBranchMember(ctx context.Context, owner, repo, branch string, ...) error
- func (t *Provider) CancelMRReview(ctx context.Context, owner, repo string, mrNumber int) error
- func (p *Provider) Capabilities() provider.CapabilitySet
- func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*model.ChangeRequest, error)
- func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*model.Issue, error)
- func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*model.CompareResult, error)
- func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*model.PlatformBranch, error)
- func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, ...) (*model.BranchProtection, error)
- func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*model.ChangeRequest, error)
- func (t *Provider) CreateCodeReview(ctx context.Context, owner, repo string, opts CreateCodeReviewOptions) (*CodeReview, error)
- func (t *Provider) CreateCommitComment(ctx context.Context, owner, repo, sha string, opts CreateCommitCommentOptions) (*CommitComment, error)
- func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, ...) error
- func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, ...) (string, error)
- func (p *Provider) CreateEmail(ctx context.Context, email string) (*EmailInfo, error)
- func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*model.FileResult, error)
- func (p *Provider) CreateForkRelation(ctx context.Context, owner, repo string, forkedFromID int) error
- func (p *Provider) CreateGroup(ctx context.Context, opts CreateGroupOptions) (*GroupInfo, error)
- func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*model.Issue, error)
- func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*model.IssueComment, error)
- func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*model.Label, error)
- func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*model.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) (*model.ReleaseInfo, error)
- func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*model.PlatformRepo, error)
- func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, ...) (*model.ReviewResult, error)
- func (p *Provider) CreateSSHKey(ctx context.Context, title, key string) (*SSHKeyInfo, error)
- func (p *Provider) CreateTag(ctx context.Context, owner, repo string, opts CreateTagOptions) (*TagDetail, error)
- func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*model.PlatformWebhook, error)
- func (p *Provider) DeleteBranch(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteBranchProtection(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteEmail(ctx context.Context, emailID int) error
- func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*model.FileResult, error)
- func (p *Provider) DeleteForkRelation(ctx context.Context, owner, repo string) error
- func (p *Provider) DeleteGroup(ctx context.Context, groupID int) error
- func (p *Provider) DeleteGroupMember(ctx context.Context, groupID, userID int) 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) DeleteProjectShare(ctx context.Context, owner, repo string, groupID int) 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) DeleteSSHKey(ctx context.Context, keyID int) error
- func (p *Provider) DeleteTag(ctx context.Context, owner, repo, tag 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) DownloadCommitReviewChangedFiles(ctx context.Context, owner, repo string, reviewID int, w io.Writer) error
- func (t *Provider) DownloadCompareChangedFiles(ctx context.Context, owner, repo, from, to string, w io.Writer) error
- func (p *Provider) DownloadMergeRequestChangedFiles(ctx context.Context, owner, repo string, mrNumber int, w io.Writer) error
- func (p *Provider) EditGroup(ctx context.Context, groupID int, opts EditGroupOptions) (*GroupInfo, error)
- func (p *Provider) EditGroupMember(ctx context.Context, groupID, userID int, opts EditGroupMemberOptions) (*MemberInfo, error)
- func (p *Provider) EditProjectMember(ctx context.Context, owner, repo string, userID int, ...) (*MemberInfo, error)
- func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*model.PlatformRepo, error)
- func (p *Provider) GetArchive(ctx context.Context, owner, repo, ref, format string) ([]byte, error)
- func (t *Provider) GetBlob(ctx context.Context, owner, repo, sha string) ([]byte, error)
- func (t *Provider) GetBranch(ctx context.Context, owner, repo, branch string) (*BranchInfo, error)
- func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*model.BranchProtection, error)
- func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*model.ChangeRequest, error)
- func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*model.MergeDiff, error)
- func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*model.ChangedFile, error)
- func (t *Provider) GetCodeReview(ctx context.Context, owner, repo string, reviewID int) (*CodeReview, error)
- func (t *Provider) GetCodeReviewChangedFiles(ctx context.Context, owner, repo string, reviewID int) ([]*model.ChangedFile, error)
- func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*model.CommitInfo, error)
- func (t *Provider) GetCommitDiff(ctx context.Context, owner, repo, sha string, opts CommitDiffOptions) ([]*model.ChangedFile, error)
- func (t *Provider) GetCommitRawFile(ctx context.Context, owner, repo, sha, path string) ([]byte, error)
- func (t *Provider) GetCommitRefs(ctx context.Context, owner, repo, sha string, refType CommitRefType) (*CommitRefs, error)
- func (p *Provider) GetCurrentUser(ctx context.Context) (*UserDetailInfo, error)
- func (p *Provider) GetEmail(ctx context.Context, emailID int) (*EmailInfo, error)
- func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
- func (p *Provider) GetGroup(ctx context.Context, groupID int) (*GroupInfo, error)
- func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*model.Issue, error)
- func (p *Provider) GetIssueSubscription(ctx context.Context, owner, repo string, issueID int) (bool, error)
- func (t *Provider) GetMRReview(ctx context.Context, owner, repo string, mrNumber int) (*MRReview, error)
- func (p *Provider) GetMRSubscription(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
- func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*model.Milestone, error)
- func (p *Provider) GetProjectMember(ctx context.Context, owner, repo string, userID int) (*MemberInfo, error)
- func (t *Provider) GetRawFile(ctx context.Context, owner, repo, ref, path string) ([]byte, error)
- func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*model.ReleaseInfo, error)
- func (p *Provider) GetRepo(ctx context.Context, owner, repo string) (*model.PlatformRepo, error)
- func (t *Provider) GetRepoTree(ctx context.Context, owner, repo, path, ref string, recursive bool) ([]*TreeEntryNode, error)
- func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*model.Review, error)
- func (p *Provider) GetSSHKey(ctx context.Context, keyID int) (*SSHKeyInfo, error)
- func (p *Provider) GetSession(ctx context.Context, login, password string) (*SessionInfo, error)
- func (p *Provider) GetStarStatus(ctx context.Context, owner, repo string) (bool, error)
- func (p *Provider) GetTag(ctx context.Context, owner, repo, tag string) (*TagDetail, error)
- func (p *Provider) GetUser(ctx context.Context, username string) (*model.CRUser, error)
- func (p *Provider) GetUserByEmail(ctx context.Context, email string) (*model.CRUser, error)
- func (p *Provider) GetUserDetail(ctx context.Context, userID int) (*UserDetailInfo, error)
- func (p *Provider) GetWatchStatus(ctx context.Context, owner, repo string) (bool, error)
- func (p *Provider) GetWebhook(ctx context.Context, owner, repo string, webhookID int64) (*model.PlatformWebhook, error)
- func (t *Provider) InviteCodeReviewer(ctx context.Context, owner, repo string, reviewID int, ...) error
- func (t *Provider) InviteMRReviewer(ctx context.Context, owner, repo string, mrNumber int, ...) error
- func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*model.BranchProtection, error)
- func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*model.PlatformBranch, error)
- func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*model.CRComment, error)
- func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*model.CRCommit, error)
- func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*model.ChangeRequest, *int, error)
- func (t *Provider) ListCodeReviews(ctx context.Context, owner, repo string, opts ListCodeReviewsOptions) ([]*CodeReview, error)
- func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*model.Collaborator, error)
- func (t *Provider) ListCommitComments(ctx context.Context, owner, repo, sha string, page, perPage int) ([]*CommitComment, error)
- func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]model.CommitStatus, error)
- func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*model.CommitInfo, error)
- func (p *Provider) ListContributors(_ context.Context, _, _ string) ([]*model.Contributor, error)
- func (p *Provider) ListEmails(ctx context.Context) ([]*EmailInfo, error)
- func (p *Provider) ListForks(_ context.Context, _, _ string) ([]*model.PlatformRepo, error)
- func (p *Provider) ListGroupMembers(ctx context.Context, groupID int, opts ListGroupMembersOptions) ([]*MemberInfo, error)
- func (p *Provider) ListGroups(ctx context.Context, opts ListGroupsOptions) ([]*GroupInfo, error)
- func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*model.IssueComment, error)
- func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*model.IssueLabel, error)
- func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*model.Issue, int, error)
- func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*model.Label, error)
- func (p *Provider) ListMilestoneIssues(ctx context.Context, owner, repo string, milestoneID, page, perPage int) ([]*model.Issue, error)
- func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]model.Milestone, error)
- func (p *Provider) ListNamespaces(ctx context.Context, opts ListNamespacesOptions) ([]*NamespaceInfo, error)
- func (p *Provider) ListNotes(ctx context.Context, owner, repo, number string) ([]*model.IssueComment, error)
- func (p *Provider) ListOwnedProjects(ctx context.Context, page, perPage int) ([]*model.PlatformRepo, error)
- func (p *Provider) ListProjectEvents(ctx context.Context, owner, repo string, opts ListProjectEventsOptions) ([]*ProjectEventInfo, error)
- func (p *Provider) ListProjectShares(ctx context.Context, owner, repo string) ([]*ProjectShareInfo, error)
- func (p *Provider) ListProjectStars(ctx context.Context, owner, repo string, page, perPage int) ([]*StarInfo, error)
- func (t *Provider) ListProtectedBranchMembers(ctx context.Context, owner, repo, branch string) ([]*ProtectedBranchMember, error)
- func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*model.ReleaseInfo, error)
- func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*model.PlatformRepo, error)
- func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]model.Review, error)
- func (p *Provider) ListSSHKeys(ctx context.Context) ([]*SSHKeyInfo, error)
- func (p *Provider) ListStargazers(ctx context.Context, owner, repo string) ([]*model.CRUser, error)
- func (p *Provider) ListTags(ctx context.Context, owner, repo string) ([]*model.TagInfo, error)
- func (p *Provider) ListUserIssues(ctx context.Context, opts ListUserIssuesOptions) ([]*model.Issue, error)
- func (p *Provider) ListUsers(ctx context.Context, opts ListUsersOptions) ([]*model.CRUser, error)
- func (p *Provider) ListWatchedProjects(ctx context.Context, page, perPage int) ([]*model.PlatformRepo, error)
- func (p *Provider) ListWatchers(ctx context.Context, owner, repo string, page, perPage int) ([]*WatcherInfo, error)
- func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*model.PlatformWebhook, error)
- func (p *Provider) MergeCR(ctx context.Context, owner, repo, number string, opts provider.MergeCROptions) (*model.ChangeRequest, error)
- func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*model.NormalizedEvent, error)
- func (p *Provider) Platform() model.Platform
- func (t *Provider) ProtectBranch(ctx context.Context, owner, repo, branch string, opts ProtectBranchOptions) error
- func (t *Provider) RemoveCodeReviewer(ctx context.Context, owner, repo string, reviewID int, reviewerID string) error
- 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 (t *Provider) RemoveMRReviewer(ctx context.Context, owner, repo string, mrNumber int, reviewerID int) error
- func (t *Provider) RemoveProtectedBranchMember(ctx context.Context, owner, repo, branch string, userID int) error
- func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*model.ChangeRequest, error)
- func (t *Provider) ReopenCodeReview(ctx context.Context, owner, repo string, reviewID int) error
- func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*model.Issue, error)
- func (t *Provider) ReopenMRReview(ctx context.Context, owner, repo string, mrNumber int) error
- func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error
- func (p *Provider) ResolveUsernames(ctx context.Context, usernames []string) ([]*model.CRUser, error)
- func (p *Provider) ShareProject(ctx context.Context, owner, repo string, opts ShareProjectOptions) error
- func (p *Provider) StarProject(ctx context.Context, owner, repo string) (bool, error)
- func (t *Provider) SubmitCodeReview(ctx context.Context, owner, repo string, reviewID int, ...) error
- func (t *Provider) SubmitMRReview(ctx context.Context, owner, repo string, mrNumber int, ...) error
- func (p *Provider) SubscribeIssue(ctx context.Context, owner, repo string, issueID int) error
- func (p *Provider) SubscribeMR(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
- func (p *Provider) TestConnection(ctx context.Context) (*model.TestConnectionResult, error)
- func (t *Provider) UnprotectBranch(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) UnstarProject(ctx context.Context, owner, repo string) error
- func (p *Provider) UnsubscribeIssue(ctx context.Context, owner, repo string, issueID int) error
- func (p *Provider) UnsubscribeMR(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
- func (p *Provider) UnwatchProject(ctx context.Context, owner, repo string) error
- func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, ...) (*model.BranchProtection, error)
- func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*model.ChangeRequest, error)
- func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo, number string, labels []string) error
- func (t *Provider) UpdateCodeReview(ctx context.Context, owner, repo string, reviewID int, ...) (*CodeReview, error)
- func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*model.FileResult, error)
- func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, ...) (*model.Issue, error)
- func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*model.IssueComment, error)
- func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, ...) (*model.Label, error)
- func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, ...) (*model.Milestone, error)
- func (p *Provider) UpdateNote(ctx context.Context, owner, repo, number, noteID, body string) (*model.IssueComment, error)
- func (t *Provider) UpdateProtectedBranchMember(ctx context.Context, owner, repo, branch string, userID int, ...) error
- func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, ...) (*model.ReleaseInfo, error)
- func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*model.PlatformRepo, error)
- func (p *Provider) UpdateWebhook(ctx context.Context, owner, repo string, webhookID int64, ...) (*model.PlatformWebhook, error)
- func (p *Provider) ValidateWebhookSignature(r *http.Request, secret string) error
- func (p *Provider) WatchProject(ctx context.Context, owner, repo string) (*WatcherInfo, error)
- type ReviewerEvent
- type SSHKeyInfo
- type SessionInfo
- type ShareProjectOptions
- type StarInfo
- type SubmitReviewOptions
- type TagDetail
- type TencentCodeAccountExtras
- type TencentCodeExtras
- type TencentCodeOrgExtras
- type TencentCodeProjectExtras
- type TreeEntryNode
- type UpdateCodeReviewOptions
- type UserDetailInfo
- type WatcherInfo
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.
Types ¶
type AddGroupMemberOptions ¶
type AddGroupMemberOptions struct {
UserID int
AccessLevel gongfeng.AccessLevelValue
}
AddGroupMemberOptions are the AddGroupMember inputs. AccessLevel uses the gongfeng AccessLevel* constants (0 = platform default).
type BranchInfo ¶
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 *model.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 *model.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 ¶
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 ¶
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 ¶
CreateGroupOptions are the CreateGroup inputs; Name and Path are required by the platform.
type CreateTagOptions ¶
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 ¶
type EditGroupMemberOptions struct {
AccessLevel gongfeng.AccessLevelValue
}
EditGroupMemberOptions are the EditGroupMember inputs.
type EditGroupOptions ¶
EditGroupOptions are the EditGroup inputs; zero values stay unchanged.
type EditProjectMemberOptions ¶
type EditProjectMemberOptions struct {
AccessLevel gongfeng.AccessLevelValue
}
EditProjectMemberOptions are the EditProjectMember inputs.
type GroupInfo ¶
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 ¶
type ListGroupMembersOptions struct {
Page int // 0 walks every page
PerPage int // 0 = platform default
}
ListGroupMembersOptions are the ListGroupMembers knobs.
type ListGroupsOptions ¶
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 ¶
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 ¶
ListProjectEventsOptions are the ListProjectEvents knobs.
type ListUserIssuesOptions ¶
type ListUserIssuesOptions struct {
// State filters by resolve state ("" = all; "opened"/"closed" in 工蜂's
// vocabulary — the provider's open maps onto "opened").
State string
// Labels is a comma-separated label-name filter.
Labels string
// Page/PerPage are caller-driven pagination (page 0 = first page).
Page int
PerPage int
}
ListUserIssuesOptions carries the filters of the global issue listing.
type ListUsersOptions ¶
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 *model.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 ¶
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 ¶
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 ¶
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 ¶
type ProjectShareInfo struct {
}
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 ¶
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 ¶
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 ¶
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 (*Provider) CancelMRReview ¶
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) (*model.ChangeRequest, error)
CloseCR implements provider.ChangeRequestManager.
func (*Provider) CloseIssue ¶
func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*model.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) (*model.CompareResult, error)
CompareCommits implements provider.CommitManager.
func (*Provider) CreateBranch ¶
func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*model.PlatformBranch, error)
CreateBranch implements provider.BranchManager.
func (*Provider) CreateBranchProtection ¶
func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, opts provider.CreateBranchProtectionOptions) (*model.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 ¶
func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*model.ChangeRequest, error)
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 ¶
CreateEmail implements TencentCodeAccountExtras.
func (*Provider) CreateFile ¶
func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*model.FileResult, error)
CreateFile implements provider.FileManager.
func (*Provider) CreateForkRelation ¶
func (p *Provider) CreateForkRelation(ctx context.Context, owner, repo string, forkedFromID int) error
CreateForkRelation implements TencentCodeProjectExtras.
func (*Provider) CreateGroup ¶
CreateGroup implements TencentCodeOrgExtras.
func (*Provider) CreateIssue ¶
func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*model.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) (*model.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) (*model.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) (*model.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) (*model.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) (*model.PlatformRepo, error)
CreateRepo implements provider.RepoManager.
func (*Provider) CreateReview ¶
func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, opts provider.CreateReviewOptions) (*model.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 ¶
CreateSSHKey implements TencentCodeAccountExtras.
func (*Provider) CreateTag ¶
func (p *Provider) CreateTag(ctx context.Context, owner, repo string, opts CreateTagOptions) (*TagDetail, error)
CreateTag implements TencentCodeProjectExtras.
func (*Provider) CreateWebhook ¶
func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*model.PlatformWebhook, error)
CreateWebhook implements provider.WebhookManager.
func (*Provider) DeleteBranch ¶
DeleteBranch implements provider.BranchManager.
func (*Provider) DeleteBranchProtection ¶
DeleteBranchProtection implements provider.BranchProtectionManager. The platform's unprotect endpoint is a PUT, not a DELETE.
func (*Provider) DeleteEmail ¶
DeleteEmail implements TencentCodeAccountExtras.
func (*Provider) DeleteFile ¶
func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*model.FileResult, error)
DeleteFile implements provider.FileManager.
func (*Provider) DeleteForkRelation ¶
DeleteForkRelation implements TencentCodeProjectExtras.
func (*Provider) DeleteGroup ¶
DeleteGroup implements TencentCodeOrgExtras.
func (*Provider) DeleteGroupMember ¶
DeleteGroupMember implements TencentCodeOrgExtras.
func (*Provider) DeleteIssueComment ¶
func (p *Provider) DeleteIssueComment(ctx context.Context, owner, repo, number string, commentID int64) error
DeleteIssueComment implements provider.IssueManager. 工蜂 addresses issue notes through the issue like its edit endpoint, so number must carry the issue's number. Deletion is permanent; the platform only lets the note's author perform it. The gongfeng SDK does not expose a delete-issue-note endpoint, so we use the SDK client's NewRequest/Do for a raw API call (same pattern as DiffManager.DeleteNote).
func (*Provider) DeleteLabel ¶
DeleteLabel implements provider.LabelManager. The label name travels in the delete body as 工蜂's addressing key.
func (*Provider) DeleteMilestone ¶
DeleteMilestone implements provider.MilestoneManager.
func (*Provider) DeleteNote ¶
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 ¶
DeleteProjectShare implements TencentCodeProjectExtras.
func (*Provider) DeleteRelease ¶
DeleteRelease implements provider.ReleaseManager via the registered list-scan detour: resolve the release ID by tag, then DELETE.
func (*Provider) DeleteRepo ¶
DeleteRepo implements provider.RepoManager.
func (*Provider) DeleteSSHKey ¶
DeleteSSHKey implements TencentCodeAccountExtras.
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 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) DownloadCommitReviewChangedFiles ¶
func (p *Provider) DownloadCommitReviewChangedFiles(ctx context.Context, owner, repo string, reviewID int, w io.Writer) error
DownloadCommitReviewChangedFiles implements TencentCodeExtras.
func (*Provider) DownloadCompareChangedFiles ¶
func (*Provider) DownloadMergeRequestChangedFiles ¶
func (p *Provider) DownloadMergeRequestChangedFiles(ctx context.Context, owner, repo string, mrNumber int, w io.Writer) error
DownloadMergeRequestChangedFiles implements TencentCodeExtras.
func (*Provider) EditGroup ¶
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 ¶
func (p *Provider) EditGroupMember(ctx context.Context, groupID, userID int, opts EditGroupMemberOptions) (*MemberInfo, error)
EditGroupMember implements TencentCodeOrgExtras.
func (*Provider) EditProjectMember ¶
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) (*model.PlatformRepo, error)
ForkRepo implements provider.RepoManager.
func (*Provider) GetArchive ¶
GetArchive implements provider.ReleaseManager.
func (*Provider) GetBranchProtection ¶
func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*model.BranchProtection, error)
GetBranchProtection implements provider.BranchProtectionManager.
func (*Provider) GetCR ¶
func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*model.ChangeRequest, error)
GetCR implements provider.ChangeRequestManager.
func (*Provider) GetCRDiff ¶
func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*model.MergeDiff, error)
GetCRDiff implements provider.DiffManager.
func (*Provider) GetCRFiles ¶
func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*model.ChangedFile, error)
GetCRFiles implements provider.DiffManager.
func (*Provider) GetCodeReview ¶
func (*Provider) GetCodeReviewChangedFiles ¶
func (*Provider) GetCommit ¶
func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*model.CommitInfo, error)
GetCommit implements provider.CommitManager.
func (*Provider) GetCommitDiff ¶
func (t *Provider) GetCommitDiff(ctx context.Context, owner, repo, sha string, opts CommitDiffOptions) ([]*model.ChangedFile, error)
func (*Provider) GetCommitRawFile ¶
func (*Provider) GetCommitRefs ¶
func (t *Provider) GetCommitRefs(ctx context.Context, owner, repo, sha string, refType CommitRefType) (*CommitRefs, error)
func (*Provider) GetCurrentUser ¶
func (p *Provider) GetCurrentUser(ctx context.Context) (*UserDetailInfo, error)
GetCurrentUser 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) GetIssueSubscription ¶
func (p *Provider) GetIssueSubscription(ctx context.Context, owner, repo string, issueID int) (bool, error)
GetIssueSubscription implements TencentCodeExtras.
func (*Provider) GetMRReview ¶
func (*Provider) GetMRSubscription ¶
func (p *Provider) GetMRSubscription(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
GetMRSubscription implements TencentCodeExtras.
func (*Provider) GetMilestone ¶
func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*model.Milestone, error)
GetMilestone implements provider.MilestoneManager.
func (*Provider) GetProjectMember ¶
func (p *Provider) GetProjectMember(ctx context.Context, owner, repo string, userID int) (*MemberInfo, error)
GetProjectMember implements TencentCodeProjectExtras.
func (*Provider) GetRawFile ¶
func (*Provider) GetReleaseByTag ¶
func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*model.ReleaseInfo, error)
GetReleaseByTag implements provider.ReleaseManager via the registered list-scan detour (see findReleaseByTag).
func (*Provider) GetRepoTree ¶
func (*Provider) GetReview ¶
func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*model.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) GetSession ¶
GetSession implements TencentCodeAccountExtras.
func (*Provider) GetStarStatus ¶
GetStarStatus implements TencentCodeProjectExtras.
func (*Provider) GetUserByEmail ¶
GetUserByEmail implements TencentCodeAccountExtras.
func (*Provider) GetUserDetail ¶
GetUserDetail implements TencentCodeAccountExtras.
func (*Provider) GetWatchStatus ¶
GetWatchStatus implements TencentCodeProjectExtras.
func (*Provider) GetWebhook ¶
func (p *Provider) GetWebhook(ctx context.Context, owner, repo string, webhookID int64) (*model.PlatformWebhook, error)
GetWebhook implements provider.WebhookConfigManager.
func (*Provider) InviteCodeReviewer ¶
func (*Provider) InviteMRReviewer ¶
func (*Provider) ListBranchProtections ¶
func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*model.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) ([]*model.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) ([]*model.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) ([]*model.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 ¶
func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*model.ChangeRequest, *int, error)
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 ¶
func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*model.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 (*Provider) ListCommitStatuses ¶
func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]model.CommitStatus, error)
ListCommitStatuses implements provider.CommitStatusManager.
func (*Provider) ListCommits ¶
func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*model.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 ¶
ListContributors implements provider.RepoStatsManager.
TencentCode does not expose a contributors list endpoint; this method always returns ErrNotImplemented.
func (*Provider) ListEmails ¶
ListEmails implements TencentCodeAccountExtras.
func (*Provider) ListForks ¶
ListForks implements provider.RepoStatsManager.
TencentCode does not expose a forks list endpoint; this method always returns ErrNotImplemented.
func (*Provider) ListGroupMembers ¶
func (p *Provider) ListGroupMembers(ctx context.Context, groupID int, opts ListGroupMembersOptions) ([]*MemberInfo, error)
ListGroupMembers implements TencentCodeOrgExtras.
func (*Provider) ListGroups ¶
ListGroups implements TencentCodeOrgExtras.
func (*Provider) ListIssueComments ¶
func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*model.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) ([]*model.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) ([]*model.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).
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 — previously this backend reported the platform total (X-Total) on caller-driven pages, a different `total` semantic from every other backend.
func (*Provider) ListLabels ¶
func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*model.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) ListMilestoneIssues ¶
func (p *Provider) ListMilestoneIssues(ctx context.Context, owner, repo string, milestoneID, page, perPage int) ([]*model.Issue, error)
ListMilestoneIssues implements TencentCodeExtras: one caller-driven page of a milestone's issues (page 0 = first page).
func (*Provider) ListMilestones ¶
func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]model.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 ¶
func (p *Provider) ListNamespaces(ctx context.Context, opts ListNamespacesOptions) ([]*NamespaceInfo, error)
ListNamespaces implements TencentCodeOrgExtras.
func (*Provider) ListNotes ¶
func (p *Provider) ListNotes(ctx context.Context, owner, repo, number string) ([]*model.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 ¶
func (p *Provider) ListOwnedProjects(ctx context.Context, page, perPage int) ([]*model.PlatformRepo, error)
ListOwnedProjects implements TencentCodeAccountExtras.
func (*Provider) ListProjectEvents ¶
func (p *Provider) ListProjectEvents(ctx context.Context, owner, repo string, opts ListProjectEventsOptions) ([]*ProjectEventInfo, error)
ListProjectEvents implements TencentCodeProjectExtras.
func (*Provider) ListProjectShares ¶
func (p *Provider) ListProjectShares(ctx context.Context, owner, repo string) ([]*ProjectShareInfo, error)
ListProjectShares implements TencentCodeProjectExtras.
func (*Provider) ListProjectStars ¶
func (p *Provider) ListProjectStars(ctx context.Context, owner, repo string, page, perPage int) ([]*StarInfo, error)
ListProjectStars implements TencentCodeProjectExtras.
func (*Provider) ListProtectedBranchMembers ¶
func (*Provider) ListReleases ¶
func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*model.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 ¶
func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*model.PlatformRepo, error)
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) ([]model.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 ¶
func (p *Provider) ListSSHKeys(ctx context.Context) ([]*SSHKeyInfo, error)
ListSSHKeys implements TencentCodeAccountExtras.
func (*Provider) ListStargazers ¶
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 ¶
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) ListUserIssues ¶
func (p *Provider) ListUserIssues(ctx context.Context, opts ListUserIssuesOptions) ([]*model.Issue, error)
ListUserIssues implements TencentCodeExtras: the global /issues listing across projects, one caller-driven page per call (Page 0 = first page).
func (*Provider) ListWatchedProjects ¶
func (p *Provider) ListWatchedProjects(ctx context.Context, page, perPage int) ([]*model.PlatformRepo, error)
ListWatchedProjects implements TencentCodeAccountExtras.
func (*Provider) ListWatchers ¶
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) ([]*model.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) (*model.ChangeRequest, error)
MergeCR implements provider.ChangeRequestManager.
选项面(issue #94):Squash/RemoveSourceBranch 在 gongfeng SDK 的 Accept 线面上没有对应字段(AcceptMergeRequestOptions 只有 merge_commit_message) ——两个意图静默丢弃(平台默认:普通合并、保留源分支)按 DivergenceIgnore 登记进台账。幂等面与家族对齐(giteafamily crs.go 的 405-merged 恢复): 已合并 MR 重试 MergeCR 返回当前 CR 而非硬失败——重试/幂等场景跨后端一致。
func (*Provider) ParseWebhookEvent ¶
func (*Provider) ProtectBranch ¶
func (*Provider) RemoveCodeReviewer ¶
func (*Provider) RemoveCollaborator ¶
RemoveCollaborator implements provider.CollaboratorManager via the username→ID resolution (the members API is ID-addressed).
func (*Provider) RemoveIssueLabel ¶
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) RemoveIssueLabels ¶
func (p *Provider) RemoveIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error
RemoveIssueLabels implements provider.IssueManager(#163):工蜂整集写 面——一次读 + 过滤全部目标名 + 单次 PUT(比逐个单删省 N-1 次读)。 整集为空的既有限制见 labelUpdate 注释(divergence 台账已登记)。
func (*Provider) RemoveMRReviewer ¶
func (*Provider) RemoveProtectedBranchMember ¶
func (*Provider) ReopenCR ¶
func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*model.ChangeRequest, error)
ReopenCR implements provider.ChangeRequestManager.
func (*Provider) ReopenCodeReview ¶
func (*Provider) ReopenIssue ¶
func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*model.Issue, error)
ReopenIssue implements provider.IssueManager via the state_event API.
func (*Provider) ReopenMRReview ¶
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) ([]*model.CRUser, error)
ResolveUsernames implements provider.UserManager.
func (*Provider) ShareProject ¶
func (p *Provider) ShareProject(ctx context.Context, owner, repo string, opts ShareProjectOptions) error
ShareProject implements TencentCodeProjectExtras.
func (*Provider) StarProject ¶
StarProject implements TencentCodeProjectExtras.
func (*Provider) SubmitCodeReview ¶
func (*Provider) SubmitMRReview ¶
func (*Provider) SubscribeIssue ¶
SubscribeIssue implements TencentCodeExtras.
func (*Provider) SubscribeMR ¶
SubscribeMR implements TencentCodeExtras.
gongfeng v0.5.0 起 PUT 只回状态码、无响应体(gongfeng issue #7:此前解 空 body 必然 EOF),服务端不再回显结果态——成功即已订阅,返回值由**已确认 的 PUT 语义**推导(幂等 PUT:2xx ⇒ 请求态已生效),不再读回显。
func (*Provider) TestConnection ¶
TestConnection implements provider.Provider.
func (*Provider) UnprotectBranch ¶
func (*Provider) UnstarProject ¶
UnstarProject implements TencentCodeProjectExtras.
func (*Provider) UnsubscribeIssue ¶
UnsubscribeIssue implements TencentCodeExtras.
func (*Provider) UnsubscribeMR ¶
func (p *Provider) UnsubscribeMR(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
UnsubscribeMR implements TencentCodeExtras.
与 SubscribeMR 同款:gongfeng v0.5.0 的 PUT 无响应体,成功即已退订 (返回 false = 不再订阅),由已确认的 PUT 语义推导。
func (*Provider) UnwatchProject ¶
UnwatchProject implements TencentCodeProjectExtras.
func (*Provider) UpdateBranchProtection ¶
func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, opts provider.UpdateBranchProtectionOptions) (*model.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) (*model.ChangeRequest, error)
UpdateCR implements provider.ChangeRequestManager.
三态收编(2A):Resolve* 非 specified 不动,specified 空值即清空。 描述 ⇒ "description":""(*string+omitempty:非 nil 指针穿过 omitempty, 空串照上 wire);指派单值面 ⇒ "assignee_id":0(Phase 3 验服务端)。
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) (*model.FileResult, error)
UpdateFile implements provider.FileManager.
func (*Provider) UpdateIssue ¶
func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, opts provider.UpdateIssueOptions) (*model.Issue, error)
UpdateIssue implements provider.IssueManager. Unspecified 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).
三态收编(2A):Resolve* 非 specified 不动,specified 空值即清空。 选项字段是 *T+omitempty——omitempty 只省略 nil 指针,指向零值的指针 照上 wire:body ⇒ "description":""、assignees ⇒ "assignee_ids":"" (csv 空串在场)、milestone ⇒ "milestone_id":0。labels 清空返回 provider.ErrClearNotSupported——既有登记 no-op(空 csv 结构性不可上 wire)尊重之,不凭结构分析推翻(divergence.go 的 RemoveIssueLabel 条目)。
func (*Provider) UpdateIssueComment ¶
func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*model.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) (*model.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) (*model.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 ¶
func (p *Provider) UpdateNote(ctx context.Context, owner, repo, number, noteID, body string) (*model.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 (*Provider) UpdateRelease ¶
func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, opts provider.UpdateReleaseOptions) (*model.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) (*model.PlatformRepo, error)
UpdateRepo implements provider.RepoManager.
func (*Provider) UpdateWebhook ¶
func (p *Provider) UpdateWebhook(ctx context.Context, owner, repo string, webhookID int64, opts provider.UpdateWebhookOptions) (*model.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 full scope (issue #91: issues/note included, or hooks created for them keep their stale flags through every update).
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.
func (*Provider) WatchProject ¶
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 ¶
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 ¶
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 ¶
type ShareProjectOptions struct {
}
ShareProjectOptions are the ShareProject inputs. GroupAccess uses the gongfeng AccessLevel* constants.
type SubmitReviewOptions ¶
type SubmitReviewOptions struct {
Event ReviewerEvent
Summary string
}
SubmitReviewOptions submits a reviewer verdict with a summary.
type TagDetail ¶
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 ¶
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) ([]*model.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) ([]*model.CRUser, error)
// GetUserByEmail resolves one user by registered email address.
GetUserByEmail(ctx context.Context, email string) (*model.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) ([]*model.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) ([]*model.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) ([]*model.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
// --- Subscriptions (issue/MR watch; 工蜂-native, no cross-platform
// counterpart) ---
// GetIssueSubscription reports whether the authenticated user watches
// an issue.
GetIssueSubscription(ctx context.Context, owner, repo string, issueID int) (bool, error)
SubscribeIssue(ctx context.Context, owner, repo string, issueID int) error
UnsubscribeIssue(ctx context.Context, owner, repo string, issueID int) error
// GetMRSubscription/SubscribeMR/UnsubscribeMR manage MR watch state;
// the mutations return the resulting subscribed flag. gongfeng v0.5.0
// 起 PUT 不再回显结果态(只回状态码,gongfeng issue #7)——返回值由已确认
// 的 PUT 语义推导(成功 ⇒ 请求态生效),GET 侧读裸布尔。
GetMRSubscription(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
SubscribeMR(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
UnsubscribeMR(ctx context.Context, owner, repo string, mrNumber int) (bool, error)
// --- Cross-project & milestone issue listings ---
// ListUserIssues lists issues across all projects visible to the
// authenticated user (工蜂's global /issues endpoint) — the project-
// scoped provider.IssueManager.ListIssues has no cross-project mode.
ListUserIssues(ctx context.Context, opts ListUserIssuesOptions) ([]*model.Issue, error)
// ListMilestoneIssues lists the issues of one milestone (caller-driven
// single page; page 0 = first page).
ListMilestoneIssues(ctx context.Context, owner, repo string, milestoneID int, page, perPage int) ([]*model.Issue, error)
// --- Archive downloads (MR / native code review variants of
// DownloadCompareChangedFiles) ---
// DownloadMergeRequestChangedFiles streams a zip of one MR's changed
// files.
DownloadMergeRequestChangedFiles(ctx context.Context, owner, repo string, mrNumber int, w io.Writer) error
// DownloadCommitReviewChangedFiles streams a zip of one native code
// review's changed files.
DownloadCommitReviewChangedFiles(ctx context.Context, owner, repo string, reviewID int, w io.Writer) 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: model.PlatformTencentCode, Token: t})
if tc, ok := p.(provider.TencentCodeExtras); ok {
tc.SubmitCodeReview(ctx, owner, repo, reviewID, opts)
}
type TencentCodeOrgExtras ¶
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 ¶
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.
// 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 ¶
UpdateCodeReviewOptions updates a code review's title/description.
type UserDetailInfo ¶
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 ¶
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.