Documentation
¶
Overview ¶
Package github is the CodeHost adapter for github.com: REST reads with ETag conditional requests cached in the Cache port, and GraphQL for review state and writes.
Index ¶
- type Client
- func (c *Client) AddConversationComment(ctx context.Context, prID, body string) error
- func (c *Client) AddThread(ctx context.Context, reviewID string, t codehost.NewThread) error
- func (c *Client) Checks(ctx context.Context, ref domain.PRRef) (domain.Checks, error)
- func (c *Client) Commits(ctx context.Context, ref domain.PRRef) ([]domain.Commit, error)
- func (c *Client) Dashboard(ctx context.Context) (codehost.Dashboard, error)
- func (c *Client) DeleteConversationComment(ctx context.Context, commentID string) error
- func (c *Client) DeleteReviewComment(ctx context.Context, commentID string) error
- func (c *Client) EditConversationComment(ctx context.Context, commentID, body string) error
- func (c *Client) EditReviewComment(ctx context.Context, commentID, body string) error
- func (c *Client) Forget(ctx context.Context, ref domain.PRRef) error
- func (c *Client) PullRequest(ctx context.Context, ref domain.PRRef) (domain.PullRequest, error)
- func (c *Client) RenderMarkdown(ctx context.Context, repo domain.Repo, body string) (string, error)
- func (c *Client) Reply(ctx context.Context, reviewID, threadID, body string) error
- func (c *Client) ReviewState(ctx context.Context, ref domain.PRRef) (domain.ReviewState, error)
- func (c *Client) SetReaction(ctx context.Context, subjectID string, r domain.Reaction, on bool) error
- func (c *Client) SetThreadResolved(ctx context.Context, threadID string, resolved bool) error
- func (c *Client) SetViewed(ctx context.Context, prID, path string, viewed bool) error
- func (c *Client) StartReview(ctx context.Context, prID string, commit domain.SHA) (string, error)
- func (c *Client) Status() codehost.Status
- func (c *Client) SubmitReview(ctx context.Context, prID, reviewID string, commit domain.SHA, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the GitHub REST and GraphQL APIs.
func New ¶
New returns a Client for the API at baseURL (e.g. https://api.github.com) whose HTTP client handles authentication.
func NewFromGH ¶
func NewFromGH(c cache.Cache, wrap func(http.RoundTripper) http.RoundTripper) (*Client, error)
NewFromGH returns a Client for api.github.com authenticated through `gh auth`. wrap, if given, wraps its HTTP transport, e.g. to count requests.
func (*Client) AddConversationComment ¶
func (*Client) Dashboard ¶
Dashboard runs its two searches at once: GitHub's search API takes seconds per query and sends no ETag to revalidate with.
func (*Client) DeleteConversationComment ¶
func (*Client) DeleteReviewComment ¶
func (*Client) EditConversationComment ¶
func (*Client) EditReviewComment ¶
func (*Client) Forget ¶
Forget drops the cached REST responses for the PR: the PR itself and everything under it, such as its commits.
func (*Client) PullRequest ¶
func (*Client) RenderMarkdown ¶
RenderMarkdown renders body through GitHub's Markdown API in GFM mode, which sanitises the HTML as comments are, and resolves issue references and mentions against repo.