github

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ListMembersFunc                    func(organization string, options github.ListMembersOptions) ([]*github.User, error)
	GetBranchFunc                      func(owner, repo, branch string, followRedirects bool) (*github.Branch, error)
	ListOrganizationMembersFunc        func(organization string, options *github.ListMembersOptions) ([]*github.User, *github.Response, error)
	GetRepositoryBranchFunc            func(owner, repo, branch string, followRedirects bool) (*github.Branch, *github.Response, error)
	ListRepositoryBranchesFunc         func(owner string, repo string) ([]*github.Branch, *github.Response, error)
	GetAuthorizedUserFunc              func() (*github.User, *github.Response, error)
	GetCommitFunc                      func(organization string, repositoryName string, sha string) (*github.RepositoryCommit, *github.Response, error)
	ListCommitsFunc                    func(organization string, repositoryName string, opts *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
	GetBranchProtectionFunc            func(owner, repo, branch string) (*github.Protection, *github.Response, error)
	GetSignaturesOfProtectedBranchFunc func(owner, repo, branch string) (*github.SignaturesProtectedBranch, *github.Response, error)
	ListPullRequestsWithCommitFunc     func(owner, repository, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
	ListPullRequestReviewsFunc         func(owner, repo string, number int, opts *github.ListOptions) ([]*github.PullRequestReview, *github.Response, error)
	ListRepositoryTopicsFunc           func(owner, repo string) ([]string, *github.Response, error)
	ListPullRequestCommitsFunc         func(owner string, repo string, number int, opts *github.ListOptions) ([]*github.RepositoryCommit, *github.Response, error)
	ListRepositoryCollaboratorsFunc    func(owner string, repo string) ([]*github.User, *github.Response, error)
	GetRepositoryFunc                  func(owner, repo string) (*github.Repository, *github.Response, error)
	GetOrganizationFunc                func(orgName string) (*github.Organization, *github.Response, error)
	GetWorkflowsFunc                   func(owner, repo string) (*github.Workflows, *github.Response, error)
	GetContentFunc                     func(owner, repo, path string, ref string) (*github.RepositoryContent, []*github.RepositoryContent, *github.Response, error)
	ListOrganizationHooksFunc          func(owner string) (hooks []*github.Hook, resp *github.Response, err error)
	ListRepositoryHooksFunc            func(owner, repo string) (hooks []*github.Hook, resp *github.Response, err error)
	ListOrganizationPackagesFunc       func(owner string, packagetype string) ([]*github.Package, *github.Response, error)
)

Functions

This section is empty.

Types

type ClientAdapterImpl

type ClientAdapterImpl struct {
	// contains filtered or unexported fields
}
var (
	Adapter ClientAdapterImpl
)

func (*ClientAdapterImpl) GetAuthorizedUser

func (ca *ClientAdapterImpl) GetAuthorizedUser() (*models.User, error)

func (*ClientAdapterImpl) GetBranchProtection

func (ca *ClientAdapterImpl) GetBranchProtection(owner string, repo *models.Repository, branch string) (*models.Protection, error)

GetBranchProtection implements clients.ClientAdapter

func (*ClientAdapterImpl) GetCommit

func (ca *ClientAdapterImpl) GetCommit(owner string, repo string, sha string) (*models.RepositoryCommit, error)

GetCommit implements clients.ClientAdapter

func (*ClientAdapterImpl) GetFileContent

func (ca *ClientAdapterImpl) GetFileContent(owner string, repo string, filepath string, ref string) ([]byte, error)

func (*ClientAdapterImpl) GetOrganization

func (ca *ClientAdapterImpl) GetOrganization(owner string) (*models.Organization, error)

func (*ClientAdapterImpl) GetPipelines

func (ca *ClientAdapterImpl) GetPipelines(owner string, repo string, branch string) ([]*pipelineModels.Pipeline, error)

func (*ClientAdapterImpl) GetRegistry

func (ca *ClientAdapterImpl) GetRegistry(organization *models.Organization) (*models.PackageRegistry, error)

func (*ClientAdapterImpl) GetRepository

func (ca *ClientAdapterImpl) GetRepository(owner string, repo string, branch string) (*models.Repository, error)

GetRepository implements clients.ClientAdapter

func (*ClientAdapterImpl) Init

func (*ClientAdapterImpl) Init(client *http.Client, token string, host string) error

Init implements clients.ClientAdapter

func (*ClientAdapterImpl) ListOrganizationMembers

func (ca *ClientAdapterImpl) ListOrganizationMembers(organization string) ([]*models.User, error)

func (*ClientAdapterImpl) ListRepositoryBranches

func (ca *ClientAdapterImpl) ListRepositoryBranches(owner string, repo string) ([]*models.Branch, error)

listRepositoryBranches implements clients.ClientAdapter

func (*ClientAdapterImpl) ListSupportedChecksIDs added in v0.1.5

func (ca *ClientAdapterImpl) ListSupportedChecksIDs() ([]string, error)

type GithubClient

type GithubClient interface {
	GetAuthorizedUser() (*github.User, *github.Response, error)
	ListOrganizationMembers(organization string, options *github.ListMembersOptions) ([]*github.User, *github.Response, error)
	ListRepositoryBranches(organization string, repositoryName string) ([]*github.Branch, *github.Response, error)
	GetRepositoryBranch(owner, repo, branch string, followRedirects bool) (*github.Branch, *github.Response, error)
	GetCommit(organization string, repositoryName string, sha string) (*github.RepositoryCommit, *github.Response, error)
	ListCommits(organization string, repositoryName string, opts *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
	GetBranchProtection(owner string, repo string, branch string) (*github.Protection, *github.Response, error)
	GetSignaturesOfProtectedBranch(owner, repo, branch string) (*github.SignaturesProtectedBranch, *github.Response, error)
	ListRepositoryCollaborators(owner string, repo string) ([]*github.User, *github.Response, error)
	ListPullRequestsWithCommit(owner, repository, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
	ListPullRequestReviews(owner, repo string, number int, opts *github.ListOptions) ([]*github.PullRequestReview, *github.Response, error)
	ListRepositoryTopics(owner, repo string) ([]string, *github.Response, error)
	ListPullRequestCommits(owner string, repo string, number int, opts *github.ListOptions) ([]*github.RepositoryCommit, *github.Response, error)
	GetRepository(owner, repo string) (*github.Repository, *github.Response, error)
	GetOrganization(owner string) (*github.Organization, *github.Response, error)
	GetWorkflows(owner, repo string) (*github.Workflows, *github.Response, error)
	GetContent(owner, repo, filepath, ref string) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error)
	ListOrganizationHooks(owner string) (hooks []*github.Hook, resp *github.Response, err error)
	ListRepositoryHooks(owner, repo string) (hooks []*github.Hook, resp *github.Response, err error)
	ListOrganizationPackages(owner string, packageType string) ([]*github.Package, *github.Response, error)
}
var (
	Client GithubClient
)

func InitClient

func InitClient(client *http.Client, token string, host string) (GithubClient, error)

func InitMocks

func InitMocks() GithubClient

func MockGetBranchProtections

func MockGetBranchProtections(protection *github.Protection) *GithubClient

func MockGetContent

func MockGetContent(content *github.RepositoryContent) *GithubClient

func MockGetOrganization

func MockGetOrganization(org *github.Organization) *GithubClient

func MockGetOrganizationMembers

func MockGetOrganizationMembers(users []*github.User) *GithubClient

func MockGetOrganizationWebhooks

func MockGetOrganizationWebhooks(hooks []*github.Hook) *GithubClient

func MockGetRepo

func MockGetRepo(repo *github.Repository) *GithubClient

func MockGetRepositoryWebhooks

func MockGetRepositoryWebhooks(hooks []*github.Hook) *GithubClient

func MockGetSignaturesOfProtectedBranch

func MockGetSignaturesOfProtectedBranch(signedCommits *github.SignaturesProtectedBranch) *GithubClient

func MockGetWorkflows

func MockGetWorkflows(workflows *github.Workflows) *GithubClient

func MockListCommits

func MockListCommits(commits []*github.RepositoryCommit) *GithubClient

func MockListOrganizationPackages

func MockListOrganizationPackages(packages []*github.Package) *GithubClient

type GithubClientImpl

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

func (*GithubClientImpl) GetAuthorizedUser

func (gca *GithubClientImpl) GetAuthorizedUser() (*github.User, *github.Response, error)

func (*GithubClientImpl) GetBranchProtection

func (gca *GithubClientImpl) GetBranchProtection(organization, repo, branch string) (*github.Protection, *github.Response, error)

func (*GithubClientImpl) GetCommit

func (gca *GithubClientImpl) GetCommit(organization string, repositoryName string, sha string) (*github.RepositoryCommit, *github.Response, error)

func (*GithubClientImpl) GetContent

func (gca *GithubClientImpl) GetContent(owner, repo, filepath, ref string) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error)

func (*GithubClientImpl) GetOrganization

func (gca *GithubClientImpl) GetOrganization(owner string) (*github.Organization, *github.Response, error)

func (*GithubClientImpl) GetRepository

func (gca *GithubClientImpl) GetRepository(owner, repo string) (*github.Repository, *github.Response, error)

func (*GithubClientImpl) GetRepositoryBranch

func (gca *GithubClientImpl) GetRepositoryBranch(organization, repositoryName, branch string, followRedirects bool) (*github.Branch, *github.Response, error)

func (*GithubClientImpl) GetSignaturesOfProtectedBranch

func (gca *GithubClientImpl) GetSignaturesOfProtectedBranch(owner, repo, branch string) (*github.SignaturesProtectedBranch, *github.Response, error)

func (*GithubClientImpl) GetWorkflows

func (gca *GithubClientImpl) GetWorkflows(owner, repo string) (*github.Workflows, *github.Response, error)

func (*GithubClientImpl) ListCommits

func (gca *GithubClientImpl) ListCommits(organization string, repositoryName string, opts *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)

func (*GithubClientImpl) ListOrganizationHooks

func (gca *GithubClientImpl) ListOrganizationHooks(owner string) (hooks []*github.Hook, resp *github.Response, err error)

need admin:org_hook

func (*GithubClientImpl) ListOrganizationMembers

func (gca *GithubClientImpl) ListOrganizationMembers(organization string, opts *github.ListMembersOptions) ([]*github.User, *github.Response, error)

func (*GithubClientImpl) ListOrganizationPackages

func (gca *GithubClientImpl) ListOrganizationPackages(owner string, packageType string) ([]*github.Package, *github.Response, error)

need read:packages

func (*GithubClientImpl) ListPullRequestCommits

func (gca *GithubClientImpl) ListPullRequestCommits(owner string, repo string, number int, opts *github.ListOptions) ([]*github.RepositoryCommit, *github.Response, error)

func (*GithubClientImpl) ListPullRequestReviews

func (gca *GithubClientImpl) ListPullRequestReviews(owner, repo string, number int, opts *github.ListOptions) ([]*github.PullRequestReview, *github.Response, error)

func (*GithubClientImpl) ListPullRequestsWithCommit

func (gca *GithubClientImpl) ListPullRequestsWithCommit(owner, repository, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)

func (*GithubClientImpl) ListRepositoryBranches

func (gca *GithubClientImpl) ListRepositoryBranches(organization string, repositoryName string) ([]*github.Branch, *github.Response, error)

func (*GithubClientImpl) ListRepositoryCollaborators

func (gca *GithubClientImpl) ListRepositoryCollaborators(owner, repo string) ([]*github.User, *github.Response, error)

func (*GithubClientImpl) ListRepositoryHooks

func (gca *GithubClientImpl) ListRepositoryHooks(owner, repo string) (hooks []*github.Hook, resp *github.Response, err error)

need admin:repo_hook->read:repo_hook

func (*GithubClientImpl) ListRepositoryTopics

func (gca *GithubClientImpl) ListRepositoryTopics(owner, repo string) ([]string, *github.Response, error)

type MockGithubClientAdapter

type MockGithubClientAdapter struct {
}

func (*MockGithubClientAdapter) GetAuthorizedUser

func (mgca *MockGithubClientAdapter) GetAuthorizedUser() (*github.User, *github.Response, error)

func (*MockGithubClientAdapter) GetBranch

func (mgca *MockGithubClientAdapter) GetBranch(owner, repo, branch string, followRedirects bool) (*github.Branch, error)

func (*MockGithubClientAdapter) GetBranchProtection

func (*MockGithubClientAdapter) GetBranchProtection(owner string, repo string, branch string) (*github.Protection, *github.Response, error)

func (*MockGithubClientAdapter) GetCommit

func (mgca *MockGithubClientAdapter) GetCommit(organization string, repositoryName string, sha string) (*github.RepositoryCommit, *github.Response, error)

func (*MockGithubClientAdapter) GetContent

func (mgca *MockGithubClientAdapter) GetContent(owner, repo, path, ref string) (*github.RepositoryContent, []*github.RepositoryContent, *github.Response, error)

func (*MockGithubClientAdapter) GetOrganization

func (mgca *MockGithubClientAdapter) GetOrganization(orgName string) (*github.Organization, *github.Response, error)

func (*MockGithubClientAdapter) GetRepository

func (mgca *MockGithubClientAdapter) GetRepository(owner, repo string) (*github.Repository, *github.Response, error)

func (*MockGithubClientAdapter) GetRepositoryBranch

func (mgca *MockGithubClientAdapter) GetRepositoryBranch(owner, repo, branch string, followRedirects bool) (*github.Branch, *github.Response, error)

func (*MockGithubClientAdapter) GetSignaturesOfProtectedBranch

func (*MockGithubClientAdapter) GetSignaturesOfProtectedBranch(owner string, repo string, branch string) (*github.SignaturesProtectedBranch, *github.Response, error)

func (*MockGithubClientAdapter) GetWorkflows

func (mgca *MockGithubClientAdapter) GetWorkflows(owner, repo string) (*github.Workflows, *github.Response, error)

func (*MockGithubClientAdapter) ListCommits

func (mgca *MockGithubClientAdapter) ListCommits(organization string, repositoryName string, opts *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)

func (*MockGithubClientAdapter) ListMembers

func (mgca *MockGithubClientAdapter) ListMembers(organization string, options github.ListMembersOptions) ([]*github.User, error)

func (*MockGithubClientAdapter) ListOrganizationHooks

func (mgca *MockGithubClientAdapter) ListOrganizationHooks(owner string) ([]*github.Hook, *github.Response, error)

func (*MockGithubClientAdapter) ListOrganizationMembers

func (mgca *MockGithubClientAdapter) ListOrganizationMembers(organization string, options *github.ListMembersOptions) ([]*github.User, *github.Response, error)

func (*MockGithubClientAdapter) ListOrganizationPackages

func (mgca *MockGithubClientAdapter) ListOrganizationPackages(owner string, packagetype string) ([]*github.Package, *github.Response, error)

func (*MockGithubClientAdapter) ListPullRequestCommits

func (mgca *MockGithubClientAdapter) ListPullRequestCommits(owner string, repo string, number int, opts *github.ListOptions) ([]*github.RepositoryCommit, *github.Response, error)

func (*MockGithubClientAdapter) ListPullRequestReviews

func (mgca *MockGithubClientAdapter) ListPullRequestReviews(owner, repo string, number int, opts *github.ListOptions) ([]*github.PullRequestReview, *github.Response, error)

func (*MockGithubClientAdapter) ListPullRequestsWithCommit

func (mgca *MockGithubClientAdapter) ListPullRequestsWithCommit(owner, repository, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)

func (*MockGithubClientAdapter) ListRepositoryBranches

func (mgca *MockGithubClientAdapter) ListRepositoryBranches(owner, repo string) ([]*github.Branch, *github.Response, error)

func (*MockGithubClientAdapter) ListRepositoryCollaborators

func (mgca *MockGithubClientAdapter) ListRepositoryCollaborators(owner string, repo string) ([]*github.User, *github.Response, error)

func (*MockGithubClientAdapter) ListRepositoryHooks

func (mgca *MockGithubClientAdapter) ListRepositoryHooks(owner, repo string) ([]*github.Hook, *github.Response, error)

func (*MockGithubClientAdapter) ListRepositoryTopics

func (mgca *MockGithubClientAdapter) ListRepositoryTopics(owner, repo string) ([]string, *github.Response, error)

Jump to

Keyboard shortcuts

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