Documentation
¶
Index ¶
- Constants
- Variables
- func IsAuthError(err error) bool
- func IsRateLimitError(err error) bool
- func NewStatusError(statusCode int, err error, header http.Header) error
- func StatusCode(err error) (int, bool)
- type CommentNode
- type Config
- type FetchOptions
- type Fetcher
- type IssueData
- type Label
- type Metadata
- type ReactionSummary
- type ResourceRef
- type ResourceType
- type ReviewData
- type TimelineEvent
Constants ¶
const ( // DefaultMaxRetries is the default retry count for GitHub API requests. DefaultMaxRetries = 3 // DefaultInitialBackoff is the first retry delay. DefaultInitialBackoff = 2 * time.Second )
Variables ¶
var ErrResourceNotFound = errors.New("github resource not found")
ErrResourceNotFound indicates the requested GitHub resource does not exist.
var ErrUnsupportedResourceType = errors.New("unsupported github resource type")
ErrUnsupportedResourceType indicates the resource type is unknown to the fetcher dispatcher.
Functions ¶
func IsAuthError ¶
IsAuthError reports whether an error is an authentication or authorization failure.
func IsRateLimitError ¶
IsRateLimitError reports whether an error is a GitHub rate limit failure.
func NewStatusError ¶
NewStatusError builds a classified HTTP status error with any retry metadata from headers.
func StatusCode ¶
StatusCode extracts the wrapped HTTP status code when available.
Types ¶
type CommentNode ¶
type CommentNode struct {
ID string
Author string
Body string
CreatedAt string
UpdatedAt string
URL string
Replies []CommentNode
Reactions ReactionSummary
}
CommentNode represents one comment and its nested replies.
type Config ¶
type Config struct {
HTTPClient *http.Client
Token string
RESTBaseURL string
GraphQLURL string
MaxRetries int
InitialBackoff time.Duration
}
Config configures the GitHub fetcher client.
func (Config) WithDefaults ¶
WithDefaults fills missing optional values with package defaults.
type FetchOptions ¶
type FetchOptions struct {
IncludeComments bool
}
FetchOptions controls fetch-time behavior.
type Fetcher ¶
type Fetcher interface {
Fetch(ctx context.Context, ref ResourceRef, opts FetchOptions) (IssueData, error)
}
Fetcher defines the contract for fetching and normalizing one GitHub resource.
func NewFetcher ¶
NewFetcher constructs a fetcher instance.
type IssueData ¶
type IssueData struct {
Description string
Timeline []TimelineEvent
Reviews []ReviewData
Thread []CommentNode
Meta Metadata
Reactions ReactionSummary
}
IssueData is the normalized transport payload consumed by other layers.
type Label ¶
type Label struct {
Name string
}
Label stores minimal label data needed for output rendering.
type Metadata ¶
type Metadata struct {
Category string
MergedAt string
AcceptedAnswerAuthor string
State string
Author string
CreatedAt string
Title string
AcceptedAnswerID string
Type ResourceType
URL string
UpdatedAt string
Labels []Label
ReviewCount int
Number int
IsAnswered bool
Merged bool
}
Metadata stores top-level fields used in front matter and metadata sections.
type ReactionSummary ¶
type ReactionSummary struct {
PlusOne int
MinusOne int
Laugh int
Hooray int
Confused int
Heart int
Rocket int
Eyes int
Total int
}
ReactionSummary captures aggregate reaction counts on a GitHub entity.
type ResourceRef ¶
type ResourceRef struct {
Owner string
Repo string
Type ResourceType
URL string
Number int
}
ResourceRef is the normalized resource identity extracted from an input URL.
type ResourceType ¶
type ResourceType string
ResourceType identifies the GitHub resource kind represented by a URL.
const ( // ResourceIssue is the type for GitHub issue URLs. ResourceIssue ResourceType = "issue" // ResourcePullRequest is the type for GitHub pull request URLs. ResourcePullRequest ResourceType = "pull_request" // ResourceDiscussion is the type for GitHub discussion URLs. ResourceDiscussion ResourceType = "discussion" )
type ReviewData ¶
type ReviewData struct {
ID string
State string
Author string
Body string
CreatedAt string
Comments []CommentNode
Reactions ReactionSummary
}
ReviewData stores review summary data and review-thread comments.