gitlab

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInterval = 60 * time.Second
)
View Source
const ViewerAlias = "@me"

Variables

This section is empty.

Functions

func DefaultQueries

func DefaultQueries() []string

func NewActive

func NewActive(sig *Signal, interval time.Duration, state *active.State) signals.ActiveSignal

NewActive polls the same *Signal.Fetch the query path uses. A separate loop would make "my merge requests" in `mino gitlab query` and in `mino serve` two code paths that drift apart.

func NormalizeAPIURL

func NormalizeAPIURL(raw string) (string, error)

func SelectorTerms

func SelectorTerms() []string

Types

type APIBackend

type APIBackend struct {
	Auth    auth.GitLabSource
	HTTP    *http.Client
	BaseURL string
	Rate    *RateHint
}

func (APIBackend) Get

func (b APIBackend) Get(ctx context.Context, path string, q url.Values) (Page, error)

type Backend

type Backend interface {
	Get(ctx context.Context, path string, query url.Values) (Page, error)
}

type CLIBackend

type CLIBackend struct {
	Hostname string
}

func (CLIBackend) Get

func (b CLIBackend) Get(ctx context.Context, path string, q url.Values) (Page, error)

type Cache

type Cache interface {
	Get(ctx context.Context, namespace, key string) (string, bool)
	Put(ctx context.Context, namespace, key, value string, expiry time.Time)
}

type CachePolicy

type CachePolicy struct {
	Read  bool
	Write bool
	TTL   time.Duration
}

type Kind

type Kind string
const (
	KindMR       Kind = "mr"
	KindIssue    Kind = "issue"
	KindPipeline Kind = "pipeline"
)

type Option

type Option func(*signalOpts)

func WithDetailCache

func WithDetailCache(c Cache, policy CachePolicy) Option

func WithRateHint

func WithRateHint(r *RateHint) Option

func WithTitle

func WithTitle(title string) Option

func WithViewer

func WithViewer(login string) Option

type Page

type Page struct {
	Body       []byte
	NextPage   int
	Total      int
	HasTotal   bool
	TotalPages int
	Short      bool
}

type RateHint

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

func NewRateHint

func NewRateHint() *RateHint

type Ref

type Ref struct {
	Project string
	Kind    Kind
	ID      int64
}

func ParseRef

func ParseRef(rawURL string) (Ref, error)

ParseRef splits on the /-/ separator rather than counting path segments, which is what makes arbitrarily nested subgroups work and is why GitLab introduced /-/ in the first place.

func (Ref) String

func (r Ref) String() string

type Selector

type Selector struct {
	Kind   Kind
	Target Target
	Params url.Values
	// contains filtered or unexported fields
}

func ParseSelector

func ParseSelector(raw string) (Selector, error)

func (Selector) NeedsViewer

func (s Selector) NeedsViewer() bool

func (Selector) Path

func (s Selector) Path() string

func (Selector) Query

func (s Selector) Query() url.Values

func (Selector) Raw

func (s Selector) Raw() string

func (*Selector) ResolveViewer

func (s *Selector) ResolveViewer(login string) error

ResolveViewer substitutes the client-side @me. GitLab has no server-side equivalent: author_username=@me matches a user literally named "@me" and returns 200 with an empty array, so an unresolved alias has to be an error rather than a pass-through.

type Signal

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

func New

func New(selectors []string, backend Backend, max int, opts ...Option) (*Signal, error)

New returns an error where the github signal does not: a selector is parsed at build time, and a bad one is a config mistake that must not render as an empty section.

func (*Signal) Detail

func (s *Signal) Detail(ctx context.Context, it signals.Item) (signals.ItemDetail, error)

func (*Signal) Fetch

func (s *Signal) Fetch(ctx context.Context) ([]signals.Section, error)

func (*Signal) Name

func (s *Signal) Name() string

type Target

type Target struct {
	Scope string
	Path  string
}

Jump to

Keyboard shortcuts

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