client

package
v0.0.0-...-fdd9c70 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error represents a NotFound response from an upstream service.

Types

type GitClient

type GitClient interface {
	GetFile(ctx context.Context, repo, ref, path string) (*scm.Content, error)
	UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, content []byte) error
	CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error)
	CreateBranch(ctx context.Context, repo, branch, sha string) error
	GetBranchHead(ctx context.Context, repo, branch string) (string, error)
}

GitClient wraps go-scm's Client with a simplified API.

type SCMClient

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

SCMClient is a wrapper for the go-scm scm.Client with a simplified API.

func New

func New(c *scm.Client) *SCMClient

New creates and returns a new SCMClient.

func (*SCMClient) CreateBranch

func (c *SCMClient) CreateBranch(ctx context.Context, repo, branch, sha string) error

CreateBranch will create a new branch in the repo from the SHA.

func (*SCMClient) CreatePullRequest

func (c *SCMClient) CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error)

CreatePullRequest creates a PullRequest with the provided input.

If an HTTP error is returned by the upstream service, an error with the response status code is returned.

func (*SCMClient) GetBranchHead

func (c *SCMClient) GetBranchHead(ctx context.Context, repo, branch string) (string, error)

GetBranchHead gets the head SHA for a specific branch.

If an HTTP error is returned by the upstream service, an error with the response status code is returned.

func (*SCMClient) GetFile

func (c *SCMClient) GetFile(ctx context.Context, repo, ref, path string) (*scm.Content, error)

GetFile reads the specific revision of a file from a repository.

If an HTTP error is returned by the upstream service, an error with the response status code is returned.

func (*SCMClient) UpdateFile

func (c *SCMClient) UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, content []byte) error

UpdateFile updates an existing file in a repository.

If an HTTP error is returned by the upstream service, an error with the response status code is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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