client

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const PageSize = 100

PageSize is the number of items to load for each iteration when fetching a list.

Variables

View Source
var ErrBotCommentNotFound = errors.New("bot comment not found")

Functions

This section is empty.

Types

type Config

type Config struct {
	Owner   string
	Repo    string
	Verbose bool
	DryRun  bool
}

type GitHub

type GitHub struct {
	Client *github.Client
	Ctx    context.Context
	DryRun bool
	Logger logger.Logger
	Owner  string
	Repo   string
}

GitHub contains everything necessary to interact with the GitHub API, including the client, a context (which must be passed with each request), a logger, etc. This object will be passed to each condition or requirement that requires fetching additional information or modifying things on GitHub. The object also provides methods for performing more complex operations than a simple API call.

func New

func New(ctx context.Context, cfg *Config) (*GitHub, error)

New initializes the API client, the logger, and creates an instance of GitHub.

func (*GitHub) GetBotComment

func (gh *GitHub) GetBotComment(prNum int) (*github.IssueComment, error)

GetBotComment retrieves the bot's (current user) comment on provided PR number.

func (*GitHub) GetOpenedPullRequest

func (gh *GitHub) GetOpenedPullRequest(prNum int) (*github.PullRequest, error)

func (*GitHub) IsUserInTeams

func (gh *GitHub) IsUserInTeams(user string, teams []string) bool

IsUserInTeams checks if the specified user is a member of any of the provided teams.

func (*GitHub) ListPR

func (gh *GitHub) ListPR(state string) ([]*github.PullRequest, error)

ListPR returns the list of pull requests in the specified state.

func (*GitHub) ListPRReviewers

func (gh *GitHub) ListPRReviewers(prNum int) (*github.Reviewers, error)

ListPRReviewers returns the list of reviewers for the specified PR number.

func (*GitHub) ListPRReviews

func (gh *GitHub) ListPRReviews(prNum int) ([]*github.PullRequestReview, error)

ListPRReviewers returns the list of reviews for the specified PR number.

func (*GitHub) ListTeamMembers

func (gh *GitHub) ListTeamMembers(team string) ([]*github.User, error)

ListTeamMembers lists the members of the specified team.

func (*GitHub) SetBotComment

func (gh *GitHub) SetBotComment(body string, prNum int) (*github.IssueComment, error)

SetBotComment creates a bot's comment on the provided PR number or updates it if it already exists.

Jump to

Keyboard shortcuts

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