api

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PerPage = 100
)

Variables

View Source
var (
	Now = time.Now().UTC().Unix()
)

Functions

This section is empty.

Types

type App added in v0.2.0

type App struct {
	Id          float64   `json:"id,omitempty"`
	NodeId      string    `json:"node_id,omitempty"`
	Owner       *User     `json:"owner,omitempty"`
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	ExternalUrl string    `json:"external_url,omitempty"`
	HtmlUrl     string    `json:"html_url,omitempty"`
	CreatedAt   Timestamp `json:"created_at,omitempty"`
	UpdatedAt   Timestamp `json:"updated_at,omitempty"`
}

type AssigneeOption added in v0.2.2

type AssigneeOption struct {
	Assignees []string
}

type CheckRun added in v0.2.0

type CheckRun struct {
	Id          float64         `json:"id,omitempty"`
	NodeId      string          `json:"node_id,omitempty"`
	HeadSha     string          `json:"head_sha,omitempty"`
	ExternalId  string          `json:"external_id,omitempty"`
	Url         string          `json:"url,omitempty"`
	HtmlUrl     string          `json:"html_url,omitempty"`
	DetailsUrl  string          `json:"details_url,omitempty"`
	Status      string          `json:"status,omitempty"`
	Conclusion  string          `json:"conclusion,omitempty"`
	StartedAt   Timestamp       `json:"started_at,omitempty"`
	CompletedAt Timestamp       `json:"completed_at,omitempty"`
	Output      *CheckRunOutput `json:"output,omitempty"`
	Name        string          `json:"name,omitempty"`
	CheckSuite  *CheckSuite     `json:"check_suite,omitempty"`
	App         *App            `json:"app,omitempty"`
}

type CheckRunAnnotation added in v0.2.0

type CheckRunAnnotation struct {
	Path            string  `json:"path,omitempty"`
	BlobHRef        string  `json:"blob_href,omitempty"`
	StartLine       float64 `json:"start_line,omitempty"`
	EndLine         float64 `json:"end_line,omitempty"`
	StartColumn     float64 `json:"start_column,omitempty"`
	EndColumn       float64 `json:"end_column,omitempty"`
	AnnotationLevel string  `json:"annotation_level,omitempty"`
	Message         string  `json:"message,omitempty"`
	Title           string  `json:"title,omitempty"`
	RawDetails      string  `json:"raw_details,omitempty"`
}

type CheckRunImage added in v0.2.0

type CheckRunImage struct {
	Alt      string `json:"alt,omitempty"`
	ImageUrl string `json:"image_url,omitempty"`
	Caption  string `json:"caption,omitempty"`
}

type CheckRunOutput added in v0.2.0

type CheckRunOutput struct {
	Title            string                `json:"title,omitempty"`
	Summary          string                `json:"summary,omitempty"`
	Text             string                `json:"text,omitempty"`
	AnnotationsCount float64               `json:"annotations_count,omitempty"`
	AnnotationsUrl   string                `json:"annotations_url,omitempty"`
	Annotations      []*CheckRunAnnotation `json:"annotations,omitempty"`
	Images           []*CheckRunImage      `json:"images,omitempty"`
}

type CheckSuite added in v0.2.0

type CheckSuite struct {
	Id         float64     `json:"id,omitempty"`
	NodeId     string      `json:"node_id,omitempty"`
	HeadBranch string      `json:"head_branch,omitempty"`
	HeadSha    string      `json:"head_sha,omitempty"`
	Url        string      `json:"url,omitempty"`
	BeforeSha  string      `json:"before,omitempty"`
	AfterSha   string      `json:"after,omitempty"`
	Status     string      `json:"status,omitempty"`
	Conclusion string      `json:"conclusion,omitempty"`
	App        *App        `json:"app,omitempty"`
	Repository *Repository `json:"repository,omitempty"`
	HeadCommit *Commit     `json:"head_commit,omitempty"`
}

type Client

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

func NewClient

func NewClient(ctx context.Context, opt *Options) *Client

func (*Client) AddApproval added in v0.2.3

func (c *Client) AddApproval(ctx context.Context, pulls []*PullRequest, opt *ReviewOption) ([]*PullRequest, error)

func (*Client) AddAssignees added in v0.2.2

func (c *Client) AddAssignees(ctx context.Context, pulls []*PullRequest, opt *AssigneeOption) ([]*PullRequest, error)

func (*Client) AppendLabel added in v0.2.2

func (c *Client) AppendLabel(ctx context.Context, pulls []*PullRequest, opt *LabelOption) ([]*PullRequest, error)

func (*Client) GetPulls

func (c *Client) GetPulls(ctx context.Context, owner string, repo string, opt PullsOption) ([]*PullRequest, error)

func (*Client) Merge

func (c *Client) Merge(ctx context.Context, pulls []*PullRequest, opt *MergeOption) ([]*PullRequest, error)

func (*Client) RemoveAssignees added in v0.2.2

func (c *Client) RemoveAssignees(ctx context.Context, pulls []*PullRequest, opt *AssigneeOption) ([]*PullRequest, error)

func (*Client) RemoveLabel added in v0.2.2

func (c *Client) RemoveLabel(ctx context.Context, pulls []*PullRequest, opt *LabelOption) ([]*PullRequest, error)

func (*Client) ReplaceAssignees added in v0.2.2

func (c *Client) ReplaceAssignees(ctx context.Context, pulls []*PullRequest, opt *AssigneeOption) ([]*PullRequest, error)

func (*Client) ReplaceLabel added in v0.2.2

func (c *Client) ReplaceLabel(ctx context.Context, pulls []*PullRequest, opt *LabelOption) ([]*PullRequest, error)

func (*Client) Status added in v0.2.0

func (c *Client) Status(ctx context.Context, pulls []*PullRequest, opt *StatusOption) ([]*PullRequest, error)

type Commit added in v0.2.0

type Commit struct {
	Url          string                 `json:"url"`
	Author       *CommitAuthor          `json:"author,omitempty"`
	Committer    *CommitAuthor          `json:"committer,omitempty"`
	Message      string                 `json:"message"`
	CommentCount float64                `json:"comment_count"`
	Verification *SignatureVerification `json:"verification,omitempty"`
}

type CommitAuthor added in v0.2.0

type CommitAuthor struct {
	Date  Timestamp `json:"date"`
	Name  string    `json:"name"`
	Email string    `json:"email"`
}

type Counter added in v0.2.0

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

func (*Counter) Increment added in v0.2.0

func (c *Counter) Increment()

func (*Counter) Num added in v0.2.0

func (c *Counter) Num() int

type Label added in v0.2.0

type Label struct {
	Id          float64 `json:"id"`
	NodeId      string  `json:"node_id"`
	Url         string  `json:"url"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Color       string  `json:"color"`
	Default     bool    `json:"default"`
}

type LabelOption added in v0.2.2

type LabelOption struct {
	Labels []string
}

type MergeOption

type MergeOption struct {
	CommitTitleTemplate   string
	CommitMessageTemplate string
	MergeMethod           string
}

type Milestone added in v0.2.0

type Milestone struct {
	Url          string    `json:"url"`
	HtmlUrl      string    `json:"html_url"`
	LabelsUrl    string    `json:"labels_url"`
	Id           float64   `json:"id"`
	NodeId       string    `json:"node_id"`
	Number       float64   `json:"number"`
	State        string    `json:"state"`
	Title        string    `json:"title"`
	Description  string    `json:"description"`
	Creator      *User     `json:"creator,omitempty"`
	OpenIssues   float64   `json:"open_issues"`
	ClosedIssues float64   `json:"closed_issues"`
	CreatedAt    Timestamp `json:"created_at,omitempty"`
	UpdatedAt    Timestamp `json:"updated_at,omitempty"`
	ClosedAt     Timestamp `json:"closed_at,omitempty"`
	DueOn        Timestamp `json:"due_on,omitempty"`
}

type Options added in v0.2.0

type Options struct {
	Token     string
	RateLimit int
}

type Pagenation added in v0.2.0

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

func NewPagenation added in v0.2.0

func NewPagenation() *Pagenation

func (*Pagenation) Done added in v0.2.0

func (p *Pagenation) Done() <-chan *PagenationResult

func (*Pagenation) Request added in v0.2.0

func (p *Pagenation) Request(ctx context.Context, callback func(opt *github.ListOptions) (interface{}, *github.Response, error))

func (*Pagenation) RequestWithLimit added in v0.2.0

func (p *Pagenation) RequestWithLimit(ctx context.Context, maxPage int, callback func(opt *github.ListOptions) (interface{}, *github.Response, error))

func (*Pagenation) RequestedNum added in v0.2.0

func (p *Pagenation) RequestedNum() int

type PagenationResult added in v0.2.0

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

func (*PagenationResult) Error added in v0.2.0

func (pr *PagenationResult) Error() error

func (*PagenationResult) Interface added in v0.2.0

func (pr *PagenationResult) Interface() interface{}

func (*PagenationResult) Response added in v0.2.0

func (pr *PagenationResult) Response() *github.Response

type PullRequest

type PullRequest struct {
	Url                 string                `json:"url"`
	Id                  float64               `json:"id"`
	NodeId              string                `json:"node_id"`
	HtmlUrl             string                `json:"html_url"`
	DiffUrl             string                `json:"diff_url"`
	PatchUrl            string                `json:"patch_url"`
	IssueUrl            string                `json:"issue_url"`
	CommitsUrl          string                `json:"commits_url"`
	ReviewCommentsUrl   string                `json:"review_comments_url"`
	ReviewCommentUrl    string                `json:"review_comment_url"`
	CommentsUrl         string                `json:"comments_url"`
	StatusesUrl         string                `json:"statuses_url"`
	Number              float64               `json:"number"`
	State               string                `json:"state"`
	Locked              bool                  `json:"locked"`
	Title               string                `json:"title"`
	User                *User                 `json:"user,omitempty"`
	Body                string                `json:"body"`
	Labels              []*Label              `json:"labels,omitempty"`
	Milestone           *Milestone            `json:"milestone,omitempty"`
	ActiveLockReason    string                `json:"active_lock_reason"`
	CreatedAt           Timestamp             `json:"created_at,omitempty"`
	UpdatedAt           Timestamp             `json:"updated_at,omitempty"`
	ClosedAt            Timestamp             `json:"closed_at,omitempty"`
	MergedAt            Timestamp             `json:"merged_at,omitempty"`
	MergeCommitSha      string                `json:"merge_commit_sha"`
	Assignee            *User                 `json:"assignee,omitempty"`
	Assignees           []*User               `json:"assignees,omitempty"`
	RequestedReviewers  []*User               `json:"requested_reviewers,omitempty"`
	RequestedTeams      []*Team               `json:"requested_teams,omitempty"`
	Head                *PullRequestBranch    `json:"head,omitempty"`
	Base                *PullRequestBranch    `json:"base,omitempty"`
	AuthorAssociation   string                `json:"author_association"`
	Draft               bool                  `json:"draft"`
	Merged              bool                  `json:"merged"`
	Mergeable           bool                  `json:"mergeable"`
	Rebaseable          bool                  `json:"rebaseable"`
	MergeableState      string                `json:"mergeable_state"`
	MergedBy            *User                 `json:"merged_by,omitempty"`
	ReviewComments      float64               `json:"review_comments"`
	MaintainerCanModify bool                  `json:"maintainer_can_modify"`
	Additions           float64               `json:"additions"`
	Deletions           float64               `json:"deletions"`
	ChangedFiles        float64               `json:"changed_files"`
	Comments            []*PullRequestComment `json:"comments"`
	Reviews             []*PullRequestReview  `json:"reviews"`
	Commits             []*RepositoryCommit   `json:"commits"`
	Statuses            []*RepoStatus         `json:"statuses"`
	Checks              []*CheckRun           `json:"checks"`
	Owner               string                `json:"-"`
	Repo                string                `json:"-"`
}

type PullRequestBranch added in v0.2.0

type PullRequestBranch struct {
	Label string      `json:"label"`
	Ref   string      `json:"ref"`
	Sha   string      `json:"sha"`
	User  *User       `json:"user,omitempty"`
	Repo  *Repository `json:"repo,omitempty"`
}

type PullRequestComment added in v0.2.0

type PullRequestComment struct {
	Url                 string    `json:"url"`
	Id                  float64   `json:"id"`
	NodeId              string    `json:"node_id"`
	PullRequestReviewId float64   `json:"pull_request_review_id"`
	DiffHunk            string    `json:"diff_hunk"`
	Path                string    `json:"path"`
	Position            float64   `json:"position"`
	OriginalPosition    float64   `json:"original_position"`
	CommitId            string    `json:"commit_id"`
	OriginalCommitId    string    `json:"original_commit_id"`
	InReplyTo           float64   `json:"in_reply_to_id"`
	User                *User     `json:"user,omitempty"`
	Body                string    `json:"body"`
	CreatedAt           Timestamp `json:"created_at,omitempty"`
	UpdatedAt           Timestamp `json:"updated_at,omitempty"`
	HtmlUrl             string    `json:"html_url"`
	PullRequestUrl      string    `json:"pull_request_url"`
	AuthorAssociation   string    `json:"author_association"`
}

type PullRequestReview added in v0.2.0

type PullRequestReview struct {
	Id             float64 `json:"id"`
	NodeId         string  `json:"node_id"`
	User           *User   `json:"user,omitempty"`
	Body           string  `json:"body"`
	CommitId       string  `json:"commit_id"`
	State          string  `json:"state"`
	HtmlUrl        string  `json:"html_url"`
	PullRequestUrl string  `json:"pull_request_url"`
}

type PullRequestRules

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

func NewPullRequestRules

func NewPullRequestRules(rules []string, limit int) *PullRequestRules

func (*PullRequestRules) Add added in v0.2.0

func (r *PullRequestRules) Add(rule string)

func (*PullRequestRules) Apply

func (r *PullRequestRules) Apply(data []*PullRequest) ([]*PullRequest, error)

func (*PullRequestRules) Expression

func (r *PullRequestRules) Expression() string

func (*PullRequestRules) GetBase

func (r *PullRequestRules) GetBase() string

func (*PullRequestRules) GetHead

func (r *PullRequestRules) GetHead() string

func (*PullRequestRules) GetLimit

func (r *PullRequestRules) GetLimit() int

func (*PullRequestRules) GetNumber

func (r *PullRequestRules) GetNumber() int

func (*PullRequestRules) GetRules

func (r *PullRequestRules) GetRules() []string

func (*PullRequestRules) GetSHA added in v0.2.0

func (r *PullRequestRules) GetSHA() string

func (*PullRequestRules) GetState

func (r *PullRequestRules) GetState() string

func (*PullRequestRules) SearchRules added in v0.2.0

func (r *PullRequestRules) SearchRules() *PullRequestRules

type PullsOption

type PullsOption struct {
	EnableComments bool
	EnableReviews  bool
	EnableCommits  bool
	EnableStatuses bool
	EnableChecks   bool
	Rules          *PullRequestRules
}

type RepoStatus added in v0.2.0

type RepoStatus struct {
	Url         string    `json:"url"`
	Id          float64   `json:"id"`
	NodeId      string    `json:"node_id"`
	State       string    `json:"state"`
	Description string    `json:"description"`
	TargetUrl   string    `json:"target_url"`
	Context     string    `json:"context"`
	CreatedAt   Timestamp `json:"created_at,omitempty"`
	UpdatedAt   Timestamp `json:"updated_at,omitempty"`
	Creator     *User     `json:"creator,omitempty"`
}

type Repository added in v0.2.0

type Repository struct {
	Id                 float64         `json:"id"`
	NodeId             string          `json:"node_id"`
	Name               string          `json:"name"`
	FullName           string          `json:"full_name"`
	Owner              *User           `json:"owner,omitempty"`
	Private            bool            `json:"private"`
	HtmlUrl            string          `json:"html_url"`
	Description        string          `json:"description"`
	Fork               bool            `json:"fork"`
	Url                string          `json:"url"`
	ArchiveUrl         string          `json:"archive_url"`
	AssigneesUrl       string          `json:"assignees_url"`
	BlobsUrl           string          `json:"blobs_url"`
	BranchesUrl        string          `json:"branches_url"`
	CollaboratorsUrl   string          `json:"collaborators_url"`
	CommentsUrl        string          `json:"comments_url"`
	CommitsUrl         string          `json:"commits_url"`
	CompareUrl         string          `json:"compare_url"`
	ContentsUrl        string          `json:"contents_url"`
	ContributorsUrl    string          `json:"contributors_url"`
	DeploymentsUrl     string          `json:"deployments_url"`
	DownloadsUrl       string          `json:"downloads_url"`
	EventsUrl          string          `json:"events_url"`
	ForksUrl           string          `json:"forks_url"`
	GitCommitsUrl      string          `json:"git_commits_url"`
	GitRefsUrl         string          `json:"git_refs_url"`
	GitTagsUrl         string          `json:"git_tags_url"`
	GitUrl             string          `json:"git_url"`
	IssueCommentUrl    string          `json:"issue_comment_url"`
	IssueEventsUrl     string          `json:"issue_events_url"`
	IssuesUrl          string          `json:"issues_url"`
	KeysUrl            string          `json:"keys_url"`
	LabelsUrl          string          `json:"labels_url"`
	LanguagesUrl       string          `json:"languages_url"`
	MergesUrl          string          `json:"merges_url"`
	MilestonesUrl      string          `json:"milestones_url"`
	NotificationsUrl   string          `json:"notifications_url"`
	PullsUrl           string          `json:"pulls_url"`
	ReleasesUrl        string          `json:"releases_url"`
	SshUrl             string          `json:"ssh_url"`
	StargazersUrl      string          `json:"stargazers_url"`
	StatusesUrl        string          `json:"statuses_url"`
	SubscribersUrl     string          `json:"subscribers_url"`
	SubscriptionUrl    string          `json:"subscription_url"`
	TagsUrl            string          `json:"tags_url"`
	TeamsUrl           string          `json:"teams_url"`
	TreesUrl           string          `json:"trees_url"`
	CloneUrl           string          `json:"clone_url"`
	MirrorUrl          string          `json:"mirror_url"`
	HooksUrl           string          `json:"hooks_url"`
	SvnUrl             string          `json:"svn_url"`
	Homepage           string          `json:"homepage"`
	Language           string          `json:"language"`
	ForksCount         float64         `json:"forks_count"`
	StargazersCount    float64         `json:"stargazers_count"`
	WatchersCount      float64         `json:"watchers_count"`
	Size               float64         `json:"size"`
	DefaultBranch      string          `json:"default_branch"`
	OpenIssuesCount    float64         `json:"open_issues_count"`
	IsTemplate         bool            `json:"is_template"`
	HasIssues          bool            `json:"has_issues"`
	HasProjects        bool            `json:"has_projects"`
	HasWiki            bool            `json:"has_wiki"`
	HasPages           bool            `json:"has_pages"`
	HasDownloads       bool            `json:"has_downloads"`
	Archived           bool            `json:"archived"`
	Disabled           bool            `json:"disabled"`
	PushedAt           Timestamp       `json:"pushed_at,omitempty"`
	CreatedAt          Timestamp       `json:"created_at,omitempty"`
	UpdatedAt          Timestamp       `json:"updated_at,omitempty"`
	Permissions        map[string]bool `json:"permissions"`
	AllowRebaseMerge   bool            `json:"allow_rebase_merge"`
	TemplateRepository *Repository     `json:"template_repository,omitempty"`
	AllowSquashMerge   bool            `json:"allow_squash_merge"`
	AllowMergeCommit   bool            `json:"allow_merge_commit"`
	SubscribersCount   float64         `json:"subscribers_count"`
	NetworkCount       float64         `json:"network_count"`
}

type RepositoryCommit added in v0.2.0

type RepositoryCommit struct {
	Url         string    `json:"url"`
	Sha         string    `json:"sha"`
	NodeId      string    `json:"node_id"`
	HtmlUrl     string    `json:"html_url"`
	CommentsUrl string    `json:"comments_url"`
	Commit      *Commit   `json:"commit,omitempty"`
	Author      *User     `json:"author,omitempty"`
	Committer   *User     `json:"committer,omitempty"`
	Parents     []*Commit `json:"parents,omitempty"`
}

type ReviewOption added in v0.2.3

type ReviewOption struct {
	Action string
}

type SignatureVerification added in v0.2.0

type SignatureVerification struct {
	Verified  bool   `json:"verified"`
	Reason    string `json:"reason"`
	Signature string `json:"signature"`
	Payload   string `json:"payload"`
}

type StatusOption added in v0.2.0

type StatusOption struct {
	State       string
	TargetURL   string
	Description string
	Context     string
}

type Team added in v0.2.0

type Team struct {
	Id              float64 `json:"id"`
	NodeId          string  `json:"node_id"`
	Url             string  `json:"url"`
	Name            string  `json:"name"`
	Slug            string  `json:"slug"`
	Description     string  `json:"description"`
	Privacy         string  `json:"privacy"`
	Permission      string  `json:"permission"`
	MembersUrl      string  `json:"members_url"`
	RepositoriesUrl string  `json:"repositories_url"`
	Parent          *Team   `json:"parent,omitempty"`
}

type Timestamp added in v0.2.0

type Timestamp float64

type User added in v0.2.0

type User struct {
	Login             string  `json:"login"`
	Id                float64 `json:"id"`
	NodeId            string  `json:"node_id"`
	AvatarUrl         string  `json:"avatar_url"`
	GravatarId        string  `json:"gravatar_id"`
	Url               string  `json:"url"`
	HtmlUrl           string  `json:"html_url"`
	FollowersUrl      string  `json:"followers_url"`
	FollowingUrl      string  `json:"following_url"`
	GistsUrl          string  `json:"gists_url"`
	StarredUrl        string  `json:"starred_url"`
	SubscriptionsUrl  string  `json:"subscriptions_url"`
	OrganizationsUrl  string  `json:"organizations_url"`
	ReposUrl          string  `json:"repos_url"`
	EventsUrl         string  `json:"events_url"`
	ReceivedEventsUrl string  `json:"received_events_url"`
	Type              string  `json:"type"`
	SiteAdmin         bool    `json:"site_admin"`
}

Jump to

Keyboard shortcuts

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