git_provider

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetScopes

func GetScopes(ctx context.Context, client *github.Client) ([]string, error)

func ValidatePermissions

func ValidatePermissions(ctx context.Context, client *github.Client, cfg *conf.GlobalConfig) error

Types

type Client

type Client interface {
	ListFiles(ctx *context.Context, repo string, branch string, path string) ([]string, error)
	GetFile(ctx *context.Context, repo string, branch string, path string) (*CommitFile, error)
	GetFiles(ctx *context.Context, repo string, branch string, paths []string) ([]*CommitFile, error)
	SetWebhook() error
	UnsetWebhook(ctx *context.Context) error
	HandlePayload(request *http.Request, secret []byte) (*WebhookPayload, error)
	SetStatus(ctx *context.Context, repo *string, commit *string, linkURL *string, status *string, message *string) error
}

func NewGitProviderClient

func NewGitProviderClient(cfg *conf.GlobalConfig) (Client, error)

func NewGithubClient

func NewGithubClient(cfg *conf.GlobalConfig) (Client, error)

type CommitFile

type CommitFile struct {
	Path    *string `json:"path"`
	Content *string `json:"content"`
}

type GithubClientImpl

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

func (*GithubClientImpl) GetFile

func (c *GithubClientImpl) GetFile(ctx *context.Context, repo string, branch string, path string) (*CommitFile, error)

func (*GithubClientImpl) GetFiles

func (c *GithubClientImpl) GetFiles(ctx *context.Context, repo string, branch string, paths []string) ([]*CommitFile, error)

func (*GithubClientImpl) HandlePayload

func (c *GithubClientImpl) HandlePayload(request *http.Request, secret []byte) (*WebhookPayload, error)

func (*GithubClientImpl) ListFiles

func (c *GithubClientImpl) ListFiles(ctx *context.Context, repo string, branch string, path string) ([]string, error)

func (*GithubClientImpl) SetStatus added in v1.3.0

func (c *GithubClientImpl) SetStatus(ctx *context.Context, repo *string, commit *string, linkURL *string, status *string, message *string) error

func (*GithubClientImpl) SetWebhook

func (c *GithubClientImpl) SetWebhook() error

func (*GithubClientImpl) UnsetWebhook

func (c *GithubClientImpl) UnsetWebhook(ctx *context.Context) error

type WebhookPayload

type WebhookPayload struct {
	Event            string `json:"event"`
	Action           string `json:"action"`
	Repo             string `json:"repoName"`
	Branch           string `json:"branch"`
	Commit           string `json:"commit"`
	User             string `json:"user"`
	UserEmail        string `json:"user_email"`
	PullRequestURL   string `json:"pull_request_url"`
	PullRequestTitle string `json:"pull_request_title"`
	DestBranch       string `json:"dest_branch"`
}

Jump to

Keyboard shortcuts

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