gogithub

package
v0.20.7 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateRepo(ctx context.Context, org string, repo *goGithub.Repository) (*goGithub.Repository, *goGithub.Response, error)
	AddDeployKeyToRepo(ctx context.Context, owner, repo string, key *goGithub.Key) error
	Repo(ctx context.Context, owner, repo string) (*goGithub.Repository, *goGithub.Response, error)
	User(ctx context.Context, user string) (*goGithub.User, *goGithub.Response, error)
	Organization(ctx context.Context, org string) (*goGithub.Organization, *goGithub.Response, error)
	GetContents(ctx context.Context, owner, repo, path string, opt *goGithub.RepositoryContentGetOptions) (
		fileContent *goGithub.RepositoryContent, directoryContent []*goGithub.RepositoryContent, resp *goGithub.Response, err error,
	)
	DeleteRepo(ctx context.Context, owner, repo string) (*goGithub.Response, error)
}

type GoGithub

type GoGithub struct {
	Opts   Options
	Client Client
}

func New

func New(ctx context.Context, opts Options) *GoGithub

func (*GoGithub) AddDeployKeyToRepo added in v0.9.2

func (g *GoGithub) AddDeployKeyToRepo(ctx context.Context, opts git.AddDeployKeyOpts) error

func (*GoGithub) AuthenticatedUser

func (g *GoGithub) AuthenticatedUser(ctx context.Context) (*goGithub.User, error)

func (*GoGithub) CheckAccessTokenPermissions

func (g *GoGithub) CheckAccessTokenPermissions(checkPATPermission string, allPermissionScopes string) error

func (*GoGithub) CreateRepo

func (g *GoGithub) CreateRepo(ctx context.Context, opts git.CreateRepoOpts) (repository *git.Repository, err error)

CreateRepo creates an empty Github Repository. The repository must be initialized locally or file must be added to it via the github api before it can be successfully cloned.

func (*GoGithub) DeleteRepo added in v0.6.0

func (g *GoGithub) DeleteRepo(ctx context.Context, opts git.DeleteRepoOpts) error

DeleteRepo deletes a Github repository.

func (*GoGithub) GetAccessTokenPermissions

func (g *GoGithub) GetAccessTokenPermissions(accessToken string) (string, error)

func (*GoGithub) GetRepo

func (g *GoGithub) GetRepo(ctx context.Context, opts git.GetRepoOpts) (*git.Repository, error)

GetRepo describes a remote repository, return the repo name if it exists. If the repo does not exist, resulting in a 404 exception, it returns a `RepoDoesNotExist` error.

func (*GoGithub) Organization

func (g *GoGithub) Organization(ctx context.Context, org string) (*goGithub.Organization, error)

func (*GoGithub) PathExists

func (g *GoGithub) PathExists(ctx context.Context, owner, repo, branch, path string) (bool, error)

PathExists checks if a path exists in the remote repository. If the owner, repository or branch doesn't exist, it returns false and no error.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}
var HttpClient HTTPClient

type Options

type Options struct {
	Auth git.TokenAuth
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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