gitee

package
v0.0.0-...-d359bf6 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package gitee golang 版本的 gitee API 实现 模仿 go-github 实现的

Index

Constants

View Source
const (
	Version = "v1.0.0"
)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

Types

type AcceptedError

type AcceptedError struct {
	// Raw contains the response body.
	Raw []byte
}

func (*AcceptedError) Error

func (*AcceptedError) Error() string

func (*AcceptedError) Is

func (ae *AcceptedError) Is(target error) bool

Is returns whether the provided error equals this error.

type ActivityService

type ActivityService service

ActivityService handles communication with the activity related methods of the gitee API.

func (*ActivityService) ListStargazers

func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error)

ListStargazers lists people who have starred the specified repo. 列出 star 了仓库的用户 GET https://gitee.com/api/v5/repos/{owner}/{repo}/stargazers

func (*ActivityService) ListWatchers

func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error)

ListWatchers lists watchers of a particular repo.

列出 watch 了仓库的用户 GET https://gitee.com/api/v5/repos/{owner}/{repo}/subscribers

type BaiduStatisticRequest

type BaiduStatisticRequest struct {
	Key string `url:"key,omitempty"` //通过百度统计页面获取的 hm.js? 后面的 key
}

type BasicCommit

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

仓库的某个提交

type BasicUser

type BasicUser struct {
	ID                *int64  `json:"id,omitempty"`
	Login             *string `json:"login,omitempty"`
	Name              *string `json:"name,omitempty"`
	AvatarURL         *string `json:"avatar_url,omitempty"`
	URL               *string `json:"url,omitempty"`
	HTMLURL           *string `json:"html_url,omitempty"`
	Remark            *string `json:"remark,omitempty"`
	FollowersURL      *string `json:"followers_url,omitempty"`
	FollowingURL      *string `json:"following_url,omitempty"`
	GistsURL          *string `json:"gists_url,omitempty"`
	StarredURL        *string `json:"starred_url,omitempty"`
	SubscriptionsURL  *string `json:"subscriptions_url,omitempty"`
	OrganizationsURL  *string `json:"organizations_url,omitempty"`
	ReposURL          *string `json:"repos_url,omitempty"`
	EventsURL         *string `json:"events_url,omitempty"`
	ReceivedEventsURL *string `json:"received_events_url,omitempty"`
	Type              *string `json:"type,omitempty"`
}

type Branch

type Branch struct {
	Name          *string      `json:"name,omitempty"`
	Commit        *BasicCommit `json:"commit,omitempty"` // 这里只有 sha,和url 2个属性
	Protected     *bool        `json:"protected,omitempty"`
	ProtectionURL *string      `json:"protection_url,omitempty"`
}

Branch represents a repository branch

func (Branch) String

func (r Branch) String() string

type BranchRequest

type BranchRequest struct {
	Refs       *string `json:"refs,omitempty"`        // 起点名称, 默认:master
	BranchName *string `json:"branch_name,omitempty"` // 新创建的分支名称
}

type Client

type Client struct {

	// Base URL for API requests. Defaults to the public GitHub API, but can be
	// set to a domain endpoint to use with GitHub Enterprise. BaseURL should
	// always be specified with a trailing slash.
	BaseURL *url.URL

	// User agent used when communicating with the GitHub API.
	UserAgent string

	// Services used for talking to different parts of the gitee API.
	Users         *UsersService
	Repositories  *RepositoriesService
	Search        *SearchService
	PullRequests  *PullRequestsService
	Organizations *OrganizationsService
	Enterprises   *EnterprisesService
	Miscellaneous *MiscellaneousService
	Gitignores    *GitignoresService
	Issues        *IssuesService
	Git           *GitService
	Gists         *GistsService
	Activity      *ActivityService
	Licenses      *LicensesService
	// contains filtered or unexported fields
}

A Client manages communication with the gitee API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new gitee API client. If a nil httpClient is provided, a new http.Client will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).

func (*Client) BareDo

func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, error)

BareDo sends an API request and lets you handle the api response. If an error or API Error occurs, the error will contain more information. Otherwise you are supposed to read and close the response's Body. If rate limit is exceeded and reset time is in the future, BareDo returns *RateLimitError immediately without making a network API call.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) Client

func (c *Client) Client() *http.Client

Client returns the http.Client used by this GitHub client.

func (*Client) Do

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

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If v is nil, and no error hapens, the response is returned as is. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type CollaboratorAddRequest

type CollaboratorAddRequest struct {
	// Permission specifies the permission to grant the user on this repository.
	// Possible values are:
	//     成员权限: 拉代码(pull),推代码(push),管理员(admin)。默认: push
	Permission string `json:"permission,omitempty"`
}

CollaboratorAddRequest specifies the optional parameters to the

type CollaboratorInvitation

type CollaboratorInvitation struct {
	*BasicUser              // 用个匿名字段 减少 这里 重复的属性
	Permissions *Permission `json:"permissions,omitempty"`
}

CollaboratorInvitation represents an invitation created when adding a collaborator.

func (CollaboratorInvitation) String

func (r CollaboratorInvitation) String() string

type CollaboratorsPermissionLevel

type CollaboratorsPermissionLevel struct {
	*BasicUser         // 用个匿名字段 减少 这里 重复的属性
	Permission *string `json:"permission,omitempty"`
}

func (CollaboratorsPermissionLevel) String

type CommentRequest

type CommentRequest struct {
	Body     *string `json:"body"`     // 评论的内容
	Path     *string `json:"path"`     //文件的相对路径
	Position *int64  `json:"position"` //Diff的相对行数
}

type CommentTarget

type CommentTarget struct {
	Issue       *string `json:"issue,omitempty"`
	PullRequest *string `json:"pull_request,omitempty"`
}

type CommentsListOptions

type CommentsListOptions struct {
	Order string `url:"order,omitempty"` //排序顺序: asc(default),desc

	ListOptions //当前的页码, 每页的数量,最大为 100
}

type Commit

type Commit struct {
	Author    *CommitAuthor `json:"author,omitempty"`
	Committer *CommitAuthor `json:"committer,omitempty"`
	Message   *string       `json:"message,omitempty"`
	Tree      *Tree         `json:"tree,omitempty"`
}

func (Commit) String

func (c Commit) String() string

type CommitAuthor

type CommitAuthor struct {
	Date  *time.Time `json:"date,omitempty"`
	Name  *string    `json:"name,omitempty"`
	Email *string    `json:"email,omitempty"`
}

type CommitFile

type CommitFile struct {
	SHA      *string `json:"sha,omitempty"`
	Filename *string `json:"filename,omitempty"`
	Status   *string `json:"status,omitempty"`

	Additions *int `json:"additions,omitempty"`
	Deletions *int `json:"deletions,omitempty"`
	Changes   *int `json:"changes,omitempty"`

	BlobURL     *string `json:"blob_url,omitempty"`
	RawURL      *string `json:"raw_url,omitempty"`
	ContentsURL *string `json:"contents_url,omitempty"`

	Patch *string `json:"patch,omitempty"`
}

type CommitStats

type CommitStats struct {
	ID        *string `json:"id,omitempty"`
	Additions *int    `json:"additions,omitempty"`
	Deletions *int    `json:"deletions,omitempty"`
	Total     *int    `json:"total,omitempty"`
}

type CommitsComparison

type CommitsComparison struct {
	BaseCommit      *RepositoryCommit   `json:"base_commit,omitempty"`
	MergeBaseCommit *RepositoryCommit   `json:"merge_base_commit,omitempty"`
	Files           []*CommitFile       `json:"files,omitempty"`
	Commits         []*RepositoryCommit `json:"commits,omitempty"`
}

func (CommitsComparison) String

func (c CommitsComparison) String() string

type CommitsListOptions

type CommitsListOptions struct {
	// SHA or branch to start listing Commits from. 提交起始的SHA值或者分支名. 默认: 仓库的默认分支
	SHA string `url:"sha,omitempty"`

	// Path that should be touched by the returned Commits. 包含该文件的提交
	Path string `url:"path,omitempty"`

	// Author of by which to filter Commits. 提交作者的邮箱或个人空间地址(username/login)
	Author string `url:"author,omitempty"`

	// Since when should Commits be included in the response.提交的起始时间,时间格式为 ISO 8601
	Since time.Time `url:"since,omitempty"`

	// Until when should Commits be included in the response.提交的最后时间,时间格式为 ISO 8601
	Until time.Time `url:"until,omitempty"`

	ListOptions //当前的页码, 每页的数量,最大为 100
}

CommitsListOptions specifies the optional parameters to the RepositoriesService.ListCommits method. 这个和 一样

type Contributor

type Contributor struct {
	Contributions *int    `json:"contributions,omitempty"`
	Name          *string `json:"name,omitempty"`
	Email         *string `json:"email,omitempty"`
}

Contributor represents a repository contributor

func (Contributor) String

func (r Contributor) String() string

type ContributorListOptions

type ContributorListOptions struct {
	Type string `url:"type,omitempty"` // 贡献者类型

	ListOptions
}

type EditRepositoryRequest

type EditRepositoryRequest struct {
	Name        string `json:"name,omitempty"`        //"name": string 仓库名称 必须要有的
	Description string `json:"description,omitempty"` //"description": string 仓库描述
	Homepage    string `json:"homepage,omitempty"`    //"homepage": string 主页
	HasIssues   bool   `json:"has_issues,omitempty"`  //"has_issues": boolean 是否开启issue功能
	HasWiki     bool   `json:"has_wiki,omitempty"`    //"has_wiki": boolean 是否开启Wiki功能
	CanComment  bool   `json:"can_comment,omitempty"` //"can_comment": boolean 是否允许用户对仓库进行评论
	//AutoInit          *bool   `json:"auto_init,omitempty"`          //值为true时则会用README初始化仓库。默认: 不初始化(false)
	//GitignoreTemplate *string `json:"gitignore_template,omitempty"` //Git Ignore模版
	//LicenseTemplate   *string `json:"license_template,omitempty"`   // License模版
	Path    string `json:"path,omitempty"`    //"path": string 仓库路径
	Private bool   `json:"private,omitempty"` //"private": boolean 是否私有
	// 下面 是 多出来的  和 CreateRepositoryRequest 比较
	IssueComment         bool   `json:"issue_comment,omitempty"`          //"issue_comment": boolean 是否允许用户对“关闭”状态的 Issue 进行评论
	SecurityHoleEnabled  bool   `json:"security_hole_enabled,omitempty"`  //这个Issue涉及到安全/隐私问题,提交后不公开此Issue(可见范围:仓库成员, 企业成员)
	DefaultBranch        string `json:"default_branch,omitempty"`         //"default_branch": string 默认分支
	PullRequestsEnabled  bool   `json:"pull_requests_enabled,omitempty"`  //"pull_requests_enabled": boolean 是否接受 Pull Request,协作开发
	OnlineEditEnabled    bool   `json:"online_edit_enabled,omitempty"`    //"online_edit_enabled": boolean 是否允许仓库文件在线编辑
	LightweightPREnabled bool   `json:"lightweight_pr_enabled,omitempty"` //"lightweight_pr_enabled": boolean 是否接受轻量级 pull request
}

EditRepositoryRequest 更新仓库设置 需要的 一个结构体,这个和 Repository 结构体类似,但是 Repository 里面有更多的字段. 接口中 标记 formData 的 都要放到 结构体里面,作为json体内容发送请求的 TODO 结构体里面 字段 是否要使用 指针类型???

type Enterprise

type Enterprise struct {
}

type EnterprisesService

type EnterprisesService service

EnterprisesService provides access to the enterprises related functions in the gitee API.

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response         // HTTP response that caused this error
	ErrorMap map[string]interface{} `json:"error"`   // more detail on individual errors
	Message  string                 `json:"message"` // error message
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type FileCommit

type FileCommit struct {
	*Commit
	Parents []BasicCommit `json:"parents,omitempty"`
}

type GistsService

type GistsService service

GistsService handles communication with the Gist related methods of the gitee API.

type GitService

type GitService service

GitService handles communication with the git data related methods of the gitee API.

type Gitignore

type Gitignore struct {
	License *string `json:"license,omitempty"`
	Source  *string `json:"source,omitempty"`
}

func (Gitignore) String

func (l Gitignore) String() string

type GitignoresService

type GitignoresService service

GitignoresService provides access to the gitignore related functions in the gitee API.

func (*GitignoresService) Get

func (s *GitignoresService) Get(ctx context.Context, licenseName string) (*Gitignore, *Response, error)

Get extended metadata for one gitignore.

获取一个 .gitignore 模板 GET https://gitee.com/api/v5/gitignore/templates/{name}

func (*GitignoresService) GetRaw

func (s *GitignoresService) GetRaw(ctx context.Context, licenseName string) (string, *Response, error)

获取一个 .gitignore 模板原始文件 GET https://gitee.com/api/v5/gitignore/templates/{name}/raw

func (*GitignoresService) List

func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error)

List all available Gitignore templates.

列出可使用的 .gitignore 模板 GET https://gitee.com/api/v5/gitignore/templates

type Hook

type Hook struct {
	ID                  *int64     `json:"id,omitempty"`
	URL                 *string    `json:"url,omitempty"`
	CreatedAt           *Timestamp `json:"created_at,omitempty"`
	Password            *string    `json:"password,omitempty"`
	ProjectID           *int64     `json:"project_id,omitempty"`
	Result              *string    `json:"result,omitempty"`
	ResultCode          *int       `json:"result_code,omitempty"`
	PushEvents          *bool      `json:"push_events,omitempty"`
	TagPushEvents       *bool      `json:"tag_push_events,omitempty"`
	IssuesEvents        *bool      `json:"issues_events,omitempty"`
	NoteEvents          *bool      `json:"note_events,omitempty"`
	MergeRequestsEvents *bool      `json:"merge_requests_events,omitempty"`
}

func (Hook) String

func (h Hook) String() string

type IssuesService

type IssuesService service

IssuesService handles communication with the issue related methods of the gitee API.

type KeyCreateRequest

type KeyCreateRequest struct {
	Key   *string `json:"key"`   // 公钥内容
	Title *string `json:"title"` // 公钥名称
}

type License

type License struct {
	License *string `json:"license,omitempty"`
	Source  *string `json:"source,omitempty"`
}

License represents an open source license.

func (License) String

func (l License) String() string

type LicensesService

type LicensesService service

LicensesService handles communication with the license related methods of the gitee API.

func (*LicensesService) Get

func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error)

Get extended metadata for one license.

获取一个开源许可协议 GET https://gitee.com/api/v5/licenses/{license}

func (*LicensesService) GetRaw

func (s *LicensesService) GetRaw(ctx context.Context, licenseName string) (string, *Response, error)

获取一个开源许可协议原始文件 GET https://gitee.com/api/v5/licenses/{license}/raw

func (*LicensesService) License

func (s *LicensesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error)

License gets the contents of a repository's license if one is detected. 这个接口github放到repos 里面了 获取一个仓库使用的开源许可协议 GET https://gitee.com/api/v5/repos/{owner}/{repo}/license

func (*LicensesService) List

func (s *LicensesService) List(ctx context.Context) ([]string, *Response, error)

List popular open source licenses.

列出可使用的开源许可协议 GET https://gitee.com/api/v5/licenses

type Links struct {
	Self *string `json:"self,omitempty"`
	HTML *string `json:"html,omitempty"`
}

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve.
	Page int `url:"page,omitempty"`

	// For paginated result sets, the number of results to include per page.
	PerPage int `url:"per_page,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support offset pagination.

type MarkdownRequest

type MarkdownRequest struct {
	Text *string `json:"text,omitempty"`
}

type Membership

type Membership struct {
	URL             *string       `json:"url,omitempty"`
	Active          *bool         `json:"active,omitempty"`
	Remark          *string       `json:"remark,omitempty"`
	Role            *string       `json:"role,omitempty"`
	OrganizationURL *string       `json:"organization_url,omitempty"`
	Organization    *Organization `json:"organization,omitempty"`
	User            *User         `json:"user,omitempty"`
}

func (Membership) String

func (o Membership) String() string

type MembershipEditRequest

type MembershipEditRequest struct {
	Remark *string `json:"remark,omitempty"` //在组织中的备注信息
}

type MembershipListOptions

type MembershipListOptions struct {
	Active *bool `url:"active,omitempty"` // 根据成员是否已激活进行筛选资料,缺省返回所有资料
	ListOptions
}

type MiscellaneousService

type MiscellaneousService service

MiscellaneousService 杂项

func (*MiscellaneousService) GetEmail

func (s *MiscellaneousService) GetEmail(ctx context.Context, opts *ListOptions) (*UserEmail, *Response, error)

GetEmails lists all email addresses for the authenticated user.

获取授权用户的全部邮箱 GET https://gitee.com/api/v5/emails

func (*MiscellaneousService) ListEmojis

func (s *MiscellaneousService) ListEmojis(ctx context.Context) (map[string]string, *Response, error)

ListEmojis returns the emojis available to use on GitHub.

列出可使用的 Emoji GET https://gitee.com/api/v5/emojis

func (*MiscellaneousService) Markdown

Markdown renders an arbitrary Markdown document.

渲染 Markdown 文本 POST https://gitee.com/api/v5/markdown

type Namespace

type Namespace struct {
	ID      *int64     `json:"id,omitempty"`
	Type    *string    `json:"type,omitempty"`
	Name    *string    `json:"name,omitempty"`
	Path    *string    `json:"path,omitempty"`
	HTMLURL *string    `json:"html_url,omitempty"`
	Parent  *Namespace `json:"parent,omitempty"`
}

获取授权用户的一个 Namespace

func (Namespace) String

func (n Namespace) String() string

type NamespaceOptions

type NamespaceOptions struct {
	Path string `url:"path,omitempty"` // path Namespace path 需要一个参数
}

type NamespacesOptions

type NamespacesOptions struct {
	Mode string `url:"mode,omitempty"` // 参与方式: project(所有参与仓库的namepsce)、intrant(所加入的namespace)、all(包含前两者),默认(intrant)
}

type Organization

type Organization struct {
	ID          *int64  `json:"id,omitempty"`
	Login       *string `json:"login,omitempty"`
	Name        *string `json:"name,omitempty"`
	URL         *string `json:"url,omitempty"`
	AvatarURL   *string `json:"avatar_url,omitempty"`
	ReposURL    *string `json:"repos_url,omitempty"`
	EventsURL   *string `json:"events_url,omitempty"`
	MembersURL  *string `json:"members_url,omitempty"`
	Description *string `json:"description,omitempty"`
	FollowCount *int64  `json:"follow_count,omitempty"`
}

func (Organization) String

func (o Organization) String() string

type OrganizationListOptions

type OrganizationListOptions struct {
	Admin *bool `url:"admin,omitempty"` // 只列出授权用户管理的组织
	ListOptions
}

type OrganizationsService

type OrganizationsService service

OrganizationsService provides access to the organization related functions in the gitee API.

func (*OrganizationsService) EditOrgMembership

func (s *OrganizationsService) EditOrgMembership(ctx context.Context, org string, membership *MembershipEditRequest) (*Membership, *Response, error)

更新授权用户在一个组织的成员资料 PATCH https://gitee.com/api/v5/user/memberships/orgs/{org}

func (*OrganizationsService) GetOrgMembership

func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error)

获取授权用户在一个组织的成员资料 GET https://gitee.com/api/v5/user/memberships/orgs/{org} 获取授权用户所属组织的一个成员 GET https://gitee.com/api/v5/orgs/{org}/memberships/{username}

func (*OrganizationsService) List

List the organizations for a user. Passing the empty string will list organizations for the authenticated user.

列出授权用户所属的组织 GET https://gitee.com/api/v5/user/orgs 列出用户所属的组织 GET https://gitee.com/api/v5/users/{username}/orgs

func (*OrganizationsService) ListOrgMemberships

func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *MembershipListOptions) ([]*Membership, *Response, error)

列出授权用户在所属组织的成员资料 GET https://gitee.com/api/v5/user/memberships/orgs

type Pages

type Pages struct {
	URL    *string `json:"url,omitempty"`
	Status *string `json:"status,omitempty"`
}

type Permission

type Permission struct {
	Pull  *bool `json:"pull,omitempty"`
	Push  *bool `json:"push,omitempty"`
	Admin *bool `json:"admin,omitempty"`
}

func (Permission) String

func (p Permission) String() string

type Program

type Program struct {
}

type Protection

type Protection struct {
	Name          *string           `json:"name,omitempty"` // branch name
	Commit        *RepositoryCommit `json:"commit,omitempty"`
	Protected     *bool             `json:"protected,omitempty"`
	ProtectionURL *string           `json:"protection_url,omitempty"`
	Links         *Links            `json:"_links,omitempty"`
}

Protection represents a repository branch's protection.

func (Protection) String

func (p Protection) String() string

type ProtectionRequest

type ProtectionRequest struct {
	Wildcard    *string `json:"wildcard,omitempty"`     // 分支/通配符
	NewWildcard *string `json:"new_wildcard,omitempty"` // 新分支/通配符(为空不修改)
	Pusher      *string `json:"pusher,omitempty"`       // admin: 仓库管理员, none: 禁止任何人合并; 用户: 个人的地址path(多个用户用 ';' 隔开)
	Merger      *string `json:"merger,omitempty"`       // admin: 仓库管理员, none: 禁止任何人合并; 用户: 个人的地址path(多个用户用 ';' 隔开)
}

type ProtectionSetting

type ProtectionSetting struct {
	ID        *int64  `json:"id,omitempty"`
	ProjectID *int64  `json:"project_id,omitempty"`
	Wildcard  *string `json:"wildcard,omitempty"` // wildcard name
	Strict    *bool   `json:"strict,omitempty"`   // 是否严格检查
	Pusher    *string `json:"pusher,omitempty"`   // admin: 仓库管理员, none: 禁止任何人合并; 用户: 个人的地址path(多个用户用 ';' 隔开)
	Merger    *string `json:"merger,omitempty"`   // admin: 仓库管理员, none: 禁止任何人合并; 用户: 个人的地址path(多个用户用 ';' 隔开)

}

func (ProtectionSetting) String

func (p ProtectionSetting) String() string

type PullRequest

type PullRequest struct {
	ID     *int64  `json:"id,omitempty"`
	Number *int    `json:"number,omitempty"`
	State  *string `json:"state,omitempty"`
	Locked *bool   `json:"locked,omitempty"`
	Title  *string `json:"title,omitempty"`
}

PullRequest represents a GitHub pull request on a repository.

func (PullRequest) String

func (p PullRequest) String() string

type PullRequestListOptions

type PullRequestListOptions struct {
	// State filters pull requests based on their state. Possible values are:
	// open, closed, all. Default is "open". 可选。Pull Request 状态
	State string `url:"state,omitempty"`

	// Head filters pull requests by head user and branch name in the format of:
	// "user:ref-name". 可选。Pull Request 提交的源分支。格式:branch 或者:username:branch
	Head string `url:"head,omitempty"`

	// Base filters pull requests by base branch name. 可选。Pull Request 提交目标分支的名称。
	Base string `url:"base,omitempty"`

	// Sort specifies how to sort pull requests. Possible values are: created,
	// updated, popularity, long-running. Default is "created". 可选。排序字段,默认按创建时间
	Sort string `url:"sort,omitempty"`

	Since string `url:"since,omitempty"` //可选。起始的更新时间,要求时间格式为 ISO 8601

	// Direction in which to sort pull requests. Possible values are: asc, desc.
	// If Sort is "created" or not specified, Default is "desc", otherwise Default
	// is "asc" 可选。升序/降序
	Direction string `url:"direction,omitempty"`

	MilestoneNumber int64 `url:"milestone_number,omitempty"` //可选。里程碑序号(id)

	Labels string `url:"labels,omitempty"` //用逗号分开的标签。如: bug,performance

	ListOptions
}

PullRequestListOptions specifies the optional parameters to the PullRequestsService.List method.

type PullRequestsService

type PullRequestsService service

PullRequestsService handles communication with the pull request related methods of the gitee API.

func (*PullRequestsService) List

List the pull requests for the specified repository. 获取Pull Request列表 GET https://gitee.com/api/v5/repos/{owner}/{repo}/pulls

type PushConfig

type PushConfig struct {
	AuthorEmailSuffix         *string `json:"author_email_suffix,omitempty"`
	CommitMessageRegex        *string `json:"commit_message_regex,omitempty"`
	ExceptManager             *bool   `json:"except_manager,omitempty"`
	MaxFileSize               *int    `json:"max_file_size,omitempty"`
	RestrictAuthorEmailSuffix *bool   `json:"restrict_author_email_suffix,omitempty"`
	RestrictCommitMessage     *bool   `json:"restrict_commit_message,omitempty"`
	RestrictFileSize          *bool   `json:"restrict_file_size,omitempty"`
	RestrictPushOwnCommit     *bool   `json:"restrict_push_own_commit,omitempty"`
}

func (PushConfig) String

func (r PushConfig) String() string

type PushConfigUpdateRequest

type PushConfigUpdateRequest struct {
	*PushConfig
}

type ReleaseAsset

type ReleaseAsset struct {
	BrowserDownloadURL *string `json:"browser_download_url,omitempty"`
}

ReleaseAsset represents a GitHub release asset in a repository.

type RepositoriesService

type RepositoriesService service

RepositoriesService handles communication with the repository related methods of the gitee API.

gitee API docs: https://gitee.com/api/v5/repos

func (*RepositoriesService) AddCollaborator

func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, acreq *CollaboratorAddRequest) (*CollaboratorInvitation, *Response, error)

AddCollaborator sends an invitation to the specified gitee user to become a collaborator to the given repo.

添加仓库成员 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/collaborators/{username}

func (*RepositoriesService) BuildPages

func (s *RepositoriesService) BuildPages(ctx context.Context, owner, repo string) (*Response, error)

TODO not test, 需要实名认证的比较麻烦. 报错1 "message": "仓库持有者未实名认证,不允许部署 pages" 报错2 "message": "500 Internal Server Error" 对这个仓库执行 oschina/git-osc RequestPageBuild requests a build of a gitee Pages site without needing to push new commit.

请求建立Pages POST https://gitee.com/api/v5/repos/{owner}/{repo}/pages/builds

func (*RepositoriesService) Clear

func (s *RepositoriesService) Clear(ctx context.Context, owner string, repo string) (*Response, error)

清空一个仓库 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/clear

func (*RepositoriesService) CompareCommits

func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error)

CompareCommits compares a range of commits with each other.

两个Commits之间对比的版本差异 GET https://gitee.com/api/v5/repos/{owner}/{repo}/compare/{base}...{head}

func (*RepositoriesService) Create

Create a new repository. 创建仓库方法 分成3个吧。创建 组织仓库 和创建 企业 仓库的 参数 都不太一样 创建一个仓库 POST https://gitee.com/api/v5/user/repos

func (*RepositoriesService) CreateBaiduStatisticKey

func (s *RepositoriesService) CreateBaiduStatisticKey(ctx context.Context, owner, repo string, opts *BaiduStatisticRequest) (*string, *Response, error)

TODO not test 设置/更新仓库的百度统计 key POST https://gitee.com/api/v5/repos/{owner}/{repo}/baidu_statistic_key

func (*RepositoriesService) CreateBranch

func (s *RepositoriesService) CreateBranch(ctx context.Context, owner string, repo string, rreq *BranchRequest) (*Branch, *Response, error)

创建分支 POST https://gitee.com/api/v5/repos/{owner}/{repo}/branches

func (*RepositoriesService) CreateBranchWildcardProtection

func (s *RepositoriesService) CreateBranchWildcardProtection(ctx context.Context, owner, repo string,
	preq *ProtectionRequest) (*ProtectionSetting, *Response, error)

CreateBranchWildcardProtection create the protection of a given branch owner 仓库所属空间地址(企业、组织或个人的地址path), 这个接口是新建一个 新的 repo 仓库路径(path) preq 结构体,里面用到 wildcard,pusher,merger 字段. wildcard 设置分支/通配符. 感觉就是这个分支规则 起的一个名称,附带着通配的作用. 例如:设置为“master”,则对名称为“master”的分支生效;设置为“*-stable“ 或 ”release*“,则对名称符合此通配符的所有保护分支生效 新建仓库保护分支策略 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/branches/setting/new

func (*RepositoriesService) CreateComment

func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *CommentRequest) (*RepositoryComment, *Response, error)

CreateComment creates a comment for the given commit.

创建Commit评论 POST https://gitee.com/api/v5/repos/{owner}/{repo}/commits/{sha}/comments

func (*RepositoriesService) CreateEntRepository

func (s *RepositoriesService) CreateEntRepository(ctx context.Context, enterprise string, opt *RepositoryCreateEntRequest) (*Repository, *Response, error)

创建企业仓库 POST https://gitee.com/api/v5/enterprises/{enterprise}/repos

func (*RepositoriesService) CreateFile

CreateFile creates a new file in a repository at the given path and returns the commit and file metadata.

新建文件 POST https://gitee.com/api/v5/repos/{owner}/{repo}/contents/{path}

func (*RepositoriesService) CreateFork

func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error)

CreateFork creates a fork of the specified repository.

This method might return an *AcceptedError and a status code of 202. This is because this is the status that GitHub returns to signify that it is now computing creating the fork in a background task. In this event, the Repository value will be returned, which includes the details about the pending fork. A follow up request, after a delay of a second or so, should result in a successful request.

Fork一个仓库 POST https://gitee.com/api/v5/repos/{owner}/{repo}/forks

func (*RepositoriesService) CreateKey

func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, kreq *KeyCreateRequest) (*SSHKey, *Response, error)

CreateKey adds a deploy key for a repository.

为仓库添加公钥 POST https://gitee.com/api/v5/repos/{owner}/{repo}/keys

func (*RepositoriesService) CreateOpenGo

func (s *RepositoriesService) CreateOpenGo(ctx context.Context, owner, repo string) (*Response, error)

开通Gitee Go POST https://gitee.com/api/v5/repos/{owner}/{repo}/open

func (*RepositoriesService) CreateOrgRepository

func (s *RepositoriesService) CreateOrgRepository(ctx context.Context, org string, opt *RepositoryCreateOrgRequest) (*Repository, *Response, error)

创建组织仓库 POST https://gitee.com/api/v5/orgs/{org}/repos

func (*RepositoriesService) CreateRelease

func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, releaseReq *RepositoryReleaseCreateRequest) (*RepositoryRelease, *Response, error)

创建仓库Release POST https://gitee.com/api/v5/repos/{owner}/{repo}/releases

func (*RepositoriesService) CreateTag

CreateTag creates a tag object.

创建一个仓库的 Tag POST https://gitee.com/api/v5/repos/{owner}/{repo}/tags

func (*RepositoriesService) Delete

func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error)

Delete a repository.

删除一个仓库 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}

func (*RepositoriesService) DeleteComment

func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error)

DeleteComment deletes a single comment from a repository.

删除Commit评论 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/comments/{id}

func (*RepositoriesService) DeleteFile

DeleteFile deletes a file from a repository and returns the commit. Requires the blob SHA of the file to be deleted.

删除文件 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/contents/{path}

func (*RepositoriesService) DeleteKey

func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error)

DeleteKey deletes a deploy key.

删除一个仓库公钥 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/keys/{id}

func (*RepositoriesService) DeleteRelease

func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error)

DeleteRelease delete a single release from a repository.

删除仓库Release DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/releases/{id}

func (*RepositoriesService) DisableKey

func (s *RepositoriesService) DisableKey(ctx context.Context, owner string, repo string, id int64) (*Response, error)

停用仓库公钥 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/keys/enable/{id}

func (*RepositoriesService) Edit

func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *EditRepositoryRequest) (*Repository, *Response, error)

Edit updates a repository.

更新仓库设置 PATCH https://gitee.com/api/v5/repos/{owner}/{repo}

func (*RepositoriesService) EditRelease

func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, releaseReq *RepositoryReleaseEditRequest) (*RepositoryRelease, *Response, error)

EditRelease edits a repository release.

Note that only a subset of the release fields are used. See RepositoryRelease for more information.

更新仓库Release PATCH https://gitee.com/api/v5/repos/{owner}/{repo}/releases/{id}

func (*RepositoriesService) EnableKey

func (s *RepositoriesService) EnableKey(ctx context.Context, owner string, repo string, id int64) (*Response, error)

启用仓库公钥 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/keys/enable/{id}

func (*RepositoriesService) Get

func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error)

Get fetches a repository.

获取用户的某个仓库 GET https://gitee.com/api/v5/repos/{owner}/{repo}

func (*RepositoriesService) GetBaiduStatisticKey

func (s *RepositoriesService) GetBaiduStatisticKey(ctx context.Context, owner, repo string) (*string, *Response, error)

TODO not test

获取仓库的百度统计 key GET https://gitee.com/api/v5/repos/{owner}/{repo}/baidu_statistic_key

func (*RepositoriesService) GetBranch

func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string) (*Branch, *Response, error)

GetBranch gets the specified branch for a repository. 获取单个分支 GET https://gitee.com/api/v5/repos/{owner}/{repo}/branches/{branch}

func (*RepositoriesService) GetComment

func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error)

GetComment gets a single comment from a repository. 获取仓库的某条Commit评论 GET https://gitee.com/api/v5/repos/{owner}/{repo}/comments/{id}

func (*RepositoriesService) GetCommit

func (s *RepositoriesService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*RepositoryCommit, *Response, error)

GetCommit fetches the Commit object for a given SHA. 仓库的某个提交: GET https://gitee.com/api/v5/repos/{owner}/{repo}/commits/{sha}

func (*RepositoriesService) GetContents

func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string,
	opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error)

GetContents can return either the metadata and content of a single file (when path references a file) or the metadata of all the files and/or subdirectories of a directory (when path references a directory). To make it easy to distinguish between both result types and to mimic the API as much as possible, both result types will be returned but only one will contain a value and the other will be nil. 获取仓库下某个文件,这时候第二个参数就会是 [] 获取仓库下面的一个目录的内容, 返回值 第一个就会是nil path 文件的路径

获取仓库具体路径下的内容 GET https://gitee.com/api/v5/repos/{owner}/{repo}/contents(/{path})

func (*RepositoriesService) GetKey

func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*SSHKey, *Response, error)

GetKey fetches a single deploy key.

获取仓库的单个公钥 GET https://gitee.com/api/v5/repos/{owner}/{repo}/keys/{id}

func (*RepositoriesService) GetLatestRelease

func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error)

GetLatestRelease fetches the latest published release for the repository.

获取仓库的最后更新的Release GET https://gitee.com/api/v5/repos/{owner}/{repo}/releases/latest

func (*RepositoriesService) GetPagesInfo

func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error)

GetPagesInfo fetches information about a Pages site.

获取Pages信息 GET https://gitee.com/api/v5/repos/{owner}/{repo}/pages

func (*RepositoriesService) GetPermissionLevel

func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*CollaboratorsPermissionLevel, *Response, error)

GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository.

查看仓库成员的权限 GET https://gitee.com/api/v5/repos/{owner}/{repo}/collaborators/{username}/permission

func (*RepositoriesService) GetPushConfig

func (s *RepositoriesService) GetPushConfig(ctx context.Context, owner, repo string) (*PushConfig, *Response, error)

获取仓库推送规则设置 GET https://gitee.com/api/v5/repos/{owner}/{repo}/push_config

func (*RepositoriesService) GetReadme

GetReadme gets the Readme file for the repository.

获取仓库README GET https://gitee.com/api/v5/repos/{owner}/{repo}/readme

func (*RepositoriesService) GetRelease

func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error)

GetRelease fetches a single release.

获取仓库的单个Releases GET https://gitee.com/api/v5/repos/{owner}/{repo}/releases/{id}

func (*RepositoriesService) GetReleaseByTag

func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error)

GetReleaseByTag fetches a release with the specified tag.

根据Tag名称获取仓库的Release GET https://gitee.com/api/v5/repos/{owner}/{repo}/releases/tags/{tag}

func (*RepositoriesService) IsCollaborator

func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error)

判断用户是否为仓库成员 GET https://gitee.com/api/v5/repos/{owner}/{repo}/collaborators/{username}

func (*RepositoriesService) List

List the repositories for a user. Passing the empty string will list repositories for the authenticated user. 列出授权用户的所有仓库 GET https://gitee.com/api/v5/user/repos 获取某个用户的公开仓库 GET https://gitee.com/api/v5/users/{username}/repos

func (*RepositoriesService) ListAvailableKeys

func (s *RepositoriesService) ListAvailableKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*SSHKey, *Response, error)

title可以用法,key内容不能重复, 把key停用之后就变到 可部署公钥列表里面了 获取的 Key 结构体中 只有 key 和 id 获取仓库可部署的公钥 GET https://gitee.com/api/v5/repos/{owner}/{repo}/keys/available

func (*RepositoriesService) ListBranches

func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string) ([]*Branch, *Response, error)

ListBranches lists branches for the specified repository. 获取所有分支: GET https://gitee.com/api/v5/repos/{owner}/{repo}/branches

func (*RepositoriesService) ListCollaborators

func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error)

ListCollaborators lists the GitHub users that have access to the repository.

获取仓库的所有成员 GET https://gitee.com/api/v5/repos/{owner}/{repo}/collaborators

func (*RepositoriesService) ListComments

func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *CommentsListOptions) ([]*RepositoryComment, *Response, error)

ListComments lists all the comments for the repository.

获取仓库的Commit评论 GET https://gitee.com/api/v5/repos/{owner}/{repo}/comments

func (*RepositoriesService) ListCommitComments

func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepositoryComment, *Response, error)

ListCommitComments lists all the comments for a given commit SHA. owner 仓库所属空间地址(企业、组织或个人的地址path) repo 仓库路径(path) ref* Commit的Reference 获取单个Commit的评论 GET https://gitee.com/api/v5/repos/{owner}/{repo}/commits/{ref}/comments

func (*RepositoriesService) ListCommits

func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error)

ListCommits lists the commits of a repository. 仓库的所有提交 GET https://gitee.com/api/v5/repos/{owner}/{repo}/commits

func (*RepositoriesService) ListContributors

func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ContributorListOptions) ([]*Contributor, *Response, error)

ListContributors lists contributors for a repository.

获取仓库贡献者 GET https://gitee.com/api/v5/repos/{owner}/{repo}/contributors

func (*RepositoriesService) ListEnterprises

func (s *RepositoriesService) ListEnterprises(ctx context.Context, enterprise string, opts *RepositoryListOptions) ([]*Repository, *Response, error)

获取企业的所有仓库 GET https://gitee.com/api/v5/enterprises/{enterprise}/repos

func (*RepositoriesService) ListForks

func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error)

ListForks lists the forks of the specified repository.

查看仓库的Forks GET https://gitee.com/api/v5/repos/{owner}/{repo}/forks

func (*RepositoriesService) ListHooks

func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error)

ListHooks lists all Hooks for the specified repository.

func (*RepositoriesService) ListKeys

func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*SSHKey, *Response, error)

ListKeys lists the deploy keys for a repository.

获取仓库已部署的公钥 GET https://gitee.com/api/v5/repos/{owner}/{repo}/keys

func (*RepositoriesService) ListOrganizations

func (s *RepositoriesService) ListOrganizations(ctx context.Context, org string, opts *RepositoryListOptions) ([]*Repository, *Response, error)

ListOrganizations 获取一个组织下的仓库 获取一个组织的仓库 GET https://gitee.com/api/v5/orgs/{org}/repos

func (*RepositoriesService) ListReleases

func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *RepositoryReleaseListOptions) ([]*RepositoryRelease, *Response, error)

ListReleases lists the releases for a repository.

获取仓库的所有Releases GET https://gitee.com/api/v5/repos/{owner}/{repo}/releases

func (*RepositoriesService) ListTags

func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error)

ListTags lists tags for the specified repository. TODO 这个接口也没有分页

列出仓库所有的tags GET https://gitee.com/api/v5/repos/{owner}/{repo}/tags

func (*RepositoriesService) ListTraffic

func (s *RepositoriesService) ListTraffic(ctx context.Context, owner, repo string, opts *TrafficDataRequest) (*TrafficData, *Response, error)

获取最近30天的七日以内访问量 POST https://gitee.com/api/v5/repos/{owner}/{repo}/traffic-data

func (*RepositoriesService) RemoveBaiduStatisticKey

func (s *RepositoriesService) RemoveBaiduStatisticKey(ctx context.Context, owner, repo string) (*Response, error)

TODO not test

删除仓库的百度统计 key DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/baidu_statistic_key

func (*RepositoriesService) RemoveBranchProtection

func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error)

RemoveBranchProtection removes the protection of a given branch.

取消保护分支的设置 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/branches/{branch}/protection

func (*RepositoriesService) RemoveBranchWildcardProtection

func (s *RepositoriesService) RemoveBranchWildcardProtection(ctx context.Context, owner, repo, wildcard string) (*Response, error)

RemoveBranchWildcardProtection removes the protection of a given wildcard.

删除仓库保护分支策略 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/branches/{wildcard}/setting

func (*RepositoriesService) RemoveCollaborator

func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error)

RemoveCollaborator removes the specified user as collaborator from the given repo. Note: Does not return error if a valid user that is not a collaborator is removed.

移除仓库成员 DELETE https://gitee.com/api/v5/repos/{owner}/{repo}/collaborators/{username}

func (*RepositoriesService) UpdateBranchProtection

func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error)

UpdateBranchProtection updates the protection of a given branch. 这个接口 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/branches/{branch}/protection 设置的 保护

和 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/branches/setting/new 设置的保护不是一个东西,

owner 仓库所属空间地址(企业、组织或个人的地址path) repo 仓库路径(path) branch 分支名称

设置分支保护 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/branches/{branch}/protection

func (*RepositoriesService) UpdateBranchWildcardProtection

func (s *RepositoriesService) UpdateBranchWildcardProtection(ctx context.Context, owner, repo, wildcard string,
	preq *ProtectionRequest) (*ProtectionSetting, *Response, error)

UpdateBranchWildcardProtection updates the protection of a given branch. 这个接口是更改已有的 分支保护测试, owner 仓库所属空间地址(企业、组织或个人的地址path) repo 仓库路径(path) wildcard 分支/通配符 preq 分支保护策略设置 结构体,里面用到 new_wildcard,pusher,merger 字段 和 CreateBranchWildcardProtection 公用一个 wildcard 设置分支/通配符. 感觉就是这个分支规则 起的一个名称,附带着通配的作用. new_wildcard 这次操作不是更新吗,如果填写这个字段,就是重新起个名称,附带着通配的作用. 分支保护策略设置 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/branches/{wildcard}/setting

func (*RepositoriesService) UpdateComment

func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64,
	comment *CommentRequest) (*RepositoryComment, *Response, error)

UpdateComment updates the body of a single comment. 更新只能更新 body 内容 更新Commit评论 PATCH https://gitee.com/api/v5/repos/{owner}/{repo}/comments/{id}

func (*RepositoriesService) UpdateFile

UpdateFile updates a file in a repository at the given path and returns the commit and file metadata. Requires the blob SHA of the file being updated.

更新文件 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/contents/{path}

func (*RepositoriesService) UpdatePages

func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *RepositoryPagesUpdateRequest) (*Response, error)

TODO not test UpdatePages updates Pages for the named repo.

上传设置 Pages SSL 证书和域名 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/pages

func (*RepositoriesService) UpdatePushConfig

func (s *RepositoriesService) UpdatePushConfig(ctx context.Context, owner, repo string, config *PushConfigUpdateRequest) (*PushConfig, *Response, error)

修改仓库推送规则设置 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/push_config

func (*RepositoriesService) UpdateReviewer

func (s *RepositoriesService) UpdateReviewer(ctx context.Context, owner, repo string, opts *RepositoryReviewerUpdateRequest) (*Repository, *Response, error)

UpdateReviewer 修改代码审查设置 PUT https://gitee.com/api/v5/repos/{owner}/{repo}/reviewer

type Repository

type Repository struct {
	ID                  *int64      `json:"id,omitempty"`                    //"id": integer
	FullName            *string     `json:"full_name,omitempty"`             //"full_name": string
	HumanName           *string     `json:"human_name,omitempty"`            //"human_name": string
	URL                 *string     `json:"url,omitempty"`                   //"url": string
	Namespace           *Namespace  `json:"namespace,omitempty"`             //"namespace": 5 properties
	Path                *string     `json:"path,omitempty"`                  //"path": string 仓库路径
	Name                *string     `json:"name,omitempty"`                  //"name": string 仓库名称
	Owner               *User       `json:"owner,omitempty"`                 //"owner": 18 properties
	Aassigner           *User       `json:"assigner,omitempty"`              //"assigner": 18 properties
	Description         *string     `json:"description,omitempty"`           //"description": string 仓库描述
	Private             *bool       `json:"private,omitempty"`               //"private": boolean 是否私有
	Public              *bool       `json:"public,omitempty"`                //"public": boolean 是否公开
	Internal            *bool       `json:"internal,omitempty"`              //"internal": string 是否内部开源
	Fork                *bool       `json:"fork,omitempty"`                  //"fork": boolean 是否是fork仓库
	HTMLURL             *string     `json:"html_url,omitempty"`              //"html_url": string
	SSHURL              *string     `json:"ssh_url,omitempty"`               //"ssh_url": string
	ForksURL            *string     `json:"forks_url,omitempty"`             //"forks_url": string
	KeysURL             *string     `json:"keys_url,omitempty"`              //"keys_url": string
	CollaboratorsURL    *string     `json:"collaborators_url,omitempty"`     //"collaborators_url": string
	HooksURL            *string     `json:"hooks_url,omitempty"`             //"hooks_url": string
	BranchesURL         *string     `json:"branches_url,omitempty"`          //"branches_url": string
	TagsURL             *string     `json:"tags_url,omitempty"`              //"tags_url": string
	BlobsURL            *string     `json:"blobs_url,omitempty"`             //"blobs_url": string
	StargazersURL       *string     `json:"stargazers_url,omitempty"`        //"stargazers_url": string
	ContributorsURL     *string     `json:"contributors_url,omitempty"`      //"contributors_url": string
	CommitsURL          *string     `json:"commits_url,omitempty"`           //"commits_url": string
	CommentsURL         *string     `json:"comments_url,omitempty"`          //"comments_url": string
	IssueCommentURL     *string     `json:"issue_comment_url,omitempty"`     //"issue_comment_url": string
	IssueURL            *string     `json:"issues_url,omitempty"`            //"issues_url": string
	PullsURL            *string     `json:"pulls_url,omitempty"`             //"pulls_url": string
	MilestonesURL       *string     `json:"milestones_url,omitempty"`        //"milestones_url": string
	NotificationsURL    *string     `json:"notifications_url,omitempty"`     //"notifications_url": string
	LabelsURL           *string     `json:"labels_url,omitempty"`            //"labels_url": string
	ReleasesURL         *string     `json:"releases_url,omitempty"`          //"releases_url": string
	Recommend           *bool       `json:"recommend,omitempty"`             //"recommend": boolean 是否是推荐仓库
	GVP                 *bool       `json:"gvp,omitempty"`                   //"gvp": boolean 是否是 GVP 仓库
	Homepage            *string     `json:"homepage,omitempty"`              //"homepage": string 主页
	Language            *string     `json:"language,omitempty"`              //"language": string 语言
	ForksCount          *int        `json:"forks_count,omitempty"`           //"forks_count": integer 仓库fork数量
	StargazersCount     *int        `json:"stargazers_count,omitempty"`      //"stargazers_count": integer 仓库star数量
	WatchersCount       *int        `json:"watchers_count,omitempty"`        //"watchers_count": integer 仓库watch数量
	DefaultBranch       *string     `json:"default_branch,omitempty"`        //"default_branch": string 默认分支
	OpenIssuesCount     *int        `json:"open_issues_count,omitempty"`     //"open_issues_count": integer 开启的issue数量
	HasIssues           *bool       `json:"has_issues,omitempty"`            //"has_issues": boolean 是否开启issue功能
	HasWiki             *bool       `json:"has_wiki,omitempty"`              //"has_wiki": boolean 是否开启Wiki功能
	IssueComment        *bool       `json:"issue_comment,omitempty"`         //"issue_comment": boolean 是否允许用户对“关闭”状态的 Issue 进行评论
	CanComment          *bool       `json:"can_comment,omitempty"`           //"can_comment": boolean 是否允许用户对仓库进行评论
	PullRequestsEnabled *bool       `json:"pull_requests_enabled,omitempty"` //"pull_requests_enabled": boolean 是否接受 Pull Request,协作开发
	HasPage             *bool       `json:"has_page,omitempty"`              //"has_page": boolean 是否开启了 Pages
	License             *string     `json:"license,omitempty"`               //"license": string 开源许可
	Outsourced          *bool       `json:"outsourced,omitempty"`            //"outsourced": boolean 仓库类型(内部/外包)
	ProjectCreator      *string     `json:"project_creator,omitempty"`       //"project_creator": string 仓库创建者的 username
	Members             []*string   `json:"members,omitempty"`               //"members": Array[String] 仓库成员的username
	PushedAt            *Timestamp  `json:"pushed_at,omitempty"`             //"pushed_at": string 最近一次代码推送时间
	CreatedAt           *Timestamp  `json:"created_at,omitempty"`            //"created_at": string
	UpdatedAt           *Timestamp  `json:"updated_at,omitempty"`            //"updated_at": string
	Parent              *Repository `json:"parent,omitempty"`                //"parent": 69 properties
	Paas                *string     `json:"paas,omitempty"`                  //"paas": string
	Stared              *bool       `json:"stared,omitempty"`                //"stared": boolean 是否 star
	Watched             *bool       `json:"watched,omitempty"`               //"watched": boolean 是否 watch
	Permission          *Permission `json:"permission,omitempty"`            //"permission": Object 操作权限
	Relation            *string     `json:"relation,omitempty"`              //"relation": string 当前用户相对于仓库的角色
	AssigneesNumber     *int        `json:"assignees_number,omitempty"`      //"assignees_number": integer 代码审查设置,审查人数
	TestersNumber       *int        `json:"testers_number,omitempty"`        //"testers_number": integer 代码审查设置,测试人数
	Assignee            []*User     `json:"assignee,omitempty"`              //"assignee": 1 item
	Testers             []*User     `json:"testers,omitempty"`               //"testers": 1 item
	Status              *string     `json:"status,omitempty"`                //"status": string 仓库状态
	Programs            []Program   `json:"programs,omitempty"`              //"programs": 5 properties
	Enterprise          *Enterprise `json:"enterprise,omitempty"`            //"enterprise": 5 properties
	ProjectLabels       []*string   `json:"project_labels,omitempty"`        //"project_labels": 3 properties
}

func (Repository) String

func (r Repository) String() string

type RepositoryComment

type RepositoryComment struct {
	ID          *int64         `json:"id,omitempty"`
	InReplyToID *int64         `json:"in_reply_to_id,omitempty"`
	Body        *string        `json:"body"`
	Source      *string        `json:"source,omitempty"`
	User        *User          `json:"user,omitempty"` // User-mutable fields
	CreatedAt   *time.Time     `json:"created_at,omitempty"`
	UpdatedAt   *time.Time     `json:"updated_at,omitempty"`
	Target      *CommentTarget `json:"target,omitempty"` // TODO这个获取的都是null,不知道是干什么用的
}

RepositoryComment represents a comment for a commit, file, or line in a repository.

func (RepositoryComment) String

func (r RepositoryComment) String() string

type RepositoryCommit

type RepositoryCommit struct {
	URL         *string `json:"url,omitempty"`
	SHA         *string `json:"sha,omitempty"`
	HTMLURL     *string `json:"html_url,omitempty"`
	CommentsURL *string `json:"comments_url,omitempty"`

	Commit *Commit `json:"commit,omitempty"` // 这个里面 反而没有 sha 和 url

	Author    *User `json:"author,omitempty"`
	Committer *User `json:"committer,omitempty"`

	Parents []*BasicCommit `json:"parents,omitempty"` // 这里只有 sha,和url 2个属性

	// Details about how many changes were made in this commit. Only filled in during GetCommit!
	Stats *CommitStats `json:"stats,omitempty"`
	// Details about which files, and how this commit touched. Only filled in during GetCommit!
	Files []*CommitFile `json:"files,omitempty"`
}

RepositoryCommit represents a commit in a repo.

type RepositoryContent

type RepositoryContent struct {
	Type        *string `json:"type,omitempty"`
	Encoding    *string `json:"encoding,omitempty"`
	Size        *int    `json:"size,omitempty"`
	Name        *string `json:"name,omitempty"`
	Path        *string `json:"path,omitempty"`
	Content     *string `json:"content,omitempty"`
	SHA         *string `json:"sha,omitempty"`
	URL         *string `json:"url,omitempty"`
	HTMLURL     *string `json:"html_url,omitempty"`
	DownloadURL *string `json:"download_url,omitempty"`
	Links       *Links  `json:"_links,omitempty"`
}

RepositoryContent represents a file or directory in a github repository.

func (*RepositoryContent) GetContent

func (r *RepositoryContent) GetContent() (string, error)

GetContent returns the content of r, decoding it if necessary.

func (RepositoryContent) String

func (r RepositoryContent) String() string

String converts RepositoryContent to a string. It's primarily for testing.

type RepositoryContentFile

type RepositoryContentFile struct {
	Content    *RepositoryContent `json:"content,omitempty"`
	FileCommit *FileCommit        `json:"commit,omitempty"`
}

RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile.

func (RepositoryContentFile) String

func (r RepositoryContentFile) String() string

type RepositoryContentFileRequest

type RepositoryContentFileRequest struct {
	Message   *string       `json:"message,omitempty"`
	Content   []byte        `json:"content"` // unencoded
	SHA       *string       `json:"sha,omitempty"`
	Branch    *string       `json:"branch,omitempty"`
	Author    *CommitAuthor `json:"author,omitempty"`
	Committer *CommitAuthor `json:"committer,omitempty"`
}

RepositoryContentFileOptions specifies optional parameters for CreateFile, UpdateFile, and DeleteFile.

type RepositoryContentGetOptions

type RepositoryContentGetOptions struct {
	Ref string `url:"ref,omitempty"` //分支、tag或commit。默认: 仓库的默认分支(通常是master)
}

RepositoryContentGetOptions represents an optional ref parameter, which can be a SHA, branch, or tag

type RepositoryCreateEntRequest

type RepositoryCreateEntRequest struct {
	*RepositoryCreateRequest // 匿名字段,复用这个结构图字段

	//创建企业仓库 POST https://gitee.com/api/v5/enterprises/{enterprise}/repos
	Outsourced     *bool   `json:"outsourced,omitempty"`      //值为true值为外包仓库, false值为内部仓库。默认: 内部仓库(false)
	ProjectCreator *string `json:"project_creator,omitempty"` //负责人的username
	Members        *string `json:"members,omitempty"`         //用逗号分开的仓库成员。如: member1,member2
}

创建企业仓库

type RepositoryCreateForkOptions

type RepositoryCreateForkOptions struct {
	Organization string `url:"organization,omitempty"` //组织空间地址,不填写默认Fork到用户个人空间地址
	Name         string `url:"name,omitempty"`         //fork 后仓库名称。默认: 源仓库名称
	Path         string `url:"path,omitempty"`         //fork 后仓库地址。默认: 源仓库地址
}

RepositoryCreateForkOptions specifies the optional parameters to the

type RepositoryCreateOrgRequest

type RepositoryCreateOrgRequest struct {
	*RepositoryCreateRequest // 匿名字段,复用这个结构图字段

	Public *int `json:"public,omitempty"` //仓库开源类型。0(私有), 1(外部开源), 2(内部开源),注:与private互斥,以public为主。
}

创建组织仓库

type RepositoryCreateRequest

type RepositoryCreateRequest struct {
	Name              *string `json:"name,omitempty"`               // 仓库名称
	Description       *string `json:"description,omitempty"`        //仓库描述
	Homepage          *string `json:"homepage,omitempty"`           //主页(eg: https://gitee.com) 一个有效的http链接
	HasIssues         *bool   `json:"has_issues,omitempty"`         //允许提Issue与否。默认: 允许(true)
	HasWiki           *bool   `json:"has_wiki,omitempty"`           //提供Wiki与否。默认: 提供(true)
	CanComment        *bool   `json:"can_comment,omitempty"`        //允许用户对仓库进行评论。默认: 允许(true)
	AutoInit          *bool   `json:"auto_init,omitempty"`          //值为true时则会用README初始化仓库。默认: 不初始化(false)
	GitignoreTemplate *string `json:"gitignore_template,omitempty"` //Git Ignore模版
	LicenseTemplate   *string `json:"license_template,omitempty"`   // License模版
	Path              *string `json:"path,omitempty"`               // 仓库路径
	Private           *bool   `json:"private,omitempty"`            //目前仅支持私有
}

RepositoryCreateRequest 创建一个仓库 需要的 json 参数

type RepositoryLicense

type RepositoryLicense struct {
	License *string `json:"license,omitempty"`
}

RepositoryLicense represents the license for a repository.

func (RepositoryLicense) String

func (l RepositoryLicense) String() string

type RepositoryListForksOptions

type RepositoryListForksOptions struct {
	// How to sort the forks list. Possible values are: newest, oldest,
	// watchers. Default is "newest". 排序方式: fork的时间(newest, oldest),star的人数(stargazers)
	Sort string `url:"sort,omitempty"`

	ListOptions
}

RepositoryListForksOptions specifies the optional parameters to the RepositoriesService.ListForks method.

type RepositoryListOptions

type RepositoryListOptions struct {
	// Visibility of repositories to list. Can be one of all, public, or private.
	// Default: all  公开(public)、私有(private)或者所有(all),默认: 所有(all)
	Visibility string `url:"visibility,omitempty"`

	// List repos of given affiliation[s].
	// Comma-separated list of values. Can include:
	// * owner: Repositories that are owned by the authenticated user.
	// * collaborator: Repositories that the user has been added to as a
	//   collaborator.
	// * organization_member: Repositories that the user has access to through
	//   being a member of an organization. This includes every repository on
	//   every team that the user is on.
	// Default: owner,collaborator,organization_member
	// owner(授权用户拥有的仓库)、collaborator(授权用户为仓库成员)、
	// organization_member(授权用户为仓库所在组织并有访问仓库权限)、
	// enterprise_member(授权用户所在企业并有访问仓库权限)、
	// admin(所有有权限的,包括所管理的组织中所有仓库、所管理的企业的所有仓库)。
	// 可以用逗号分隔符组合。如: owner, organization_member 或 owner, collaborator, organization_member
	Affiliation string `url:"affiliation,omitempty"`

	// Type of repositories to list.
	// Can be one of all, owner, public, private, member. Default: all
	// Will cause a 422 error if used in the same request as visibility or
	// affiliation.
	// 筛选用户仓库: 其创建(owner)、个人(personal)、其为成员(member)、公开(public)、私有(private),
	//不能与 visibility 或 affiliation 参数一并使用,否则会报 422 错误
	Type string `url:"type,omitempty"`

	// How to sort the repository list. Can be one of created, updated, pushed,
	// full_name. Default: full_name
	// 排序方式: 创建时间(created),更新时间(updated),最后推送时间(pushed),
	// 仓库所属与名称(full_name)。默认: full_name
	Sort string `url:"sort,omitempty"`

	// Direction in which to sort repositories. Can be one of asc or desc.
	// Default: when using full_name: asc; otherwise desc
	// 如果sort参数为full_name,用升序(asc)。否则降序(desc)
	Direction string `url:"direction,omitempty"`

	// 搜索关键字
	Q string `url:"q,omitempty"`

	ListOptions
}

type RepositoryPagesUpdateRequest

type RepositoryPagesUpdateRequest struct {
	Domain            *string `json:"domain"`              //自定义域名
	SslCertificateCrt *string `json:"ssl_certificate_crt"` //证书文件内容(需进行BASE64编码)
	SslCertificateKey *string `json:"ssl_certificate_key"` //私钥文件内容(需进行BASE64编码)
}

type RepositoryRelease

type RepositoryRelease struct {
	ID              *int64          `json:"id,omitempty"`
	TagName         *string         `json:"tag_name,omitempty"`
	TargetCommitish *string         `json:"target_commitish,omitempty"`
	Prerelease      *bool           `json:"prerelease,omitempty"`
	Name            *string         `json:"name,omitempty"`
	Body            *string         `json:"body,omitempty"`
	Author          *BasicUser      `json:"author,omitempty"`
	CreatedAt       *Timestamp      `json:"created_at,omitempty"`
	Assets          []*ReleaseAsset `json:"assets,omitempty"`
}

RepositoryRelease represents a GitHub release in a repository.

func (RepositoryRelease) String

func (r RepositoryRelease) String() string

type RepositoryReleaseCreateRequest

type RepositoryReleaseCreateRequest struct {
	*RepositoryReleaseRequest         //重复的字段 利用 匿名字段优化一下
	TargetCommitish           *string `json:"target_commitish,omitempty"` //分支名称或者commit SHA, 默认是当前默认分支
}

type RepositoryReleaseEditRequest

type RepositoryReleaseEditRequest struct {
	*RepositoryReleaseRequest //重复的字段 利用 匿名字段优化一下
}

type RepositoryReleaseListOptions

type RepositoryReleaseListOptions struct {
	Direction string `url:"direction,omitempty"`

	ListOptions
}

type RepositoryReleaseRequest

type RepositoryReleaseRequest struct {
	TagName    *string `json:"tag_name,omitempty"`   //Tag 名称, 提倡以v字母为前缀做为Release名称,例如v1.0或者v2.3.4
	Name       *string `json:"name,omitempty"`       //Release 名称
	Body       *string `json:"body,omitempty"`       //Release 描述
	Prerelease *bool   `json:"prerelease,omitempty"` //是否为预览版本。默认: false(非预览版本)
}

type RepositoryReviewerUpdateRequest

type RepositoryReviewerUpdateRequest struct {
	Assignees       string `json:"assignees"`       //审查人员username,可多个,半角逗号分隔,如:(username1,username2)
	Testers         string `json:"testers"`         //测试人员username,可多个,半角逗号分隔,如:(username1,username2)
	AssigneesNumber int    `json:"assignees_numbe"` //最少审查人数
	TestersNumber   int    `json:"testers_number"`  //最少测试人数
}

type RepositoryTag

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

RepositoryTag represents a repository tag.

func (RepositoryTag) String

func (r RepositoryTag) String() string

type RepositoryTagCreateRequest

type RepositoryTagCreateRequest struct {
	Refs       string `json:"refs,omitempty"`        //起点名称, 默认:master
	TagName    string `json:"tag_name,omitempty"`    //新创建的标签名称
	TagMessage string `json:"tag_message,omitempty"` //Tag 描述, 默认为空
}

type Response

type Response struct {
	*http.Response

	// These fields provide the page values for paginating through a set of
	// results. Any or all of these may be set to the zero value for
	// responses that are not part of a paginated set, or for which there
	// are no additional pages.
	//
	// These fields support what is called "offset pagination" and should
	// be used with the ListOptions struct.
	NextPage  int
	PrevPage  int
	FirstPage int
	LastPage  int

	TotalCount int
	TotalPage  int
}

Response is a gitee API response. This wraps the standard http.Response returned from gitee and provides convenient access to things like pagination links.

type SSHKey

type SSHKey struct {
	// 获取一个公钥
	ID        *int64     `json:"id,omitempty"`
	Key       *string    `json:"key,omitempty"`
	URL       *string    `json:"url,omitempty"`
	Title     *string    `json:"title,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

func (SSHKey) String

func (k SSHKey) String() string

type SearchService

type SearchService service

SearchService provides access to the search related functions in the gitee API.

type TagCommit

type TagCommit struct {
	SHA  *string    `json:"sha,omitempty"`
	Date *Timestamp `json:"date,omitempty"`
}

TagCommit 用于 获取 tags 的 commit 结构体

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

type TrafficCount

type TrafficCount struct {
	Bucket *string `json:"bucket,omitempty"`
	*TrafficSummary
}

func (TrafficCount) String

func (r TrafficCount) String() string

type TrafficData

type TrafficData struct {
	Counts  []TrafficCount  `json:"counts,omitempty"`
	Summary *TrafficSummary `json:"summary,omitempty"`
}

func (TrafficData) String

func (r TrafficData) String() string

type TrafficDataRequest

type TrafficDataRequest struct {
	StartDay string `json:"start_day,omitempty"` //访问量的开始时间,默认今天,格式:yyyy-MM-dd
	EndDay   string `json:"end_day,omitempty"`   //访问量的结束时间,默认七天前,格式:yyyy-MM-dd
}

type TrafficSummary

type TrafficSummary struct {
	IP          *int `json:"ip,omitempty"`
	Pull        *int `json:"pull,omitempty"`
	Push        *int `json:"push,omitempty"`
	DownloadZip *int `json:"download_zip,omitempty"`
}

func (TrafficSummary) String

func (r TrafficSummary) String() string

type Tree

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

type User

type User struct {
	*BasicUser
	SiteAdmin   *bool      `json:"site_admin,omitempty"`
	Blog        *string    `json:"blog,omitempty"`
	Weibo       *string    `json:"weibo,omitempty"`
	Bio         *string    `json:"bio,omitempty"`
	PublicRepos *int       `json:"public_repos,omitempty"`
	PublicGists *int       `json:"public_gists,omitempty"`
	Followers   *int       `json:"followers,omitempty"`
	Following   *int       `json:"following,omitempty"`
	Stared      *int       `json:"stared,omitempty"`
	Watched     *int       `json:"watched,omitempty"`
	CreatedAt   *Timestamp `json:"created_at,omitempty"`
	UpdatedAt   *Timestamp `json:"updated_at,omitempty"`
	Email       *string    `json:"email,omitempty"`
}

User represents a gitee user.

func (User) String

func (u User) String() string

type UserEditRequest

type UserEditRequest struct {
	Name  *string `json:"name,omitempty"` //
	Blog  *string `json:"blog,omitempty"`
	Weibo *string `json:"weibo,omitempty"`
	Bio   *string `json:"bio,omitempty"`
}

type UserEmail

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

UserEmail represents user's email address

type UserListOptions

type UserListOptions struct {
	// Note: Pagination is powered exclusively by the Since parameter,
	// ListOptions.Page has no effect.
	// ListOptions.PerPage controls an undocumented GitHub API parameter.
	ListOptions
}

UserListOptions specifies optional parameters to the UsersService.ListAll method.

type UsersService

type UsersService service

UsersService handles communication with the user related methods of the gitee API.

gitee API docs:

func (*UsersService) CreateKey

func (s *UsersService) CreateKey(ctx context.Context, key *KeyCreateRequest) (*SSHKey, *Response, error)

CreateKey adds a public key for the authenticated user.

添加一个公钥 POST https://gitee.com/api/v5/user/keys

func (*UsersService) DeleteKey

func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error)

DeleteKey deletes a public key.

删除一个公钥 DELETE https://gitee.com/api/v5/user/keys/{id}

func (*UsersService) Edit

func (s *UsersService) Edit(ctx context.Context, user *UserEditRequest) (*User, *Response, error)

Edit the authenticated user.

更新授权用户的资料 PATCH https://gitee.com/api/v5/user

func (*UsersService) Follow

func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error)

Follow will cause the authenticated user to follow the specified user.

关注一个用户 PUT https://gitee.com/api/v5/user/following/{username}

func (*UsersService) Get

func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, error)

获取一个用户 GET https://gitee.com/api/v5/users/{username} 获取授权用户的资料 GET https://gitee.com/api/v5/user

func (*UsersService) GetKey

func (s *UsersService) GetKey(ctx context.Context, id int64) (*SSHKey, *Response, error)

通过sshkey的id来获取公钥 获取一个公钥 GET https://gitee.com/api/v5/user/keys/{id} id=公钥 ID

func (*UsersService) GetNamespace

func (s *UsersService) GetNamespace(ctx context.Context, opts *NamespaceOptions) (*Namespace, *Response, error)

获取授权用户的一个 Namespace GET https://gitee.com/api/v5/user/namespace path Namespace path 需要一个参数

func (*UsersService) IsFollowing

func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error)

IsFollowing checks if "user" is following "target". Passing the empty string for "user" will check if the authenticated user is following "target".

检查授权用户是否关注了一个用户 GET https://gitee.com/api/v5/user/following/{username}
检查指定用户是否关注目标用户 GET https://gitee.com/api/v5/users/{username}/following/{target_user}

func (*UsersService) ListFollowers

func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *ListOptions) ([]*User, *Response, error)

列出指定用户的关注者 GET https://gitee.com/api/v5/users/{username}/followers 列出授权用户的关注者 GET https://gitee.com/api/v5/user/followers 这个获取的是 我被哪些人 关注了

func (*UsersService) ListFollowings

func (s *UsersService) ListFollowings(ctx context.Context, user string, opts *ListOptions) ([]*User, *Response, error)

列出指定用户正在关注的用户 GET https://gitee.com/api/v5/users/{username}/following 列出授权用户正关注的用户 GET https://gitee.com/api/v5/user/following 这是获取的是我关注的哪些人,或者某个账号下面他关注的其他人

func (*UsersService) ListKeys

func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOptions) ([]*SSHKey, *Response, error)

获取当前授权用户的sshkey,这个能获取多个的,一个列表 列出授权用户的所有公钥 GET https://gitee.com/api/v5/user/keys 列出指定用户的所有公钥 GET https://gitee.com/api/v5/users/{username}/keys

func (*UsersService) ListNamespaces

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

列出授权用户所有的 Namespace GET https://gitee.com/api/v5/user/namespaces mode 参与方式: project(所有参与仓库的namepsce)、intrant(所加入的namespace)、all(包含前两者),默认(intrant)

func (*UsersService) Unfollow

func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error)

Unfollow will cause the authenticated user to unfollow the specified user.

取消关注一个用户 DELETE https://gitee.com/api/v5/user/following/{username}

Jump to

Keyboard shortcuts

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