github

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffIssues

func DiffIssues(old, head map[int]Issue) map[int]diff.Diff[Issue]

DiffIssues returns the difference between two sets of issues.

func ParseIssueComments added in v0.3.0

func ParseIssueComments(jsonBytes []byte) (map[int][]IssueComment, error)

func ParseIssues

func ParseIssues(jsonBytes []byte) (map[int]Issue, error)

func ParsePullRequestReviews

func ParsePullRequestReviews(jsonBytes []byte) (map[int][]PullRequestReview, error)

Types

type Account

type Account struct {
	Login string `json:"login"`
}

func (Account) String

func (a Account) String() string

type Client

type Client struct {
	Client     *http.Client
	APIVersion string
	Token      string
	PageEvent  func(page int) // PageEvent is called when a new page is being fetched.
}

func NewClient

func NewClient() *Client

func (*Client) IssueComments added in v0.3.0

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

IssueComments takes a snapshot of all comments for an issue.

func (*Client) PullRequestReviews

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

PullRequestReviews takes a snapshot of all reviews for a pull request.

func (*Client) Snapshot

func (c *Client) Snapshot(ctx context.Context, org, repo string, opts SnapshotOptions) ([]byte, int, error)

Snapshot takes a snapshot of all issues and pull requests in a repository.

type Issue

type Issue struct {
	HTMLURL     string       `json:"html_url"`
	Number      int          `json:"number"`
	Title       string       `json:"title"`
	User        Account      `json:"user"`
	Labels      []Label      `json:"labels"`
	Assignees   []Account    `json:"assignees"`
	State       string       `json:"state"`
	Milestone   Milestone    `json:"milestone"`
	CreatedAt   time.Time    `json:"created_at"`
	ClosedAt    *time.Time   `json:"closed_at"`
	PullRequest *PullRequest `json:"pull_request,omitempty"`
}

Issue is an abbreviated version of the GitHub issue type.

func (Issue) Duration added in v0.3.0

func (i Issue) Duration() time.Duration

func (Issue) IsPullRequest

func (i Issue) IsPullRequest() bool

func (Issue) Merged

func (i Issue) Merged() bool

func (Issue) String

func (i Issue) String() string

type IssueComment added in v0.3.0

type IssueComment struct {
	ID        int       `json:"id"`
	User      Account   `json:"user"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Label

type Label struct {
	Name string `json:"name"`
}

func (Label) String

func (l Label) String() string

type Milestone

type Milestone struct {
	Title string `json:"title"`
}

func (Milestone) String

func (m Milestone) String() string

type PullRequest

type PullRequest struct {
	MergedAt *time.Time `json:"merged_at"`
}

type PullRequestReview

type PullRequestReview struct {
	User        Account   `json:"user"`
	State       string    `json:"state"`
	SubmittedAt time.Time `json:"submitted_at"`
}

type SnapshotOptions added in v0.3.0

type SnapshotOptions struct {
	State        string
	UpdatedSince *time.Time
}

SnapshotOptions are options for taking a snapshot.

Jump to

Keyboard shortcuts

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