github

package
v0.0.0-...-150c8f6 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name        = "clutch.service.github"
	CurrentUser = ""
)

Variables

This section is empty.

Functions

func New

func New(cfg *any.Any, logger *zap.Logger, scope tally.Scope) (service.Service, error)

Types

type Client

type Client interface {
	GetFile(ctx context.Context, ref *RemoteRef, path string) (*File, error)
	GetDirectory(ctx context.Context, ref *RemoteRef, path string) (*Directory, error)
	CreateBranch(ctx context.Context, req *CreateBranchRequest) error
	CreatePullRequest(ctx context.Context, ref *RemoteRef, base, title, body string) (*PullRequestInfo, error)
	CreateRepository(ctx context.Context, req *sourcecontrolv1.CreateRepositoryRequest) (*sourcecontrolv1.CreateRepositoryResponse, error)
	CreateIssueComment(ctx context.Context, ref *RemoteRef, number int, body string) error
	CompareCommits(ctx context.Context, ref *RemoteRef, compareSHA string) (*githubv3.CommitsComparison, error)
	GetCommit(ctx context.Context, ref *RemoteRef) (*Commit, error)
	GetRepository(ctx context.Context, ref *RemoteRef) (*Repository, error)
	GetOrganization(ctx context.Context, organization string) (*githubv3.Organization, error)
	ListOrganizations(ctx context.Context, user string) ([]*githubv3.Organization, error)
	ListPullRequestsWithCommit(ctx context.Context, ref *RemoteRef, sha string, opts *githubv3.ListOptions) ([]*PullRequestInfo, error)
	GetOrgMembership(ctx context.Context, user, org string) (*githubv3.Membership, error)
	GetUser(ctx context.Context, username string) (*githubv3.User, error)
}

Client allows various interactions with remote repositories on GitHub.

type Commit

type Commit struct {
	Files     []*githubv3.CommitFile
	Message   string
	Author    *githubv3.User
	ParentRef string
}

type CreateBranchRequest

type CreateBranchRequest struct {
	// The base for the new branch.
	Ref *RemoteRef

	// The name of the new branch.
	BranchName string

	// Files and their content. Files will be clobbered with new content or created if they don't already exist.
	Files FileMap

	// The commit message for files added.
	CommitMessage string

	// Fetch only ReferenceName specified branch.
	SingleBranch bool
}

type Directory

type Directory struct {
	Path             string
	LastModifiedTime time.Time
	LastModifiedSHA  string
	Entries          []*Entry
}

type Entry

type Entry struct {
	Name string
	Type string
}

type File

type File struct {
	Path             string
	Contents         io.ReadCloser
	SHA              string
	LastModifiedTime time.Time
	LastModifiedSHA  string
}

File contains information about a requested file, including its content.

type FileMap

type FileMap map[string]io.ReadCloser

type PullRequestInfo

type PullRequestInfo struct {
	Number     int
	HTMLURL    string
	BranchName string
}

type RemoteRef

type RemoteRef struct {
	// Organization or user that owns the repository.
	RepoOwner string
	// Name of the repository.
	RepoName string
	// SHA, branch name, or tag.
	Ref string
}

Remote ref points to a git reference using a combination of the repository and the reference itself.

type Repository

type Repository struct {
	Name          string
	Owner         string
	DefaultBranch string
}

Repository contains information about a requested repository.

type StatsRoundTripper

type StatsRoundTripper struct {
	Wrapped http.RoundTripper
	// contains filtered or unexported fields
}

func (*StatsRoundTripper) RoundTrip

func (st *StatsRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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