gogithub

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 14 Imported by: 0

README

GoGitHub

gogithub is a high-level module to interact with GitHub.

The initial purpose is to search for pull open pull requests in accounts so that reports can be generated for remediation.

The inclusion of checks is being investigated:

https://docs.github.com/en/rest/guides/using-the-rest-api-to-interact-with-checks?apiVersion=2022-11-28

Documentation

Index

Constants

View Source
const (
	UsernameDependabot = "dependabot[bot]"
	UserIDDependabot   = 49699333

	ParamPerPageValueMax     = 100
	ParamPerPageValueDefault = 30

	ParamUser           = "user"
	ParamState          = "state"
	ParamStateValueOpen = "open"
	ParamIs             = "is"
	ParamIsValuePR      = "pr"

	BaseURLRepoAPI  = "https://api.github.com/repos"
	BaseURLRepoHTML = "https://github.com"
)

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")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*github.Client
}

func NewClient

func NewClient(httpClient *http.Client) *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)

func (*Client) SearchOpenPullRequests

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

type Issue

type Issue struct {
	*github.Issue
}

func (*Issue) AuthorUserID added in v0.2.0

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

func (*Issue) AuthorUsername

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

func (*Issue) CreatedAge

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

func (*Issue) CreatedTime

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

func (*Issue) MustAuthorUserID added in v0.2.0

func (is *Issue) MustAuthorUserID() int64

func (*Issue) MustAuthorUsername

func (is *Issue) MustAuthorUsername() string

type Issues

type Issues []*github.Issue

func (Issues) RepositoryIssueCounts added in v0.2.0

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

func (Issues) Table

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

func (Issues) TableRepos added in v0.2.0

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

func (Issues) TableSet added in v0.2.0

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

type Query

type Query map[string]string

func (Query) Encode

func (q Query) Encode() string

Encode implements a version of GitHub API encoding.

Directories

Path Synopsis
pullrequest

Jump to

Keyboard shortcuts

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