webhooks

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FailureExpireRate = 5
)
View Source
const (
	WebhookExpireDuration = 30 * 24 * time.Hour // 30 Days
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseWebhook

type BaseWebhook struct {
	Logger   echo.Logger
	Callback string
	Events   events.Events
}

func (*BaseWebhook) HasEvent

func (bh *BaseWebhook) HasEvent(evt events.Event) bool

func (*BaseWebhook) Trigger

func (bh *BaseWebhook) Trigger(data JobData) error

type ConfigHook

type ConfigHook struct {
	BaseWebhook
}

func (*ConfigHook) DisableOnExpiryDate

func (ch *ConfigHook) DisableOnExpiryDate(_ time.Time) error

func (*ConfigHook) DisableOnFailure

func (ch *ConfigHook) DisableOnFailure() error

func (*ConfigHook) IsEnabled

func (ch *ConfigHook) IsEnabled() bool

func (*ConfigHook) Reset

func (ch *ConfigHook) Reset() error

type DatabaseHook

type DatabaseHook struct {
	BaseWebhook
	// contains filtered or unexported fields
}

func (*DatabaseHook) DisableOnExpiryDate

func (dh *DatabaseHook) DisableOnExpiryDate(now time.Time) error

func (*DatabaseHook) DisableOnFailure

func (dh *DatabaseHook) DisableOnFailure() error

func (*DatabaseHook) IsEnabled

func (dh *DatabaseHook) IsEnabled() bool

func (*DatabaseHook) Reset

func (dh *DatabaseHook) Reset() error

type Job

type Job struct {
	Data            JobData
	Hook            Webhook
	CanExpireAtTime bool
}

type JobData

type JobData struct {
	Token string       `json:"token"`
	Event events.Event `json:"event"`
}

type Manager

type Manager interface {
	Trigger(tx *pop.Connection, evt events.Event, data interface{})
	GenerateJWT(data interface{}, event events.Event) (string, error)
}

func NewManager

func NewManager(cfg *config.Config, persister persistence.Persister, jwkManager hankoJwk.Manager, logger echo.Logger) (Manager, error)

type Webhook

type Webhook interface {
	Trigger(data JobData) error
	DisableOnExpiryDate(now time.Time) error
	DisableOnFailure() error
	Reset() error
	IsEnabled() bool
	HasEvent(evt events.Event) bool
}

func NewConfigHook

func NewConfigHook(cfgHook config.Webhook, logger echo.Logger) Webhook

func NewDatabaseHook

func NewDatabaseHook(dbHook models.Webhook, persister persistence.WebhookPersister, logger echo.Logger) Webhook

type Webhooks

type Webhooks []Webhook

type Worker

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

func NewWorker

func NewWorker(hookChannel chan Job, logger echo.Logger) Worker

func (*Worker) Run

func (w *Worker) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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