github

package
v0.0.0-...-f8ac4ba Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecondaryRateLimitResponse             = "" /* 136-byte string literal not displayed */
	SecondaryRateLimitStatusCode           = 403
	ResourceGoneStatusCode                 = 410
	IssuesDisabledForRepoResponse          = "Issues are disabled for this repo"
	PullRequestAlreadyExistsForBranchError = "A pull request already exists for"
)
View Source
const (
	PersonalAccessTokenEnvVar = "GITHUB_TOKEN"
)

Variables

This section is empty.

Functions

func GetGithubToken

func GetGithubToken() (string, error)

Types

type Client

type Client struct {
	Git          GitClient
	Repositories RepoClient
	PullRequests PullRequestClient
	Issues       IssueClient
}

func NewClient

func NewClient(ctx context.Context, personalAccessToken string) (*Client, error)

type GitClient

type GitClient interface {
	GetRef(ctx context.Context, owner string, repo string, ref string) (*github.Reference, *github.Response, error)
	CreateRef(ctx context.Context, owner string, repo string, ref *github.Reference) (*github.Reference, *github.Response, error)
	CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*github.TreeEntry) (*github.Tree, *github.Response, error)
	CreateCommit(ctx context.Context, owner string, repo string, commit *github.Commit) (*github.Commit, *github.Response, error)
	UpdateRef(ctx context.Context, owner string, repo string, ref *github.Reference, force bool) (*github.Reference, *github.Response, error)
}

type GitHubUser

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

func NewGitHubUser

func NewGitHubUser(user, email, token string) GitHubUser

func (GitHubUser) Email

func (ghu GitHubUser) Email() string

func (GitHubUser) Token

func (ghu GitHubUser) Token() string

func (GitHubUser) User

func (ghu GitHubUser) User() string

type IssueClient

type IssueClient interface {
	Create(ctx context.Context, owner string, repo string, issue *github.IssueRequest) (*github.Issue, *github.Response, error)
	Get(ctx context.Context, owner string, repo string, issueNum int) (*github.Issue, *github.Response, error)
}

type PullRequestClient

type PullRequestClient interface {
	Get(ctx context.Context, owner string, repo string, number int) (*github.PullRequest, *github.Response, error)
	Create(ctx context.Context, owner string, repo string, pull *github.NewPullRequest) (*github.PullRequest, *github.Response, error)
	List(ctx context.Context, owner string, repo string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
}

type RepoClient

type RepoClient interface {
	GetCommit(ctx context.Context, owner, repo, sha string, opts *github.ListOptions) (*github.RepositoryCommit, *github.Response, error)
	GetContents(ctx context.Context, owner, repo, path string, opts *github.RepositoryContentGetOptions) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error)
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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