action

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDispatcher

func NewDispatcher(
	ctx context.Context,
	config types.ConfigManager,
	logger types.Logger,
	router types.HTTPRouter,
	metrics types.MetricsManager,
	health types.HealthManager,
	clientManager types.ClientManager,
) (types.Dispatcher, error)

func NewWebSocketBroker

func NewWebSocketBroker(ctx context.Context, logger types.Logger, config *types.BrokerConfig, health types.HealthManager) (types.ActionBroker, error)

func RegisterActionBroker

func RegisterActionBroker(actionBrokerName string, creator types.ActionBrokerCreator)

Types

type BrokerState

type BrokerState int32
const (
	BrokerStateStopped BrokerState = iota
	BrokerStateStarting
	BrokerStateRunning
	BrokerStateStopping
	BrokerStateReconnecting
)

type Dispatcher

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

func (*Dispatcher) IsRunning

func (d *Dispatcher) IsRunning() bool

func (*Dispatcher) Publish

func (d *Dispatcher) Publish(action string, payload interface{}) error

func (*Dispatcher) Start

func (d *Dispatcher) Start() error

func (*Dispatcher) Stop

func (d *Dispatcher) Stop() error

func (*Dispatcher) Subscribe

func (d *Dispatcher) Subscribe(action string, handler types.ActionHandler) error

func (*Dispatcher) Unsubscribe

func (d *Dispatcher) Unsubscribe(action string) error

type State

type State int32
const (
	StateStopped State = iota
	StateStarting
	StateRunning
	StateStopping
)

type WebSocketBroker

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

func (*WebSocketBroker) IsRunning

func (w *WebSocketBroker) IsRunning() bool

func (*WebSocketBroker) Publish

func (w *WebSocketBroker) Publish(action string, payload interface{}) error

func (*WebSocketBroker) RegisterRoutes

func (w *WebSocketBroker) RegisterRoutes(_ types.HTTPRouter)

func (*WebSocketBroker) Start

func (w *WebSocketBroker) Start() error

func (*WebSocketBroker) Stop

func (w *WebSocketBroker) Stop() error

func (*WebSocketBroker) Subscribe

func (w *WebSocketBroker) Subscribe(action string, handler types.ActionHandler) error

func (*WebSocketBroker) Unsubscribe

func (w *WebSocketBroker) Unsubscribe(action string) error

type WebSocketConfig

type WebSocketConfig struct {
	URL            string        `json:"url"`
	ReconnectDelay time.Duration `json:"reconnect_delay"`
	MaxRetries     int           `json:"max_retries"`
	PingInterval   time.Duration `json:"ping_interval"`
	PongWait       time.Duration `json:"pong_wait"`
	WriteWait      time.Duration `json:"write_wait"`
}

type Webhook

type Webhook struct {
	ID        string            `json:"id" db:"id"`
	Event     string            `json:"event" db:"event"`
	URL       string            `json:"url" db:"url"`
	Headers   map[string]string `json:"headers" db:"headers"`
	Secret    string            `json:"secret" db:"secret"`
	Enabled   bool              `json:"enabled" db:"enabled"`
	CreatedAt time.Time         `json:"created_at" db:"created_at"`
}

type WebhookCreateRequest

type WebhookCreateRequest struct {
	Event   string            `json:"event" validate:"required"`
	URL     string            `json:"url" validate:"required,url"`
	Headers map[string]string `json:"headers"`
	Enabled *bool             `json:"enabled"`
}

type WebhookListResponse

type WebhookListResponse struct {
	Success bool       `json:"success"`
	Data    []*Webhook `json:"data,omitempty"`
	Total   int        `json:"total"`
	Error   string     `json:"error,omitempty"`
}

type WebhookManager

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

func NewWebhookManager

func NewWebhookManager(ctx context.Context, logger types.Logger, metrics types.MetricsManager) (*WebhookManager, error)

func (*WebhookManager) IsRunning

func (wm *WebhookManager) IsRunning() bool

func (*WebhookManager) Start

func (wm *WebhookManager) Start() error

func (*WebhookManager) Stop

func (wm *WebhookManager) Stop() error

type WebhookResponse

type WebhookResponse struct {
	Success bool     `json:"success"`
	Data    *Webhook `json:"data,omitempty"`
	Error   string   `json:"error,omitempty"`
}

type WebhookState

type WebhookState int32
const (
	WebhookStateStopped WebhookState = iota
	WebhookStateStarting
	WebhookStateRunning
	WebhookStateStopping
)

type WebhookUpdateRequest

type WebhookUpdateRequest struct {
	Event   *string           `json:"event"`
	URL     *string           `json:"url"`
	Headers map[string]string `json:"headers"`
	Enabled *bool             `json:"enabled"`
}

Jump to

Keyboard shortcuts

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