Documentation
¶
Index ¶
- type Adapter
- func (a *Adapter) AuthenticatedUser() string
- func (a *Adapter) FetchActivities(prs []*pullrequest.PullRequest, since time.Time) (map[string]pullrequest.PRActivityData, error)
- func (a *Adapter) FetchPRStatus(owner, repo string, number int) (pullrequest.PRStatus, error)
- func (a *Adapter) FetchRequestedReviews() ([]*pullrequest.PullRequest, error)
- func (a *Adapter) FetchUserCreated() ([]*pullrequest.PullRequest, error)
- type AuthTransport
- type BatchedTimelineResponse
- type Client
- type GraphQLError
- type GraphQLResponse
- type LatestReviewsDTO
- type PullRequestDTO
- type ReviewDTO
- type TimelineItemDTO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements the pullrequest.PullRequestRepository interface
func NewAdapterWithURL ¶
NewAdapterWithURL creates a new GitHub adapter with a custom base URL (for testing)
func (*Adapter) AuthenticatedUser ¶
AuthenticatedUser returns the GitHub login of the authenticated user. Used by the application layer (e.g. notification handler, use case) to filter self-authored activities when deciding what to notify about.
func (*Adapter) FetchActivities ¶
func (a *Adapter) FetchActivities(prs []*pullrequest.PullRequest, since time.Time) (map[string]pullrequest.PRActivityData, error)
FetchActivities fetches activity/enrichment facts for PRs since the given time using batched GraphQL queries.
func (*Adapter) FetchPRStatus ¶
FetchPRStatus fetches the current status of a specific PR (open, merged, closed). Uses a lightweight GraphQL query to check only the PR state.
func (*Adapter) FetchRequestedReviews ¶
func (a *Adapter) FetchRequestedReviews() ([]*pullrequest.PullRequest, error)
FetchRequestedReviews fetches PRs where the user is requested to review or has reviewed Note: GitHub search doesn't support OR operator, so we fetch both separately and deduplicate
func (*Adapter) FetchUserCreated ¶
func (a *Adapter) FetchUserCreated() ([]*pullrequest.PullRequest, error)
FetchUserCreated fetches PRs created by the user
type AuthTransport ¶
type AuthTransport struct {
// contains filtered or unexported fields
}
AuthTransport adds authentication headers to requests
type BatchedTimelineResponse ¶
type BatchedTimelineResponse struct {
Data map[string]interface{} `json:"data"`
Errors []GraphQLError `json:"errors"`
}
BatchedTimelineResponse represents the response for batched timeline queries using aliases
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles HTTP communication with GitHub API
func NewClientWithURL ¶
NewClientWithURL creates a new GitHub API client with a custom base URL (for testing)
func (*Client) ExecuteBatchedTimelineQuery ¶
func (c *Client) ExecuteBatchedTimelineQuery(query string) (*BatchedTimelineResponse, error)
ExecuteBatchedTimelineQuery executes a batched GraphQL query with aliases
func (*Client) ExecuteQuery ¶
func (c *Client) ExecuteQuery(query string, variables map[string]interface{}) (*GraphQLResponse, error)
ExecuteQuery executes a GraphQL query
func (*Client) FetchAuthenticatedUserLogin ¶
FetchAuthenticatedUserLogin fetches the login of the authenticated user
type GraphQLError ¶
GraphQLError represents a GraphQL error
type GraphQLResponse ¶
type GraphQLResponse struct {
Data struct {
Search struct {
Nodes []PullRequestDTO `json:"nodes"`
PageInfo struct {
EndCursor string `json:"endCursor"`
HasNextPage bool `json:"hasNextPage"`
} `json:"pageInfo"`
} `json:"search"`
} `json:"data"`
Errors []GraphQLError `json:"errors"`
}
GraphQLResponse represents the GitHub GraphQL API response
type LatestReviewsDTO ¶
type LatestReviewsDTO struct {
Nodes []ReviewDTO `json:"nodes"`
}
LatestReviewsDTO represents the latest reviews connection on a PR
type PullRequestDTO ¶
type PullRequestDTO struct {
Title string `json:"title"`
URL string `json:"url"`
Number int `json:"number"`
CreatedAt time.Time `json:"createdAt"`
IsDraft bool `json:"isDraft"`
Repository struct {
NameWithOwner string `json:"nameWithOwner"`
} `json:"repository"`
Author struct {
Login string `json:"login"`
} `json:"author"`
LatestReviews *LatestReviewsDTO `json:"latestReviews,omitempty"`
Commits *struct {
Nodes []struct {
Commit struct {
StatusCheckRollup *struct {
State string `json:"state"`
} `json:"statusCheckRollup"`
} `json:"commit"`
} `json:"nodes"`
} `json:"commits,omitempty"`
}
PullRequestDTO represents the GitHub API response for a pull request
type ReviewDTO ¶
type ReviewDTO struct {
Author struct {
Login string `json:"login"`
} `json:"author"`
State string `json:"state"`
SubmittedAt time.Time `json:"submittedAt"`
}
ReviewDTO represents a single review from the GitHub API
type TimelineItemDTO ¶
type TimelineItemDTO struct {
Typename string `json:"__typename"`
CreatedAt time.Time `json:"createdAt"`
Author *struct {
Login string `json:"login"`
} `json:"author,omitempty"`
Body string `json:"body,omitempty"`
State string `json:"state,omitempty"` // For reviews
Commit *struct {
OID string `json:"oid"`
CommittedDate time.Time `json:"committedDate"`
Author *struct {
User *struct {
Login string `json:"login"`
} `json:"user"`
} `json:"author"`
} `json:"commit,omitempty"` // For commits
Reactions *struct {
Nodes []struct {
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
User *struct {
Login string `json:"login"`
} `json:"user"`
} `json:"nodes"`
} `json:"reactions,omitempty"` // For comment and review reactions
}
TimelineItemDTO represents a timeline item (comment, review, etc.)