gitcode

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 10 Imported by: 0

README

GitCode API Client

Go 语言的 GitCode / AtomGit API 客户端库,提供对 GitCode 平台几乎所有 REST API (/api/v5) 的类型安全访问。

Go Reference Go Version

功能特性

  • 认证 — Bearer Token / PRIVATE-TOKEN Header / access_token Query 三种鉴权 + OAuth 2.0 授权码流程
  • 仓库 — 创建/更新/删除/Fork/归档/转让,组织仓库,文件 CRUD,Tree/Blob,Raw,文件&图片上传
  • Issue — 仓库 Issue CRUD、评论、标签、里程碑、操作日志、关联 PR;用户/组织/企业级 Issue 查询
  • Pull Request — CRUD、合并、文件/提交/评论/审查、标签、审查人/测试人分配、操作日志、关联 Issue
  • 分支 — 列表/创建/删除,保护分支规则,提交比较,提交历史
  • Webhook — CRUD、测试推送,Push/TagPull/Issue/PullRequest/Note 事件解析
  • 用户 — 当前用户/指定用户、SSH 公钥、邮箱、动态、Star 仓库、Namespace
  • 组织 / 企业 — 组织信息/成员/关注者,企业成员、企业 Issue/PR、Issue 扩展状态、企业标签
  • 搜索 — 仓库 / Issue / 用户
  • 其他 — 仓库设置、Push 配置、PR 设置、模块开关、审查规则、下载统计、限流、通知
  • 类型友好FlexInt/FlexString/NullableTime 等 JSON 容错类型,适配 GitCode 返回值类型漂移

环境要求

  • Go ≥ 1.26(go.mod 已锁定)
  • 一个 GitCode 个人访问令牌(PAT)或 OAuth 应用凭据

安装

go get github.com/yi-nology/gitcode_api@latest

当前最新版本为 v0.2.0,完整版本历史见 releases

快速开始

package main

import (
    "context"
    "fmt"
    "log"

    gitcode "github.com/yi-nology/gitcode_api"
)

func main() {
    client := gitcode.NewClient("your-gitcode-token")
    ctx := context.Background()

    user, err := client.GetCurrentUser(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("当前用户: %s (%s)\n", user.Name, user.Login)

    repos, err := client.ListRepositories(ctx, gitcode.ListRepositoriesOptions{
        ListOptions: gitcode.ListOptions{Page: 1, PerPage: 10},
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, r := range repos {
        fmt.Printf("- %s\n", r.FullName)
    }
}

更完整的示例参见 examples/main.go

客户端与认证

获取 Token

访问 GitCode → 个人设置 → 私人令牌 创建 Token。

三种鉴权方式

Client 默认使用 Authorization: Bearer <token>,可通过 SetAuthStyle 切换:

client := gitcode.NewClient("your-token")                       // Bearer (默认)
client.SetAuthStyle(gitcode.AuthStylePrivateToken)              // PRIVATE-TOKEN Header
client.SetAuthStyle(gitcode.AuthStyleAccessToken)               // access_token Query 参数
私有部署 / 自定义 HTTP 客户端
client := gitcode.NewClientWithBaseURL("https://your-gitcode.com/api/v5", "token")
client.SetHTTPClient(&http.Client{Timeout: 60 * time.Second})   // 自定义超时

默认 BaseURL 为 https://api.gitcode.com/api/v5,默认超时 30s。

OAuth 2.0

适用于需要用户授权而非固定 Token 的场景:

oauth := gitcode.NewOAuthClient("client-id", "client-secret", "https://app.example.com/callback")

// 1. 引导用户跳转授权
url := oauth.AuthorizeURL("user_info projects", "random-state")
http.Redirect(w, r, url, http.StatusFound)

// 2. 用回调拿到的 code 换 token
token, err := oauth.ExchangeToken(ctx, code)

// 3. 用 token 创建 API 客户端
client := gitcode.NewClientFromOAuthToken(token)

// 4. 后续可用 refresh token 续期
token, err = oauth.RefreshToken(ctx, token.RefreshToken)

API 示例

下文示例中 ctx := context.Background(),owner/repo 为仓库所有者和路径名。

仓库与文件
// 创建仓库(私有)
private := false
repo, _ := client.CreateRepository(ctx, gitcode.CreateRepositoryOptions{
    Name:        "my-repo",
    Description: "描述",
    Private:     &private,
    AutoInit:    &private, // true,初始化 README
})

// 更新 / 删除 / Fork
client.UpdateRepository(ctx, "owner", "my-repo", gitcode.UpdateRepositoryOptions{Description: "新描述"})
client.DeleteRepository(ctx, "owner", "my-repo")
client.ForkRepository(ctx, "owner", "repo", nil)

// 组织下创建仓库
client.CreateOrgRepository(ctx, "my-org", gitcode.CreateOrgRepoOptions{Name: "team-repo"})

// 文件 CRUD(content 需 base64 编码)
content, _ := client.GetRepositoryContent(ctx, "owner", "repo", "README.md", "main")
res, _ := client.CreateFile(ctx, "owner", "repo", "a.txt", gitcode.CreateFileOptions{
    Message: "add a",
    Content: base64.StdEncoding.EncodeToString([]byte("hi")),
    Branch:  "main",
})
client.UpdateFile(ctx, "owner", "repo", "a.txt", gitcode.UpdateFileOptions{
    Message: "upd", Content: "...", SHA: res.Content.SHA, Branch: "main",
})

// 原始内容 / Tree / Blob / 贡献者 / 语言
raw, _      := client.GetRawFile(ctx, "owner", "repo", "README.md", "main")
tree, _     := client.GetTree(ctx, "owner", "repo", "main", true)
blob, _     := client.GetBlob(ctx, "owner", "repo", sha)
contribs, _ := client.ListContributors(ctx, "owner", "repo")
langs, _    := client.GetLanguages(ctx, "owner", "repo")

// 标签 / Release
tags, _     := client.ListTags(ctx, "owner", "repo")
release, _  := client.CreateRelease(ctx, "owner", "repo", gitcode.CreateReleaseOptions{
    TagName: "v1.0.0", Title: "v1.0.0", Body: "release notes",
})
client.DeleteRelease(ctx, "owner", "repo", release.TagName)
Issue / 标签 / 里程碑
// Issue CRUD
issue, _ := client.CreateIssue(ctx, "owner", "repo", gitcode.CreateIssueOptions{
    Title:  "Bug 报告",
    Body:   "问题描述",
    Labels: []string{"bug"},
})
client.UpdateIssue(ctx, "owner", "repo", int(issue.Number), gitcode.UpdateIssueOptions{State: gitcode.IssueStateClosed})
client.ReopenIssue(ctx, "owner", "repo", int(issue.Number))

// 评论
client.CreateIssueComment(ctx, "owner", "repo", int(issue.Number), "+1")
client.ListIssueComments(ctx, "owner", "repo", int(issue.Number))

// 仓库标签
client.CreateIssueLabel(ctx, "owner", "repo", "bug", "#ee0701")
client.UpdateIssueLabel(ctx, "owner", "repo", "bug", gitcode.UpdateLabelOptions{Color: "#d73a4a"})
client.AddIssueLabels(ctx, "owner", "repo", int(issue.Number), []string{"bug"})
client.ReplaceIssueLabels(ctx, "owner", "repo", int(issue.Number), []string{"bug", "p0"})

// 里程碑
ms, _ := client.CreateMilestone(ctx, "owner", "repo", "v2.0", "下个版本")
client.ListMilestones(ctx, "owner", "repo")
client.UpdateMilestone(ctx, "owner", "repo", int(ms.ID), gitcode.UpdateMilestoneOptions{State: "closed"})

// 操作日志 / 关联 PR
logs, _ := client.GetIssueOperateLogs(ctx, "owner", "repo", int(issue.Number))
prs, _  := client.GetIssueLinkedPRs(ctx, "owner", "repo", int(issue.Number))
Pull Request
pr, _ := client.CreatePullRequest(ctx, "owner", "repo", gitcode.CreatePullRequestOptions{
    Title: "feat: xxx", Head: "feature", Base: "main",
})

// 合并 (Squash)
client.MergePullRequest(ctx, "owner", "repo", pr.Number, &gitcode.MergePullRequestOptions{
    CommitMessage: "merge feat",
    Squash:        true,
})

// 文件 / 提交 / 评论 / 审查
client.ListPullRequestFiles(ctx, "owner", "repo", pr.Number)
client.ListPullRequestCommits(ctx, "owner", "repo", pr.Number)
client.CreatePullRequestReview(ctx, "owner", "repo", pr.Number, "LGTM", "APPROVE")

// 标签 / 审查人 / 测试人
client.AddPullRequestLabels(ctx, "owner", "repo", pr.Number, []string{"review"})
client.AssignPullRequestReviewers(ctx, "owner", "repo", pr.Number, "user1,user2")
client.AssignPullRequestTesters(ctx, "owner", "repo", pr.Number, "qa1")
client.HandlePullRequestReview(ctx, "owner", "repo", pr.Number, false) // force=false

// 关联 Issue / 操作日志
issues, _ := client.GetPullRequestLinkedIssues(ctx, "owner", "repo", pr.Number, gitcode.ListOptions{})
logs, _   := client.GetPullRequestOperateLogs(ctx, "owner", "repo", pr.Number)
分支与提交
client.CreateBranch(ctx, "owner", "repo", gitcode.CreateBranchOptions{
    BranchName: "dev", Refs: "main",
})
client.DeleteBranch(ctx, "owner", "repo", "dev")

// 保护分支规则
client.CreateBranchProtection(ctx, "owner", "repo", gitcode.CreateBranchProtectionOptions{
    Name:                     "main",
    RequiredApprovingReviews: 2,
    AllowForcePushes:         false,
})
client.ListBranchProtections(ctx, "owner", "repo")
client.DeleteBranchProtection(ctx, "owner", "repo", "main")

// 提交
commits, _ := client.ListCommits(ctx, "owner", "repo", gitcode.ListCommitsOptions{Branch: "main"})
commit, _  := client.GetCommit(ctx, "owner", "repo", commits[0].SHA)
cmp, _     := client.CompareCommits(ctx, "owner", "repo", "main", "dev")
fmt.Printf("ahead=%d behind=%d\n", cmp.AheadBy, cmp.BehindBy)
Webhook
active := true
hook, _ := client.CreateWebhook(ctx, "owner", "repo", gitcode.CreateWebhookOptions{
    URL:    "https://example.com/hook",
    Secret: "s3cret",
    Events: []string{"push", "pull_request"},
    Active: &active,
})
client.TestWebhook(ctx, "owner", "repo", hook.ID)
client.DeleteWebhook(ctx, "owner", "repo", hook.ID)

接收并解析事件(以 Gin 为例):

payload, _ := io.ReadAll(r.Body)
switch r.Header.Get("X-Gitcode-Event") {
case "push":
    e, _ := client.ParsePushEvent(payload)
    log.Printf("push %s -> %s", e.Before[:8], e.After[:8])
case "pull_request":
    e, _ := client.ParsePullRequestEvent(payload)
    log.Printf("PR #%d %s", e.Number, e.Action)
case "issues":
    e, _ := client.ParseIssueEvent(payload)
    log.Printf("issue #%d %s", int(e.Issue.Number), e.Action)
case "note":
    e, _ := client.ParseNoteEvent(payload)
    log.Printf("note on %s", e.NoteType)
case "tag_push":
    e, _ := client.ParseTagPushEvent(payload)
    log.Printf("tag %s", e.Ref)
}

还提供了 PushEvent/PullRequestWebhookEvent/IssueWebhookEvent/NoteWebhookEvent/TagPushEvent 五种事件类型,见 webhooks.go

用户 / SSH 公钥 / 邮箱
me, _     := client.GetCurrentUser(ctx)
user, _   := client.GetUser(ctx, "somebody")
emails, _ := client.ListEmails(ctx)

key, _ := client.CreateSSHKey(ctx, gitcode.CreateSSHKeyOptions{
    Title: "mbp", Key: "ssh-ed25519 AAAA...",
})
client.ListSSHKeys(ctx, gitcode.ListOptions{PerPage: 50})
client.DeleteSSHKey(ctx, key.ID)

events, _ := client.GetUserEvents(ctx, me.Login, "2025", "") // 年度动态
starred, _ := client.ListStarredRepositories(ctx, gitcode.ListStarredReposOptions{})
ns, _      := client.GetNamespace(ctx, "somepath")
组织 / 企业
// 组织
client.ListUserOrganizations(ctx, "username", gitcode.ListOptions{})
org, _      := client.GetOrgInfo(ctx, "my-org")
client.UpdateOrganization(ctx, "my-org", gitcode.UpdateOrgOptions{Description: "..."})
client.InviteOrgMember(ctx, "my-org", "newbie", gitcode.InviteMemberOptions{Permission: "write"})
client.RemoveOrgMember(ctx, "my-org", "newbie")
client.ListOrgMembers(ctx, "my-org", "admin", gitcode.ListOptions{})

// 企业
client.ListEnterpriseMembers(ctx, "my-ent", "", gitcode.ListOptions{})
client.UpdateEnterpriseMember(ctx, "my-ent", "user", gitcode.UpdateEnterpriseMemberOptions{Role: "admin"})

// 企业 Issue / PR
client.ListEnterpriseIssues(ctx, "my-ent", gitcode.ListUserIssuesOptions{State: "open"})
client.ListEnterprisePullRequests(ctx, "my-ent", gitcode.ListEnterprisePRsOptions{State: "open"})
client.ListEnterpriseLabels(ctx, "my-ent")
client.GetOrgIssueExtendSettings(ctx, "my-org") // 自定义状态扩展
搜索
repos, _ := client.SearchRepositories(ctx, gitcode.SearchRepositoriesOptions{
    Query: "gin web", Sort: "stars_count",
})
issues, _ := client.SearchIssues(ctx, gitcode.SearchIssuesOptions{
    Query: "memory leak", Repo: "owner/repo", State: "open",
})
users, _ := client.SearchUsers(ctx, gitcode.SearchUsersOptions{Query: "octocat"})
Star / Watch / 其他
client.StarRepository(ctx, "owner", "repo")
starred, _ := client.IsRepositoryStarred(ctx, "owner", "repo") // bool
client.UnstarRepository(ctx, "owner", "repo")

stargazers, _ := client.ListStargazers(ctx, "owner", "repo", gitcode.ListOptions{})
watchers, _   := client.ListWatchers(ctx, "owner", "repo", gitcode.ListOptions{})

// 仓库设置类
client.UpdateRepoSettings(ctx, "owner", "repo", &gitcode.RepoSettings{HasIssues: true})
client.UpdatePushConfig(ctx, "owner", "repo", &gitcode.PushConfig{MaxFileSize: 104857600})
client.UpdatePRSettings(ctx, "owner", "repo", &gitcode.PRSettings{DefaultMergeMethod: "merge"})
client.SetModuleSetting(ctx, "owner", "repo", gitcode.ModuleSetting{Wiki: false})
client.UpdateReviewerConfig(ctx, "owner", "repo", gitcode.ReviewerConfig{MinApprovingReviews: 1})

// 归档 / 转让
client.ArchiveRepository(ctx, "owner", "repo")
client.TransferRepository(ctx, "owner", "repo", gitcode.TransferRepoOptions{NewOwner: "new-owner"})

// 限流 / 通知
rl, _ := client.GetRateLimit(ctx)
nots, _ := client.ListNotifications(ctx)

通用类型

types.go 中定义了若干容错类型,用于处理 GitCode API 返回值类型不稳定的情况:

类型 用途
FlexInt 同一字段可能是 123"123"
FlexString 同一字段可能是 "abc"123
NullableTime 时间字段可能为空字符串
Timestamp 字符串格式时间(RFC3339)
Error API 错误响应结构(见下)

错误处理

Client 在 HTTP 状态码 ≥ 400 时返回标准 error(fmt.Errorf),错误信息包含方法、路径、状态码和响应体:

_, err := client.GetRepository(ctx, "owner", "missing")
if err != nil {
    log.Println(err)
    // 输出形如: GitCode API GET /repos/owner/missing returned 404: {"message":"404 Not Found"}
}

如需进一步解析错误体,可使用 types.Error:

var apiErr gitcode.Error
if json.Unmarshal([]byte(extractBody(err)), &apiErr) == nil {
    log.Printf("message=%s", apiErr.Message)
}

项目结构

gitcode_api/
├── client.go             # Client 构造、鉴权、HTTP 请求、User、ListOptions、RateLimit
├── oauth.go              # OAuthClient 授权码流程
├── repos.go              # 仓库 / 文件 / Tree / Blob / 标签 / Release / 设置 / 归档 / 转让
├── issues.go             # Issue CRUD / 评论 / 标签 / 里程碑
├── enterprise_issues.go  # 用户 / 组织 / 企业级 Issue、操作日志、关联 PR
├── pulls.go              # Pull Request 全套 + 审查 / 测试 / 标签 / 企业 PR
├── branches.go           # 分支 / 保护分支 / 提交 / 比较
├── webhooks.go           # Webhook CRUD + 5 类事件解析
├── search.go             # 搜索仓库 / Issue / 用户
├── users.go              # SSH 公钥 / 邮箱 / 动态 / Star / Namespace
├── orgs.go               # 组织 / 企业成员管理 / Issue 扩展配置
├── milestones.go         # 里程碑(带选项版本)
├── labels.go             # 仓库标签更新 / 替换 / 企业标签
├── types.go              # FlexInt/FlexString/NullableTime/Error 等通用类型 + Star/通知 API
├── gitcode_test.go       # 单元测试 + 真实 API 集成测试
└── examples/
    └── main.go           # 可运行的使用示例

测试

测试分为两类:纯函数测试(不需要网络)和 真实 API 集成测试(会在你的账户下创建/删除临时仓库)。

# 默认运行(需在 gitcode_test.go 顶部填入有效 Token)
GITCODE_TOKEN="your-token" go test -v ./...

# 跳过需要联网的集成测试
go test -short ./...

集成测试会真实创建仓库(test-api-<timestamp>),测试结束后自动清理。请使用测试账号的 Token。

与 gitcode-cli 的关系

本项目参考了 gitcode-cli 的设计理念,提供 Go 语言的 API 客户端实现:

gitcode-cli (gc) gitcode_api
gc auth login NewClient(token) / OAuthClient
gc repo list ListRepositories()
gc issue create CreateIssue()
gc pr create CreatePullRequest()

相关项目

许可证

MIT。

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.gitcode.com/api/v5"
)
View Source
const (
	DefaultOAuthBaseURL = "https://gitcode.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveStatus

type ArchiveStatus struct {
	Archived bool `json:"archived"`
}

type AuthStyle

type AuthStyle int
const (
	AuthStyleBearer AuthStyle = iota
	AuthStylePrivateToken
	AuthStyleAccessToken
)

type Branch

type Branch struct {
	Name          string              `json:"name"`
	Commit        *BranchCommitDetail `json:"commit"`
	DefaultBranch bool                `json:"default_branch,omitempty"`
	Protected     bool                `json:"protected"`
}

type BranchCommitDetail

type BranchCommitDetail struct {
	SHA    string `json:"sha"`
	URL    string `json:"url"`
	Commit *struct {
		Author    *CommitAuthor `json:"author"`
		Committer *CommitAuthor `json:"committer"`
		Message   string        `json:"message"`
	} `json:"commit"`
}

type BranchProtection

type BranchProtection struct {
	Enabled                  bool `json:"enabled"`
	RequiredStatusChecks     bool `json:"required_status_checks"`
	RequiredApprovingReviews int  `json:"required_approving_reviews"`
	AllowForcePushes         bool `json:"allow_force_pushes"`
	AllowDeletions           bool `json:"allow_deletions"`
}

type BranchProtectionRule

type BranchProtectionRule struct {
	ID                       int64  `json:"id"`
	RepositoryID             int64  `json:"repository_id"`
	Name                     string `json:"name"`
	RequiredStatusChecks     bool   `json:"required_status_checks"`
	RequiredApprovingReviews int    `json:"required_approving_reviews"`
	AllowForcePushes         bool   `json:"allow_force_pushes"`
	AllowDeletions           bool   `json:"allow_deletions"`
}

type Client

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

func NewClient

func NewClient(token string) *Client

func NewClientFromOAuthToken

func NewClientFromOAuthToken(token *OAuthToken) *Client

func NewClientWithBaseURL

func NewClientWithBaseURL(baseURL, token string) *Client

func (*Client) AddIssueLabels

func (c *Client) AddIssueLabels(ctx context.Context, owner, repo string, number int, labels []string) error

func (*Client) AddPullRequestLabels

func (c *Client) AddPullRequestLabels(ctx context.Context, owner, repo string, number int, labels []string) error

func (*Client) ArchiveRepository

func (c *Client) ArchiveRepository(ctx context.Context, owner, repo string) error

func (*Client) AssignPullRequestReviewers

func (c *Client) AssignPullRequestReviewers(ctx context.Context, owner, repo string, number int, assignees string) error

func (*Client) AssignPullRequestTesters

func (c *Client) AssignPullRequestTesters(ctx context.Context, owner, repo string, number int, testers string) error

func (*Client) CloseIssue

func (c *Client) CloseIssue(ctx context.Context, owner, repo string, number int) (*Issue, error)

func (*Client) ClosePullRequest

func (c *Client) ClosePullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)

func (*Client) CompareCommits

func (c *Client) CompareCommits(ctx context.Context, owner, repo, base, head string) (*CommitComparison, error)

func (*Client) CreateBranch

func (c *Client) CreateBranch(ctx context.Context, owner, repo string, opts CreateBranchOptions) (*Branch, error)

func (*Client) CreateBranchProtection

func (c *Client) CreateBranchProtection(ctx context.Context, owner, repo string, opts CreateBranchProtectionOptions) (*BranchProtectionRule, error)

func (*Client) CreateFile

func (c *Client) CreateFile(ctx context.Context, owner, repo, path string, opts CreateFileOptions) (*FileResult, error)

func (*Client) CreateIssue

func (c *Client) CreateIssue(ctx context.Context, owner, repo string, opts CreateIssueOptions) (*Issue, error)

func (*Client) CreateIssueComment

func (c *Client) CreateIssueComment(ctx context.Context, owner, repo string, number int, body string) (*IssueComment, error)

func (*Client) CreateIssueLabel

func (c *Client) CreateIssueLabel(ctx context.Context, owner, repo string, name, color string) (*Label, error)

func (*Client) CreateMilestone

func (c *Client) CreateMilestone(ctx context.Context, owner, repo string, title, description string) (*Milestone, error)

func (*Client) CreateMilestoneWithOptions

func (c *Client) CreateMilestoneWithOptions(ctx context.Context, owner, repo string, opts CreateMilestoneOptions) (*Milestone, error)

func (*Client) CreateOrgRepository

func (c *Client) CreateOrgRepository(ctx context.Context, org string, opts CreateOrgRepoOptions) (*Repository, error)

func (*Client) CreatePullRequest

func (c *Client) CreatePullRequest(ctx context.Context, owner, repo string, opts CreatePullRequestOptions) (*PullRequest, error)

func (*Client) CreatePullRequestComment

func (c *Client) CreatePullRequestComment(ctx context.Context, owner, repo string, number int, body, path string, position, commitID string) (*PullRequestComment, error)

func (*Client) CreatePullRequestInlineComment

func (c *Client) CreatePullRequestInlineComment(ctx context.Context, owner, repo string, number int, opts CreatePullRequestInlineCommentOptions) (*PullRequestComment, error)

func (*Client) CreatePullRequestReview

func (c *Client) CreatePullRequestReview(ctx context.Context, owner, repo string, number int, body, event string) (*PullRequestReview, error)

func (*Client) CreateRelease

func (c *Client) CreateRelease(ctx context.Context, owner, repo string, opts CreateReleaseOptions) (*Release, error)

func (*Client) CreateRepository

func (c *Client) CreateRepository(ctx context.Context, opts CreateRepositoryOptions) (*Repository, error)

func (*Client) CreateSSHKey

func (c *Client) CreateSSHKey(ctx context.Context, opts CreateSSHKeyOptions) (*SSHKey, error)

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(ctx context.Context, owner, repo string, opts CreateWebhookOptions) (*Webhook, error)

func (*Client) DeleteBranch

func (c *Client) DeleteBranch(ctx context.Context, owner, repo, branch string) error

func (*Client) DeleteBranchProtection

func (c *Client) DeleteBranchProtection(ctx context.Context, owner, repo, name string) error

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, owner, repo, path string, opts DeleteFileOptions) (*FileResult, error)

func (*Client) DeleteIssueComment

func (c *Client) DeleteIssueComment(ctx context.Context, owner, repo string, commentID int64) error

func (*Client) DeleteIssueLabel

func (c *Client) DeleteIssueLabel(ctx context.Context, owner, repo string, name string) error

func (*Client) DeleteMilestone

func (c *Client) DeleteMilestone(ctx context.Context, owner, repo string, number int) error

func (*Client) DeletePullRequestComment

func (c *Client) DeletePullRequestComment(ctx context.Context, owner, repo string, commentID string) error

func (*Client) DeleteRelease

func (c *Client) DeleteRelease(ctx context.Context, owner, repo string, tagName string) error

func (*Client) DeleteRepository

func (c *Client) DeleteRepository(ctx context.Context, owner, repo string) error

func (*Client) DeleteSSHKey

func (c *Client) DeleteSSHKey(ctx context.Context, id int64) error

func (*Client) DeleteTag

func (c *Client) DeleteTag(ctx context.Context, owner, repo, tagName string) error

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(ctx context.Context, owner, repo string, hookID int64) error

func (*Client) ExitOrganization

func (c *Client) ExitOrganization(ctx context.Context, org string) error

func (*Client) ForkRepository

func (c *Client) ForkRepository(ctx context.Context, owner, repo string, opts *CreateRepositoryOptions) (*Repository, error)

func (*Client) GetArchiveStatus

func (c *Client) GetArchiveStatus(ctx context.Context, owner, repo string) (*ArchiveStatus, error)

func (*Client) GetBlob

func (c *Client) GetBlob(ctx context.Context, owner, repo, sha string) (*GitBlob, error)

func (*Client) GetBranch

func (c *Client) GetBranch(ctx context.Context, owner, repo, branch string) (*Branch, error)

func (*Client) GetCommit

func (c *Client) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, error)

func (*Client) GetContributorStatistics

func (c *Client) GetContributorStatistics(ctx context.Context, owner, repo string) ([]*ContributorStatistic, error)

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser(ctx context.Context) (*User, error)

func (*Client) GetCustomizedRoles

func (c *Client) GetCustomizedRoles(ctx context.Context, owner, repo string) ([]*CustomizedRole, error)

func (*Client) GetDownloadStatistics

func (c *Client) GetDownloadStatistics(ctx context.Context, owner, repo string) ([]*DownloadStatistic, error)

func (*Client) GetEnterpriseIssue

func (c *Client) GetEnterpriseIssue(ctx context.Context, enterprise string, number int) (*Issue, error)

func (*Client) GetEnterpriseIssueLinkedPRs

func (c *Client) GetEnterpriseIssueLinkedPRs(ctx context.Context, enterprise string, number int) ([]*PullRequest, error)

func (*Client) GetEnterpriseMember

func (c *Client) GetEnterpriseMember(ctx context.Context, enterprise, username string) (*EnterpriseMember, error)

func (*Client) GetIssue

func (c *Client) GetIssue(ctx context.Context, owner, repo string, number int) (*Issue, error)

func (*Client) GetIssueComment

func (c *Client) GetIssueComment(ctx context.Context, owner, repo string, commentID int64) (*IssueComment, error)

func (*Client) GetIssueLinkedPRs

func (c *Client) GetIssueLinkedPRs(ctx context.Context, owner, repo string, number int) ([]*PullRequest, error)

func (*Client) GetIssueOperateLogs

func (c *Client) GetIssueOperateLogs(ctx context.Context, owner, repo string, number int) ([]*IssueOperateLog, error)

func (*Client) GetLanguages

func (c *Client) GetLanguages(ctx context.Context, owner, repo string) (Language, error)

func (*Client) GetMilestone

func (c *Client) GetMilestone(ctx context.Context, owner, repo string, number int) (*Milestone, error)

func (*Client) GetNamespace

func (c *Client) GetNamespace(ctx context.Context, path string) (*Namespace, error)

func (*Client) GetOrgInfo

func (c *Client) GetOrgInfo(ctx context.Context, org string) (*Organization, error)

func (*Client) GetOrgIssueExtendSettings

func (c *Client) GetOrgIssueExtendSettings(ctx context.Context, org string) ([]*IssueExtendSetting, error)

func (*Client) GetOrgMemberDetail

func (c *Client) GetOrgMemberDetail(ctx context.Context, org, username string) (*OrgMemberDetail, error)

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context, org string) (*Organization, error)

func (*Client) GetPRSettings

func (c *Client) GetPRSettings(ctx context.Context, owner, repo string) (*PRSettings, error)

func (*Client) GetPullRequest

func (c *Client) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)

func (*Client) GetPullRequestComment

func (c *Client) GetPullRequestComment(ctx context.Context, owner, repo string, commentID int64) (*PullRequestComment, error)

func (*Client) GetPullRequestLinkedIssues

func (c *Client) GetPullRequestLinkedIssues(ctx context.Context, owner, repo string, number int, opts ListOptions) ([]*Issue, error)

func (*Client) GetPullRequestOperateLogs

func (c *Client) GetPullRequestOperateLogs(ctx context.Context, owner, repo string, number int) ([]*PROperateLog, error)

func (*Client) GetPushConfig

func (c *Client) GetPushConfig(ctx context.Context, owner, repo string) (*PushConfig, error)

func (*Client) GetRateLimit

func (c *Client) GetRateLimit(ctx context.Context) (*RateLimit, error)

func (*Client) GetRawFile

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

func (*Client) GetRepoSettings

func (c *Client) GetRepoSettings(ctx context.Context, owner, repo string) (*RepoSettings, error)

func (*Client) GetRepository

func (c *Client) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)

func (*Client) GetRepositoryContent

func (c *Client) GetRepositoryContent(ctx context.Context, owner, repo, path, ref string) (*RepositoryContent, error)

func (*Client) GetSSHKey

func (c *Client) GetSSHKey(ctx context.Context, id int64) (*SSHKey, error)

func (*Client) GetTree

func (c *Client) GetTree(ctx context.Context, owner, repo, sha string, recursive bool) (*GitTree, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, username string) (*User, error)

func (*Client) GetUserEvents

func (c *Client) GetUserEvents(ctx context.Context, username, year, next string) (*UserEventsResponse, error)

func (*Client) GetUserMembership

func (c *Client) GetUserMembership(ctx context.Context, org string) (*UserMembership, error)

func (*Client) GetWebhook

func (c *Client) GetWebhook(ctx context.Context, owner, repo string, hookID int64) (*Webhook, error)

func (*Client) HandlePullRequestReview

func (c *Client) HandlePullRequestReview(ctx context.Context, owner, repo string, number int, force bool) error

func (*Client) HandlePullRequestTest

func (c *Client) HandlePullRequestTest(ctx context.Context, owner, repo string, number int, force bool) error

func (*Client) InviteOrgMember

func (c *Client) InviteOrgMember(ctx context.Context, org, username string, opts InviteMemberOptions) (*User, error)

func (*Client) IsPullRequestMerged

func (c *Client) IsPullRequestMerged(ctx context.Context, owner, repo string, number int) (bool, error)

func (*Client) IsRepositoryStarred

func (c *Client) IsRepositoryStarred(ctx context.Context, owner, repo string) (bool, error)

func (*Client) ListBranchProtections

func (c *Client) ListBranchProtections(ctx context.Context, owner, repo string) ([]*BranchProtectionRule, error)

func (*Client) ListBranches

func (c *Client) ListBranches(ctx context.Context, owner, repo string) ([]*Branch, error)

func (*Client) ListCommits

func (c *Client) ListCommits(ctx context.Context, owner, repo string, opts ListCommitsOptions) ([]*Commit, error)

func (*Client) ListContributors

func (c *Client) ListContributors(ctx context.Context, owner, repo string) ([]*Contributor, error)

func (*Client) ListEmails

func (c *Client) ListEmails(ctx context.Context) ([]*Email, error)

func (*Client) ListEnterpriseIssueComments

func (c *Client) ListEnterpriseIssueComments(ctx context.Context, enterprise string, number int, opts ListOptions) ([]*IssueComment, error)

func (*Client) ListEnterpriseIssueLabels

func (c *Client) ListEnterpriseIssueLabels(ctx context.Context, enterprise string, issueID int64) ([]*Label, error)

func (*Client) ListEnterpriseIssues

func (c *Client) ListEnterpriseIssues(ctx context.Context, enterprise string, opts ListUserIssuesOptions) ([]*Issue, error)

func (*Client) ListEnterpriseLabels

func (c *Client) ListEnterpriseLabels(ctx context.Context, enterprise string) ([]*EnterpriseLabel, error)

func (*Client) ListEnterpriseMembers

func (c *Client) ListEnterpriseMembers(ctx context.Context, enterprise, role string, opts ListOptions) ([]*EnterpriseMember, error)

func (*Client) ListEnterprisePullRequests

func (c *Client) ListEnterprisePullRequests(ctx context.Context, enterprise string, opts ListEnterprisePRsOptions) ([]*PullRequest, error)

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, owner, repo string) ([]*FileListEntry, error)

func (*Client) ListForks

func (c *Client) ListForks(ctx context.Context, owner, repo string, opts ListOptions) ([]*Repository, error)

func (*Client) ListIssueComments

func (c *Client) ListIssueComments(ctx context.Context, owner, repo string, number int) ([]*IssueComment, error)

func (*Client) ListIssueLabels

func (c *Client) ListIssueLabels(ctx context.Context, owner, repo string) ([]*Label, error)

func (*Client) ListIssues

func (c *Client) ListIssues(ctx context.Context, owner, repo string, opts ListIssuesOptions) ([]*Issue, error)

func (*Client) ListMilestones

func (c *Client) ListMilestones(ctx context.Context, owner, repo string) ([]*Milestone, error)

func (*Client) ListMilestonesWithOptions

func (c *Client) ListMilestonesWithOptions(ctx context.Context, owner, repo string, opts ListMilestonesOptions) ([]*Milestone, error)

func (*Client) ListNotifications

func (c *Client) ListNotifications(ctx context.Context) ([]*Notification, error)

func (*Client) ListOrgFollowers

func (c *Client) ListOrgFollowers(ctx context.Context, org string, opts ListOptions) ([]*OrgFollowers, error)

func (*Client) ListOrgIssues

func (c *Client) ListOrgIssues(ctx context.Context, org string, opts ListUserIssuesOptions) ([]*Issue, error)

func (*Client) ListOrgMembers

func (c *Client) ListOrgMembers(ctx context.Context, org, role string, opts ListOptions) ([]*OrgMember, error)

func (*Client) ListOrgPullRequests

func (c *Client) ListOrgPullRequests(ctx context.Context, org string, opts ListEnterprisePRsOptions) ([]*PullRequest, error)

func (*Client) ListOrgRepositories

func (c *Client) ListOrgRepositories(ctx context.Context, org, repoType string, opts ListOptions) ([]*Repository, error)

func (*Client) ListOrganizationMembers

func (c *Client) ListOrganizationMembers(ctx context.Context, org string) ([]*Member, error)

func (*Client) ListOrganizations

func (c *Client) ListOrganizations(ctx context.Context) ([]*Organization, error)

func (*Client) ListOrganizationsWithOptions

func (c *Client) ListOrganizationsWithOptions(ctx context.Context, admin bool, opts ListOptions) ([]*Organization, error)

func (*Client) ListPullRequestComments

func (c *Client) ListPullRequestComments(ctx context.Context, owner, repo string, number int) ([]*PullRequestComment, error)

func (*Client) ListPullRequestCommits

func (c *Client) ListPullRequestCommits(ctx context.Context, owner, repo string, number int) ([]*Commit, error)

func (*Client) ListPullRequestFiles

func (c *Client) ListPullRequestFiles(ctx context.Context, owner, repo string, number int) ([]*PullRequestFile, error)

func (*Client) ListPullRequestLabels

func (c *Client) ListPullRequestLabels(ctx context.Context, owner, repo string, number int) ([]*Label, error)

func (*Client) ListPullRequestReviews

func (c *Client) ListPullRequestReviews(ctx context.Context, owner, repo string, number int) ([]*PullRequestReview, error)

func (*Client) ListPullRequests

func (c *Client) ListPullRequests(ctx context.Context, owner, repo string, opts ListPullRequestsOptions) ([]*PullRequest, error)

func (*Client) ListReleases

func (c *Client) ListReleases(ctx context.Context, owner, repo string) ([]*Release, error)

func (*Client) ListRepoAllIssueComments

func (c *Client) ListRepoAllIssueComments(ctx context.Context, owner, repo string, opts ListOptions) ([]*IssueComment, error)

func (*Client) ListRepoEvents

func (c *Client) ListRepoEvents(ctx context.Context, owner, repo string, opts ListOptions) ([]*RepoEvent, error)

func (*Client) ListRepositories

func (c *Client) ListRepositories(ctx context.Context, opts ListRepositoriesOptions) ([]*Repository, error)

func (*Client) ListRepositoryContents

func (c *Client) ListRepositoryContents(ctx context.Context, owner, repo, path, ref string) ([]*RepositoryContent, error)

func (*Client) ListSSHKeys

func (c *Client) ListSSHKeys(ctx context.Context, opts ListOptions) ([]*SSHKey, error)

func (*Client) ListStargazers

func (c *Client) ListStargazers(ctx context.Context, owner, repo string, opts ListOptions) ([]*User, error)

func (*Client) ListStarredRepositories

func (c *Client) ListStarredRepositories(ctx context.Context, opts ListStarredReposOptions) ([]*Repository, error)

func (*Client) ListTags

func (c *Client) ListTags(ctx context.Context, owner, repo string) ([]*Tag, error)

func (*Client) ListUserIssues

func (c *Client) ListUserIssues(ctx context.Context, opts ListUserIssuesOptions) ([]*Issue, error)

func (*Client) ListUserOrganizations

func (c *Client) ListUserOrganizations(ctx context.Context, username string, opts ListOptions) ([]*Organization, error)

func (*Client) ListWatchers

func (c *Client) ListWatchers(ctx context.Context, owner, repo string, opts ListOptions) ([]*User, error)

func (*Client) ListWebhooks

func (c *Client) ListWebhooks(ctx context.Context, owner, repo string) ([]*Webhook, error)

func (*Client) MergePullRequest

func (c *Client) MergePullRequest(ctx context.Context, owner, repo string, number int, opts *MergePullRequestOptions) error

func (*Client) ParseIssueEvent

func (c *Client) ParseIssueEvent(payload []byte) (*IssueWebhookEvent, error)

func (*Client) ParseNoteEvent

func (c *Client) ParseNoteEvent(payload []byte) (*NoteWebhookEvent, error)

func (*Client) ParsePullRequestEvent

func (c *Client) ParsePullRequestEvent(payload []byte) (*PullRequestWebhookEvent, error)

func (*Client) ParsePushEvent

func (c *Client) ParsePushEvent(payload []byte) (*PushEvent, error)

func (*Client) ParseTagPushEvent

func (c *Client) ParseTagPushEvent(payload []byte) (*TagPushEvent, error)

func (*Client) RemoveAllIssueLabels

func (c *Client) RemoveAllIssueLabels(ctx context.Context, owner, repo string, number int) error

func (*Client) RemoveIssueLabel

func (c *Client) RemoveIssueLabel(ctx context.Context, owner, repo string, number int, name string) error

func (*Client) RemoveOrgMember

func (c *Client) RemoveOrgMember(ctx context.Context, org, username string) error

func (*Client) RemovePullRequestLabel

func (c *Client) RemovePullRequestLabel(ctx context.Context, owner, repo string, number int, name string) error

func (*Client) ReopenIssue

func (c *Client) ReopenIssue(ctx context.Context, owner, repo string, number int) (*Issue, error)

func (*Client) ReopenPullRequest

func (c *Client) ReopenPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)

func (*Client) ReplaceIssueLabels

func (c *Client) ReplaceIssueLabels(ctx context.Context, owner, repo string, number int, labels []string) error

func (*Client) ReplacePullRequestLabels

func (c *Client) ReplacePullRequestLabels(ctx context.Context, owner, repo string, number int, labels []string) error

func (*Client) ResetPullRequestReviewStatus

func (c *Client) ResetPullRequestReviewStatus(ctx context.Context, owner, repo string, number int, resetAll bool) error

func (*Client) ResetPullRequestTestStatus

func (c *Client) ResetPullRequestTestStatus(ctx context.Context, owner, repo string, number int, resetAll bool) error

func (*Client) SearchIssues

func (c *Client) SearchIssues(ctx context.Context, opts SearchIssuesOptions) ([]*SearchIssueResult, error)

func (*Client) SearchRepositories

func (c *Client) SearchRepositories(ctx context.Context, opts SearchRepositoriesOptions) ([]*SearchRepositoryResult, error)

func (*Client) SearchUsers

func (c *Client) SearchUsers(ctx context.Context, opts SearchUsersOptions) ([]*SearchUserResult, error)

func (*Client) SetAuthStyle

func (c *Client) SetAuthStyle(style AuthStyle)

func (*Client) SetHTTPClient

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

func (*Client) SetModuleSetting

func (c *Client) SetModuleSetting(ctx context.Context, owner, repo string, setting ModuleSetting) error

func (*Client) StarRepository

func (c *Client) StarRepository(ctx context.Context, owner, repo string) error

func (*Client) TestWebhook

func (c *Client) TestWebhook(ctx context.Context, owner, repo string, hookID int64) error

func (*Client) TransferRepository

func (c *Client) TransferRepository(ctx context.Context, owner, repo string, opts TransferRepoOptions) error

func (*Client) TransferToOrg

func (c *Client) TransferToOrg(ctx context.Context, org, repo, newOwner string) error

func (*Client) UnassignPullRequestReviewers

func (c *Client) UnassignPullRequestReviewers(ctx context.Context, owner, repo string, number int, assignees string) error

func (*Client) UnstarRepository

func (c *Client) UnstarRepository(ctx context.Context, owner, repo string) error

func (*Client) UpdateBranchProtection

func (c *Client) UpdateBranchProtection(ctx context.Context, owner, repo, wildcard string, opts UpdateBranchProtectionOptions) error

func (*Client) UpdateEnterpriseMember

func (c *Client) UpdateEnterpriseMember(ctx context.Context, enterprise, username string, opts UpdateEnterpriseMemberOptions) (*EnterpriseMember, error)

func (*Client) UpdateFile

func (c *Client) UpdateFile(ctx context.Context, owner, repo, path string, opts UpdateFileOptions) (*FileResult, error)

func (*Client) UpdateIssue

func (c *Client) UpdateIssue(ctx context.Context, owner, repo string, number int, opts UpdateIssueOptions) (*Issue, error)

func (*Client) UpdateIssueComment

func (c *Client) UpdateIssueComment(ctx context.Context, owner, repo string, commentID int64, body string) (*IssueComment, error)

func (*Client) UpdateIssueLabel

func (c *Client) UpdateIssueLabel(ctx context.Context, owner, repo, originalName string, opts UpdateLabelOptions) (*Label, error)

func (*Client) UpdateMilestone

func (c *Client) UpdateMilestone(ctx context.Context, owner, repo string, number int, opts UpdateMilestoneOptions) (*Milestone, error)

func (*Client) UpdateOrgRepoStatus

func (c *Client) UpdateOrgRepoStatus(ctx context.Context, org, repo, status string) error

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(ctx context.Context, org string, opts UpdateOrgOptions) (*Organization, error)

func (*Client) UpdatePRSettings

func (c *Client) UpdatePRSettings(ctx context.Context, owner, repo string, settings *PRSettings) error

func (*Client) UpdatePullRequest

func (c *Client) UpdatePullRequest(ctx context.Context, owner, repo string, number int, opts UpdatePullRequestOptions) (*PullRequest, error)

func (*Client) UpdatePullRequestComment

func (c *Client) UpdatePullRequestComment(ctx context.Context, owner, repo string, commentID string, body string) (*PullRequestComment, error)

func (*Client) UpdatePushConfig

func (c *Client) UpdatePushConfig(ctx context.Context, owner, repo string, config *PushConfig) error

func (*Client) UpdateRepoMember

func (c *Client) UpdateRepoMember(ctx context.Context, owner, repo, username string, opts UpdateMemberOptions) error

func (*Client) UpdateRepoSettings

func (c *Client) UpdateRepoSettings(ctx context.Context, owner, repo string, opts *RepoSettings) (*RepoSettings, error)

func (*Client) UpdateRepository

func (c *Client) UpdateRepository(ctx context.Context, owner, repo string, opts UpdateRepositoryOptions) (*Repository, error)

func (*Client) UpdateReviewerConfig

func (c *Client) UpdateReviewerConfig(ctx context.Context, owner, repo string, config ReviewerConfig) error

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(ctx context.Context, owner, repo string, hookID int64, opts UpdateWebhookOptions) (*Webhook, error)

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, owner, repo string, filePath string) (*FileUploadResult, error)

func (*Client) UploadImage

func (c *Client) UploadImage(ctx context.Context, owner, repo string, filePath string) (*FileUploadResult, error)

type Commit

type Commit struct {
	SHA       string    `json:"sha"`
	Message   string    `json:"message"`
	Author    *User     `json:"author"`
	Committer *User     `json:"committer"`
	CreatedAt time.Time `json:"created_at"`
	URL       string    `json:"url,omitempty"`
}

type CommitAuthor

type CommitAuthor struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Date  string `json:"date"`
}

type CommitComparison

type CommitComparison struct {
	TotalCommits int                `json:"total_commits"`
	AheadBy      int                `json:"ahead_by"`
	BehindBy     int                `json:"behind_by"`
	Commits      []*Commit          `json:"commits"`
	Files        []*PullRequestFile `json:"files"`
}

type Contributor

type Contributor struct {
	ID            string `json:"id"`
	Login         string `json:"login"`
	AvatarURL     string `json:"avatar_url"`
	Contributions int    `json:"contributions"`
}

type ContributorStatistic

type ContributorStatistic struct {
	Author *User `json:"author"`
	Total  int   `json:"total"`
	Weeks  []*struct {
		W string `json:"w"`
		A int    `json:"a"`
		D int    `json:"d"`
		C int    `json:"c"`
	} `json:"weeks"`
}

type CreateBranchOptions

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

type CreateBranchProtectionOptions

type CreateBranchProtectionOptions struct {
	Name                     string `json:"name"`
	RequiredStatusChecks     bool   `json:"required_status_checks"`
	RequiredApprovingReviews int    `json:"required_approving_reviews"`
	AllowForcePushes         bool   `json:"allow_force_pushes"`
	AllowDeletions           bool   `json:"allow_deletions"`
}

type CreateFileOptions

type CreateFileOptions struct {
	Message string `json:"message"`
	Content string `json:"content"`
	Branch  string `json:"branch,omitempty"`
}

type CreateIssueOptions

type CreateIssueOptions struct {
	Title     string   `json:"title"`
	Body      string   `json:"body,omitempty"`
	Assignee  string   `json:"assignee,omitempty"`
	Assignees []string `json:"assignees,omitempty"`
	Milestone int64    `json:"milestone,omitempty"`
	Labels    []string `json:"labels,omitempty"`
}

func (CreateIssueOptions) MarshalJSON

func (o CreateIssueOptions) MarshalJSON() ([]byte, error)

type CreateMilestoneOptions

type CreateMilestoneOptions struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	DueOn       string `json:"due_on"`
}

type CreateOrgRepoOptions

type CreateOrgRepoOptions struct {
	Name              string `json:"name"`
	Description       string `json:"description,omitempty"`
	Homepage          string `json:"homepage,omitempty"`
	HasIssues         *bool  `json:"has_issues,omitempty"`
	HasWiki           *bool  `json:"has_wiki,omitempty"`
	CanComment        *bool  `json:"can_comment,omitempty"`
	Public            *int   `json:"public,omitempty"`
	Private           *bool  `json:"private,omitempty"`
	AutoInit          *bool  `json:"auto_init,omitempty"`
	GitignoreTemplate string `json:"gitignore_template,omitempty"`
	LicenseTemplate   string `json:"license_template,omitempty"`
	Path              string `json:"path,omitempty"`
	DefaultBranch     string `json:"default_branch,omitempty"`
}

type CreatePullRequestInlineCommentOptions

type CreatePullRequestInlineCommentOptions struct {
	Body     string `json:"body"`
	Path     string `json:"path"`
	Line     int    `json:"line"`
	Side     string `json:"side"`
	CommitID string `json:"commit_id,omitempty"`
}

type CreatePullRequestOptions

type CreatePullRequestOptions struct {
	Title string `json:"title"`
	Body  string `json:"body,omitempty"`
	Head  string `json:"head"`
	Base  string `json:"base"`
	Draft bool   `json:"draft,omitempty"`
}

type CreateReleaseOptions

type CreateReleaseOptions struct {
	TagName    string `json:"tag_name"`
	Target     string `json:"target_commitish,omitempty"`
	Title      string `json:"name"`
	Body       string `json:"body,omitempty"`
	Draft      bool   `json:"draft"`
	Prerelease bool   `json:"prerelease"`
}

type CreateRepositoryOptions

type CreateRepositoryOptions struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Private     *bool  `json:"private,omitempty"`
	AutoInit    *bool  `json:"auto_init,omitempty"`
}

type CreateSSHKeyOptions

type CreateSSHKeyOptions struct {
	Title string `json:"title"`
	Key   string `json:"key"`
}

type CreateWebhookOptions

type CreateWebhookOptions struct {
	URL    string   `json:"url"`
	Secret string   `json:"secret,omitempty"`
	Events []string `json:"events,omitempty"`
	Active *bool    `json:"active,omitempty"`
}

type CustomizedRole

type CustomizedRole struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type DeleteFileOptions

type DeleteFileOptions struct {
	Message string `json:"message"`
	SHA     string `json:"sha"`
	Branch  string `json:"branch,omitempty"`
}

type DownloadStatistic

type DownloadStatistic struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type Email

type Email struct {
	Email string `json:"email"`
	State string `json:"state"`
}

type EnterpriseLabel

type EnterpriseLabel struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Color     string `json:"color"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type EnterpriseMember

type EnterpriseMember struct {
	User       *User  `json:"user"`
	URL        string `json:"url"`
	Active     bool   `json:"active"`
	Role       string `json:"role"`
	Enterprise *struct {
		ID  int64  `json:"id"`
		URL string `json:"url"`
	} `json:"enterprise"`
}

type Error

type Error struct {
	Message string `json:"message"`
	Errors  []struct {
		Resource string `json:"resource"`
		Field    string `json:"field"`
		Code     string `json:"code"`
	} `json:"errors"`
}

func (*Error) Error

func (e *Error) Error() string

type FileListEntry

type FileListEntry struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Type string `json:"type"`
}

type FileResult

type FileResult struct {
	Content *RepositoryContent `json:"content"`
	Commit  *Commit            `json:"commit"`
}

type FileUploadResult

type FileUploadResult struct {
	FilePath string `json:"file_path"`
}

type FlexInt

type FlexInt int

func (*FlexInt) UnmarshalJSON

func (fi *FlexInt) UnmarshalJSON(data []byte) error

type FlexString

type FlexString string

func (*FlexString) UnmarshalJSON

func (fs *FlexString) UnmarshalJSON(data []byte) error

type GitBlob

type GitBlob struct {
	SHA      string `json:"sha"`
	Size     int64  `json:"size"`
	URL      string `json:"url"`
	Content  string `json:"content"`
	Encoding string `json:"encoding"`
}

type GitTree

type GitTree struct {
	SHA       string          `json:"sha"`
	URL       string          `json:"url"`
	Truncated bool            `json:"truncated"`
	Tree      []*GitTreeEntry `json:"tree"`
}

type GitTreeEntry

type GitTreeEntry struct {
	Path string `json:"path"`
	Mode string `json:"mode"`
	Type string `json:"type"`
	SHA  string `json:"sha"`
	Size int64  `json:"size"`
	URL  string `json:"url"`
}

type InviteMemberOptions

type InviteMemberOptions struct {
	Permission string `json:"permission,omitempty"`
	RoleID     string `json:"role_id,omitempty"`
}

type Issue

type Issue struct {
	ID        int64      `json:"id"`
	Number    FlexInt    `json:"number"`
	Title     string     `json:"title"`
	Body      string     `json:"body"`
	State     IssueState `json:"state"`
	User      *User      `json:"user"`
	Author    *User      `json:"author"`
	Assignees []*User    `json:"assignees"`
	Labels    []*Label   `json:"labels"`
	Milestone *Milestone `json:"milestone"`
	HTMLURL   string     `json:"html_url"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	ClosedAt  *time.Time `json:"closed_at"`
}

type IssueComment

type IssueComment struct {
	ID        int64     `json:"id"`
	Body      string    `json:"body"`
	User      *User     `json:"user"`
	Author    *User     `json:"author"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type IssueExtendSetting

type IssueExtendSetting struct {
	TypeName string `json:"type_name"`
	TypeID   int    `json:"type_id"`
	TypeDesc string `json:"type_desc"`
	Status   []*struct {
		StatusName         string `json:"status_name"`
		StatusID           int    `json:"status_id"`
		StatusDesc         string `json:"status_desc"`
		GitcodeIssueStatus int    `json:"gitcode_issue_status"`
	} `json:"status"`
}

type IssueOperateLog

type IssueOperateLog struct {
	ID        int64  `json:"id"`
	Action    string `json:"action"`
	CreatedAt string `json:"created_at"`
	User      *User  `json:"user"`
}

type IssueState

type IssueState string
const (
	IssueStateOpen   IssueState = "open"
	IssueStateClosed IssueState = "closed"
)

type IssueWebhookEvent

type IssueWebhookEvent struct {
	Action     string      `json:"action"`
	Issue      *Issue      `json:"issue"`
	Repository *Repository `json:"repository"`
	Sender     *User       `json:"sender"`
}

type Label

type Label struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

type Language

type Language map[string]int

type ListBranchProtectionOptions

type ListBranchProtectionOptions struct {
	ListOptions
}

type ListCommitsOptions

type ListCommitsOptions struct {
	ListOptions
	Branch string `json:"branch,omitempty"`
	Since  string `json:"since,omitempty"`
	Until  string `json:"until,omitempty"`
}

type ListEnterprisePRsOptions

type ListEnterprisePRsOptions struct {
	ListOptions
	State       string `json:"state,omitempty"`
	IssueNumber int    `json:"issue_number,omitempty"`
	Sort        string `json:"sort,omitempty"`
	Direction   string `json:"direction,omitempty"`
}

type ListIssuesOptions

type ListIssuesOptions struct {
	ListOptions
	State     IssueState `json:"state,omitempty"`
	Assignee  string     `json:"assignee,omitempty"`
	Creator   string     `json:"creator,omitempty"`
	Milestone string     `json:"milestone,omitempty"`
	Labels    string     `json:"labels,omitempty"`
	Sort      string     `json:"sort,omitempty"`
	Direction string     `json:"direction,omitempty"`
	Since     string     `json:"since,omitempty"`
}

type ListMilestonesOptions

type ListMilestonesOptions struct {
	ListOptions
	State     string `json:"state,omitempty"`
	Sort      string `json:"sort,omitempty"`
	Direction string `json:"direction,omitempty"`
}

type ListOptions

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

type ListPullRequestsOptions

type ListPullRequestsOptions struct {
	ListOptions
	State     PullRequestState `json:"state,omitempty"`
	Sort      string           `json:"sort,omitempty"`
	Direction string           `json:"direction,omitempty"`
	Head      string           `json:"head,omitempty"`
	Base      string           `json:"base,omitempty"`
}

type ListRepositoriesOptions

type ListRepositoriesOptions struct {
	ListOptions
	Owner string `json:"owner,omitempty"`
	Type  string `json:"type,omitempty"`
	Sort  string `json:"sort,omitempty"`
}

type ListStarredReposOptions

type ListStarredReposOptions struct {
	ListOptions
	Sort      string `json:"sort,omitempty"`
	Direction string `json:"direction,omitempty"`
}

type ListUserIssuesOptions

type ListUserIssuesOptions struct {
	ListOptions
	Filter    string `json:"filter,omitempty"`
	State     string `json:"state,omitempty"`
	Labels    string `json:"labels,omitempty"`
	Sort      string `json:"sort,omitempty"`
	Direction string `json:"direction,omitempty"`
	Since     string `json:"since,omitempty"`
}

type Member

type Member struct {
	ID    string `json:"id"`
	Login string `json:"login"`
	Role  string `json:"role"`
}

type MergePullRequestOptions

type MergePullRequestOptions struct {
	CommitMessage string `json:"commit_message,omitempty"`
	Squash        bool   `json:"squash,omitempty"`
}

type Milestone

type Milestone struct {
	ID          int64      `json:"id"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	State       string     `json:"state"`
	DueDate     *time.Time `json:"due_date"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
}

type ModuleSetting

type ModuleSetting struct {
	Issues   bool `json:"issues"`
	Wiki     bool `json:"wiki"`
	Releases bool `json:"releases"`
}

type Namespace

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

type NoteWebhookEvent

type NoteWebhookEvent struct {
	NoteType   string      `json:"noteable_type"`
	NoteID     int64       `json:"id"`
	Body       string      `json:"body"`
	Author     *User       `json:"author"`
	Repository *Repository `json:"repository"`
	Sender     *User       `json:"sender"`
}

type Notification

type Notification struct {
	ID      string `json:"id"`
	Reason  string `json:"reason"`
	Unread  bool   `json:"unread"`
	Subject struct {
		Title string `json:"title"`
		URL   string `json:"url"`
		Type  string `json:"type"`
	} `json:"subject"`
	CreatedAt time.Time `json:"created_at"`
}

type NullableTime

type NullableTime struct {
	time.Time
	Valid bool
}

func (*NullableTime) UnmarshalJSON

func (nt *NullableTime) UnmarshalJSON(data []byte) error

type OAuthClient

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

func NewOAuthClient

func NewOAuthClient(clientID, clientSecret, redirectURI string) *OAuthClient

func (*OAuthClient) AuthorizeURL

func (o *OAuthClient) AuthorizeURL(scope, state string) string

func (*OAuthClient) ExchangeToken

func (o *OAuthClient) ExchangeToken(ctx context.Context, code string) (*OAuthToken, error)

func (*OAuthClient) RefreshToken

func (o *OAuthClient) RefreshToken(ctx context.Context, refreshToken string) (*OAuthToken, error)

func (*OAuthClient) SetBaseURL

func (o *OAuthClient) SetBaseURL(baseURL string)

type OAuthToken

type OAuthToken struct {
	AccessToken  string    `json:"access_token"`
	ExpiresIn    int       `json:"expires_in"`
	RefreshToken string    `json:"refresh_token"`
	Scope        string    `json:"scope"`
	CreatedAt    time.Time `json:"created_at"`
}

type OrgFollowers

type OrgFollowers struct {
	ID        int64  `json:"id"`
	Login     string `json:"login"`
	Name      string `json:"name"`
	AvatarURL string `json:"avatar_url"`
	WatchAt   string `json:"watch_at"`
}

type OrgMember

type OrgMember struct {
	AvatarURL  string `json:"avatar_url"`
	HTMLURL    string `json:"html_url"`
	ID         string `json:"id"`
	Login      string `json:"login"`
	MemberRole string `json:"member_role"`
	Name       string `json:"name"`
	Type       string `json:"type"`
}

type OrgMemberDetail

type OrgMemberDetail struct {
	ID        int64  `json:"id"`
	Path      string `json:"path"`
	Name      string `json:"name"`
	URL       string `json:"url"`
	AvatarURL string `json:"avatar_url"`
	User      *User  `json:"user"`
}

type Organization

type Organization struct {
	ID          int64  `json:"id"`
	Login       string `json:"login"`
	Name        string `json:"name"`
	Description string `json:"description"`
	AvatarURL   string `json:"avatar_url"`
}

type PROperateLog

type PROperateLog struct {
	ID        int64  `json:"id"`
	Action    string `json:"action"`
	CreatedAt string `json:"created_at"`
	User      *User  `json:"user"`
}

type PRSettings

type PRSettings struct {
	DefaultMergeMethod string `json:"default_merge_method"`
	AutoCloseIssues    bool   `json:"auto_close_issues"`
}

type PullRequest

type PullRequest struct {
	ID          int64              `json:"id"`
	Number      int                `json:"number"`
	IID         int                `json:"iid,omitempty"`
	Title       string             `json:"title"`
	Body        string             `json:"body"`
	Description string             `json:"description,omitempty"`
	State       PullRequestState   `json:"state"`
	User        *User              `json:"user"`
	Author      *User              `json:"author"`
	Head        *PullRequestBranch `json:"head"`
	Base        *PullRequestBranch `json:"base"`
	Merged      bool               `json:"merged"`
	Mergeable   *bool              `json:"mergeable"`
	HTMLURL     string             `json:"html_url"`
	DiffURL     string             `json:"diff_url,omitempty"`
	PatchURL    string             `json:"patch_url,omitempty"`
	Draft       bool               `json:"draft,omitempty"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
	ClosedAt    NullableTime       `json:"closed_at,omitempty"`
	MergedAt    NullableTime       `json:"merged_at,omitempty"`
}

type PullRequestBranch

type PullRequestBranch struct {
	Ref  string `json:"ref"`
	SHA  string `json:"sha"`
	Repo *struct {
		FullName string `json:"full_name"`
		Name     string `json:"name"`
		Path     string `json:"path"`
		HTMLURL  string `json:"html_url"`
	} `json:"repo"`
}

type PullRequestComment

type PullRequestComment struct {
	ID        FlexString `json:"id"`
	Body      string     `json:"body"`
	User      *User      `json:"user"`
	Author    *User      `json:"author"`
	Path      string     `json:"path"`
	Position  int        `json:"position"`
	Line      int        `json:"line"`
	Side      string     `json:"side"`
	CommitID  string     `json:"commit_id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
}

type PullRequestFile

type PullRequestFile struct {
	Filename         string      `json:"filename"`
	PreviousFilename string      `json:"previous_filename,omitempty"`
	Status           string      `json:"status"`
	Additions        int         `json:"additions"`
	Deletions        int         `json:"deletions"`
	Changes          int         `json:"changes"`
	Patch            interface{} `json:"patch,omitempty"`
}

type PullRequestReview

type PullRequestReview struct {
	ID        int64     `json:"id"`
	Body      string    `json:"body"`
	State     string    `json:"state"`
	User      *User     `json:"user"`
	Author    *User     `json:"author"`
	CommitID  string    `json:"commit_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type PullRequestState

type PullRequestState string
const (
	PullRequestStateOpen   PullRequestState = "open"
	PullRequestStateOpened PullRequestState = "opened"
	PullRequestStateClosed PullRequestState = "closed"
	PullRequestStateMerged PullRequestState = "merged"
)

type PullRequestWebhookEvent

type PullRequestWebhookEvent struct {
	Action      string       `json:"action"`
	Number      int          `json:"number"`
	PullRequest *PullRequest `json:"pull_request"`
	Repository  *Repository  `json:"repository"`
	Sender      *User        `json:"sender"`
}

type PushConfig

type PushConfig struct {
	MaxFileSize        int      `json:"max_file_size"`
	ProhibitedFiles    []string `json:"prohibited_files"`
	CommitMessageRegex string   `json:"commit_message_regex"`
}

type PushEvent

type PushEvent struct {
	Ref        string      `json:"ref"`
	Before     string      `json:"before"`
	After      string      `json:"after"`
	Repository *Repository `json:"repository"`
	Commits    []*Commit   `json:"commits"`
	Sender     *User       `json:"sender"`
}

type RateLimit

type RateLimit struct {
	Limit     int       `json:"limit"`
	Remaining int       `json:"remaining"`
	Reset     time.Time `json:"reset"`
}

type Release

type Release struct {
	ID              int64     `json:"id"`
	TagName         string    `json:"tag_name"`
	TargetCommitish string    `json:"target_commitish,omitempty"`
	Name            string    `json:"name"`
	Body            string    `json:"body"`
	HTMLURL         string    `json:"html_url,omitempty"`
	Draft           bool      `json:"draft"`
	Prerelease      bool      `json:"prerelease"`
	CreatedAt       time.Time `json:"created_at"`
	PublishedAt     time.Time `json:"published_at,omitempty"`
}

type RepoEvent

type RepoEvent struct {
	ID        int64  `json:"id"`
	Type      string `json:"type"`
	CreatedAt string `json:"created_at"`
	PushData  *struct {
		Ref string `json:"ref"`
	} `json:"push_data"`
}

type RepoSettings

type RepoSettings struct {
	ID            int64  `json:"id"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	DefaultBranch string `json:"default_branch"`
	HasIssues     bool   `json:"has_issues"`
	HasWiki       bool   `json:"has_wiki"`
	CanComment    bool   `json:"can_comment"`
	Private       bool   `json:"private"`
}

type Repository

type Repository struct {
	ID        int64  `json:"id"`
	FullName  string `json:"full_name"`
	Name      string `json:"name"`
	Path      string `json:"path,omitempty"`
	Owner     *User  `json:"owner"`
	Namespace *struct {
		ID   int64  `json:"id"`
		Name string `json:"name"`
		Path string `json:"path"`
	} `json:"namespace,omitempty"`
	Description     string     `json:"description"`
	CloneURL        string     `json:"http_url_to_repo"`
	SSHURL          string     `json:"ssh_url_to_repo"`
	HTMLURL         string     `json:"web_url"`
	DefaultBranch   string     `json:"default_branch"`
	Private         bool       `json:"private"`
	Public          bool       `json:"public,omitempty"`
	Fork            bool       `json:"fork"`
	StarsCount      int        `json:"stargazers_count"`
	ForksCount      int        `json:"forks_count"`
	WatchersCount   int        `json:"watchers_count"`
	OpenIssuesCount int        `json:"open_issues_count"`
	Language        string     `json:"language,omitempty"`
	CreatedAt       time.Time  `json:"created_at"`
	UpdatedAt       time.Time  `json:"updated_at"`
	PushedAt        *time.Time `json:"pushed_at,omitempty"`
}

type RepositoryContent

type RepositoryContent struct {
	Name     string `json:"name"`
	Path     string `json:"path"`
	Size     int64  `json:"size"`
	Type     string `json:"type"`
	Content  string `json:"content,omitempty"`
	Encoding string `json:"encoding,omitempty"`
	SHA      string `json:"sha"`
	Links    struct {
		Self string `json:"self"`
		Git  string `json:"git"`
	} `json:"_links"`
}

type ReviewerConfig

type ReviewerConfig struct {
	MinApprovingReviews int  `json:"min_approving_reviews"`
	RequireCodeOwner    bool `json:"require_code_owner"`
}

type SSHKey

type SSHKey struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title"`
	Key       string    `json:"key"`
	CreatedAt time.Time `json:"created_at"`
	URL       string    `json:"url"`
}

type SearchIssueResult

type SearchIssueResult struct {
	ID         int64     `json:"id"`
	HTMLURL    string    `json:"html_url"`
	Number     string    `json:"number"`
	State      string    `json:"state"`
	Title      string    `json:"title"`
	Body       string    `json:"body"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	Labels     []*Label  `json:"labels"`
	Priority   int       `json:"priority"`
	Comments   int       `json:"comments"`
	Repository *struct {
		ID        int64  `json:"id"`
		FullName  string `json:"full_name"`
		HumanName string `json:"human_name"`
		Path      string `json:"path"`
		Name      string `json:"name"`
		URL       string `json:"url"`
		Owner     *User  `json:"owner"`
	} `json:"repository"`
}

type SearchIssuesOptions

type SearchIssuesOptions struct {
	ListOptions
	Query string `json:"q"`
	Sort  string `json:"sort,omitempty"`
	Order string `json:"order,omitempty"`
	Repo  string `json:"repo,omitempty"`
	State string `json:"state,omitempty"`
}

type SearchOptions

type SearchOptions struct {
	ListOptions
	Query string `json:"q"`
	Order string `json:"order,omitempty"`
}

type SearchRepositoriesOptions

type SearchRepositoriesOptions struct {
	ListOptions
	Query    string `json:"q"`
	Sort     string `json:"sort,omitempty"`
	Order    string `json:"order,omitempty"`
	Owner    string `json:"owner,omitempty"`
	Fork     string `json:"fork,omitempty"`
	Language string `json:"language,omitempty"`
}

type SearchRepositoryResult

type SearchRepositoryResult struct {
	ID              int64     `json:"id"`
	FullName        string    `json:"full_name"`
	HumanName       string    `json:"human_name"`
	Path            string    `json:"path"`
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	SSHURLToRepo    string    `json:"ssh_url_to_repo"`
	HTTPURLToRepo   string    `json:"http_url_to_repo"`
	WebURL          string    `json:"web_url"`
	ForksCount      int       `json:"forks_count"`
	StargazersCount int       `json:"stargazers_count"`
	WatchersCount   int       `json:"watchers_count"`
	DefaultBranch   string    `json:"default_branch"`
	OpenIssuesCount int       `json:"open_issues_count"`
	Private         bool      `json:"private"`
	Public          bool      `json:"public"`
	Fork            bool      `json:"fork"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	PushedAt        string    `json:"pushed_at"`
	Owner           *User     `json:"owner"`
	Namespace       *struct {
		ID      int64  `json:"id"`
		Type    string `json:"type"`
		Name    string `json:"name"`
		Path    string `json:"path"`
		HTMLURL string `json:"html_url"`
	} `json:"namespace"`
}

type SearchResult

type SearchResult struct {
	TotalCount int           `json:"total_count"`
	Items      []*Repository `json:"items"`
}

type SearchUserResult

type SearchUserResult struct {
	ID        string    `json:"id"`
	Login     string    `json:"login"`
	Name      string    `json:"name"`
	AvatarURL string    `json:"avatar_url"`
	HTMLURL   string    `json:"html_url"`
	CreatedAt time.Time `json:"created_at"`
}

type SearchUsersOptions

type SearchUsersOptions struct {
	ListOptions
	Query string `json:"q"`
	Sort  string `json:"sort,omitempty"`
	Order string `json:"order,omitempty"`
}

type Star

type Star struct {
	StarredAt time.Time `json:"starred_at"`
}

type Tag

type Tag struct {
	Name   string `json:"name"`
	Commit struct {
		SHA string `json:"sha"`
	} `json:"commit"`
}

type TagPushEvent

type TagPushEvent struct {
	Ref        string      `json:"ref"`
	Before     string      `json:"before"`
	After      string      `json:"after"`
	Repository *Repository `json:"repository"`
	Sender     *User       `json:"sender"`
}

type Timestamp

type Timestamp struct {
	time.Time
}

func (*Timestamp) UnmarshalJSON

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

type TransferRepoOptions

type TransferRepoOptions struct {
	NewOwner string `json:"new_owner"`
}

type UpdateBranchProtectionOptions

type UpdateBranchProtectionOptions struct {
	Pusher string `json:"pusher"`
	Merger string `json:"merger"`
}

type UpdateEnterpriseMemberOptions

type UpdateEnterpriseMemberOptions struct {
	Role string `json:"role"`
}

type UpdateFileOptions

type UpdateFileOptions struct {
	Message string `json:"message"`
	Content string `json:"content"`
	SHA     string `json:"sha"`
	Branch  string `json:"branch,omitempty"`
}

type UpdateIssueOptions

type UpdateIssueOptions struct {
	Title      string     `json:"title,omitempty"`
	Body       string     `json:"body,omitempty"`
	State      IssueState `json:"state,omitempty"`
	StateEvent string     `json:"state_event,omitempty"`
	Assignee   string     `json:"assignee,omitempty"`
	Assignees  []string   `json:"assignees,omitempty"`
	Milestone  int64      `json:"milestone,omitempty"`
	Labels     []string   `json:"labels,omitempty"`
}

type UpdateLabelOptions

type UpdateLabelOptions struct {
	Name  string `json:"name,omitempty"`
	Color string `json:"color,omitempty"`
}

type UpdateMemberOptions

type UpdateMemberOptions struct {
	Permission string `json:"permission"`
}

type UpdateMilestoneOptions

type UpdateMilestoneOptions struct {
	Title       string `json:"title"`
	State       string `json:"state,omitempty"`
	Description string `json:"description,omitempty"`
	DueOn       string `json:"due_on"`
}

type UpdateOrgOptions

type UpdateOrgOptions struct {
	Name        string `json:"name,omitempty"`
	Email       string `json:"email,omitempty"`
	Location    string `json:"location,omitempty"`
	Description string `json:"description,omitempty"`
	HTMLURL     string `json:"html_url,omitempty"`
}

type UpdatePullRequestOptions

type UpdatePullRequestOptions struct {
	Title      string           `json:"title,omitempty"`
	Body       string           `json:"body,omitempty"`
	State      PullRequestState `json:"state,omitempty"`
	StateEvent string           `json:"state_event,omitempty"`
	Base       string           `json:"base,omitempty"`
}

type UpdateRepositoryOptions

type UpdateRepositoryOptions struct {
	Name          string `json:"name,omitempty"`
	Description   string `json:"description,omitempty"`
	DefaultBranch string `json:"default_branch,omitempty"`
	Private       *bool  `json:"private,omitempty"`
}

type UpdateWebhookOptions

type UpdateWebhookOptions struct {
	URL    string   `json:"url,omitempty"`
	Secret string   `json:"secret,omitempty"`
	Events []string `json:"events,omitempty"`
	Active *bool    `json:"active,omitempty"`
}

type User

type User struct {
	ID        FlexString `json:"id"`
	Login     string     `json:"login"`
	Name      string     `json:"name"`
	Email     string     `json:"email"`
	AvatarURL string     `json:"avatar_url"`
	HTMLURL   string     `json:"html_url,omitempty"`
	Type      string     `json:"type,omitempty"`
}

type UserEvent

type UserEvent struct {
	Action         int    `json:"action"`
	ActionName     string `json:"action_name"`
	AuthorID       int64  `json:"author_id"`
	AuthorUsername string `json:"author_username"`
	ProjectID      int64  `json:"project_id"`
	ProjectName    string `json:"project_name"`
	CreatedAt      string `json:"created_at"`
	PushData       *struct {
		CommitCount int    `json:"commit_count"`
		Action      string `json:"action"`
		RefType     string `json:"ref_type"`
		Ref         string `json:"ref"`
		CommitFrom  string `json:"commit_from"`
		CommitTo    string `json:"commit_to"`
		CommitTitle string `json:"commit_title"`
	} `json:"push_data"`
}

type UserEventsResponse

type UserEventsResponse struct {
	Events map[string][]*UserEvent `json:"events"`
	Next   string                  `json:"next"`
}

type UserMembership

type UserMembership struct {
	ID           int64  `json:"id"`
	Path         string `json:"path"`
	Name         string `json:"name"`
	URL          string `json:"url"`
	AvatarURL    string `json:"avatar_url"`
	User         *User  `json:"user"`
	Active       bool   `json:"active"`
	Role         string `json:"role"`
	Organization *struct {
		ID    int64  `json:"id"`
		Login string `json:"login"`
		Name  string `json:"name"`
	} `json:"organization"`
}

type Webhook

type Webhook struct {
	ID                  int64     `json:"id"`
	URL                 string    `json:"url"`
	Events              []string  `json:"events"`
	PushEvents          bool      `json:"push_events"`
	TagPushEvents       bool      `json:"tag_push_events"`
	IssuesEvents        bool      `json:"issues_events"`
	MergeRequestsEvents bool      `json:"merge_requests_events"`
	NoteEvents          bool      `json:"note_events"`
	Active              bool      `json:"active"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
}

type WebhookEvent

type WebhookEvent struct {
	Ref        string      `json:"ref"`
	Before     string      `json:"before"`
	After      string      `json:"after"`
	Repository *Repository `json:"repository"`
	Commits    []*Commit   `json:"commits"`
	Sender     *User       `json:"sender"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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