search

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package search provides GitHub search API functionality.

Index

Constants

View Source
const (
	ParamUser  = "user"
	ParamState = "state"
	ParamIs    = "is"
	ParamOrg   = "org"
	ParamRepo  = "repo"
	ParamType  = "type"
)

Query parameter names.

View Source
const (
	ParamStateValueOpen   = "open"
	ParamStateValueClosed = "closed"
	ParamIsValuePR        = "pr"
	ParamIsValueIssue     = "issue"
)

Query parameter values.

View Source
const (
	ParamPerPageValueMax     = 100
	ParamPerPageValueDefault = 30
)

Pagination constants.

Variables

View Source
var (
	ErrIssueIsNotSet                 = errors.New("issue is not set")
	ErrUserIsNotSet                  = errors.New("user is not set")
	ErrUserLoginIsNotSet             = errors.New("user login is not set")
	ErrIssueCreatedAtIsNotSet        = errors.New("issue created at is not set")
	ErrIssueCreatedAtGetTimeIsNotSet = errors.New("issue created at gettime is not set")
)

Issue-related errors.

Functions

This section is empty.

Types

type Client

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

Client wraps the GitHub client for search operations.

func NewClient

func NewClient(ghClient *github.Client) *Client

NewClient creates a new search client.

func NewClientHTTP

func NewClientHTTP(httpClient *http.Client) *Client

NewClientHTTP creates a new search client from an HTTP client.

func (*Client) SearchIssues

func (c *Client) SearchIssues(ctx context.Context, qry Query, opts *github.SearchOptions) (*github.IssuesSearchResult, *github.Response, error)

SearchIssues is a wrapper for SearchService.Issues().

func (*Client) SearchIssuesAll

func (c *Client) SearchIssuesAll(ctx context.Context, qry Query, opts *github.SearchOptions) (Issues, error)

SearchIssuesAll retrieves all issues matching the query with pagination.

func (*Client) SearchOpenPullRequests

func (c *Client) SearchOpenPullRequests(ctx context.Context, username string, opts *github.SearchOptions) (*github.IssuesSearchResult, *github.Response, error)

SearchOpenPullRequests searches for open pull requests by username.

type Issue

type Issue struct {
	*github.Issue
}

Issue wraps a GitHub issue with helper methods.

func (*Issue) AuthorUserID

func (is *Issue) AuthorUserID() (int64, error)

AuthorUserID returns the author's user ID.

func (*Issue) AuthorUsername

func (is *Issue) AuthorUsername() (string, error)

AuthorUsername returns the author's username.

func (*Issue) CreatedAge

func (is *Issue) CreatedAge() (time.Duration, error)

CreatedAge returns the duration since the issue was created.

func (*Issue) CreatedTime

func (is *Issue) CreatedTime() (time.Time, error)

CreatedTime returns the issue creation time.

func (*Issue) MustAuthorUserID

func (is *Issue) MustAuthorUserID() int64

MustAuthorUserID returns the author user ID or -1 on error.

func (*Issue) MustAuthorUsername

func (is *Issue) MustAuthorUsername() string

MustAuthorUsername returns the author username or empty string on error.

type Issues

type Issues []*github.Issue

Issues is a slice of GitHub issues.

func (Issues) RepositoryIssueCounts

func (iss Issues) RepositoryIssueCounts(htmlURLs bool) map[string]int

RepositoryIssueCounts returns a map of repository URLs to issue counts.

func (Issues) Table

func (iss Issues) Table(name string) (*table.Table, error)

Table creates a table of issues.

func (Issues) TableRepos

func (iss Issues) TableRepos(name string, htmlURLs bool) *table.Table

TableRepos creates a table of repositories with issue counts.

func (Issues) TableSet

func (iss Issues) TableSet() (*table.TableSet, error)

TableSet returns a table set with issues and repositories.

type Query

type Query map[string]string

Query represents a GitHub search query.

func (Query) Encode

func (q Query) Encode() string

Encode implements GitHub API query encoding. Keys are sorted to ensure deterministic output.

Jump to

Keyboard shortcuts

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