Documentation
¶
Overview ¶
Package github adapts GitHub REST and GraphQL APIs to gitprovider read models.
Index ¶
- Variables
- type Client
- func (c *Client) Capabilities() gitprovider.ProviderCaps
- func (c *Client) GetDiff(ctx context.Context, ref gitprovider.PRRef) (gitprovider.UnifiedDiff, error)
- func (c *Client) GetDiffBetweenRefs(ctx context.Context, ref gitprovider.PRRef, baseSHA, headSHA string) (gitprovider.UnifiedDiff, error)
- func (c *Client) GetFileAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, filePath string) ([]byte, error)
- func (c *Client) GetPR(ctx context.Context, ref gitprovider.PRRef) (gitprovider.PR, error)
- func (c *Client) Host() string
- func (c *Client) ListInlineThreads(ctx context.Context, ref gitprovider.PRRef) ([]gitprovider.InlineThread, error)
- func (c *Client) ListIssueComments(ctx context.Context, ref gitprovider.PRRef) ([]gitprovider.IssueComment, error)
- func (c *Client) ListReviews(ctx context.Context, ref gitprovider.PRRef) ([]gitprovider.Review, error)
- func (c *Client) ListTreeAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, treePath string) ([]gitprovider.TreeEntry, error)
- func (c *Client) PostInlineComment(ctx context.Context, ref gitprovider.PRRef, comment gitprovider.InlineComment) (gitprovider.CommentID, error)
- func (c *Client) PostIssueComment(ctx context.Context, ref gitprovider.PRRef, body string) (gitprovider.CommentID, error)
- func (c *Client) ReplyToThread(ctx context.Context, ref gitprovider.PRRef, threadID gitprovider.ThreadID, ...) (gitprovider.CommentID, error)
- func (c *Client) ResolveThread(ctx context.Context, ref gitprovider.PRRef, threadID gitprovider.ThreadID) error
- func (c *Client) SubmitReview(ctx context.Context, ref gitprovider.PRRef, request gitprovider.ReviewRequest) (gitprovider.ReviewID, error)
- func (c *Client) WhoAmI(ctx context.Context, creds gitprovider.Credential) (gitprovider.Identity, error)
- type InstallationLookup
- type Options
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
var ( // ErrValidation identifies non-retryable adapter input or GitHub validation failures. ErrValidation = errors.New("github: validation error") // ErrUnhandledGraphQL identifies non-retryable GraphQL errors not covered by the provider taxonomy. ErrUnhandledGraphQL = errors.New("github: unhandled graphql error") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a GitHub read adapter. CR-10 adds write methods and full gitprovider.GitProvider satisfaction.
func NewFromGitConfig ¶
func NewFromGitConfig(git config.GitConfig, store TokenStore, opts Options) (*Client, gitprovider.Credential, error)
NewFromGitConfig builds a GitHub client and credential from config plus a token store.
func (*Client) Capabilities ¶
func (c *Client) Capabilities() gitprovider.ProviderCaps
Capabilities returns GitHub feature support.
func (*Client) GetDiff ¶
func (c *Client) GetDiff(ctx context.Context, ref gitprovider.PRRef) (gitprovider.UnifiedDiff, error)
GetDiff returns the raw unified diff for a pull request.
func (*Client) GetDiffBetweenRefs ¶ added in v0.3.56
func (c *Client) GetDiffBetweenRefs(ctx context.Context, ref gitprovider.PRRef, baseSHA, headSHA string) (gitprovider.UnifiedDiff, error)
GetDiffBetweenRefs returns the raw unified diff between two git refs in the pull request's base repository.
func (*Client) GetFileAtRef ¶
func (c *Client) GetFileAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, filePath string) ([]byte, error)
GetFileAtRef returns raw file contents at a git ref.
func (*Client) GetPR ¶
func (c *Client) GetPR(ctx context.Context, ref gitprovider.PRRef) (gitprovider.PR, error)
GetPR returns one pull request snapshot.
func (*Client) ListInlineThreads ¶
func (c *Client) ListInlineThreads(ctx context.Context, ref gitprovider.PRRef) ([]gitprovider.InlineThread, error)
ListInlineThreads returns inline review threads and their comments.
func (*Client) ListIssueComments ¶
func (c *Client) ListIssueComments(ctx context.Context, ref gitprovider.PRRef) ([]gitprovider.IssueComment, error)
ListIssueComments returns all issue comments on the pull request's issue.
func (*Client) ListReviews ¶
func (c *Client) ListReviews(ctx context.Context, ref gitprovider.PRRef) ([]gitprovider.Review, error)
ListReviews returns all pull request reviews.
func (*Client) ListTreeAtRef ¶
func (c *Client) ListTreeAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, treePath string) ([]gitprovider.TreeEntry, error)
ListTreeAtRef returns tree entries for a path at a git ref.
func (*Client) PostInlineComment ¶
func (c *Client) PostInlineComment(ctx context.Context, ref gitprovider.PRRef, comment gitprovider.InlineComment) (gitprovider.CommentID, error)
PostInlineComment posts a line- or file-scoped pull request review comment.
func (*Client) PostIssueComment ¶
func (c *Client) PostIssueComment(ctx context.Context, ref gitprovider.PRRef, body string) (gitprovider.CommentID, error)
PostIssueComment posts a pull-request issue comment.
func (*Client) ReplyToThread ¶
func (c *Client) ReplyToThread(ctx context.Context, ref gitprovider.PRRef, threadID gitprovider.ThreadID, body string) (gitprovider.CommentID, error)
ReplyToThread posts a reply to an existing pull request review thread.
func (*Client) ResolveThread ¶
func (c *Client) ResolveThread(ctx context.Context, ref gitprovider.PRRef, threadID gitprovider.ThreadID) error
ResolveThread resolves an existing pull request review thread.
func (*Client) SubmitReview ¶
func (c *Client) SubmitReview(ctx context.Context, ref gitprovider.PRRef, request gitprovider.ReviewRequest) (gitprovider.ReviewID, error)
SubmitReview submits the final pull-request review event.
func (*Client) WhoAmI ¶
func (c *Client) WhoAmI(ctx context.Context, creds gitprovider.Credential) (gitprovider.Identity, error)
WhoAmI returns the identity for the supplied credential.
type InstallationLookup ¶ added in v0.3.78
InstallationLookup carries repository context for GitHub App installation lookup.