Documentation
¶
Index ¶
- func IsResolutionError(err error) bool
- type Author
- type Client
- func (c *Client) CheckRateLimit(ctx context.Context) error
- func (c *Client) FetchOrgRepos(ctx context.Context, org string, filterRepos []string) ([]string, error)
- func (c *Client) FetchReviewActivity(ctx context.Context, org, repo string, since time.Time) (*FetchReviewActivityResult, error)
- func (c *Client) ValidateOrg(ctx context.Context, org string) error
- type CommentNode
- type FetchReviewActivityResult
- type OrgReposData
- type PRNode
- type PageInfo
- type RateLimit
- type RepoNode
- type RepoPRsData
- type ReviewCommentDetail
- type ReviewCommentDetailPR
- type ReviewNode
- type UserActivity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsResolutionError ¶
IsResolutionError checks if an error is a repo resolution error.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a GitHub GraphQL API client.
func New ¶
New creates a GitHub GraphQL client. It reads GITHUB_TOKEN and GITHUB_API_URL from the environment.
func (*Client) CheckRateLimit ¶
CheckRateLimit queries the current rate limit status.
func (*Client) FetchOrgRepos ¶
func (c *Client) FetchOrgRepos(ctx context.Context, org string, filterRepos []string) ([]string, error)
FetchOrgRepos returns repository names for the given org. If filterRepos is non-empty, those names are returned directly without querying.
func (*Client) FetchReviewActivity ¶
func (c *Client) FetchReviewActivity(ctx context.Context, org, repo string, since time.Time) (*FetchReviewActivityResult, error)
FetchReviewActivity fetches review activity for a single repo. Returns an error containing "Could not resolve" for repos that don't exist.
type CommentNode ¶
type CommentNode struct {
Author *Author `json:"author"`
Body string `json:"body"`
DiffHunk string `json:"diffHunk"`
CreatedAt string `json:"createdAt"`
}
CommentNode is a single review thread comment.
type FetchReviewActivityResult ¶
type FetchReviewActivityResult struct {
Activity map[string]*UserActivity
Details []ReviewCommentDetail
}
FetchReviewActivityResult holds the results of fetching review activity.
type OrgReposData ¶
type OrgReposData struct {
Organization struct {
Repositories struct {
PageInfo PageInfo `json:"pageInfo"`
Nodes []RepoNode `json:"nodes"`
} `json:"repositories"`
} `json:"organization"`
RateLimit RateLimit `json:"rateLimit"`
}
OrgReposData is the unwrapped data from the org repos query.
type PRNode ¶
type PRNode struct {
Number int `json:"number"`
Title string `json:"title"`
URL string `json:"url"`
State string `json:"state"`
UpdatedAt string `json:"updatedAt"`
Author *Author `json:"author"`
Reviews struct {
Nodes []ReviewNode `json:"nodes"`
} `json:"reviews"`
ReviewThreads struct {
Nodes []struct {
Comments struct {
Nodes []CommentNode `json:"nodes"`
} `json:"comments"`
} `json:"nodes"`
} `json:"reviewThreads"`
}
PRNode is a single pull request from the review activity query.
type RepoNode ¶
type RepoNode struct {
Name string `json:"name"`
}
RepoNode is a single repository from the org repos query.
type RepoPRsData ¶
type RepoPRsData struct {
Repository *struct {
PullRequests struct {
PageInfo PageInfo `json:"pageInfo"`
Nodes []PRNode `json:"nodes"`
} `json:"pullRequests"`
} `json:"repository"`
RateLimit RateLimit `json:"rateLimit"`
}
RepoPRsData is the unwrapped data from the review activity query.
type ReviewCommentDetail ¶
type ReviewCommentDetail struct {
Reviewer string `json:"reviewer"`
Body string `json:"body"`
DiffHunk string `json:"diffHunk"`
CreatedAt string `json:"createdAt"`
PR ReviewCommentDetailPR `json:"pr"`
}
ReviewCommentDetail is an enriched comment with PR metadata.
type ReviewCommentDetailPR ¶
type ReviewCommentDetailPR struct {
Repo string `json:"repo"`
Number int `json:"number"`
Title string `json:"title"`
Author string `json:"author"`
URL string `json:"url"`
State string `json:"state"`
}
ReviewCommentDetailPR holds PR metadata for a comment.
type ReviewNode ¶
type ReviewNode struct {
Author *Author `json:"author"`
State string `json:"state"`
CreatedAt string `json:"createdAt"`
}
ReviewNode is a single review on a PR.