Documentation
¶
Index ¶
- func ParseWebHook(messageType string, payload []byte) (any, error)
- func Ptr[T any](v T) *T
- func WebHookType(r *http.Request) string
- type API
- 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) 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 Option
- type PullRequest
- type PullRequestUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseWebHook ¶
ParseWebHook parses the raw webhook payload into a typed go-github event value. This wraps github.ParseWebHook so consumers do not need to import go-github directly.
func Ptr ¶
func Ptr[T any](v T) *T
Ptr returns a pointer to the given value, equivalent to go-github's github.Ptr.
func WebHookType ¶
WebHookType returns the X-GitHub-Event header value from the request. This wraps github.WebHookType so consumers do not need to import go-github directly.
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)
}
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 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) 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 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.