provider

package
v0.0.0-...-5d910d0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(cfg Config) (interfaces.CodeProvider, error)

NewProvider creates a new VCS provider based on the configuration

Types

type Config

type Config struct {
	Type          ProviderType `yaml:"type" env:"PROVIDER_TYPE"`
	BaseURL       string       `yaml:"base_url" env:"PROVIDER_BASE_URL"`
	Token         string       `yaml:"token" env:"PROVIDER_TOKEN"`
	WebhookSecret string       `yaml:"webhook_secret" env:"PROVIDER_WEBHOOK_SECRET"`
	BotUsername   string       `yaml:"bot_username" env:"PROVIDER_BOT_USERNAME"`
}

Config represents VCS provider configuration

func (*Config) PrepareAndValidate

func (c *Config) PrepareAndValidate() error

type FetchOptions

type FetchOptions struct {
	TargetBranch string     // Filter by target branch (e.g., "main", "develop")
	UpdatedSince *time.Time // Only fetch MRs updated after this time
	CreatedSince *time.Time // Only fetch MRs created after this time
	Limit        int        // Maximum number of results (default: 50)
}

FetchOptions defines options for fetching merge requests

func (*FetchOptions) SetDefaults

func (o *FetchOptions) SetDefaults()

SetDefaults sets default values for fetch options

type Fetcher

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

Fetcher provides utility methods for fetching merge requests from repositories

func NewFetcher

func NewFetcher(provider interfaces.CodeProvider) *Fetcher

NewFetcher creates a new MR fetcher instance

func (*Fetcher) BatchProcessMRs

func (f *Fetcher) BatchProcessMRs(ctx context.Context, projectID string, filter *model.MergeRequestFilter, processor func(*model.MergeRequest) error) error

BatchProcessMRs processes multiple merge requests with a callback function

func (*Fetcher) FetchMRsByAuthor

func (f *Fetcher) FetchMRsByAuthor(ctx context.Context, projectID, authorID string) ([]*model.MergeRequest, error)

FetchMRsByAuthor retrieves merge requests created by a specific author

func (*Fetcher) FetchMRsToReview

func (f *Fetcher) FetchMRsToReview(ctx context.Context, projectID string, options FetchOptions) ([]*model.MergeRequest, error)

FetchMRsToReview retrieves merge requests that need review based on various criteria

func (*Fetcher) FetchOpenMRs

func (f *Fetcher) FetchOpenMRs(ctx context.Context, projectID string) ([]*model.MergeRequest, error)

FetchOpenMRs retrieves all open merge requests from a repository

func (*Fetcher) FetchRecentMRs

func (f *Fetcher) FetchRecentMRs(ctx context.Context, projectID string, since time.Duration) ([]*model.MergeRequest, error)

FetchRecentMRs retrieves merge requests updated in the last specified duration

func (*Fetcher) PollForUpdates

func (f *Fetcher) PollForUpdates(ctx context.Context, projectID string, interval time.Duration, callback func([]*model.MergeRequest)) error

PollForUpdates continuously polls for updated merge requests

type ProviderType

type ProviderType string
const (
	GitLab    ProviderType = "gitlab"
	GitHub    ProviderType = "github"
	Bitbucket ProviderType = "bitbucket"
)

SupportedProviderTypes defines the supported VCS provider types

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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