provider

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const APITokenType = "api-token"

Variables

This section is empty.

Functions

func FromURL

func FromURL(repoURL string, options ...ProviderOption) (Provider, Repository, error)

Types

type Comment

type Comment struct {
	ID   int
	Link string
}

type GitHubProvider

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

func (GitHubProvider) AddCommentToPullRequest

func (p GitHubProvider) AddCommentToPullRequest(ctx context.Context, pr PullRequest, body []byte) (*Comment, error)

func (GitHubProvider) ListPullRequests

func (p GitHubProvider) ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)

func (*GitHubProvider) SetHostname

func (p *GitHubProvider) SetHostname(hostname string) error

func (*GitHubProvider) SetLogger

func (p *GitHubProvider) SetLogger(log logr.Logger) error

func (*GitHubProvider) SetToken

func (p *GitHubProvider) SetToken(tokenType, token string) error

func (*GitHubProvider) Setup

func (p *GitHubProvider) Setup() error

type Provider

type Provider interface {
	ListPullRequests(ctx context.Context, repo Repository) ([]PullRequest, error)
	AddCommentToPullRequest(ctx context.Context, repo PullRequest, body []byte) (*Comment, error)

	SetLogger(logr.Logger) error
	SetToken(tokenType, token string) error
	SetHostname(hostname string) error

	Setup() error
}

func New

func New(provider ProviderType, options ...ProviderOption) (Provider, error)

type ProviderOption

type ProviderOption func(Provider) error

func WithDomain

func WithDomain(domain string) ProviderOption

func WithLogger

func WithLogger(log logr.Logger) ProviderOption

func WithToken

func WithToken(tokenType, token string) ProviderOption

type ProviderType

type ProviderType string

type PullRequest

type PullRequest struct {
	Repository Repository
	Number     int
	BaseBranch string
	HeadBranch string
	BaseSha    string
	HeadSha    string
}

type Repository

type Repository struct {
	Project string
	Org     string
	Name    string
}

func (Repository) String

func (r Repository) String() string

Jump to

Keyboard shortcuts

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