hook

package
v4.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name          string
	RepoPattern   string
	TriggerEvent  Event
	OperationType OperationType
	OperationID   uuid.UUID
}

type Event

type Event string

Event defines the trigger of the hook, such as post-clone, post-fork, or post-create

const (
	EventAny        Event = ""
	EventPostClone  Event = "post-clone"
	EventPostFork   Event = "post-fork"
	EventPostCreate Event = "post-create"
)

type Hook

type Hook interface {
	ID() string
	UUID() uuid.UUID
	Name() string

	RepoPattern() string
	TriggerEvent() Event

	OperationType() OperationType
	OperationID() string
	OperationUUID() uuid.UUID

	Match(ref repository.Reference, event Event) (bool, error)
}

func ConcreteHook

func ConcreteHook(
	id uuid.UUID,
	name string,
	repoPattern string,
	triggerEvent string,
	operationType string,
	operationID uuid.UUID,
) Hook

ConcreteHook creates a Hook with the given parameters.

func NewHook

func NewHook(entry Entry) Hook

type HookService

type HookService interface {
	store.Content

	List() iter.Seq2[Hook, error]
	ListFor(reference repository.Reference, event Event) iter.Seq2[Hook, error]
	Add(ctx context.Context, entry Entry) (id string, _ error)
	Get(ctx context.Context, idlike string) (Hook, error)
	Update(ctx context.Context, idlike string, entry Entry) error
	Remove(ctx context.Context, idlike string) error
	Load(iter.Seq2[Hook, error]) error
}

HookService defines the hook management interface

func NewHookService

func NewHookService() HookService

NewHookService creates a new HookService with the given content store.

type OperationType

type OperationType string

OperationType defines the type of operation that the hook performs

const (
	OperationTypeOverlay OperationType = "overlay"
	OperationTypeScript  OperationType = "script"
)

Jump to

Keyboard shortcuts

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