gitprovider

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeInputs

func MakeInputs(results []Result, defaults map[string]any) ([]map[string]*apiextensionsv1.JSON, error)

MakeInputs converts a list of results into a list of ResourceSet inputs with defaults.

Types

type Filters

type Filters struct {
	IncludeBranchRe *regexp.Regexp
	ExcludeBranchRe *regexp.Regexp
	Labels          []string
	Limit           int
}

Filters holds the filters for the Git SaaS responses.

type GitHubProvider

type GitHubProvider struct {
	Client *github.Client
	Owner  string
	Repo   string
}

func NewGitHubProvider

func NewGitHubProvider(ctx context.Context, opts Options) (*GitHubProvider, error)

func (*GitHubProvider) ListBranches

func (p *GitHubProvider) ListBranches(ctx context.Context, opts Options) ([]Result, error)

func (*GitHubProvider) ListRequests

func (p *GitHubProvider) ListRequests(ctx context.Context, opts Options) ([]Result, error)

type GitLabProvider

type GitLabProvider struct {
	Client  *gitlab.Client
	Project string
}

func NewGitLabProvider

func NewGitLabProvider(ctx context.Context, opts Options) (*GitLabProvider, error)

func (*GitLabProvider) ListBranches

func (p *GitLabProvider) ListBranches(ctx context.Context, opts Options) ([]Result, error)

func (*GitLabProvider) ListRequests

func (p *GitLabProvider) ListRequests(ctx context.Context, opts Options) ([]Result, error)

type Interface

type Interface interface {
	// ListBranches returns a list of branches that match the filters.
	ListBranches(ctx context.Context, opts Options) ([]Result, error)

	// ListRequests returns a list of pull/merge requests that match the filters.
	ListRequests(ctx context.Context, opts Options) ([]Result, error)
}

Interface that all Git SaaS providers must implement.

type Options

type Options struct {
	URL      string
	CertPool *x509.CertPool
	Token    string
	Filters  Filters
}

Options holds the configuration for the Git SaaS provider.

type Result

type Result struct {
	ID     string `json:"id"`
	SHA    string `json:"sha"`
	Branch string `json:"branch"`
	Author string `json:"author,omitempty"`
	Title  string `json:"title,omitempty"`
}

Result holds the information extracted from the Git SaaS provider response.

func (*Result) ToMap

func (r *Result) ToMap() map[string]any

ToMap converts the result into a map.

func (*Result) ToMapWithDefaults

func (r *Result) ToMapWithDefaults(defaults map[string]any) map[string]any

ToMapWithDefaults converts the result into a map with default values.

Jump to

Keyboard shortcuts

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