github

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type CreateBranchInput

type CreateBranchInput struct {
	RepositoryNodeID InternalRepositoryNodeID
	BranchName       git.BranchName
	CommitSHA        git.CommitSHA
}

type CreatePullRequestInput

type CreatePullRequestInput struct {
	BaseRepository       git.RepositoryID
	BaseBranchName       git.BranchName
	BaseRepositoryNodeID InternalRepositoryNodeID
	HeadRepository       git.RepositoryID
	HeadBranchName       git.BranchName
	Title                string
	Body                 string // optional
	Draft                bool
}

type CreatePullRequestOutput

type CreatePullRequestOutput struct {
	PullRequestNodeID githubv4.ID
	URL               string
}

type GitHub

type GitHub struct {
	Client client.Interface
	Logger logger.Interface
}

GitHub provides GitHub API access.

func (*GitHub) CreateBlob

func (c *GitHub) CreateBlob(ctx context.Context, n git.NewBlob) (git.BlobSHA, error)

CreateBlob creates a blob and returns SHA of it.

func (*GitHub) CreateBranch

func (c *GitHub) CreateBranch(ctx context.Context, in CreateBranchInput) error

CreateBranch creates a branch and returns nil or an error.

func (*GitHub) CreateCommit

func (c *GitHub) CreateCommit(ctx context.Context, n git.NewCommit) (git.CommitSHA, error)

CreateCommit creates a commit and returns SHA of it.

func (*GitHub) CreateFork

func (c *GitHub) CreateFork(ctx context.Context, id git.RepositoryID) (*git.RepositoryID, error)

CreateFork creates a fork of the repository. This returns ID of the fork.

func (*GitHub) CreatePullRequest

func (c *GitHub) CreatePullRequest(ctx context.Context, in CreatePullRequestInput) (*CreatePullRequestOutput, error)

func (*GitHub) CreateRelease

func (c *GitHub) CreateRelease(ctx context.Context, r git.Release) (*git.Release, error)

CreateRelease creates a release.

func (*GitHub) CreateReleaseAsset

func (c *GitHub) CreateReleaseAsset(ctx context.Context, a git.ReleaseAsset) error

CreateRelease creates a release asset.

func (*GitHub) CreateTree

func (c *GitHub) CreateTree(ctx context.Context, n git.NewTree) (git.TreeSHA, error)

CreateTree creates a tree and returns SHA of it.

func (*GitHub) GetReleaseByTagOrNil

func (c *GitHub) GetReleaseByTagOrNil(ctx context.Context, repo git.RepositoryID, tag git.TagName) (*git.Release, error)

GetReleaseByTagOrNil returns the release associated to the tag. It returns nil if it does not exist.

func (*GitHub) QueryCommit

func (c *GitHub) QueryCommit(ctx context.Context, in QueryCommitInput) (*QueryCommitOutput, error)

QueryCommit returns the commit.

func (*GitHub) QueryDefaultBranch

func (c *GitHub) QueryDefaultBranch(ctx context.Context, in QueryDefaultBranchInput) (*QueryDefaultBranchOutput, error)

QueryDefaultBranch returns the default branch names. You can set both repositories or either repository.

func (*GitHub) QueryForCommit

func (c *GitHub) QueryForCommit(ctx context.Context, in QueryForCommitInput) (*QueryForCommitOutput, error)

QueryForCommit returns the repository for creating or updating the branch.

func (*GitHub) QueryForPullRequest

func (c *GitHub) QueryForPullRequest(ctx context.Context, in QueryForPullRequestInput) (*QueryForPullRequestOutput, error)

QueryForPullRequest performs the query for creating a pull request.

func (*GitHub) RequestPullRequestReview

func (c *GitHub) RequestPullRequestReview(ctx context.Context, in RequestPullRequestReviewInput) error

func (*GitHub) UpdateBranch

func (c *GitHub) UpdateBranch(ctx context.Context, in UpdateBranchInput) error

UpdateBranch updates the branch and returns nil or an error.

type Interface

type Interface interface {
	CreateFork(ctx context.Context, id git.RepositoryID) (*git.RepositoryID, error)

	QueryForCommit(ctx context.Context, in QueryForCommitInput) (*QueryForCommitOutput, error)
	CreateBranch(ctx context.Context, in CreateBranchInput) error
	UpdateBranch(ctx context.Context, in UpdateBranchInput) error
	CreateCommit(ctx context.Context, commit git.NewCommit) (git.CommitSHA, error)

	QueryCommit(ctx context.Context, in QueryCommitInput) (*QueryCommitOutput, error)
	CreateTree(ctx context.Context, tree git.NewTree) (git.TreeSHA, error)
	CreateBlob(ctx context.Context, blob git.NewBlob) (git.BlobSHA, error)

	GetReleaseByTagOrNil(ctx context.Context, repo git.RepositoryID, tag git.TagName) (*git.Release, error)
	CreateRelease(ctx context.Context, r git.Release) (*git.Release, error)
	CreateReleaseAsset(ctx context.Context, a git.ReleaseAsset) error

	QueryForPullRequest(ctx context.Context, in QueryForPullRequestInput) (*QueryForPullRequestOutput, error)
	CreatePullRequest(ctx context.Context, in CreatePullRequestInput) (*CreatePullRequestOutput, error)
	RequestPullRequestReview(ctx context.Context, in RequestPullRequestReviewInput) error

	QueryDefaultBranch(ctx context.Context, in QueryDefaultBranchInput) (*QueryDefaultBranchOutput, error)
}

type InternalBranchNodeID

type InternalBranchNodeID githubv4.ID

type InternalRepositoryNodeID

type InternalRepositoryNodeID githubv4.ID

type QueryCommitInput

type QueryCommitInput struct {
	Repository git.RepositoryID
	CommitSHA  git.CommitSHA
}

type QueryCommitOutput

type QueryCommitOutput struct {
	ChangedFiles int
}

type QueryDefaultBranchInput

type QueryDefaultBranchInput struct {
	BaseRepository git.RepositoryID
	HeadRepository git.RepositoryID
}

type QueryDefaultBranchOutput

type QueryDefaultBranchOutput struct {
	BaseDefaultBranchName git.BranchName
	HeadDefaultBranchName git.BranchName
}

type QueryForCommitInput

type QueryForCommitInput struct {
	ParentRepository git.RepositoryID
	ParentRef        git.RefName // optional
	TargetRepository git.RepositoryID
	TargetBranchName git.BranchName // optional
}

type QueryForCommitOutput

type QueryForCommitOutput struct {
	CurrentUserName              string
	ParentDefaultBranchCommitSHA git.CommitSHA
	ParentDefaultBranchTreeSHA   git.TreeSHA
	ParentRefCommitSHA           git.CommitSHA // empty if the parent ref does not exist
	ParentRefTreeSHA             git.TreeSHA   // empty if the parent ref does not exist
	TargetRepositoryNodeID       InternalRepositoryNodeID
	TargetBranchNodeID           InternalBranchNodeID
	TargetBranchCommitSHA        git.CommitSHA // empty if the branch does not exist
	TargetBranchTreeSHA          git.TreeSHA   // empty if the branch does not exist
}

func (*QueryForCommitOutput) TargetBranchExists

func (q *QueryForCommitOutput) TargetBranchExists() bool

type QueryForPullRequestInput

type QueryForPullRequestInput struct {
	BaseRepository git.RepositoryID
	BaseBranchName git.BranchName
	HeadRepository git.RepositoryID
	HeadBranchName git.BranchName
	ReviewerUser   string // optional
}

type QueryForPullRequestOutput

type QueryForPullRequestOutput struct {
	CurrentUserName      string
	BaseRepositoryNodeID InternalRepositoryNodeID
	HeadBranchCommitSHA  git.CommitSHA
	PullRequestURL       string      // URL of the pull request associated to the head branch, if exists
	ReviewerUserNodeID   githubv4.ID // optional
}

type RequestPullRequestReviewInput

type RequestPullRequestReviewInput struct {
	PullRequest githubv4.ID
	User        githubv4.ID
}

type UpdateBranchInput

type UpdateBranchInput struct {
	BranchRefNodeID InternalBranchNodeID
	CommitSHA       git.CommitSHA
	Force           bool
}

Directories

Path Synopsis
mock_client
Package mock_client is a generated GoMock package.
Package mock_client is a generated GoMock package.
Package mock_github is a generated GoMock package.
Package mock_github is a generated GoMock package.

Jump to

Keyboard shortcuts

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