package github import ( "context" "time" ) // PullRequest represents a GitHub pull request. type PullRequest struct { // Number is the pull request number Number int `json:"number"` // Title is the pull request title Title string `json:"title"` // CreatedAt is the timestamp when the PR was created CreatedAt time.Time `json:"created_at"` // UpdatedAt is the timestamp when the PR was last updated UpdatedAt time.Time `json:"updated_at"` // User is the GitHub user who created the PR User User `json:"user"` } // Review represents a pull request review. type Review struct { // ID is the unique identifier for the review ID int64 `json:"id"` // User is the GitHub user who submitted the review User User `json:"user"` // State represents the review decision: APPROVED, CHANGES_REQUESTED, or COMMENTED State string `json:"state"` // SubmittedAt is the timestamp when the review was submitted SubmittedAt time.Time `json:"submitted_at"` // Body is the review comment text Body string `json:"body"` } // ReviewComment represents an inline comment on a pull request review. type ReviewComment struct { // ID is the unique identifier for the comment ID int64 `json:"id"` // ReviewID is the ID of the review this comment belongs to ReviewID int64 `json:"pull_request_review_id"` // User is the GitHub user who made the comment User User `json:"user"` // Body is the comment text Body string `json:"body"` // CreatedAt is the timestamp when the comment was created CreatedAt time.Time `json:"created_at"` // UpdatedAt is the timestamp when the comment was last updated UpdatedAt time.Time `json:"updated_at"` // Path is the file path where the comment was made Path string `json:"path"` // Line is the line number where the comment was made Line int `json:"line"` } // User represents a GitHub user. type User struct { // Login is the GitHub username Login string `json:"login"` // ID is the GitHub user ID ID int64 `json:"id"` } // APIError represents a GitHub API error response. type APIError struct { // Message describes the error that occurred Message string `json:"message"` // DocumentationURL points to the relevant API documentation DocumentationURL string `json:"documentation_url"` } // RateLimit represents GitHub API rate limit information. type RateLimit struct { // Limit is the maximum number of requests allowed per hour Limit int // Remaining is the number of requests remaining in the current hour Remaining int // Reset is the time when the rate limit will be reset Reset time.Time } // ClientInterface defines the interface for GitHub API interactions. type ClientInterface interface { // GetPullRequests fetches pull requests created within the specified date range. // It returns a slice of PullRequest and any error that occurred. GetPullRequests( ctx context.Context, owner, repo string, since, until time.Time, ) ([]PullRequest, error) // GetPullRequestReviews fetches all reviews for a specific pull request. // It returns a slice of Review and any error that occurred. GetPullRequestReviews(ctx context.Context, owner, repo string, prNumber int) ([]Review, error) // GetPullRequestReviewComments fetches all review comments for a specific pull request. // It returns a slice of ReviewComment and any error that occurred. GetPullRequestReviewComments( ctx context.Context, owner, repo string, prNumber int, ) ([]ReviewComment, error) // GetRateLimit returns the current rate limit information. // It returns a RateLimit pointer and any error that occurred. GetRateLimit(ctx context.Context) (*RateLimit, error) } // TestFixtures represents the test data structure. type TestFixtures struct { // PullRequests is a slice of sample pull requests PullRequests []PullRequest // Reviews maps PR numbers to their reviews Reviews map[string][]Review // Comments maps PR numbers to their review comments Comments map[string][]ReviewComment // RateLimit contains sample rate limit information RateLimit RateLimit }