github

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: LGPL-3.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectNotFound = errors.New("project not found")
)

Functions

func GetPullRequestBaseOwnerName

func GetPullRequestBaseOwnerName(pullRequest *github.PullRequest) string

func GetPullRequestBaseRepoName

func GetPullRequestBaseRepoName(pullRequest *github.PullRequest) string

func GetPullRequestHeadOwnerName

func GetPullRequestHeadOwnerName(pullRequest *github.PullRequest) string

func GetPullRequestHeadRepoName

func GetPullRequestHeadRepoName(pullRequest *github.PullRequest) string

func GetPullRequestNumber

func GetPullRequestNumber(pullRequest *github.PullRequest) int

func PaginatedRequest

func PaginatedRequest(
	initFn func() interface{},
	reqFn func(interface{}, int) (interface{}, *github.Response, error),
) (interface{}, error)

func ParseNumPages

func ParseNumPages(resp *github.Response) int

ParseNumPages Given a link header string representing pagination info, returns total number of pages.

func ParseNumPagesFromLink(link string) int

Types

type FieldDetails

type FieldDetails struct {
	ID      string
	Name    string
	Options []struct {
		ID   string
		Name string
	}
}

type FieldNode

type FieldNode struct {
	Details FieldDetails `graphql:"... on ProjectV2SingleSelectField"`
}

type Fields

type Fields struct {
	PageInfo PageInfo
	Nodes    []FieldNode
}

type GQLReviewThread

type GQLReviewThread struct {
	IsResolved githubv4.Boolean
	IsOutdated githubv4.Boolean
}

type GithubClient

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

func NewGithubClient

func NewGithubClient(clientREST *github.Client, clientGQL *githubv4.Client) *GithubClient

func NewGithubClientFromToken

func NewGithubClientFromToken(ctx context.Context, token string) *GithubClient

func (*GithubClient) AddAssignees

func (c *GithubClient) AddAssignees(ctx context.Context, owner string, repo string, number int, assignees []string) (*github.Issue, *github.Response, error)

func (*GithubClient) AddLabels

func (c *GithubClient) AddLabels(ctx context.Context, owner string, repo string, number int, labels []string) ([]*github.Label, *github.Response, error)

func (*GithubClient) CreateComment

func (c *GithubClient) CreateComment(ctx context.Context, owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

func (*GithubClient) CreateLabel

func (c *GithubClient) CreateLabel(ctx context.Context, owner string, repo string, label *github.Label) (*github.Label, *github.Response, error)

func (*GithubClient) DeleteComment

func (c *GithubClient) DeleteComment(ctx context.Context, owner string, repo string, commentId int64) (*github.Response, error)

func (*GithubClient) DownloadContents

func (c *GithubClient) DownloadContents(ctx context.Context, filePath string, branch *github.PullRequestBranch) ([]byte, error)

func (*GithubClient) EditComment

func (c *GithubClient) EditComment(ctx context.Context, owner string, repo string, commentId int64, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

func (*GithubClient) EditIssue added in v3.3.0

func (c *GithubClient) EditIssue(ctx context.Context, owner string, repo string, number int, issue *github.IssueRequest) (*github.Issue, *github.Response, error)

func (*GithubClient) EditPullRequest

func (c *GithubClient) EditPullRequest(ctx context.Context, owner string, repo string, number int, pull *github.PullRequest) (*github.PullRequest, *github.Response, error)

func (*GithubClient) GetClientGraphQL

func (c *GithubClient) GetClientGraphQL() *githubv4.Client

func (*GithubClient) GetClientREST

func (c *GithubClient) GetClientREST() *github.Client

FIXME: Remove these to hide the implementation details.

func (*GithubClient) GetComments added in v3.3.0

func (c *GithubClient) GetComments(ctx context.Context, owner string, repo string, number int, opts *github.IssueListCommentsOptions) ([]*github.IssueComment, error)

func (*GithubClient) GetDefaultRepositoryBranch added in v3.3.0

func (c *GithubClient) GetDefaultRepositoryBranch(ctx context.Context, owner string, repo string) (string, error)

func (*GithubClient) GetIssue added in v3.3.0

func (c *GithubClient) GetIssue(ctx context.Context, owner, repo string, number int) (*github.Issue, *github.Response, error)

func (*GithubClient) GetIssueTimeline added in v3.3.0

func (c *GithubClient) GetIssueTimeline(ctx context.Context, owner string, repo string, number int) ([]*github.Timeline, error)

func (*GithubClient) GetIssuesAvailableAssignees

func (c *GithubClient) GetIssuesAvailableAssignees(ctx context.Context, owner string, repo string) ([]*github.User, error)

func (*GithubClient) GetLabel

func (c *GithubClient) GetLabel(ctx context.Context, owner string, repo string, name string) (*github.Label, *github.Response, error)

func (*GithubClient) GetProjectFieldsByProjectNumber

func (c *GithubClient) GetProjectFieldsByProjectNumber(ctx context.Context, owner, repo string, projectNumber uint64, retryCount int) ([]FieldNode, error)

func (*GithubClient) GetProjectV2ByName

func (c *GithubClient) GetProjectV2ByName(ctx context.Context, owner, repo, name string) (*ProjectV2, error)

func (*GithubClient) GetPullRequest

func (c *GithubClient) GetPullRequest(ctx context.Context, owner string, repo string, number int) (*github.PullRequest, *github.Response, error)

func (*GithubClient) GetPullRequestClosingIssuesCount added in v3.3.0

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

func (*GithubClient) GetPullRequestCommits

func (c *GithubClient) GetPullRequestCommits(ctx context.Context, owner string, repo string, number int) ([]*github.RepositoryCommit, error)

func (*GithubClient) GetPullRequestFiles

func (c *GithubClient) GetPullRequestFiles(ctx context.Context, owner string, repo string, number int) ([]*github.CommitFile, error)

func (*GithubClient) GetPullRequestReviewers

func (c *GithubClient) GetPullRequestReviewers(ctx context.Context, owner string, repo string, number int, opts *github.ListOptions) (*github.Reviewers, error)

func (*GithubClient) GetPullRequestReviews

func (c *GithubClient) GetPullRequestReviews(ctx context.Context, owner string, repo string, number int) ([]*github.PullRequestReview, error)

func (*GithubClient) GetPullRequests

func (c *GithubClient) GetPullRequests(ctx context.Context, owner string, repo string) ([]*github.PullRequest, error)

func (*GithubClient) GetRepoCollaborators

func (c *GithubClient) GetRepoCollaborators(ctx context.Context, owner string, repo string) ([]*github.User, error)

func (*GithubClient) GetRepositoryBranch

func (c *GithubClient) GetRepositoryBranch(ctx context.Context, owner string, repo string, branch string, followRedirects bool) (*github.Branch, *github.Response, error)

func (*GithubClient) GetReviewThreads

func (c *GithubClient) GetReviewThreads(ctx context.Context, owner string, repo string, number int, retryCount int) ([]GQLReviewThread, error)

func (*GithubClient) ListCheckRunsForRef

func (c *GithubClient) ListCheckRunsForRef(ctx context.Context, owner string, repo string, ref string, opts *github.ListCheckRunsOptions) (*github.ListCheckRunsResults, *github.Response, error)

func (*GithubClient) ListIssuesByRepo

func (c *GithubClient) ListIssuesByRepo(ctx context.Context, owner string, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)

func (*GithubClient) ListOrganizationMembers

func (c *GithubClient) ListOrganizationMembers(ctx context.Context, org string, opts *github.ListMembersOptions) ([]*github.User, *github.Response, error)

func (*GithubClient) ListTeamMembersBySlug

func (c *GithubClient) ListTeamMembersBySlug(ctx context.Context, org string, slug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, *github.Response, error)

func (*GithubClient) Merge

func (c *GithubClient) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *github.PullRequestOptions) (*github.PullRequestMergeResult, *github.Response, error)

func (*GithubClient) RemoveLabelForIssue

func (c *GithubClient) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*github.Response, error)

func (*GithubClient) RequestReviewers

func (c *GithubClient) RequestReviewers(ctx context.Context, owner string, repo string, number int, reviewers github.ReviewersRequest) (*github.PullRequest, *github.Response, error)

type PageInfo

type PageInfo struct {
	HasNextPage bool
	EndCursor   string
}

type ProjectV2

type ProjectV2 struct {
	ID     string
	Number uint64
	Title  string
}

type ReviewThreadsQuery

type ReviewThreadsQuery struct {
	Repository struct {
		PullRequest struct {
			ReviewThreads struct {
				Nodes    []GQLReviewThread
				PageInfo struct {
					EndCursor   githubv4.String
					HasNextPage bool
				}
			} `graphql:"reviewThreads(first: 10, after: $reviewThreadsCursor)"`
		} `graphql:"pullRequest(number: $pullRequestNumber)"`
	} `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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