Documentation
¶
Index ¶
- type Client
- func (c *Client) AddComment(subjectID, body string) error
- func (c *Client) AddDiscussionComment(discussionID, body string) error
- func (c *Client) AddDiscussionCommentReply(replyToID, body string) error
- func (c *Client) AddReviewThreadReply(threadID, body string) error
- func (c *Client) CloseIssue(id string) error
- func (c *Client) ClosePullRequest(id string) error
- func (c *Client) FetchComments(itemType ItemType, owner, repo string, number int) ([]RemoteComment, error)
- func (c *Client) FetchDiscussion(owner, repo string, number int) (*Discussion, error)
- func (c *Client) FetchDiscussions(owner, repo string, limit int) ([]Discussion, error)
- func (c *Client) FetchIssue(owner, repo string, number int) (*Issue, error)
- func (c *Client) FetchIssues(owner, repo string, limit int) ([]Issue, error)
- func (c *Client) FetchPullRequest(owner, repo string, number int) (*PullRequest, error)
- func (c *Client) FetchPullRequests(owner, repo string, limit int) ([]PullRequest, error)
- func (c *Client) FetchRemoteState(itemType ItemType, owner, repo string, number int) (RemoteState, error)
- func (c *Client) Query(query string, variables map[string]interface{}, response interface{}) error
- func (c *Client) ReopenIssue(id string) error
- func (c *Client) ReopenPullRequest(id string) error
- func (c *Client) UpdateDiscussion(id, title, body string) error
- func (c *Client) UpdateDiscussionComment(commentID, body string) error
- func (c *Client) UpdateIssue(id, title, body string) error
- func (c *Client) UpdateIssueComment(commentID, body string) error
- func (c *Client) UpdatePullRequest(id, title, body string) error
- type Comment
- type Discussion
- type DiscussionComment
- type DiscussionCommentNode
- type DiscussionNode
- type DiscussionsResponse
- type Issue
- type IssueNode
- type IssueReference
- type IssuesResponse
- type ItemType
- type ParentIssueNode
- type ParsedInput
- type PullRequest
- type PullRequestNode
- type PullRequestsResponse
- type RemoteComment
- type RemoteState
- type ReviewComment
- type ReviewThread
- type SingleDiscussionResponse
- type SingleIssueResponse
- type SinglePullRequestResponse
- type SubIssueNode
- type SubIssuesSummary
- type SubIssuesSummaryNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to interact with GitHub's GraphQL API.
func (*Client) AddComment ¶
AddComment adds a new comment to an issue or PR.
func (*Client) AddDiscussionComment ¶
AddDiscussionComment adds a new comment to a discussion.
func (*Client) AddDiscussionCommentReply ¶
AddDiscussionCommentReply adds a reply to a discussion comment.
func (*Client) AddReviewThreadReply ¶
AddReviewThreadReply adds a reply to a PR review thread.
func (*Client) CloseIssue ¶
CloseIssue closes an issue.
func (*Client) ClosePullRequest ¶
ClosePullRequest closes a pull request.
func (*Client) FetchComments ¶
func (c *Client) FetchComments(itemType ItemType, owner, repo string, number int) ([]RemoteComment, error)
FetchComments fetches current comments for an item.
func (*Client) FetchDiscussion ¶
func (c *Client) FetchDiscussion(owner, repo string, number int) (*Discussion, error)
FetchDiscussion fetches a single discussion by number.
func (*Client) FetchDiscussions ¶
func (c *Client) FetchDiscussions(owner, repo string, limit int) ([]Discussion, error)
FetchDiscussions fetches all discussions from a repository with pagination.
func (*Client) FetchIssue ¶
FetchIssue fetches a single issue by number.
func (*Client) FetchIssues ¶
FetchIssues fetches all issues from a repository with pagination.
func (*Client) FetchPullRequest ¶
func (c *Client) FetchPullRequest(owner, repo string, number int) (*PullRequest, error)
FetchPullRequest fetches a single PR by number.
func (*Client) FetchPullRequests ¶
func (c *Client) FetchPullRequests(owner, repo string, limit int) ([]PullRequest, error)
FetchPullRequests fetches all PRs from a repository with pagination.
func (*Client) FetchRemoteState ¶
func (c *Client) FetchRemoteState(itemType ItemType, owner, repo string, number int) (RemoteState, error)
FetchRemoteState fetches the updatedAt timestamp and state for an item.
func (*Client) ReopenIssue ¶
ReopenIssue reopens an issue.
func (*Client) ReopenPullRequest ¶
ReopenPullRequest reopens a pull request.
func (*Client) UpdateDiscussion ¶
UpdateDiscussion updates a discussion's title and body.
func (*Client) UpdateDiscussionComment ¶
UpdateDiscussionComment updates an existing discussion comment.
func (*Client) UpdateIssue ¶
UpdateIssue updates an issue's title and body.
func (*Client) UpdateIssueComment ¶
UpdateIssueComment updates an existing comment on an issue or PR.
func (*Client) UpdatePullRequest ¶
UpdatePullRequest updates a PR's title and body.
type Comment ¶
type Comment struct {
ID string `json:"id"`
Author string `json:"author"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Comment represents a comment on an issue, PR, or discussion.
type Discussion ¶
type Discussion struct {
ID string `json:"id"`
URL string `json:"url"`
Number int `json:"number"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Title string `json:"title"`
Body string `json:"body"`
Category string `json:"category"`
Author string `json:"author"`
AnswerID string `json:"answerId,omitempty"`
Locked bool `json:"locked"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Comments []DiscussionComment `json:"comments"`
}
Discussion represents a GitHub discussion with all metadata.
type DiscussionComment ¶
type DiscussionComment struct {
ID string `json:"id"`
Author string `json:"author"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Replies []DiscussionComment `json:"replies,omitempty"`
}
DiscussionComment represents a comment or reply in a discussion.
type DiscussionCommentNode ¶
type DiscussionCommentNode struct {
ID string `json:"id"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Author struct {
Login string `json:"login"`
} `json:"author"`
Replies struct {
Nodes []struct {
ID string `json:"id"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Author struct {
Login string `json:"login"`
} `json:"author"`
} `json:"nodes"`
} `json:"replies"`
}
DiscussionCommentNode represents a comment in a discussion.
type DiscussionNode ¶
type DiscussionNode struct {
ID string `json:"id"`
URL string `json:"url"`
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
Locked bool `json:"locked"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Category struct {
Name string `json:"name"`
} `json:"category"`
Author struct {
Login string `json:"login"`
} `json:"author"`
Answer struct {
ID string `json:"id"`
} `json:"answer"`
Comments struct {
Nodes []DiscussionCommentNode `json:"nodes"`
} `json:"comments"`
}
DiscussionNode represents a discussion in the GraphQL response.
type DiscussionsResponse ¶
type DiscussionsResponse struct {
Repository struct {
Discussions struct {
PageInfo struct {
HasNextPage bool `json:"hasNextPage"`
EndCursor string `json:"endCursor"`
} `json:"pageInfo"`
Nodes []DiscussionNode `json:"nodes"`
} `json:"discussions"`
} `json:"repository"`
}
DiscussionsResponse represents the GraphQL response for discussions.
type Issue ¶
type Issue struct {
ID string `json:"id"`
URL string `json:"url"`
Number int `json:"number"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Author string `json:"author"`
Labels []string `json:"labels"`
Assignees []string `json:"assignees"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Comments []Comment `json:"comments"`
Parent *IssueReference `json:"parent,omitempty"`
Children []IssueReference `json:"children,omitempty"`
SubIssuesSummary *SubIssuesSummary `json:"subIssuesSummary,omitempty"`
}
Issue represents a GitHub issue with all metadata.
type IssueNode ¶
type IssueNode struct {
ID string `json:"id"`
URL string `json:"url"`
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Author struct {
Login string `json:"login"`
} `json:"author"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Labels struct {
Nodes []struct {
Name string `json:"name"`
} `json:"nodes"`
} `json:"labels"`
Assignees struct {
Nodes []struct {
Login string `json:"login"`
} `json:"nodes"`
} `json:"assignees"`
Comments struct {
Nodes []struct {
ID string `json:"id"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Author struct {
Login string `json:"login"`
} `json:"author"`
} `json:"nodes"`
} `json:"comments"`
Parent *ParentIssueNode `json:"parent"`
SubIssues struct {
Nodes []SubIssueNode `json:"nodes"`
} `json:"subIssues"`
SubIssuesSummary *SubIssuesSummaryNode `json:"subIssuesSummary"`
}
IssueNode represents an issue in the GraphQL response.
type IssueReference ¶
type IssueReference struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
URL string `json:"url"`
State string `json:"state"`
Owner string `json:"owner"`
Repo string `json:"repo"`
}
IssueReference represents a reference to a parent or child issue.
type IssuesResponse ¶
type IssuesResponse struct {
Repository struct {
Issues struct {
PageInfo struct {
HasNextPage bool `json:"hasNextPage"`
EndCursor string `json:"endCursor"`
} `json:"pageInfo"`
Nodes []IssueNode `json:"nodes"`
} `json:"issues"`
} `json:"repository"`
}
IssuesResponse represents the GraphQL response for issues.
type ParentIssueNode ¶
type ParentIssueNode struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
URL string `json:"url"`
State string `json:"state"`
Repository struct {
Owner struct {
Login string `json:"login"`
} `json:"owner"`
Name string `json:"name"`
} `json:"repository"`
}
ParentIssueNode represents a parent issue in the GraphQL response.
type ParsedInput ¶
type ParsedInput struct {
Owner string
Repo string
Number int // 0 if fetching all
ItemType ItemType // Empty if fetching all types
}
ParsedInput represents parsed command input (URL or owner/repo).
func ParseInput ¶
func ParseInput(input string) (*ParsedInput, error)
ParseInput parses the input argument which can be a URL or owner/repo format.
type PullRequest ¶
type PullRequest struct {
ID string `json:"id"`
URL string `json:"url"`
Number int `json:"number"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Author string `json:"author"`
Draft bool `json:"draft"`
Labels []string `json:"labels"`
Assignees []string `json:"assignees"`
HeadRef string `json:"headRef"`
BaseRef string `json:"baseRef"`
MergeCommit string `json:"mergeCommit,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
MergedAt time.Time `json:"mergedAt,omitempty"`
Comments []Comment `json:"comments"`
ReviewThreads []ReviewThread `json:"reviewThreads"`
}
PullRequest represents a GitHub pull request with all metadata.
type PullRequestNode ¶
type PullRequestNode struct {
ID string `json:"id"`
URL string `json:"url"`
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Author struct {
Login string `json:"login"`
} `json:"author"`
IsDraft bool `json:"isDraft"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
MergedAt time.Time `json:"mergedAt"`
HeadRefName string `json:"headRefName"`
BaseRefName string `json:"baseRefName"`
MergeCommit struct {
Oid string `json:"oid"`
} `json:"mergeCommit"`
Labels struct {
Nodes []struct {
Name string `json:"name"`
} `json:"nodes"`
} `json:"labels"`
Assignees struct {
Nodes []struct {
Login string `json:"login"`
} `json:"nodes"`
} `json:"assignees"`
Comments struct {
Nodes []struct {
ID string `json:"id"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Author struct {
Login string `json:"login"`
} `json:"author"`
} `json:"nodes"`
} `json:"comments"`
ReviewThreads struct {
Nodes []struct {
ID string `json:"id"`
Path string `json:"path"`
Line int `json:"line"`
IsResolved bool `json:"isResolved"`
IsOutdated bool `json:"isOutdated"`
Comments struct {
Nodes []struct {
ID string `json:"id"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Author struct {
Login string `json:"login"`
} `json:"author"`
} `json:"nodes"`
} `json:"comments"`
} `json:"nodes"`
} `json:"reviewThreads"`
}
PullRequestNode represents a PR in the GraphQL response.
type PullRequestsResponse ¶
type PullRequestsResponse struct {
Repository struct {
PullRequests struct {
PageInfo struct {
HasNextPage bool `json:"hasNextPage"`
EndCursor string `json:"endCursor"`
} `json:"pageInfo"`
Nodes []PullRequestNode `json:"nodes"`
} `json:"pullRequests"`
} `json:"repository"`
}
PullRequestsResponse represents the GraphQL response for pull requests.
type RemoteComment ¶
RemoteComment represents a comment fetched from GitHub for comparison.
type RemoteState ¶
type RemoteState struct {
UpdatedAt time.Time
State string // "OPEN", "CLOSED", "MERGED" (PRs only)
}
RemoteState holds the remote item's current state info.
type ReviewComment ¶
type ReviewComment struct {
ID string `json:"id"`
Author string `json:"author"`
Body string `json:"body"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
ReviewComment represents an inline review comment on a PR.
type ReviewThread ¶
type ReviewThread struct {
ID string `json:"id"`
Path string `json:"path"`
Line int `json:"line"`
IsResolved bool `json:"isResolved"`
IsOutdated bool `json:"isOutdated"`
Comments []ReviewComment `json:"comments"`
}
ReviewThread represents a review thread on a PR (a conversation on a specific line).
type SingleDiscussionResponse ¶
type SingleDiscussionResponse struct {
Repository struct {
Discussion DiscussionNode `json:"discussion"`
} `json:"repository"`
}
SingleDiscussionResponse represents the GraphQL response for a single discussion.
type SingleIssueResponse ¶
type SingleIssueResponse struct {
Repository struct {
Issue IssueNode `json:"issue"`
} `json:"repository"`
}
SingleIssueResponse represents the GraphQL response for a single issue.
type SinglePullRequestResponse ¶
type SinglePullRequestResponse struct {
Repository struct {
PullRequest PullRequestNode `json:"pullRequest"`
} `json:"repository"`
}
SinglePullRequestResponse represents the GraphQL response for a single PR.
type SubIssueNode ¶
type SubIssueNode struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
URL string `json:"url"`
State string `json:"state"`
Repository struct {
Owner struct {
Login string `json:"login"`
} `json:"owner"`
Name string `json:"name"`
} `json:"repository"`
}
SubIssueNode represents a sub-issue in the GraphQL response.
type SubIssuesSummary ¶
type SubIssuesSummary struct {
Total int `json:"total"`
Completed int `json:"completed"`
PercentComplete int `json:"percentComplete"`
}
SubIssuesSummary provides statistics about sub-issues.
type SubIssuesSummaryNode ¶
type SubIssuesSummaryNode struct {
Total int `json:"total"`
Completed int `json:"completed"`
PercentCompleted int `json:"percentCompleted"`
}
SubIssuesSummaryNode represents the sub-issues summary in the GraphQL response.