github_client

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MPL-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxCommentLength = 64 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func CreateGithubClient

func CreateGithubClient(cfg config.ServerConfig) (*Client, error)

CreateGithubClient creates a new GitHub client using the auth token provided. We can't validate the token at this point, so if it exists we assume it works

func (*Client) CommitStatus

func (c *Client) CommitStatus(ctx context.Context, pr vcs.PullRequest, status pkg.CommitState) error

func (*Client) CreateHook

func (c *Client) CreateHook(ctx context.Context, ownerAndRepoName, webhookUrl, webhookSecret string) error

func (*Client) Email

func (c *Client) Email() string

func (*Client) GetHookByUrl

func (c *Client) GetHookByUrl(ctx context.Context, ownerAndRepoName, webhookUrl string) (*vcs.WebHookConfig, error)

func (*Client) GetName

func (c *Client) GetName() string

func (*Client) LoadHook

func (c *Client) LoadHook(ctx context.Context, id string) (vcs.PullRequest, error)

func (*Client) ParseHook

func (c *Client) ParseHook(r *http.Request, request []byte) (vcs.PullRequest, error)

func (*Client) PostMessage

func (c *Client) PostMessage(ctx context.Context, pr vcs.PullRequest, message string) *msg.Message

func (*Client) TidyOutdatedComments

func (c *Client) TidyOutdatedComments(ctx context.Context, pr vcs.PullRequest) error

func (*Client) ToEmoji added in v1.4.3

func (c *Client) ToEmoji(s pkg.CommitState) string

ToEmoji returns a string representation of this state for use in the request

func (*Client) UpdateMessage

func (c *Client) UpdateMessage(ctx context.Context, m *msg.Message, msg string) error

func (*Client) Username

func (c *Client) Username() string

func (*Client) VerifyHook

func (c *Client) VerifyHook(r *http.Request, secret string) ([]byte, error)

type GClient added in v1.6.4

type GClient struct {
	PullRequests PullRequestsServices
	Repositories RepositoriesServices
	Issues       IssuesServices
}

GClient is a struct that holds the services for the GitHub client

type IssuesService added in v1.6.4

type IssuesService struct {
	IssuesServices
}

type IssuesServices added in v1.6.4

type IssuesServices interface {
	CreateComment(ctx context.Context, owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)
	DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*github.Response, error)
	ListComments(ctx context.Context, owner string, repo string, number int, opts *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error)
	EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)
}

type PullRequestsService added in v1.6.4

type PullRequestsService struct {
	PullRequestsServices
}

type PullRequestsServices added in v1.6.4

type PullRequestsServices interface {
	List(ctx context.Context, owner string, repo string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
	ListFiles(ctx context.Context, owner string, repo string, number int, opts *github.ListOptions) ([]*github.CommitFile, *github.Response, error)
	GetRaw(ctx context.Context, owner string, repo string, number int, opts github.RawOptions) (string, *github.Response, error)
	Get(ctx context.Context, owner string, repo string, number int) (*github.PullRequest, *github.Response, error)
}

type RepositoriesService added in v1.6.4

type RepositoriesService struct {
	RepositoriesServices
}

type RepositoriesServices added in v1.6.4

type RepositoriesServices interface {
	GetContents(ctx context.Context, owner, repo, path string, opts *github.RepositoryContentGetOptions) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error)
	Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
	CreateStatus(ctx context.Context, owner, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, *github.Response, error)
	CreateHook(ctx context.Context, owner, repo string, hook *github.Hook) (*github.Hook, *github.Response, error)
	ListHooks(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.Hook, *github.Response, error)
}

Jump to

Keyboard shortcuts

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