github

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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 wraps the GitHub API client.

func NewClient

func NewClient(ctx context.Context, token string) *Client

NewClient creates a new GitHub client using the provided token. If token is empty, it returns an unauthenticated client.

func (*Client) AddLabels

func (c *Client) AddLabels(ctx context.Context, org, repo string, number int, labels []string) error

AddLabels adds labels to an issue.

func (*Client) CloseIssue added in v0.1.7

func (c *Client) CloseIssue(ctx context.Context, org, repo string, number int) error

CloseIssue closes a GitHub issue by setting its state to "closed".

func (*Client) CreateComment

func (c *Client) CreateComment(ctx context.Context, org, repo string, number int, body string) error

CreateComment posts a comment on an issue.

func (*Client) GetFileContent added in v0.0.4

func (c *Client) GetFileContent(ctx context.Context, org, repo, path, ref string) ([]byte, error)

GetFileContent fetches the raw content of a file from a repository. ref can be a branch, tag, or commit SHA. If empty, the default branch is used.

func (*Client) GetIssue

func (c *Client) GetIssue(ctx context.Context, org, repo string, number int) (*github.Issue, error)

GetIssue fetches issue details.

func (*Client) GetPullRequest added in v0.2.1

func (c *Client) GetPullRequest(ctx context.Context, org, repo string, number int) (*github.PullRequest, error)

GetPullRequest fetches full PR details including changed file count.

func (*Client) ListComments added in v0.0.3

func (c *Client) ListComments(ctx context.Context, org, repo string, number int, opts *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error)

ListComments fetches comments for a specific issue.

func (*Client) ListIssueCommentReactions added in v0.1.7

func (c *Client) ListIssueCommentReactions(ctx context.Context, org, repo string, commentID int64) ([]*github.Reaction, error)

ListIssueCommentReactions fetches all reactions on a specific issue comment.

func (*Client) ListIssueEvents added in v0.1.0

func (c *Client) ListIssueEvents(ctx context.Context, org, repo string, number int) ([]*github.IssueEvent, error)

ListIssueEvents fetches timeline events for a specific issue. This includes events like transferred, closed, reopened, labeled, etc.

func (*Client) ListIssues added in v0.0.3

func (c *Client) ListIssues(ctx context.Context, org, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)

ListIssues fetches a list of issues from the repository. options can be used to filter by state, labels, etc. If options is nil, default options are used.

func (*Client) ListPullRequestFiles added in v0.2.1

func (c *Client) ListPullRequestFiles(ctx context.Context, org, repo string, number int) ([]*github.CommitFile, error)

ListPullRequestFiles fetches all changed files for a PR (paginated).

func (*Client) RemoveLabel added in v0.1.7

func (c *Client) RemoveLabel(ctx context.Context, org, repo string, number int, label string) error

RemoveLabel removes a single label from an issue. Returns nil if the label was not present (GitHub API returns 404, which we treat as success).

func (*Client) TransferIssue

func (c *Client) TransferIssue(ctx context.Context, org, repo string, number int, targetRepo string) (string, error)

TransferIssue transfers an issue to another repository using GitHub GraphQL API. Requires the user to have admin/write access to both repositories. targetRepo should be in "owner/repo" format. Returns the URL of the transferred issue.

type GraphQLClient added in v0.1.0

type GraphQLClient struct {
	// contains filtered or unexported fields
}

GraphQLClient provides access to GitHub's GraphQL API.

func NewGraphQLClient added in v0.1.0

func NewGraphQLClient(httpClient *http.Client, token string) *GraphQLClient

NewGraphQLClient creates a new GraphQL client with the given token.

func (*GraphQLClient) GetIssueNodeID added in v0.1.0

func (c *GraphQLClient) GetIssueNodeID(ctx context.Context, owner, repo string, number int) (string, error)

GetIssueNodeID fetches the GraphQL node ID for an issue.

func (*GraphQLClient) GetRepositoryNodeID added in v0.1.0

func (c *GraphQLClient) GetRepositoryNodeID(ctx context.Context, owner, repo string) (string, error)

GetRepositoryNodeID fetches the GraphQL node ID for a repository.

func (*GraphQLClient) TransferIssue added in v0.1.0

func (c *GraphQLClient) TransferIssue(ctx context.Context, issueNodeID, targetRepoNodeID string) (string, error)

TransferIssue transfers an issue to another repository using GraphQL mutation. Returns the new issue URL after transfer.

type SearchHit added in v0.2.1

type SearchHit struct {
	Number int
	Title  string
	Body   string
	URL    string
	State  string
	Type   string // "issue" or "pr"
}

SearchHit represents a single result from the GitHub hybrid search API.

type Searcher added in v0.2.1

type Searcher struct {
	// contains filtered or unexported fields
}

Searcher wraps the GitHub /search/issues endpoint with search_type=hybrid support.

func NewSearcher added in v0.2.1

func NewSearcher(ctx context.Context, token string) *Searcher

NewSearcher creates a Searcher authenticated with the given token.

func (*Searcher) SearchIssues added in v0.2.1

func (s *Searcher) SearchIssues(ctx context.Context, org, repo, query, itemType string, limit int) (hits []SearchHit, rateLimited bool, err error)

SearchIssues queries /search/issues?search_type=hybrid for the given repo. itemType filters results: "issue" for issues only, "pr" for pull requests only, or "" to search both. Returns hits, rateLimited=true when the API rate-limit is hit (not a hard error), and a non-nil err only for genuine failures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL