gongfeng

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

gongfeng-sdk-go

腾讯工蜂 REST API 的 Go SDK,完整覆盖工蜂 v3 API。

特性

  • 基于标准库自建 HTTP Client,无重型第三方依赖
  • 按资源拆分 Service,每个 API 资源独立文件
  • 所有方法支持 context.Context
  • 统一的分页、认证、错误处理
  • 函数式选项模式(WithBaseURLWithHTTPClient

安装

go get github.com/studyzy/gongfeng-sdk-go

快速开始

package main

import (
	"context"
	"fmt"
	"log"

	gongfeng "github.com/studyzy/gongfeng-sdk-go"
)

func main() {
	client, err := gongfeng.NewClient("your-private-token")
	if err != nil {
		log.Fatal(err)
	}

	// 获取项目列表
	projects, _, err := client.Projects.ListProjects(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
	}
	for _, p := range projects {
		fmt.Printf("%d: %s\n", p.ID, p.PathWithNamespace)
	}
}

自定义配置

// 连接私有部署的工蜂实例
client, err := gongfeng.NewClient("token",
	gongfeng.WithBaseURL("https://git.example.com/"),
)

支持的 API

Service 说明
Projects 项目 CRUD、搜索、成员管理
Groups 项目组 CRUD、成员管理
Branches 分支创建、删除、保护分支
Tags Tag 列表、创建、删除
MergeRequests MR 创建、合并、评论、变更查询
Commits 提交查询、Diff、评论、Ref
Repositories 存档下载、文件树、文件 CRUD、分支比较
Issues 缺陷 CRUD
Notes MR/Issue 评论 CRUD
Labels 标签 CRUD
Milestones 里程碑 CRUD
Users 用户查询
Namespaces 命名空间列表与搜索
Releases 版本发布 CRUD
Webhooks 回调钩子 CRUD
Forks Fork 项目
Watchers 项目关注/取消关注
Session 获取私有令牌
CommitStatuses 提交检测(CI 状态)
Reviews MR 评审 + Commit 评审

API 文档

详细的工蜂 REST API 文档见 docs/api/

Documentation

Overview

Package gongfeng 提供腾讯工蜂 REST API 的 Go 客户端。

Index

Constants

View Source
const (
	// DefaultBaseURL 是工蜂公有云的默认地址。
	DefaultBaseURL = "https://git.code.tencent.com/"
)

Variables

This section is empty.

Functions

func Ptr

func Ptr[T any](v T) *T

Ptr 返回 v 的指针,用于构造可选参数。

Types

type AcceptMergeRequestOptions

type AcceptMergeRequestOptions struct {
	MergeCommitMessage *string `json:"merge_commit_message,omitempty"`
}

AcceptMergeRequestOptions 表示 AcceptMergeRequest 的可选参数。

type AccessLevelValue

type AccessLevelValue int

AccessLevelValue 表示工蜂的权限级别。

const (
	GuestPermission     AccessLevelValue = 10
	FollowerPermission  AccessLevelValue = 15
	ReporterPermission  AccessLevelValue = 20
	DeveloperPermission AccessLevelValue = 30
	MasterPermission    AccessLevelValue = 40
	OwnerPermission     AccessLevelValue = 50
)

工蜂权限级别常量。

type AddGroupMemberOptions

type AddGroupMemberOptions struct {
	UserID      *int              `json:"user_id,omitempty"`
	AccessLevel *AccessLevelValue `json:"access_level,omitempty"`
}

AddGroupMemberOptions 表示 AddGroupMember 的可选参数。

type AddProjectMemberOptions

type AddProjectMemberOptions struct {
	UserID      *int              `json:"user_id,omitempty"`
	AccessLevel *AccessLevelValue `json:"access_level,omitempty"`
}

AddProjectMemberOptions 表示 AddProjectMember 的可选参数。

type AddWebhookOptions

type AddWebhookOptions struct {
	URL                   *string `json:"url,omitempty" url:"url,omitempty"`
	PushEvents            *bool   `json:"push_events,omitempty" url:"push_events,omitempty"`
	IssuesEvents          *bool   `json:"issues_events,omitempty" url:"issues_events,omitempty"`
	MergeRequestsEvents   *bool   `json:"merge_requests_events,omitempty" url:"merge_requests_events,omitempty"`
	TagPushEvents         *bool   `json:"tag_push_events,omitempty" url:"tag_push_events,omitempty"`
	NoteEvents            *bool   `json:"note_events,omitempty" url:"note_events,omitempty"`
	EnableSSLVerification *bool   `json:"enable_ssl_verification,omitempty" url:"enable_ssl_verification,omitempty"`
}

AddWebhookOptions 是 AddWebhook 的可选参数。

type ArchiveOptions

type ArchiveOptions struct {
	SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
}

ArchiveOptions 是 Archive 的可选参数。

type Branch

type Branch struct {
	Name               string  `json:"name,omitempty"`
	Protected          bool    `json:"protected,omitempty"`
	DevelopersCanPush  bool    `json:"developers_can_push,omitempty"`
	DevelopersCanMerge bool    `json:"developers_can_merge,omitempty"`
	Commit             *Commit `json:"commit,omitempty"`
}

Branch 表示工蜂代码分支。

type BranchesService

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

BranchesService 处理与工蜂分支相关的 API。

func (*BranchesService) CreateBranch

func (s *BranchesService) CreateBranch(ctx context.Context, pid interface{}, opts *CreateBranchOptions) (*Branch, *Response, error)

CreateBranch 创建一个新分支。

func (*BranchesService) DeleteBranch

func (s *BranchesService) DeleteBranch(ctx context.Context, pid interface{}, branch string) (*Response, error)

DeleteBranch 删除分支。

func (*BranchesService) GetBranch

func (s *BranchesService) GetBranch(ctx context.Context, pid interface{}, branch string) (*Branch, *Response, error)

GetBranch 获取单个分支的详情。

func (*BranchesService) GetProtectedBranch

func (s *BranchesService) GetProtectedBranch(ctx context.Context, pid interface{}, branch string) (*ProtectedBranch, *Response, error)

GetProtectedBranch 获取保护分支详情。

func (*BranchesService) ListBranches

func (s *BranchesService) ListBranches(ctx context.Context, pid interface{}, opts *ListBranchesOptions) ([]*Branch, *Response, error)

ListBranches 获取项目分支列表。

type Client

type Client struct {
	Branches       *BranchesService
	CommitStatuses *CommitStatusService
	Commits        *CommitsService
	Forks          *ForksService
	Groups         *GroupsService
	Issues         *IssuesService
	Labels         *LabelsService
	MergeRequests  *MergeRequestsService
	Milestones     *MilestonesService
	Namespaces     *NamespacesService
	Notes          *NotesService
	Projects       *ProjectsService
	Releases       *ReleasesService
	Repositories   *RepositoriesService
	Reviews        *ReviewsService
	Session        *SessionService
	Tags           *TagsService
	Users          *UsersService
	Watchers       *WatchersService
	Webhooks       *WebhooksService
	// contains filtered or unexported fields
}

Client 是腾讯工蜂 API 的客户端入口。

func NewClient

func NewClient(token string, options ...ClientOptionFunc) (*Client, error)

NewClient 创建一个工蜂 API 客户端。token 为用户的 Private Token。

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do 执行 API 请求并将 JSON 响应解码到 v。 如果 v 为 nil 则不解码响应体。 如果 v 实现了 io.Writer,则将响应体直接写入。

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, path string, body interface{}) (*http.Request, error)

NewRequest 构造一个 API 请求。

path 是相对于 /api/v3/ 的路径(不带前导 /)。 对于 GET 请求,body 会被编码为 URL query 参数。 对于其他方法,body 会被 JSON 编码为请求体。

type ClientOptionFunc

type ClientOptionFunc func(*Client) error

ClientOptionFunc 是客户端的函数式选项。

func WithBaseURL

func WithBaseURL(urlStr string) ClientOptionFunc

WithBaseURL 设置工蜂实例的 URL。

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOptionFunc

WithHTTPClient 设置自定义的 HTTP 客户端。

type Commit

type Commit struct {
	ID             string   `json:"id,omitempty"`
	ShortID        string   `json:"short_id,omitempty"`
	Title          string   `json:"title,omitempty"`
	Message        string   `json:"message,omitempty"`
	AuthorName     string   `json:"author_name,omitempty"`
	AuthorEmail    string   `json:"author_email,omitempty"`
	AuthoredDate   Time     `json:"authored_date,omitempty"`
	CommitterName  string   `json:"committer_name,omitempty"`
	CommitterEmail string   `json:"committer_email,omitempty"`
	CommittedDate  Time     `json:"committed_date,omitempty"`
	CreatedAt      Time     `json:"created_at,omitempty"`
	ParentIDs      []string `json:"parent_ids,omitempty"`
}

Commit 表示一次 Git 提交。

type CommitComment

type CommitComment struct {
	Note     string `json:"note"`
	Author   *User  `json:"author"`
	Path     string `json:"path"`
	Line     int    `json:"line"`
	LineType string `json:"line_type"`
}

CommitComment 表示提交的评论。

type CommitRef

type CommitRef struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

CommitRef 表示提交对应的分支或 tag 引用。

type CommitStatus

type CommitStatus struct {
	ID          int    `json:"id,omitempty"`
	SHA         string `json:"sha,omitempty"`
	Ref         string `json:"ref,omitempty"`
	Status      string `json:"status,omitempty"`
	Name        string `json:"name,omitempty"`
	TargetURL   string `json:"target_url,omitempty"`
	Description string `json:"description,omitempty"`
	CreatedAt   Time   `json:"created_at,omitempty"`
	Author      *User  `json:"author,omitempty"`
}

CommitStatus 表示一个提交的检测状态。

type CommitStatusResult

type CommitStatusResult struct {
	SHA      string          `json:"sha,omitempty"`
	Status   string          `json:"status,omitempty"`
	Statuses []*CommitStatus `json:"statuses,omitempty"`
}

CommitStatusResult 表示一个提交的检测组合结果。

type CommitStatusService

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

CommitStatusService 处理与提交检测状态相关的 API 调用。

func (*CommitStatusService) CreateCommitStatus

func (s *CommitStatusService) CreateCommitStatus(ctx context.Context, pid interface{}, sha string, opts *CreateCommitStatusOptions) (*CommitStatus, *Response, error)

CreateCommitStatus 为指定提交新建一个检测结果。

func (*CommitStatusService) GetCommitStatusResult

func (s *CommitStatusService) GetCommitStatusResult(ctx context.Context, pid interface{}, ref string) (*CommitStatusResult, *Response, error)

GetCommitStatusResult 查询指定提交的检测组合结果。

func (*CommitStatusService) ListCommitStatuses

func (s *CommitStatusService) ListCommitStatuses(ctx context.Context, pid interface{}, sha string, opts *ListCommitStatusesOptions) ([]*CommitStatus, *Response, error)

ListCommitStatuses 查询指定提交的检测结果列表。

type CommitsService

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

CommitsService 处理与工蜂提交相关的 API。

func (*CommitsService) CreateCommitComment

func (s *CommitsService) CreateCommitComment(ctx context.Context, pid interface{}, sha string, opts *CreateCommitCommentOptions) (*CommitComment, *Response, error)

CreateCommitComment 为提交添加评论。

func (*CommitsService) GetCommit

func (s *CommitsService) GetCommit(ctx context.Context, pid interface{}, sha string) (*Commit, *Response, error)

GetCommit 获取单个提交的详情。

func (*CommitsService) GetCommitDiff

func (s *CommitsService) GetCommitDiff(ctx context.Context, pid interface{}, sha string, opts *GetCommitDiffOptions) ([]*Diff, *Response, error)

GetCommitDiff 获取提交的 Diff。

func (*CommitsService) ListCommitComments

func (s *CommitsService) ListCommitComments(ctx context.Context, pid interface{}, sha string, opts *ListCommitCommentsOptions) ([]*CommitComment, *Response, error)

ListCommitComments 获取提交的评论列表。

func (*CommitsService) ListCommitRefs

func (s *CommitsService) ListCommitRefs(ctx context.Context, pid interface{}, sha string, opts *ListCommitRefsOptions) ([]*CommitRef, *Response, error)

ListCommitRefs 获取提交对应的分支和 tag 引用。

func (*CommitsService) ListCommits

func (s *CommitsService) ListCommits(ctx context.Context, pid interface{}, opts *ListCommitsOptions) ([]*Commit, *Response, error)

ListCommits 获取项目的提交列表。

type CompareOptions

type CompareOptions struct {
	From     *string `url:"from,omitempty" json:"from,omitempty"`
	To       *string `url:"to,omitempty" json:"to,omitempty"`
	Straight *bool   `url:"straight,omitempty" json:"straight,omitempty"`
}

CompareOptions 是 Compare 的可选参数。

type CompareResult

type CompareResult struct {
	Commit         *Commit   `json:"commit,omitempty"`
	Commits        []*Commit `json:"commits,omitempty"`
	Diffs          []*Diff   `json:"diffs,omitempty"`
	CompareTimeout bool      `json:"compare_timeout,omitempty"`
	CompareSameRef bool      `json:"compare_same_ref,omitempty"`
	Overflow       bool      `json:"over_flow,omitempty"`
	FilesTotal     int       `json:"files_total,omitempty"`
	CommitsTotal   int       `json:"commits_total,omitempty"`
}

CompareResult 表示两个分支/Tag/SHA 的比较结果。

type ConfigStorage

type ConfigStorage struct {
	LimitLFSFileSize int `json:"limit_lfs_file_size,omitempty"`
	LimitSize        int `json:"limit_size,omitempty"`
	LimitFileSize    int `json:"limit_file_size,omitempty"`
	LimitLFSSize     int `json:"limit_lfs_size,omitempty"`
}

ConfigStorage 表示项目的存储配置。

type CreateBranchOptions

type CreateBranchOptions struct {
	BranchName *string `json:"branch_name,omitempty"`
	Ref        *string `json:"ref,omitempty"`
}

CreateBranchOptions 表示 CreateBranch 的可选参数。

type CreateCommitCommentOptions

type CreateCommitCommentOptions struct {
	Note     *string `json:"note,omitempty" url:"note,omitempty"`
	Path     *string `json:"path,omitempty" url:"path,omitempty"`
	Line     *int    `json:"line,omitempty" url:"line,omitempty"`
	LineType *string `json:"line_type,omitempty" url:"line_type,omitempty"`
}

CreateCommitCommentOptions 表示 CreateCommitComment 的可选参数。

type CreateCommitReviewOptions

type CreateCommitReviewOptions struct {
	Title                 *string `json:"title,omitempty" url:"title,omitempty"`
	SourceBranch          *string `json:"source_branch,omitempty" url:"source_branch,omitempty"`
	TargetBranch          *string `json:"target_branch,omitempty" url:"target_branch,omitempty"`
	Description           *string `json:"description,omitempty" url:"description,omitempty"`
	SourceCommit          *string `json:"source_commit,omitempty" url:"source_commit,omitempty"`
	TargetCommit          *string `json:"target_commit,omitempty" url:"target_commit,omitempty"`
	TargetProjectID       *int    `json:"target_project_id,omitempty" url:"target_project_id,omitempty"`
	ReviewerIDs           *string `json:"reviewer_ids,omitempty" url:"reviewer_ids,omitempty"`
	NecessaryReviewerIDs  *string `json:"necessary_reviewer_ids,omitempty" url:"necessary_reviewer_ids,omitempty"`
	ApproverRule          *int    `json:"approver_rule,omitempty" url:"approver_rule,omitempty"`
	NecessaryApproverRule *int    `json:"necessary_approver_rule,omitempty" url:"necessary_approver_rule,omitempty"`
}

CreateCommitReviewOptions 是 CreateCommitReview 的请求参数。

type CreateCommitStatusOptions

type CreateCommitStatusOptions struct {
	State       *string `json:"state,omitempty" url:"state,omitempty"`
	Ref         *string `json:"ref,omitempty" url:"ref,omitempty"`
	Name        *string `json:"name,omitempty" url:"name,omitempty"`
	TargetURL   *string `json:"target_url,omitempty" url:"target_url,omitempty"`
	Description *string `json:"description,omitempty" url:"description,omitempty"`
	Context     *string `json:"context,omitempty" url:"context,omitempty"`
}

CreateCommitStatusOptions 是 CreateCommitStatus 的可选参数。

type CreateEmailOptions

type CreateEmailOptions struct {
	Email *string `json:"email,omitempty" url:"email,omitempty"`
}

CreateEmailOptions 是 CreateEmail 的可选参数。

type CreateFileOptions

type CreateFileOptions struct {
	FilePath      *string `json:"file_path,omitempty" url:"file_path,omitempty"`
	BranchName    *string `json:"branch_name,omitempty" url:"branch_name,omitempty"`
	Encoding      *string `json:"encoding,omitempty" url:"encoding,omitempty"`
	Content       *string `json:"content,omitempty" url:"content,omitempty"`
	CommitMessage *string `json:"commit_message,omitempty" url:"commit_message,omitempty"`
}

CreateFileOptions 是 CreateFile 的可选参数。

type CreateGroupOptions

type CreateGroupOptions struct {
	Name        *string `json:"name,omitempty"`
	Path        *string `json:"path,omitempty"`
	Description *string `json:"description,omitempty"`
}

CreateGroupOptions 表示 CreateGroup 的可选参数。

type CreateIssueNoteOptions

type CreateIssueNoteOptions struct {
	Body *string `json:"body,omitempty" url:"body,omitempty"`
}

CreateIssueNoteOptions 是 CreateIssueNote 的可选参数。

type CreateIssueOptions

type CreateIssueOptions struct {
	Title       *string `json:"title,omitempty" url:"title,omitempty"`
	Grade       *int    `json:"grade,omitempty" url:"grade,omitempty"`
	Description *string `json:"description,omitempty" url:"description,omitempty"`
	AssigneeIDs *string `json:"assignee_ids,omitempty" url:"assignee_ids,omitempty"`
	MilestoneID *int    `json:"milestone_id,omitempty" url:"milestone_id,omitempty"`
	Labels      *string `json:"labels,omitempty" url:"labels,omitempty"`
}

CreateIssueOptions 是 CreateIssue 的可选参数。

type CreateLabelOptions

type CreateLabelOptions struct {
	Name        *string `json:"name,omitempty" url:"name,omitempty"`
	Color       *string `json:"color,omitempty" url:"color,omitempty"`
	Description *string `json:"description,omitempty" url:"description,omitempty"`
}

CreateLabelOptions 是 CreateLabel 的可选参数。

type CreateMRCommentOptions

type CreateMRCommentOptions struct {
	Body *string `json:"body,omitempty"`
}

CreateMRCommentOptions 表示 CreateMRComment 的可选参数。

type CreateMergeRequestNoteOptions

type CreateMergeRequestNoteOptions struct {
	Body          *string `json:"body,omitempty" url:"body,omitempty"`
	Path          *string `json:"path,omitempty" url:"path,omitempty"`
	Line          *string `json:"line,omitempty" url:"line,omitempty"`
	LineType      *string `json:"line_type,omitempty" url:"line_type,omitempty"`
	ReviewerState *string `json:"reviewer_state,omitempty" url:"reviewer_state,omitempty"`
}

CreateMergeRequestNoteOptions 是 CreateMergeRequestNote 的可选参数。

type CreateMergeRequestOptions

type CreateMergeRequestOptions struct {
	SourceBranch *string `json:"source_branch,omitempty"`
	TargetBranch *string `json:"target_branch,omitempty"`
	Title        *string `json:"title,omitempty"`
	AssigneeID   *int    `json:"assignee_id,omitempty"`
	Description  *string `json:"description,omitempty"`
	Reviewers    *string `json:"reviewers,omitempty"`
	ApproverRule *string `json:"approver_rule,omitempty"`
}

CreateMergeRequestOptions 表示 CreateMergeRequest 的可选参数。

type CreateMilestoneOptions

type CreateMilestoneOptions struct {
	Title       *string `json:"title,omitempty"`
	Description *string `json:"description,omitempty"`
	DueDate     *string `json:"due_date,omitempty"`
	StateEvent  *string `json:"state_event,omitempty"`
}

CreateMilestoneOptions 表示 CreateMilestone 的可选参数。

type CreateProjectOptions

type CreateProjectOptions struct {
	Name                 *string `json:"name,omitempty"`
	Path                 *string `json:"path,omitempty"`
	Description          *string `json:"description,omitempty"`
	NamespaceID          *int    `json:"namespace_id,omitempty"`
	IssuesEnabled        *bool   `json:"issues_enabled,omitempty"`
	MergeRequestsEnabled *bool   `json:"merge_requests_enabled,omitempty"`
	WikiEnabled          *bool   `json:"wiki_enabled,omitempty"`
	Public               *bool   `json:"public,omitempty"`
	ForkEnabled          *bool   `json:"fork_enabled,omitempty"`
	VisibilityLevel      *int    `json:"visibility_level,omitempty"`
}

CreateProjectOptions 表示 CreateProject 的可选参数。

type CreateReleaseOptions

type CreateReleaseOptions struct {
	TagName     *string `json:"tag_name,omitempty" url:"tag_name,omitempty"`
	Description *string `json:"description,omitempty" url:"description,omitempty"`
}

CreateReleaseOptions 是 CreateRelease 的可选参数。

type CreateReviewNoteOptions

type CreateReviewNoteOptions struct {
	Body          *string `json:"body,omitempty" url:"body,omitempty"`
	Path          *string `json:"path,omitempty" url:"path,omitempty"`
	Line          *string `json:"line,omitempty" url:"line,omitempty"`
	LineType      *string `json:"line_type,omitempty" url:"line_type,omitempty"`
	ReviewerState *string `json:"reviewer_state,omitempty" url:"reviewer_state,omitempty"`
}

CreateReviewNoteOptions 是 CreateReviewNote 的可选参数。

type CreateSSHKeyOptions

type CreateSSHKeyOptions struct {
	Title *string `json:"title,omitempty" url:"title,omitempty"`
	Key   *string `json:"key,omitempty" url:"key,omitempty"`
}

CreateSSHKeyOptions 是 CreateSSHKey 的可选参数。

type CreateTagOptions

type CreateTagOptions struct {
	TagName *string `json:"tag_name,omitempty" url:"tag_name,omitempty"`
	Ref     *string `json:"ref,omitempty" url:"ref,omitempty"`
	Message *string `json:"message,omitempty" url:"message,omitempty"`
}

CreateTagOptions 是 CreateTag 的可选参数。

type DeleteFileOptions

type DeleteFileOptions struct {
	FilePath      *string `json:"file_path,omitempty" url:"file_path,omitempty"`
	BranchName    *string `json:"branch_name,omitempty" url:"branch_name,omitempty"`
	CommitMessage *string `json:"commit_message,omitempty" url:"commit_message,omitempty"`
}

DeleteFileOptions 是 DeleteFile 的可选参数。

type DeleteLabelOptions

type DeleteLabelOptions struct {
	Name *string `json:"name,omitempty" url:"name,omitempty"`
}

DeleteLabelOptions 是 DeleteLabel 的可选参数。

type Diff

type Diff struct {
	OldPath     string `json:"old_path,omitempty"`
	NewPath     string `json:"new_path,omitempty"`
	AMode       int    `json:"a_mode,omitempty"`
	BMode       int    `json:"b_mode,omitempty"`
	Diff        string `json:"diff,omitempty"`
	NewFile     bool   `json:"new_file,omitempty"`
	RenamedFile bool   `json:"renamed_file,omitempty"`
	DeletedFile bool   `json:"deleted_file,omitempty"`
	IsTooLarge  bool   `json:"is_too_large,omitempty"`
	IsCollapse  bool   `json:"is_collapse,omitempty"`
	Additions   int    `json:"additions,omitempty"`
	Deletions   int    `json:"deletions,omitempty"`
}

Diff 表示一个文件的变更。

type EditGroupMemberOptions

type EditGroupMemberOptions struct {
	AccessLevel *AccessLevelValue `json:"access_level,omitempty"`
}

EditGroupMemberOptions 表示 EditGroupMember 的可选参数。

type EditGroupOptions

type EditGroupOptions struct {
	ID          *int    `json:"id,omitempty"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

EditGroupOptions 表示 EditGroup 的可选参数。

type EditMilestoneOptions

type EditMilestoneOptions struct {
	Title       *string `json:"title,omitempty"`
	Description *string `json:"description,omitempty"`
	DueDate     *string `json:"due_date,omitempty"`
	StateEvent  *string `json:"state_event,omitempty"`
}

EditMilestoneOptions 表示 EditMilestone 的可选参数。

type EditProjectMemberOptions

type EditProjectMemberOptions struct {
	AccessLevel *AccessLevelValue `json:"access_level,omitempty"`
}

EditProjectMemberOptions 表示 EditProjectMember 的可选参数。

type EditWebhookOptions

type EditWebhookOptions struct {
	URL                   *string `json:"url,omitempty" url:"url,omitempty"`
	PushEvents            *bool   `json:"push_events,omitempty" url:"push_events,omitempty"`
	IssuesEvents          *bool   `json:"issues_events,omitempty" url:"issues_events,omitempty"`
	MergeRequestsEvents   *bool   `json:"merge_requests_events,omitempty" url:"merge_requests_events,omitempty"`
	TagPushEvents         *bool   `json:"tag_push_events,omitempty" url:"tag_push_events,omitempty"`
	NoteEvents            *bool   `json:"note_events,omitempty" url:"note_events,omitempty"`
	EnableSSLVerification *bool   `json:"enable_ssl_verification,omitempty" url:"enable_ssl_verification,omitempty"`
}

EditWebhookOptions 是 EditWebhook 的可选参数。

type Email

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

Email 表示用户邮箱。

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Message  string `json:"message"`
}

ErrorResponse 表示工蜂 API 返回的错误。

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error 实现 error 接口。

type ForksService

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

ForksService 处理与 Fork 相关的 API 调用。

func (*ForksService) CreateForkRelation

func (s *ForksService) CreateForkRelation(ctx context.Context, pid interface{}, forkedFromID int) (*Response, error)

CreateForkRelation 在项目之间创建 Fork 关系。

func (*ForksService) DeleteForkRelation

func (s *ForksService) DeleteForkRelation(ctx context.Context, pid interface{}) (*Response, error)

DeleteForkRelation 取消项目的 Fork 关系。

func (*ForksService) ForkProject

func (s *ForksService) ForkProject(ctx context.Context, pid interface{}) (*Project, *Response, error)

ForkProject 将项目 Fork 到当前用户的命名空间。

type GetCommitDiffOptions

type GetCommitDiffOptions struct {
	Path             *string `url:"path,omitempty" json:"path,omitempty"`
	IgnoreWhiteSpace *bool   `url:"ignore_white_space,omitempty" json:"ignore_white_space,omitempty"`
}

GetCommitDiffOptions 表示 GetCommitDiff 的可选参数。

type GetFileOptions

type GetFileOptions struct {
	FilePath *string `url:"file_path,omitempty" json:"file_path,omitempty"`
	Ref      *string `url:"ref,omitempty" json:"ref,omitempty"`
}

GetFileOptions 是 GetFile 的可选参数。

type GetRawFileOptions

type GetRawFileOptions struct {
	FilePath *string `url:"filepath,omitempty" json:"filepath,omitempty"`
}

GetRawFileOptions 是 GetRawFile 和 GetCommitRawFile 的可选参数。

type GetSessionOptions

type GetSessionOptions struct {
	Login    *string `json:"login,omitempty" url:"login,omitempty"`
	Email    *string `json:"email,omitempty" url:"email,omitempty"`
	Password *string `json:"password,omitempty" url:"password,omitempty"`
}

GetSessionOptions 是 GetSession 的请求参数。

type GetUserByEmailOptions

type GetUserByEmailOptions struct {
	Email *string `url:"email,omitempty" json:"email,omitempty"`
}

GetUserByEmailOptions 是 GetUserByEmail 的可选参数。

type Group

type Group struct {
	ID          int        `json:"id,omitempty"`
	Name        string     `json:"name,omitempty"`
	Path        string     `json:"path,omitempty"`
	WebURL      string     `json:"web_url,omitempty"`
	Description string     `json:"description,omitempty"`
	AvatarURL   string     `json:"avatar_url,omitempty"`
	Projects    []*Project `json:"projects,omitempty"`
}

Group 表示工蜂项目组。

type GroupsService

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

GroupsService 处理与工蜂项目组相关的 API。

func (*GroupsService) AddGroupMember

func (s *GroupsService) AddGroupMember(ctx context.Context, gid interface{}, opts *AddGroupMemberOptions) (*Member, *Response, error)

AddGroupMember 添加项目组成员。

func (*GroupsService) CreateGroup

func (s *GroupsService) CreateGroup(ctx context.Context, opts *CreateGroupOptions) (*Group, *Response, error)

CreateGroup 创建一个新项目组。

func (*GroupsService) DeleteGroup

func (s *GroupsService) DeleteGroup(ctx context.Context, gid interface{}) (*Response, error)

DeleteGroup 删除项目组。

func (*GroupsService) DeleteGroupMember

func (s *GroupsService) DeleteGroupMember(ctx context.Context, gid interface{}, userID int) (*Response, error)

DeleteGroupMember 移除项目组成员。

func (*GroupsService) EditGroup

func (s *GroupsService) EditGroup(ctx context.Context, opts *EditGroupOptions) (*Group, *Response, error)

EditGroup 编辑项目组。

func (*GroupsService) EditGroupMember

func (s *GroupsService) EditGroupMember(ctx context.Context, gid interface{}, userID int, opts *EditGroupMemberOptions) (*Member, *Response, error)

EditGroupMember 修改项目组成员的权限。

func (*GroupsService) GetGroup

func (s *GroupsService) GetGroup(ctx context.Context, gid interface{}) (*Group, *Response, error)

GetGroup 获取项目组详情(含下属项目)。

func (*GroupsService) ListGroupMembers

func (s *GroupsService) ListGroupMembers(ctx context.Context, gid interface{}, opts *ListGroupMembersOptions) ([]*Member, *Response, error)

ListGroupMembers 获取项目组成员列表。

func (*GroupsService) ListGroups

func (s *GroupsService) ListGroups(ctx context.Context, opts *ListGroupsOptions) ([]*Group, *Response, error)

ListGroups 获取项目组列表。

type InviteCommitReviewerOptions

type InviteCommitReviewerOptions struct {
	ReviewerID          *int `json:"reviewer_id,omitempty" url:"reviewer_id,omitempty"`
	NecessaryReviewerID *int `json:"necessary_reviewer_id,omitempty" url:"necessary_reviewer_id,omitempty"`
}

InviteCommitReviewerOptions 是 InviteCommitReviewer 的可选参数。

type InviteMRReviewerOptions

type InviteMRReviewerOptions struct {
	ReviewerID          *int `json:"reviewer_id,omitempty" url:"reviewer_id,omitempty"`
	NecessaryReviewerID *int `json:"necessary_reviewer_id,omitempty" url:"necessary_reviewer_id,omitempty"`
}

InviteMRReviewerOptions 是 InviteMRReviewer 的可选参数。

type Issue

type Issue struct {
	ID           int        `json:"id,omitempty"`
	IID          int        `json:"iid,omitempty"`
	ProjectID    int        `json:"project_id,omitempty"`
	Title        string     `json:"title,omitempty"`
	Description  string     `json:"description,omitempty"`
	State        string     `json:"state,omitempty"`
	ResolveState string     `json:"resolve_state,omitempty"`
	Grade        *int       `json:"grade,omitempty"`
	Labels       []string   `json:"labels,omitempty"`
	Assignees    []*User    `json:"assignees,omitempty"`
	Assignee     *User      `json:"assignee,omitempty"`
	Author       *User      `json:"author,omitempty"`
	CreatedAt    Time       `json:"created_at,omitempty"`
	UpdatedAt    Time       `json:"updated_at,omitempty"`
	Milestone    *Milestone `json:"milestone,omitempty"`
}

Issue 表示一个缺陷。

type IssuesService

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

IssuesService 处理与 Issue 相关的 API 调用。

func (*IssuesService) CreateIssue

func (s *IssuesService) CreateIssue(ctx context.Context, pid interface{}, opts *CreateIssueOptions) (*Issue, *Response, error)

CreateIssue 在项目中新建一个缺陷。

func (*IssuesService) DeleteIssue added in v0.6.0

func (s *IssuesService) DeleteIssue(ctx context.Context, pid interface{}, issueID int) (*Response, error)

DeleteIssue 删除项目中指定 ID 的缺陷。

func (*IssuesService) GetIssue

func (s *IssuesService) GetIssue(ctx context.Context, pid interface{}, issueID int) (*Issue, *Response, error)

GetIssue 获取项目中指定 ID 的缺陷。

func (*IssuesService) GetIssueSubscription

func (s *IssuesService) GetIssueSubscription(ctx context.Context, pid interface{}, issueID int) (bool, *Response, error)

GetIssueSubscription 查询缺陷订阅状态。

func (*IssuesService) ListIssues

func (s *IssuesService) ListIssues(ctx context.Context, pid interface{}, opts *ListIssuesOptions) ([]*Issue, *Response, error)

ListIssues 获取项目的缺陷列表。

func (*IssuesService) ListUserIssues

func (s *IssuesService) ListUserIssues(ctx context.Context, opts *ListIssuesOptions) ([]*Issue, *Response, error)

ListUserIssues 获取当前用户创建的缺陷列表。

func (*IssuesService) SubscribeIssue

func (s *IssuesService) SubscribeIssue(ctx context.Context, pid interface{}, issueID int) (*Response, error)

SubscribeIssue 订阅缺陷。

func (*IssuesService) UnsubscribeIssue

func (s *IssuesService) UnsubscribeIssue(ctx context.Context, pid interface{}, issueID int) (*Response, error)

UnsubscribeIssue 取消订阅缺陷。

func (*IssuesService) UpdateIssue

func (s *IssuesService) UpdateIssue(ctx context.Context, pid interface{}, issueID int, opts *UpdateIssueOptions) (*Issue, *Response, error)

UpdateIssue 编辑项目中指定的缺陷。

type Label

type Label struct {
	Name                   string `json:"name,omitempty"`
	Color                  string `json:"color,omitempty"`
	Description            string `json:"description,omitempty"`
	OpenIssuesCount        int    `json:"open_issues_count,omitempty"`
	ClosedIssuesCount      int    `json:"closed_issues_count,omitempty"`
	OpenMergeRequestsCount int    `json:"open_merge_requests_count,omitempty"`
}

Label 表示一个项目标签。

type LabelsService

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

LabelsService 处理与 Label 相关的 API 调用。

func (*LabelsService) CreateLabel

func (s *LabelsService) CreateLabel(ctx context.Context, pid interface{}, opts *CreateLabelOptions) (*Label, *Response, error)

CreateLabel 在项目中创建一个新标签。

func (*LabelsService) DeleteLabel

func (s *LabelsService) DeleteLabel(ctx context.Context, pid interface{}, opts *DeleteLabelOptions) (*Response, error)

DeleteLabel 删除项目中的一个标签。

func (*LabelsService) ListLabels

func (s *LabelsService) ListLabels(ctx context.Context, pid interface{}, opts *ListLabelsOptions) ([]*Label, *Response, error)

ListLabels 获取项目的标签列表。

func (*LabelsService) UpdateLabel

func (s *LabelsService) UpdateLabel(ctx context.Context, pid interface{}, opts *UpdateLabelOptions) (*Label, *Response, error)

UpdateLabel 更新项目中的一个标签。

type ListBranchesOptions

type ListBranchesOptions struct {
	ListOptions
}

ListBranchesOptions 表示 ListBranches 的可选参数。

type ListCommitCommentsOptions

type ListCommitCommentsOptions struct {
	ListOptions
}

ListCommitCommentsOptions 表示 ListCommitComments 的可选参数。

type ListCommitRefsOptions

type ListCommitRefsOptions struct {
	ListOptions
	Type *string `url:"type,omitempty" json:"type,omitempty"`
}

ListCommitRefsOptions 表示 ListCommitRefs 的可选参数。

type ListCommitReviewsOptions

type ListCommitReviewsOptions struct {
	ListOptions
	AuthorID *int    `url:"author_id,omitempty" json:"author_id,omitempty"`
	State    *string `url:"state,omitempty" json:"state,omitempty"`
	OrderBy  *string `url:"order_by,omitempty" json:"order_by,omitempty"`
	Sort     *string `url:"sort,omitempty" json:"sort,omitempty"`
}

ListCommitReviewsOptions 是 ListCommitReviews 的可选参数。

type ListCommitStatusesOptions

type ListCommitStatusesOptions struct {
	ListOptions
	Ref   *string `url:"ref,omitempty" json:"ref,omitempty"`
	Stage *string `url:"stage,omitempty" json:"stage,omitempty"`
	Name  *string `url:"name,omitempty" json:"name,omitempty"`
	All   *bool   `url:"all,omitempty" json:"all,omitempty"`
}

ListCommitStatusesOptions 是 ListCommitStatuses 的可选参数。

type ListCommitsOptions

type ListCommitsOptions struct {
	ListOptions
	RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
	Path    *string `url:"path,omitempty" json:"path,omitempty"`
	Since   *string `url:"since,omitempty" json:"since,omitempty"`
	Until   *string `url:"until,omitempty" json:"until,omitempty"`
}

ListCommitsOptions 表示 ListCommits 的可选参数。

type ListGroupMembersOptions

type ListGroupMembersOptions struct {
	ListOptions
}

ListGroupMembersOptions 表示 ListGroupMembers 的可选参数。

type ListGroupsOptions

type ListGroupsOptions struct {
	ListOptions
	Search *string `url:"search,omitempty" json:"search,omitempty"`
}

ListGroupsOptions 表示 ListGroups 的可选参数。

type ListIssueNotesOptions

type ListIssueNotesOptions struct {
	ListOptions
}

ListIssueNotesOptions 是 ListIssueNotes 的可选参数。

type ListIssuesOptions

type ListIssuesOptions struct {
	ListOptions
	IID           *int    `url:"iid,omitempty" json:"iid,omitempty"`
	ResolveState  *string `url:"resolve_state,omitempty" json:"resolve_state,omitempty"`
	Grade         *int    `url:"grade,omitempty" json:"grade,omitempty"`
	State         *string `url:"state,omitempty" json:"state,omitempty"`
	Labels        *string `url:"labels,omitempty" json:"labels,omitempty"`
	Milestone     *string `url:"milestone,omitempty" json:"milestone,omitempty"`
	OrderBy       *string `url:"order_by,omitempty" json:"order_by,omitempty"`
	Sort          *string `url:"sort,omitempty" json:"sort,omitempty"`
	CreatedAfter  *string `url:"created_after,omitempty" json:"created_after,omitempty"`
	CreatedBefore *string `url:"created_before,omitempty" json:"created_before,omitempty"`
}

ListIssuesOptions 是 ListIssues 的可选参数。

type ListLabelsOptions

type ListLabelsOptions struct {
	ListOptions
}

ListLabelsOptions 是 ListLabels 的可选参数。

type ListMRCommentsOptions

type ListMRCommentsOptions struct {
	ListOptions
}

ListMRCommentsOptions 表示 ListMRComments 的可选参数。

type ListMergeRequestCommitsOptions

type ListMergeRequestCommitsOptions struct {
	ListOptions
}

ListMergeRequestCommitsOptions 表示 ListMergeRequestCommits 的可选参数。

type ListMergeRequestNotesOptions

type ListMergeRequestNotesOptions struct {
	ListOptions
}

ListMergeRequestNotesOptions 是 ListMergeRequestNotes 的可选参数。

type ListMergeRequestsOptions

type ListMergeRequestsOptions struct {
	ListOptions
	State   *string `url:"state,omitempty" json:"state,omitempty"`
	OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
	Sort    *string `url:"sort,omitempty" json:"sort,omitempty"`
	IID     *int    `url:"iid,omitempty" json:"iid,omitempty"`
}

ListMergeRequestsOptions 表示 ListMergeRequests 的可选参数。

type ListMilestoneIssuesOptions

type ListMilestoneIssuesOptions struct {
	ListOptions
}

ListMilestoneIssuesOptions 表示 ListMilestoneIssues 的可选参数。

type ListMilestonesOptions

type ListMilestonesOptions struct {
	ListOptions
}

ListMilestonesOptions 表示 ListMilestones 的可选参数。

type ListNamespacesOptions

type ListNamespacesOptions struct {
	ListOptions
	Search *string `url:"search,omitempty" json:"search,omitempty"`
}

ListNamespacesOptions 是 ListNamespaces 的可选参数。

type ListOptions

type ListOptions struct {
	Page    int `url:"page,omitempty" json:"page,omitempty"`
	PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"`
}

ListOptions 是所有列表接口通用的分页参数。

type ListProjectEventsOptions

type ListProjectEventsOptions struct {
	ListOptions
	UserIDOrName interface{}
}

ListProjectEventsOptions 表示 ListProjectEvents 的可选参数。

type ListProjectMembersOptions

type ListProjectMembersOptions struct {
	ListOptions
	Query *string `url:"query,omitempty" json:"query,omitempty"`
}

ListProjectMembersOptions 表示 ListProjectMembers 的可选参数。

type ListProjectStarsOptions

type ListProjectStarsOptions struct {
	ListOptions
}

ListProjectStarsOptions 表示 ListProjectStars 的可选参数。

type ListProjectsOptions

type ListProjectsOptions struct {
	ListOptions
	Search           *string `url:"search,omitempty" json:"search,omitempty"`
	Archived         *bool   `url:"archived,omitempty" json:"archived,omitempty"`
	WithArchived     *bool   `url:"with_archived,omitempty" json:"with_archived,omitempty"`
	WithPush         *bool   `url:"with_push,omitempty" json:"with_push,omitempty"`
	Abandoned        *bool   `url:"abandoned,omitempty" json:"abandoned,omitempty"`
	VisibilityLevels *string `url:"visibility_levels,omitempty" json:"visibility_levels,omitempty"`
	OrderBy          *string `url:"order_by,omitempty" json:"order_by,omitempty"`
	Sort             *string `url:"sort,omitempty" json:"sort,omitempty"`
}

ListProjectsOptions 表示 ListProjects 的可选参数。

type ListReleasesOptions

type ListReleasesOptions struct {
	ListOptions
}

ListReleasesOptions 是 ListReleases 的可选参数。

type ListReviewNotesOptions

type ListReviewNotesOptions struct {
	ListOptions
}

ListReviewNotesOptions 是 ListReviewNotes 的可选参数。

type ListTagsOptions

type ListTagsOptions struct {
	ListOptions
}

ListTagsOptions 是 ListTags 的可选参数。

type ListTreeOptions

type ListTreeOptions struct {
	ListOptions
	Path    *string `url:"path,omitempty" json:"path,omitempty"`
	RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
}

ListTreeOptions 是 ListTree 的可选参数。

type ListUsersOptions

type ListUsersOptions struct {
	ListOptions
	Search *string `url:"search,omitempty" json:"search,omitempty"`
}

ListUsersOptions 是 ListUsers 的可选参数。

type ListWatchedProjectsOptions

type ListWatchedProjectsOptions struct {
	ListOptions
}

ListWatchedProjectsOptions 是 ListWatchedProjects 的可选参数。

type ListWatchersOptions

type ListWatchersOptions struct {
	ListOptions
}

ListWatchersOptions 是 ListWatchers 的可选参数。

type ListWebhooksOptions

type ListWebhooksOptions struct {
	ListOptions
}

ListWebhooksOptions 是 ListWebhooks 的可选参数。

type MRComment

type MRComment struct {
	ID         int    `json:"id,omitempty"`
	Body       string `json:"body,omitempty"`
	Attachment string `json:"attachment,omitempty"`
	Author     *User  `json:"author,omitempty"`
	CreatedAt  Time   `json:"created_at,omitempty"`
	System     bool   `json:"system,omitempty"`
}

MRComment 表示合并请求的评论。

type MRSubscription

type MRSubscription struct {
	Subscribed bool `json:"subscribed,omitempty"`
}

MRSubscription 表示合并请求的订阅状态。

type Member

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

Member 表示一个组或项目的成员。

type MergeRequest

type MergeRequest struct {
	ID              int        `json:"id,omitempty"`
	IID             int        `json:"iid,omitempty"`
	Title           string     `json:"title,omitempty"`
	Description     string     `json:"description,omitempty"`
	State           string     `json:"state,omitempty"`
	TargetBranch    string     `json:"target_branch,omitempty"`
	SourceBranch    string     `json:"source_branch,omitempty"`
	TargetProjectID int        `json:"target_project_id,omitempty"`
	SourceProjectID int        `json:"source_project_id,omitempty"`
	Assignee        *User      `json:"assignee,omitempty"`
	Author          *User      `json:"author,omitempty"`
	Milestone       *Milestone `json:"milestone,omitempty"`
	ProjectID       int        `json:"project_id,omitempty"`
	WorkInProgress  bool       `json:"work_in_progress,omitempty"`
	Labels          []string   `json:"labels,omitempty"`
	CreatedAt       Time       `json:"created_at,omitempty"`
	UpdatedAt       Time       `json:"updated_at,omitempty"`
	Upvotes         int        `json:"upvotes,omitempty"`
	Downvotes       int        `json:"downvotes,omitempty"`
}

MergeRequest 表示工蜂合并请求。

type MergeRequestChanges

type MergeRequestChanges struct {
	MergeRequest
	Files []*Diff `json:"files,omitempty"`
}

MergeRequestChanges 表示合并请求的详情及其代码变更。

type MergeRequestsService

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

MergeRequestsService 处理与工蜂合并请求相关的 API。

func (*MergeRequestsService) AcceptMergeRequest

func (s *MergeRequestsService) AcceptMergeRequest(ctx context.Context, pid interface{}, mergeRequestID int, opts *AcceptMergeRequestOptions) (*MergeRequest, *Response, error)

AcceptMergeRequest 合并一个合并请求。

func (*MergeRequestsService) CreateMRComment

func (s *MergeRequestsService) CreateMRComment(ctx context.Context, pid interface{}, mergeRequestID int, opts *CreateMRCommentOptions) (*MRComment, *Response, error)

CreateMRComment 添加合并请求评论。

func (*MergeRequestsService) CreateMergeRequest

func (s *MergeRequestsService) CreateMergeRequest(ctx context.Context, pid interface{}, opts *CreateMergeRequestOptions) (*MergeRequest, *Response, error)

CreateMergeRequest 新增合并请求。

func (*MergeRequestsService) DownloadMergeRequestChangedFiles

func (s *MergeRequestsService) DownloadMergeRequestChangedFiles(ctx context.Context, pid interface{}, mergeRequestID int, w io.Writer) (*Response, error)

DownloadMergeRequestChangedFiles 下载合并请求的差异文件集。

func (*MergeRequestsService) GetMRSubscription

func (s *MergeRequestsService) GetMRSubscription(ctx context.Context, pid interface{}, mergeRequestID int) (*MRSubscription, *Response, error)

GetMRSubscription 查询是否订阅了合并请求。

func (*MergeRequestsService) GetMergeRequest

func (s *MergeRequestsService) GetMergeRequest(ctx context.Context, pid interface{}, mergeRequestID int) (*MergeRequest, *Response, error)

GetMergeRequest 查询单个合并请求。

func (*MergeRequestsService) GetMergeRequestChanges

func (s *MergeRequestsService) GetMergeRequestChanges(ctx context.Context, pid interface{}, mergeRequestID int) (*MergeRequestChanges, *Response, error)

GetMergeRequestChanges 查询合并请求的代码变更。

func (*MergeRequestsService) ListMRComments

func (s *MergeRequestsService) ListMRComments(ctx context.Context, pid interface{}, mergeRequestID int, opts *ListMRCommentsOptions) ([]*MRComment, *Response, error)

ListMRComments 获取合并请求的评论列表。

func (*MergeRequestsService) ListMergeRequestCommits

func (s *MergeRequestsService) ListMergeRequestCommits(ctx context.Context, pid interface{}, mergeRequestID int, opts *ListMergeRequestCommitsOptions) ([]*Commit, *Response, error)

ListMergeRequestCommits 获取合并请求中的提交列表。

func (*MergeRequestsService) ListMergeRequests

func (s *MergeRequestsService) ListMergeRequests(ctx context.Context, pid interface{}, opts *ListMergeRequestsOptions) ([]*MergeRequest, *Response, error)

ListMergeRequests 获取项目的合并请求列表。

func (*MergeRequestsService) SubscribeMR

func (s *MergeRequestsService) SubscribeMR(ctx context.Context, pid interface{}, mergeRequestID int) (*MRSubscription, *Response, error)

SubscribeMR 订阅合并请求。

func (*MergeRequestsService) UnsubscribeMR

func (s *MergeRequestsService) UnsubscribeMR(ctx context.Context, pid interface{}, mergeRequestID int) (*MRSubscription, *Response, error)

UnsubscribeMR 取消订阅合并请求。

func (*MergeRequestsService) UpdateMergeRequest

func (s *MergeRequestsService) UpdateMergeRequest(ctx context.Context, pid interface{}, mergeRequestID int, opts *UpdateMergeRequestOptions) (*MergeRequest, *Response, error)

UpdateMergeRequest 更新合并请求。

type Milestone

type Milestone struct {
	ID          int    `json:"id,omitempty"`
	IID         int    `json:"iid,omitempty"`
	ProjectID   int    `json:"project_id,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	State       string `json:"state,omitempty"`
	DueDate     Time   `json:"due_date,omitempty"`
	CreatedAt   Time   `json:"created_at,omitempty"`
	UpdatedAt   Time   `json:"updated_at,omitempty"`
}

Milestone 表示工蜂里程碑。

type MilestoneIssue

type MilestoneIssue struct {
	ID          int      `json:"id,omitempty"`
	IID         int      `json:"iid,omitempty"`
	ProjectID   int      `json:"project_id,omitempty"`
	Title       string   `json:"title,omitempty"`
	Description string   `json:"description,omitempty"`
	State       string   `json:"state,omitempty"`
	CreatedAt   Time     `json:"created_at,omitempty"`
	UpdatedAt   Time     `json:"updated_at,omitempty"`
	Labels      []string `json:"labels,omitempty"`
	Author      *User    `json:"author,omitempty"`
	Assignee    *User    `json:"assignee,omitempty"`
}

MilestoneIssue 表示里程碑下的缺陷。

type MilestonesService

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

MilestonesService 处理与工蜂里程碑相关的 API。

func (*MilestonesService) CreateMilestone

func (s *MilestonesService) CreateMilestone(ctx context.Context, pid interface{}, opts *CreateMilestoneOptions) (*Milestone, *Response, error)

CreateMilestone 新增里程碑。

func (*MilestonesService) DeleteMilestone

func (s *MilestonesService) DeleteMilestone(ctx context.Context, pid interface{}, milestoneID int) (*Response, error)

DeleteMilestone 删除里程碑。

func (*MilestonesService) EditMilestone

func (s *MilestonesService) EditMilestone(ctx context.Context, pid interface{}, milestoneID int, opts *EditMilestoneOptions) (*Milestone, *Response, error)

EditMilestone 编辑里程碑。

func (*MilestonesService) GetMilestone

func (s *MilestonesService) GetMilestone(ctx context.Context, pid interface{}, milestoneID int) (*Milestone, *Response, error)

GetMilestone 获取单个里程碑。

func (*MilestonesService) ListMilestoneIssues

func (s *MilestonesService) ListMilestoneIssues(ctx context.Context, pid interface{}, milestoneID int, opts *ListMilestoneIssuesOptions) ([]*MilestoneIssue, *Response, error)

ListMilestoneIssues 获取里程碑下的缺陷列表。

func (*MilestonesService) ListMilestones

func (s *MilestonesService) ListMilestones(ctx context.Context, pid interface{}, opts *ListMilestonesOptions) ([]*Milestone, *Response, error)

ListMilestones 获取项目的里程碑列表。

type Namespace

type Namespace struct {
	ID          int    `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Path        string `json:"path,omitempty"`
	Kind        string `json:"kind,omitempty"`
	WebURL      string `json:"web_url,omitempty"`
	Description string `json:"description,omitempty"`
	AvatarURL   string `json:"avatar_url,omitempty"`
}

Namespace 表示工蜂命名空间。

type NamespacesService

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

NamespacesService 处理与命名空间相关的 API 调用。

func (*NamespacesService) ListNamespaces

func (s *NamespacesService) ListNamespaces(ctx context.Context, opts *ListNamespacesOptions) ([]*Namespace, *Response, error)

ListNamespaces 获取命名空间列表。

type Note

type Note struct {
	ID           int    `json:"id,omitempty"`
	Body         string `json:"body,omitempty"`
	Attachment   string `json:"attachment,omitempty"`
	Author       *User  `json:"author,omitempty"`
	CreatedAt    Time   `json:"created_at,omitempty"`
	UpdatedAt    Time   `json:"updated_at,omitempty"`
	System       bool   `json:"system,omitempty"`
	NoteableID   int    `json:"noteable_id,omitempty"`
	NoteableType string `json:"noteable_type,omitempty"`
}

Note 表示一条评论。

type NotesService

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

NotesService 处理与 Note 相关的 API 调用。

func (*NotesService) CreateIssueNote

func (s *NotesService) CreateIssueNote(ctx context.Context, pid interface{}, issueID int, opts *CreateIssueNoteOptions) (*Note, *Response, error)

CreateIssueNote 为缺陷创建一条评论。

func (*NotesService) CreateMergeRequestNote

func (s *NotesService) CreateMergeRequestNote(ctx context.Context, pid interface{}, mergeRequestID int, opts *CreateMergeRequestNoteOptions) (*Note, *Response, error)

CreateMergeRequestNote 为合并请求创建一条评论。

func (*NotesService) CreateReviewNote

func (s *NotesService) CreateReviewNote(ctx context.Context, pid interface{}, reviewID int, opts *CreateReviewNoteOptions) (*Note, *Response, error)

CreateReviewNote 为代码评审创建一条评论。

func (*NotesService) GetIssueNote

func (s *NotesService) GetIssueNote(ctx context.Context, pid interface{}, issueID, noteID int) (*Note, *Response, error)

GetIssueNote 获取缺陷中指定 ID 的评论。

func (*NotesService) GetMergeRequestNote

func (s *NotesService) GetMergeRequestNote(ctx context.Context, pid interface{}, mergeRequestID, noteID int) (*Note, *Response, error)

GetMergeRequestNote 获取合并请求中指定 ID 的评论。

func (*NotesService) GetReviewNote

func (s *NotesService) GetReviewNote(ctx context.Context, pid interface{}, reviewID, noteID int) (*Note, *Response, error)

GetReviewNote 获取代码评审中指定 ID 的评论。

func (*NotesService) ListIssueNotes

func (s *NotesService) ListIssueNotes(ctx context.Context, pid interface{}, issueID int, opts *ListIssueNotesOptions) ([]*Note, *Response, error)

ListIssueNotes 获取缺陷的评论列表。

func (*NotesService) ListMergeRequestNotes

func (s *NotesService) ListMergeRequestNotes(ctx context.Context, pid interface{}, mergeRequestID int, opts *ListMergeRequestNotesOptions) ([]*Note, *Response, error)

ListMergeRequestNotes 获取合并请求的评论列表。

func (*NotesService) ListReviewNotes

func (s *NotesService) ListReviewNotes(ctx context.Context, pid interface{}, reviewID int, opts *ListReviewNotesOptions) ([]*Note, *Response, error)

ListReviewNotes 获取代码评审的评论列表。

func (*NotesService) UpdateIssueNote

func (s *NotesService) UpdateIssueNote(ctx context.Context, pid interface{}, issueID, noteID int, opts *UpdateIssueNoteOptions) (*Note, *Response, error)

UpdateIssueNote 修改缺陷中指定 ID 的评论。

func (*NotesService) UpdateMergeRequestNote

func (s *NotesService) UpdateMergeRequestNote(ctx context.Context, pid interface{}, mergeRequestID, noteID int, opts *UpdateMergeRequestNoteOptions) (*Note, *Response, error)

UpdateMergeRequestNote 修改合并请求中指定 ID 的评论。

func (*NotesService) UpdateReviewNote

func (s *NotesService) UpdateReviewNote(ctx context.Context, pid interface{}, reviewID, noteID int, opts *UpdateReviewNoteOptions) (*Note, *Response, error)

UpdateReviewNote 修改代码评审中指定 ID 的评论。

type Project

type Project struct {
	ID                   int            `json:"id,omitempty"`
	Description          string         `json:"description,omitempty"`
	Public               bool           `json:"public,omitempty"`
	Archived             bool           `json:"archived,omitempty"`
	VisibilityLevel      int            `json:"visibility_level,omitempty"`
	Namespace            *Namespace     `json:"namespace,omitempty"`
	Name                 string         `json:"name,omitempty"`
	NameWithNamespace    string         `json:"name_with_namespace,omitempty"`
	Path                 string         `json:"path,omitempty"`
	PathWithNamespace    string         `json:"path_with_namespace,omitempty"`
	DefaultBranch        string         `json:"default_branch,omitempty"`
	SSHURLToRepo         string         `json:"ssh_url_to_repo,omitempty"`
	HTTPURLToRepo        string         `json:"http_url_to_repo,omitempty"`
	HTTPSURLToRepo       string         `json:"https_url_to_repo,omitempty"`
	WebURL               string         `json:"web_url,omitempty"`
	TagList              []string       `json:"tag_list,omitempty"`
	IssuesEnabled        bool           `json:"issues_enabled,omitempty"`
	MergeRequestsEnabled bool           `json:"merge_requests_enabled,omitempty"`
	WikiEnabled          bool           `json:"wiki_enabled,omitempty"`
	SnippetsEnabled      bool           `json:"snippets_enabled,omitempty"`
	ReviewEnabled        bool           `json:"review_enabled,omitempty"`
	ForkEnabled          bool           `json:"fork_enabled,omitempty"`
	CreatedAt            Time           `json:"created_at,omitempty"`
	LastActivityAt       Time           `json:"last_activity_at,omitempty"`
	CreatorID            int            `json:"creator_id,omitempty"`
	AvatarURL            string         `json:"avatar_url,omitempty"`
	WatchsCount          int            `json:"watchs_count,omitempty"`
	StarsCount           int            `json:"stars_count,omitempty"`
	ForksCount           int            `json:"forks_count,omitempty"`
	ConfigStorage        *ConfigStorage `json:"config_storage,omitempty"`
	Statistics           *Statistics    `json:"statistics,omitempty"`
}

Project 表示工蜂项目。

type ProjectEvent

type ProjectEvent struct {
	Title          string                 `json:"title,omitempty"`
	ProjectID      int                    `json:"project_id,omitempty"`
	ActionName     string                 `json:"action_name,omitempty"`
	TargetID       int                    `json:"target_id,omitempty"`
	TargetType     string                 `json:"target_type,omitempty"`
	AuthorID       int                    `json:"author_id,omitempty"`
	AuthorUsername string                 `json:"author_username,omitempty"`
	CreatedAt      Time                   `json:"created_at,omitempty"`
	TargetTitle    string                 `json:"target_title,omitempty"`
	Data           map[string]interface{} `json:"data,omitempty"`
}

ProjectEvent 表示项目事件。

type ProjectShare

type ProjectShare struct {
	ProjectID   int  `json:"project_id,omitempty"`
	GroupID     int  `json:"group_id,omitempty"`
	GroupAccess int  `json:"group_access,omitempty"`
	CreatedAt   Time `json:"created_at,omitempty"`
	UpdatedAt   Time `json:"updated_at,omitempty"`
}

ProjectShare 表示项目共享到组的关系。

type ProjectStar

type ProjectStar struct {
	ProjectID int   `json:"project_id,omitempty"`
	User      *User `json:"user,omitempty"`
}

ProjectStar 表示项目标星关系。

type ProjectsService

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

ProjectsService 处理与工蜂项目相关的 API。

func (*ProjectsService) AddProjectMember

func (s *ProjectsService) AddProjectMember(ctx context.Context, pid interface{}, opts *AddProjectMemberOptions) (*Member, *Response, error)

AddProjectMember 添加项目成员。

func (*ProjectsService) CreateProject

func (s *ProjectsService) CreateProject(ctx context.Context, opts *CreateProjectOptions) (*Project, *Response, error)

CreateProject 创建一个新项目。

func (*ProjectsService) DeleteProject

func (s *ProjectsService) DeleteProject(ctx context.Context, pid interface{}) (*Response, error)

DeleteProject 删除项目。

func (*ProjectsService) DeleteProjectMember

func (s *ProjectsService) DeleteProjectMember(ctx context.Context, pid interface{}, userID int) (*Response, error)

DeleteProjectMember 移除项目成员。

func (*ProjectsService) DeleteProjectShare

func (s *ProjectsService) DeleteProjectShare(ctx context.Context, pid interface{}, groupID int) (*Response, error)

DeleteProjectShare 删除项目共享关系。

func (*ProjectsService) EditProjectMember

func (s *ProjectsService) EditProjectMember(ctx context.Context, pid interface{}, userID int, opts *EditProjectMemberOptions) (*Member, *Response, error)

EditProjectMember 修改项目成员的权限。

func (*ProjectsService) GetProject

func (s *ProjectsService) GetProject(ctx context.Context, pid interface{}) (*Project, *Response, error)

GetProject 获取单个项目的详情。

func (*ProjectsService) GetProjectMember

func (s *ProjectsService) GetProjectMember(ctx context.Context, pid interface{}, userID int) (*Member, *Response, error)

GetProjectMember 获取项目中的单个成员。

func (*ProjectsService) GetStarStatus

func (s *ProjectsService) GetStarStatus(ctx context.Context, pid interface{}) (bool, *Response, error)

GetStarStatus 查询项目标星状态。

func (*ProjectsService) ListOwnedProjects

func (s *ProjectsService) ListOwnedProjects(ctx context.Context, opts *ListProjectsOptions) ([]*Project, *Response, error)

ListOwnedProjects 获取当前用户拥有的项目列表。

func (*ProjectsService) ListProjectEvents

func (s *ProjectsService) ListProjectEvents(ctx context.Context, pid interface{}, opts *ListProjectEventsOptions) ([]*ProjectEvent, *Response, error)

ListProjectEvents 获取项目事件列表。

func (*ProjectsService) ListProjectMembers

func (s *ProjectsService) ListProjectMembers(ctx context.Context, pid interface{}, opts *ListProjectMembersOptions) ([]*Member, *Response, error)

ListProjectMembers 获取项目成员列表。

func (*ProjectsService) ListProjectShares

func (s *ProjectsService) ListProjectShares(ctx context.Context, pid interface{}) ([]*ProjectShare, *Response, error)

ListProjectShares 获取项目共享的组列表。

func (*ProjectsService) ListProjectStars

func (s *ProjectsService) ListProjectStars(ctx context.Context, pid interface{}, opts *ListProjectStarsOptions) ([]*ProjectStar, *Response, error)

ListProjectStars 获取项目标星用户列表。

func (*ProjectsService) ListProjects

func (s *ProjectsService) ListProjects(ctx context.Context, opts *ListProjectsOptions) ([]*Project, *Response, error)

ListProjects 获取项目列表。

func (*ProjectsService) SearchProjects added in v0.6.0

func (s *ProjectsService) SearchProjects(ctx context.Context, query string) ([]*Project, *Response, error)

SearchProjects 按关键词搜索项目。

func (*ProjectsService) ShareProject

func (s *ProjectsService) ShareProject(ctx context.Context, pid interface{}, opts *ShareProjectOptions) (*Response, error)

ShareProject 将项目共享给组。

func (*ProjectsService) StarProject

func (s *ProjectsService) StarProject(ctx context.Context, pid interface{}) (bool, *Response, error)

StarProject 对项目标星。

func (*ProjectsService) UnstarProject

func (s *ProjectsService) UnstarProject(ctx context.Context, pid interface{}) (*Response, error)

UnstarProject 取消项目标星。

func (*ProjectsService) UpdateProject

func (s *ProjectsService) UpdateProject(ctx context.Context, pid interface{}, opts *UpdateProjectOptions) (*Project, *Response, error)

UpdateProject 修改项目设置。

type ProtectedBranch

type ProtectedBranch struct {
	Name               string `json:"name,omitempty"`
	DevelopersCanPush  bool   `json:"developers_can_push,omitempty"`
	DevelopersCanMerge bool   `json:"developers_can_merge,omitempty"`
}

ProtectedBranch 表示保护分支的详情。

type Release

type Release struct {
	TagName     string  `json:"tag_name,omitempty"`
	Description string  `json:"description,omitempty"`
	CreatedAt   Time    `json:"created_at,omitempty"`
	Author      *User   `json:"author,omitempty"`
	Commit      *Commit `json:"commit,omitempty"`
}

Release 表示一个项目发布版本。

type ReleasesService

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

ReleasesService 处理与 Release 相关的 API 调用。

func (*ReleasesService) CreateRelease

func (s *ReleasesService) CreateRelease(ctx context.Context, pid interface{}, opts *CreateReleaseOptions) (*Release, *Response, error)

CreateRelease 在项目中创建一个新的 Release。

func (*ReleasesService) DeleteRelease

func (s *ReleasesService) DeleteRelease(ctx context.Context, pid interface{}, tagName string) (*Response, error)

DeleteRelease 删除项目中指定 tag 的 Release。

func (*ReleasesService) GetRelease

func (s *ReleasesService) GetRelease(ctx context.Context, pid interface{}, tagName string) (*Release, *Response, error)

GetRelease 获取项目中指定 tag 的 Release。

func (*ReleasesService) ListReleases

func (s *ReleasesService) ListReleases(ctx context.Context, pid interface{}, opts *ListReleasesOptions) ([]*Release, *Response, error)

ListReleases 获取项目的所有 Release。

func (*ReleasesService) UpdateRelease

func (s *ReleasesService) UpdateRelease(ctx context.Context, pid interface{}, tagName string, opts *UpdateReleaseOptions) (*Release, *Response, error)

UpdateRelease 更新项目中指定 tag 的 Release。

type RemoveCommitReviewerOptions

type RemoveCommitReviewerOptions struct {
	ReviewerID *int `json:"reviewer_id,omitempty" url:"reviewer_id,omitempty"`
}

RemoveCommitReviewerOptions 是 RemoveCommitReviewer 的可选参数。

type RemoveMRReviewerOptions

type RemoveMRReviewerOptions struct {
	ReviewerID *int `json:"reviewer_id,omitempty" url:"reviewer_id,omitempty"`
}

RemoveMRReviewerOptions 是 RemoveMRReviewer 的可选参数。

type RepositoriesService

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

RepositoriesService 处理与仓库相关的 API 调用。

func (*RepositoriesService) Archive

func (s *RepositoriesService) Archive(ctx context.Context, pid interface{}, w io.Writer, opts *ArchiveOptions) (*Response, error)

Archive 下载项目仓库的存档,将内容写入 w。

func (*RepositoriesService) Compare

func (s *RepositoriesService) Compare(ctx context.Context, pid interface{}, opts *CompareOptions) (*CompareResult, *Response, error)

Compare 比较项目中两个分支、Tag 或 SHA。

func (*RepositoriesService) CreateFile

func (s *RepositoriesService) CreateFile(ctx context.Context, pid interface{}, opts *CreateFileOptions) (*RepositoryFile, *Response, error)

CreateFile 在仓库中创建一个新文件。

func (*RepositoriesService) DeleteFile

func (s *RepositoriesService) DeleteFile(ctx context.Context, pid interface{}, opts *DeleteFileOptions) (*Response, error)

DeleteFile 删除仓库中的一个文件。

func (*RepositoriesService) DownloadCompareChangedFiles

func (s *RepositoriesService) DownloadCompareChangedFiles(ctx context.Context, pid interface{}, w io.Writer, opts *CompareOptions) (*Response, error)

DownloadCompareChangedFiles 下载 Compare 差异文件集。

func (*RepositoriesService) GetCommitRawFile

func (s *RepositoriesService) GetCommitRawFile(ctx context.Context, pid interface{}, sha string, w io.Writer, opts *GetRawFileOptions) (*Response, error)

GetCommitRawFile 获取指定提交中的文件原始内容。

func (*RepositoriesService) GetFile

func (s *RepositoriesService) GetFile(ctx context.Context, pid interface{}, opts *GetFileOptions) (*RepositoryFile, *Response, error)

GetFile 获取仓库中指定文件的内容。

func (*RepositoriesService) GetRawFile

func (s *RepositoriesService) GetRawFile(ctx context.Context, pid interface{}, sha string, w io.Writer, opts *GetRawFileOptions) (*Response, error)

GetRawFile 获取 blob 原始内容。

func (*RepositoriesService) ListTree

func (s *RepositoriesService) ListTree(ctx context.Context, pid interface{}, opts *ListTreeOptions) ([]*TreeNode, *Response, error)

ListTree 获取项目仓库的文件树。

func (*RepositoriesService) UpdateFile

func (s *RepositoriesService) UpdateFile(ctx context.Context, pid interface{}, opts *UpdateFileOptions) (*RepositoryFile, *Response, error)

UpdateFile 修改仓库中的一个文件。

type RepositoryFile

type RepositoryFile struct {
	FileName string `json:"file_name,omitempty"`
	FilePath string `json:"file_path,omitempty"`
	Size     int    `json:"size,omitempty"`
	Encoding string `json:"encoding,omitempty"`
	Content  string `json:"content,omitempty"`
	Ref      string `json:"ref,omitempty"`
	BlobID   string `json:"blob_id,omitempty"`
	CommitID string `json:"commit_id,omitempty"`
}

RepositoryFile 表示仓库中的一个文件。

type Response

type Response struct {
	*http.Response

	// TotalItems 是查询结果的总条目数。
	TotalItems int

	// TotalPages 是总页数。
	TotalPages int

	// ItemsPerPage 是每页条目数。
	ItemsPerPage int

	// CurrentPage 是当前页码(从 1 开始)。
	CurrentPage int

	// NextPage 是下一页页码。
	NextPage int

	// PreviousPage 是上一页页码。
	PreviousPage int
}

Response 包装 http.Response,附加工蜂 API 的分页信息。

type Review

type Review struct {
	ID                    int         `json:"id,omitempty"`
	ProjectID             int         `json:"project_id,omitempty"`
	Title                 string      `json:"title,omitempty"`
	Description           string      `json:"description,omitempty"`
	State                 string      `json:"state,omitempty"`
	CreatedAt             Time        `json:"created_at,omitempty"`
	UpdatedAt             Time        `json:"updated_at,omitempty"`
	Author                *User       `json:"author,omitempty"`
	Reviewers             []*Reviewer `json:"reviewers,omitempty"`
	ReviewableID          int         `json:"reviewable_id,omitempty"`
	ReviewableType        string      `json:"reviewable_type,omitempty"`
	ApproverRule          int         `json:"approver_rule,omitempty"`
	NecessaryApproverRule int         `json:"necessary_approver_rule,omitempty"`
	PushResetEnabled      bool        `json:"push_reset_enabled,omitempty"`
}

Review 表示一个 Commit 评审。

type Reviewer

type Reviewer struct {
	ID          int    `json:"id,omitempty"`
	Username    string `json:"username,omitempty"`
	Name        string `json:"name,omitempty"`
	State       string `json:"state,omitempty"`
	AvatarURL   string `json:"avatar_url,omitempty"`
	Type        string `json:"type,omitempty"`
	ReviewState string `json:"review_state,omitempty"`
	CreatedAt   Time   `json:"created_at,omitempty"`
	UpdatedAt   Time   `json:"updated_at,omitempty"`
}

Reviewer 表示一个评审人。

type ReviewsService

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

ReviewsService 处理与 MR 评审和 Commit 评审相关的 API 调用。

func (*ReviewsService) CancelMRReview

func (s *ReviewsService) CancelMRReview(ctx context.Context, pid interface{}, mergeRequestID int) (*Response, error)

CancelMRReview 取消 MR 评审。

func (*ReviewsService) CreateCommitReview

func (s *ReviewsService) CreateCommitReview(ctx context.Context, pid interface{}, opts *CreateCommitReviewOptions) (*Review, *Response, error)

CreateCommitReview 新建一个 Commit 评审。

func (*ReviewsService) DownloadCommitReviewChangedFiles

func (s *ReviewsService) DownloadCommitReviewChangedFiles(ctx context.Context, pid interface{}, reviewID int, w io.Writer) (*Response, error)

DownloadCommitReviewChangedFiles 下载 Commit Review 差异文件集。

func (*ReviewsService) GetCommitReview

func (s *ReviewsService) GetCommitReview(ctx context.Context, pid interface{}, reviewID int) (*Review, *Response, error)

GetCommitReview 获取单个 Commit 评审。

func (*ReviewsService) GetMRReview

func (s *ReviewsService) GetMRReview(ctx context.Context, pid interface{}, mergeRequestID int) (*Review, *Response, error)

GetMRReview 获取 MR 评审信息。

func (*ReviewsService) InviteCommitReviewer

func (s *ReviewsService) InviteCommitReviewer(ctx context.Context, pid interface{}, reviewID int, opts *InviteCommitReviewerOptions) (*Response, error)

InviteCommitReviewer 邀请评审人参与 Commit 评审。

func (*ReviewsService) InviteMRReviewer

func (s *ReviewsService) InviteMRReviewer(ctx context.Context, pid interface{}, mergeRequestID int, opts *InviteMRReviewerOptions) (*Response, error)

InviteMRReviewer 邀请评审人参与 MR 评审。

func (*ReviewsService) ListCommitReviews

func (s *ReviewsService) ListCommitReviews(ctx context.Context, pid interface{}, opts *ListCommitReviewsOptions) ([]*Review, *Response, error)

ListCommitReviews 获取项目的 Commit 评审列表。

func (*ReviewsService) RemoveCommitReviewer

func (s *ReviewsService) RemoveCommitReviewer(ctx context.Context, pid interface{}, reviewID int, opts *RemoveCommitReviewerOptions) (*Response, error)

RemoveCommitReviewer 移除 Commit 评审人。

func (*ReviewsService) RemoveMRReviewer

func (s *ReviewsService) RemoveMRReviewer(ctx context.Context, pid interface{}, mergeRequestID int, opts *RemoveMRReviewerOptions) (*Response, error)

RemoveMRReviewer 移除 MR 评审人。

func (*ReviewsService) ReopenCommitReview

func (s *ReviewsService) ReopenCommitReview(ctx context.Context, pid interface{}, reviewID int) (*Review, *Response, error)

ReopenCommitReview 重置 Commit 评审状态。

func (*ReviewsService) ReopenMRReview

func (s *ReviewsService) ReopenMRReview(ctx context.Context, pid interface{}, mergeRequestID int) (*Review, *Response, error)

ReopenMRReview 重置 MR 评审状态。

func (*ReviewsService) SubmitCommitReviewSummary

func (s *ReviewsService) SubmitCommitReviewSummary(ctx context.Context, pid interface{}, reviewID int, opts *SubmitCommitReviewSummaryOptions) (*Review, *Response, error)

SubmitCommitReviewSummary 发表 Commit 评审意见。

func (*ReviewsService) SubmitMRReviewSummary

func (s *ReviewsService) SubmitMRReviewSummary(ctx context.Context, pid interface{}, mergeRequestID int, opts *SubmitMRReviewSummaryOptions) (*Review, *Response, error)

SubmitMRReviewSummary 发表 MR 评审意见。

func (*ReviewsService) UpdateCommitReview

func (s *ReviewsService) UpdateCommitReview(ctx context.Context, pid interface{}, reviewID int, opts *UpdateCommitReviewOptions) (*Review, *Response, error)

UpdateCommitReview 更新 Commit 评审。

type SSHKey

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

SSHKey 表示用户 SSH Key。

type Session

type Session struct {
	ID           int    `json:"id,omitempty"`
	Username     string `json:"username,omitempty"`
	Email        string `json:"email,omitempty"`
	Name         string `json:"name,omitempty"`
	PrivateToken string `json:"private_token,omitempty"`
	State        string `json:"state,omitempty"`
	AvatarURL    string `json:"avatar_url,omitempty"`
}

Session 表示通过登录获取的用户会话信息。

type SessionService

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

SessionService 处理与用户会话相关的 API 调用。

func (*SessionService) GetSession

func (s *SessionService) GetSession(ctx context.Context, opts *GetSessionOptions) (*Session, *Response, error)

GetSession 通过登录凭据获取用户的私有令牌。

type ShareProjectOptions

type ShareProjectOptions struct {
	GroupID     *int `json:"group_id,omitempty"`
	GroupAccess *int `json:"group_access,omitempty"`
}

ShareProjectOptions 表示 ShareProject 的可选参数。

type Statistics

type Statistics struct {
	CommitCount    int     `json:"commit_count,omitempty"`
	RepositorySize float64 `json:"repository_size,omitempty"`
}

Statistics 表示项目的统计信息。

type SubmitCommitReviewSummaryOptions

type SubmitCommitReviewSummaryOptions struct {
	ReviewerEvent *string `json:"reviewer_event,omitempty" url:"reviewer_event,omitempty"`
	Summary       *string `json:"summary,omitempty" url:"summary,omitempty"`
}

SubmitCommitReviewSummaryOptions 是 SubmitCommitReviewSummary 的可选参数。

type SubmitMRReviewSummaryOptions

type SubmitMRReviewSummaryOptions struct {
	ReviewerEvent *string `json:"reviewer_event,omitempty" url:"reviewer_event,omitempty"`
	Summary       *string `json:"summary,omitempty" url:"summary,omitempty"`
}

SubmitMRReviewSummaryOptions 是 SubmitMRReviewSummary 的可选参数。

type Tag

type Tag struct {
	Name    string  `json:"name,omitempty"`
	Message string  `json:"message,omitempty"`
	Commit  *Commit `json:"commit,omitempty"`
}

Tag 表示一个 Git 标签。

type TagsService

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

TagsService 处理与 Tag 相关的 API 调用。

func (*TagsService) CreateTag

func (s *TagsService) CreateTag(ctx context.Context, pid interface{}, opts *CreateTagOptions) (*Tag, *Response, error)

CreateTag 在项目中创建一个新的 Tag。

func (*TagsService) DeleteTag

func (s *TagsService) DeleteTag(ctx context.Context, pid interface{}, tagName string) (*Response, error)

DeleteTag 删除项目中指定名称的 Tag。

func (*TagsService) GetTag

func (s *TagsService) GetTag(ctx context.Context, pid interface{}, tagName string) (*Tag, *Response, error)

GetTag 获取项目中指定名称的 Tag。

func (*TagsService) ListTags

func (s *TagsService) ListTags(ctx context.Context, pid interface{}, opts *ListTagsOptions) ([]*Tag, *Response, error)

ListTags 获取项目的所有 Tag。

type Time

type Time struct {
	time.Time
}

Time 是工蜂 API 中使用的时间类型。 它封装了 time.Time 并提供了自定义的 JSON 序列化/反序列化, 以正确处理工蜂 API 返回的多种时间格式。

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON 实现 json.Marshaler 接口。

func (Time) String

func (t Time) String() string

String 实现 fmt.Stringer 接口。

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 json.Unmarshaler 接口。 支持解析多种时间格式。

type TreeNode

type TreeNode struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
	Mode string `json:"mode,omitempty"`
}

TreeNode 表示仓库文件树中的一个节点。

type UpdateCommitReviewOptions

type UpdateCommitReviewOptions struct {
	Title       *string `json:"title,omitempty" url:"title,omitempty"`
	Description *string `json:"description,omitempty" url:"description,omitempty"`
}

UpdateCommitReviewOptions 是 UpdateCommitReview 的可选参数。

type UpdateFileOptions

type UpdateFileOptions struct {
	FilePath      *string `json:"file_path,omitempty" url:"file_path,omitempty"`
	BranchName    *string `json:"branch_name,omitempty" url:"branch_name,omitempty"`
	Encoding      *string `json:"encoding,omitempty" url:"encoding,omitempty"`
	Content       *string `json:"content,omitempty" url:"content,omitempty"`
	CommitMessage *string `json:"commit_message,omitempty" url:"commit_message,omitempty"`
}

UpdateFileOptions 是 UpdateFile 的可选参数。

type UpdateIssueNoteOptions

type UpdateIssueNoteOptions struct {
	Body *string `json:"body,omitempty" url:"body,omitempty"`
}

UpdateIssueNoteOptions 是 UpdateIssueNote 的可选参数。

type UpdateIssueOptions

type UpdateIssueOptions struct {
	Title        *string `json:"title,omitempty" url:"title,omitempty"`
	ResolveState *string `json:"resolve_state,omitempty" url:"resolve_state,omitempty"`
	Grade        *int    `json:"grade,omitempty" url:"grade,omitempty"`
	Description  *string `json:"description,omitempty" url:"description,omitempty"`
	AssigneeIDs  *string `json:"assignee_ids,omitempty" url:"assignee_ids,omitempty"`
	MilestoneID  *int    `json:"milestone_id,omitempty" url:"milestone_id,omitempty"`
	Labels       *string `json:"labels,omitempty" url:"labels,omitempty"`
	StateEvent   *string `json:"state_event,omitempty" url:"state_event,omitempty"`
}

UpdateIssueOptions 是 UpdateIssue 的可选参数。

type UpdateLabelOptions

type UpdateLabelOptions struct {
	Name        *string `json:"name,omitempty" url:"name,omitempty"`
	NewName     *string `json:"new_name,omitempty" url:"new_name,omitempty"`
	Color       *string `json:"color,omitempty" url:"color,omitempty"`
	Description *string `json:"description,omitempty" url:"description,omitempty"`
}

UpdateLabelOptions 是 UpdateLabel 的可选参数。

type UpdateMergeRequestNoteOptions

type UpdateMergeRequestNoteOptions struct {
	Body          *string `json:"body,omitempty" url:"body,omitempty"`
	ReviewerState *string `json:"reviewer_state,omitempty" url:"reviewer_state,omitempty"`
}

UpdateMergeRequestNoteOptions 是 UpdateMergeRequestNote 的可选参数。

type UpdateMergeRequestOptions

type UpdateMergeRequestOptions struct {
	Title        *string `json:"title,omitempty"`
	Description  *string `json:"description,omitempty"`
	TargetBranch *string `json:"target_branch,omitempty"`
	AssigneeID   *int    `json:"assignee_id,omitempty"`
	StateEvent   *string `json:"state_event,omitempty"`
}

UpdateMergeRequestOptions 表示 UpdateMergeRequest 的可选参数。

type UpdateProjectOptions

type UpdateProjectOptions struct {
	Name                 *string  `json:"name,omitempty"`
	Description          *string  `json:"description,omitempty"`
	DefaultBranch        *string  `json:"default_branch,omitempty"`
	LimitFileSize        *float64 `json:"limit_file_size,omitempty"`
	LimitLFSFileSize     *float64 `json:"limit_lfs_file_size,omitempty"`
	IssuesEnabled        *bool    `json:"issues_enabled,omitempty"`
	MergeRequestsEnabled *bool    `json:"merge_requests_enabled,omitempty"`
	WikiEnabled          *bool    `json:"wiki_enabled,omitempty"`
	ReviewEnabled        *bool    `json:"review_enabled,omitempty"`
	ForkEnabled          *bool    `json:"fork_enabled,omitempty"`
	TagNameRegex         *string  `json:"tag_name_regex,omitempty"`
	TagCreatePushLevel   *int     `json:"tag_create_push_level,omitempty"`
	VisibilityLevel      *int     `json:"visibility_level,omitempty"`
}

UpdateProjectOptions 表示 UpdateProject 的可选参数。

type UpdateReleaseOptions

type UpdateReleaseOptions struct {
	Description *string `json:"description,omitempty" url:"description,omitempty"`
}

UpdateReleaseOptions 是 UpdateRelease 的可选参数。

type UpdateReviewNoteOptions

type UpdateReviewNoteOptions struct {
	Body          *string `json:"body,omitempty" url:"body,omitempty"`
	ReviewerState *string `json:"reviewer_state,omitempty" url:"reviewer_state,omitempty"`
}

UpdateReviewNoteOptions 是 UpdateReviewNote 的可选参数。

type User

type User struct {
	ID        int    `json:"id,omitempty"`
	Username  string `json:"username,omitempty"`
	Name      string `json:"name,omitempty"`
	State     string `json:"state,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
	WebURL    string `json:"web_url,omitempty"`
}

User 表示工蜂用户信息。

type UserDetail

type UserDetail struct {
	User
	Email            string `json:"email,omitempty"`
	Bio              string `json:"bio,omitempty"`
	CreatedAt        Time   `json:"created_at,omitempty"`
	IsAdmin          bool   `json:"is_admin,omitempty"`
	ProjectLimit     int    `json:"projects_limit,omitempty"`
	CanCreateGroup   bool   `json:"can_create_group,omitempty"`
	CanCreateProject bool   `json:"can_create_project,omitempty"`
}

UserDetail 表示工蜂用户的详细信息。

type UsersService

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

UsersService 处理与用户相关的 API 调用。

func (*UsersService) CreateEmail

func (s *UsersService) CreateEmail(ctx context.Context, opts *CreateEmailOptions) (*Email, *Response, error)

CreateEmail 为当前用户添加邮箱。

func (*UsersService) CreateSSHKey

func (s *UsersService) CreateSSHKey(ctx context.Context, opts *CreateSSHKeyOptions) (*SSHKey, *Response, error)

CreateSSHKey 为当前用户创建 SSH Key。

func (*UsersService) DeleteEmail

func (s *UsersService) DeleteEmail(ctx context.Context, emailID int) (*Response, error)

DeleteEmail 删除当前用户指定邮箱。

func (*UsersService) DeleteSSHKey

func (s *UsersService) DeleteSSHKey(ctx context.Context, keyID int) (*Response, error)

DeleteSSHKey 删除当前用户指定的 SSH Key。

func (*UsersService) GetCurrentUser

func (s *UsersService) GetCurrentUser(ctx context.Context) (*UserDetail, *Response, error)

GetCurrentUser 获取当前认证用户的信息。

func (*UsersService) GetEmail

func (s *UsersService) GetEmail(ctx context.Context, emailID int) (*Email, *Response, error)

GetEmail 获取当前用户指定邮箱。

func (*UsersService) GetSSHKey

func (s *UsersService) GetSSHKey(ctx context.Context, keyID int) (*SSHKey, *Response, error)

GetSSHKey 获取当前用户指定的 SSH Key。

func (*UsersService) GetUser

func (s *UsersService) GetUser(ctx context.Context, uid interface{}) (*UserDetail, *Response, error)

GetUser 获取指定 ID 或用户名的用户信息。

func (*UsersService) GetUserByEmail

func (s *UsersService) GetUserByEmail(ctx context.Context, opts *GetUserByEmailOptions) (*User, *Response, error)

GetUserByEmail 通过邮箱获取用户基本信息。

func (*UsersService) ListEmails

func (s *UsersService) ListEmails(ctx context.Context) ([]*Email, *Response, error)

ListEmails 获取当前用户邮箱列表。

func (*UsersService) ListSSHKeys

func (s *UsersService) ListSSHKeys(ctx context.Context) ([]*SSHKey, *Response, error)

ListSSHKeys 获取当前用户的 SSH Key 列表。

func (*UsersService) ListUsers

func (s *UsersService) ListUsers(ctx context.Context, opts *ListUsersOptions) ([]*User, *Response, error)

ListUsers 获取用户列表。

func (*UsersService) ListWatchedProjects

func (s *UsersService) ListWatchedProjects(ctx context.Context, opts *ListWatchedProjectsOptions) ([]*Project, *Response, error)

ListWatchedProjects 获取当前用户关注的项目列表。

type VisibilityValue

type VisibilityValue int

VisibilityValue 表示项目的可见级别。

const (
	PrivateVisibility  VisibilityValue = 0
	InternalVisibility VisibilityValue = 10
	PublicVisibility   VisibilityValue = 20
)

项目可见级别常量。

type WatchProjectOptions

type WatchProjectOptions struct {
	Mute *bool `json:"mute,omitempty" url:"mute,omitempty"`
}

WatchProjectOptions 是 WatchProject 的可选参数。

type Watcher

type Watcher struct {
	ProjectID int   `json:"project_id,omitempty"`
	Mute      bool  `json:"mute,omitempty"`
	User      *User `json:"user,omitempty"`
}

Watcher 表示项目关注关系。

type WatchersService

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

WatchersService 处理与项目关注者相关的 API 调用。

func (*WatchersService) GetWatchStatus

func (s *WatchersService) GetWatchStatus(ctx context.Context, pid interface{}) (bool, *Response, error)

GetWatchStatus 获取当前用户是否关注项目。

func (*WatchersService) ListWatchers

func (s *WatchersService) ListWatchers(ctx context.Context, pid interface{}, opts *ListWatchersOptions) ([]*Watcher, *Response, error)

ListWatchers 获取项目的关注者列表。

func (*WatchersService) UnwatchProject

func (s *WatchersService) UnwatchProject(ctx context.Context, pid interface{}) (*Response, error)

UnwatchProject 取消关注一个项目。

func (*WatchersService) WatchProject

func (s *WatchersService) WatchProject(ctx context.Context, pid interface{}, opts *WatchProjectOptions) (*Watcher, *Response, error)

WatchProject 关注一个项目。

type Webhook

type Webhook struct {
	ID                    int    `json:"id,omitempty"`
	URL                   string `json:"url,omitempty"`
	ProjectID             int    `json:"project_id,omitempty"`
	PushEvents            bool   `json:"push_events,omitempty"`
	IssuesEvents          bool   `json:"issues_events,omitempty"`
	MergeRequestsEvents   bool   `json:"merge_requests_events,omitempty"`
	TagPushEvents         bool   `json:"tag_push_events,omitempty"`
	NoteEvents            bool   `json:"note_events,omitempty"`
	EnableSSLVerification bool   `json:"enable_ssl_verification,omitempty"`
	CreatedAt             Time   `json:"created_at,omitempty"`
}

Webhook 表示一个项目的回调钩子。

type WebhooksService

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

WebhooksService 处理与项目 Webhook 相关的 API 调用。

func (*WebhooksService) AddWebhook

func (s *WebhooksService) AddWebhook(ctx context.Context, pid interface{}, opts *AddWebhookOptions) (*Webhook, *Response, error)

AddWebhook 为项目添加一个回调钩子。

func (*WebhooksService) DeleteWebhook

func (s *WebhooksService) DeleteWebhook(ctx context.Context, pid interface{}, hookID int) (*Response, error)

DeleteWebhook 删除项目中指定 ID 的 Webhook。

func (*WebhooksService) EditWebhook

func (s *WebhooksService) EditWebhook(ctx context.Context, pid interface{}, hookID int, opts *EditWebhookOptions) (*Webhook, *Response, error)

EditWebhook 编辑项目中指定 ID 的 Webhook。

func (*WebhooksService) GetWebhook

func (s *WebhooksService) GetWebhook(ctx context.Context, pid interface{}, hookID int) (*Webhook, *Response, error)

GetWebhook 获取项目中指定 ID 的 Webhook。

func (*WebhooksService) ListWebhooks

func (s *WebhooksService) ListWebhooks(ctx context.Context, pid interface{}, opts *ListWebhooksOptions) ([]*Webhook, *Response, error)

ListWebhooks 获取项目的所有 Webhook。

Jump to

Keyboard shortcuts

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