Documentation
¶
Index ¶
- func WithGithubAppAuth(ctx context.Context, signer JWTSigner, appID int64, keyAlias string) context.Context
- func WithGithubToken(ctx context.Context, token string) context.Context
- type API
- type AuthProvider
- type Client
- func (c *Client) CreateIssueComment(ctx context.Context, owner, repo string, issueNumber int, body string) (*IssueComment, error)
- func (c *Client) FindIssueCommentWithMarker(ctx context.Context, owner, repo string, issueNumber int, marker string) (*IssueComment, error)
- func (c *Client) GetInstallationToken(ctx context.Context, installationID int64) (string, error)
- func (c *Client) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
- func (c *Client) RoundTrip(req *http.Request) (*http.Response, error)
- func (c *Client) UpdateIssueComment(ctx context.Context, owner, repo string, commentID int64, body string) (*IssueComment, error)
- type IssueComment
- type JWTSigner
- type PullRequest
- type PullRequestUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithGithubAppAuth ¶ added in v1.0.8
Types ¶
type API ¶
type API interface {
FindIssueCommentWithMarker(ctx context.Context, owner, repo string, issueNumber int, marker string) (*IssueComment, error)
CreateIssueComment(ctx context.Context, owner, repo string, issueNumber int, body string) (*IssueComment, error)
UpdateIssueComment(ctx context.Context, owner, repo string, commentID int64, body string) (*IssueComment, error)
GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
GetInstallationToken(ctx context.Context, installationID int64) (string, error)
}
API is the handler-facing interface satisfied by *Client. It exists for dependency injection in handler tests; the shared library provides one implementation. Methods take only the operation's intrinsic arguments; auth is applied by the authTransport on the underlying http client.
type AuthProvider ¶ added in v1.0.8
func GetAuthProvider ¶ added in v1.0.8
func GetAuthProvider(ctx context.Context) AuthProvider
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the GitHub API client used by handlers. It is built on top of go-github, authenticated with a static token via authTransport.
func NewClient ¶
NewClient returns a Client authenticated with the supplied token, issuing requests against baseURL using httpClient's transport.
A nil httpClient falls back to http.DefaultClient. The caller's *http.Client is not mutated; we shallow-copy before installing the auth transport wrapper.
baseURL "" or "https://api.github.com" targets public GitHub. Any other value retargets the underlying go-github client at a GHES instance via WithEnterpriseURLs.
func (*Client) CreateIssueComment ¶
func (c *Client) CreateIssueComment(ctx context.Context, owner, repo string, issueNumber int, body string) (*IssueComment, error)
CreateIssueComment creates a comment on the specified issue or pull request.
func (*Client) FindIssueCommentWithMarker ¶
func (c *Client) FindIssueCommentWithMarker(ctx context.Context, owner, repo string, issueNumber int, marker string) (*IssueComment, error)
FindIssueCommentWithMarker lists issue comments and returns the first one whose body contains the marker string. Returns nil, nil if no matching comment is found.
func (*Client) GetInstallationToken ¶ added in v1.0.8
func (*Client) GetPullRequest ¶
func (c *Client) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
GetPullRequest retrieves a pull request by number.
func (*Client) UpdateIssueComment ¶
func (c *Client) UpdateIssueComment(ctx context.Context, owner, repo string, commentID int64, body string) (*IssueComment, error)
UpdateIssueComment updates an existing issue comment by ID.
type IssueComment ¶
IssueComment represents a GitHub issue or PR comment.
type JWTSigner ¶ added in v1.0.8
type JWTSigner interface {
SignGithubJWT(ctx context.Context, token *jwt.Token, keyAlias string) error
}
JWTSigner signs a GitHub App JWT using a KMS-backed key.
type PullRequest ¶
type PullRequest struct {
ID int64
State string
User PullRequestUser
}
PullRequest represents a GitHub pull request as returned by GetPullRequest.
type PullRequestUser ¶
type PullRequestUser struct {
Login string
}
PullRequestUser carries the login of a pull request author.