giteeapi

package
v0.0.0-...-9c224a8 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MulanPSL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseApiGitee = "https://gitee.com/api/v5"

	/*
	   https://gitee.com/api/v5/repos/{owner}/{repo}/contents/{path}
	*/
	ApiGiteeCreateFile = "/repos/%s/%s/contents/%v"
	/*
	   https://gitee.com/api/v5/user/repos?access_token={access_token}&visibility={visibility}&affiliation={affiliation}&type={type}&sort={sort}&direction={direction}&q={1}&page={page}&per_page={per_page}
	*/
	ApiGiteeGetRepos = "/user/repos?access_token=%s&type=%v&sort=%v&direction=%v&page=%v&per_page=%v"

	/*
	   https://gitee.com/api/v5/repos/{owner}/{repo}/hooks
	*/
	ApiGiteeCreateHooks = "/repos/%s/%s/hooks"
	/*
	   https://gitee.com/api/v5/repos/{owner}/{repo}/hooks
	*/
	ApiGiteeGetHooks = "/repos/%s/%s/hooks?access_token=%s&page=%v&per_page=%v"

	/*
	   https://gitee.com/api/v5/repos/{owner}/{repo}/hooks/{id}
	*/
	ApiGiteeDeleteHooks = "/repos/%s/%s/hooks/%v?access_token=%s"
	/*
	  https://gitee.com/api/v5/repos/{owner}/{repo}/branches
	*/
	ApiGiteeGetRepoBranches = "/repos/%s/%s/branches?access_token=%s"
	/*
		repos/{owner}/{repo}/contents(/{path})
	*/
	ApiGiteeGetFileContents = "repos/%s/%s/contents/%s?access_token=%s&ref=%s"
)

api 路径

Variables

This section is empty.

Functions

func New

func New(uri string) (*thirdapi.Client, error)

func NewDefault

func NewDefault() *thirdapi.Client

Types

type RepositoryService

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

func (*RepositoryService) CreateWebHooks

func (s *RepositoryService) CreateWebHooks(accessToken, owner, repo, backUrl, password string) (*thirdapi.RepositoryHook, error)

CreateWebHooks

owner : 仓库所属空间地址(企业、组织或个人的地址path)
repo : 仓库路径(path)
backUrl : 回调地址
password : webhook 密钥

func (*RepositoryService) DeleteHooks

func (s *RepositoryService) DeleteHooks(accessToken, owner, repo, hookId string) error

func (*RepositoryService) GetBranchYmls

func (s *RepositoryService) GetBranchYmls(accessToken, owner, repo, path string, ref string) ([]*thirdapi.YMLFile, error)

func (*RepositoryService) GetRepoBranches

func (s *RepositoryService) GetRepoBranches(accessToken, owner, repo string) ([]*thirdapi.RepositoryBranch, error)

func (*RepositoryService) GetRepos

func (s *RepositoryService) GetRepos(accessToken, username, types, sort, direction string, page, per_page int) (*thirdapi.RepositoryPage, error)

GetRepos

visibility : 公开(public)、私有(private)或者所有(all),默认: 所有(all)
affiliation : owner(授权用户拥有的仓库)、collaborator(授权用户为仓库成员)、organization_member(授权用户为仓库所在组织并有访问仓库权限)、
  enterprise_member(授权用户所在企业并有访问仓库权限)、admin(所有有权限的,包括所管理的组织中所有仓库、所管理的企业的所有仓库)。 可以用逗号分隔符组合。
  如: owner, organization_member 或 owner, collaborator, organization_member
type : 筛选用户仓库: 其创建(owner)、个人(personal)、其为成员(member)、公开(public)、私有(private),不能与 visibility 或 affiliation 参数一并使用,否则会报 422 错误
sort : 排序方式: 创建时间(created),更新时间(updated),最后推送时间(pushed),仓库所属与名称(full_name)。默认: full_name
direction : 如果sort参数为full_name,用升序(asc)。否则降序(desc)
q : 搜索关键字
page : 当前的页码
per_page : 每页的数量,最大为 100

func (*RepositoryService) GetWebHooks

func (s *RepositoryService) GetWebHooks(accessToken, owner, repo string, page, per_page int) ([]*thirdapi.RepositoryHook, error)

func (*RepositoryService) PushFile

func (s *RepositoryService) PushFile(accessToken, owner, repo, path, content string, branch ...string) ([]byte, error)

func (*RepositoryService) UpdateFile

func (s *RepositoryService) UpdateFile(accessToken, owner, repo, path, sha, content string, branch ...string) ([]byte, error)

Jump to

Keyboard shortcuts

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