Documentation ¶
Index ¶
- Constants
- type Event
- type Manager
- func (m *Manager) BroadcastEvent(event string, scope string, data any) error
- func (m *Manager) BroadcastToWebhook(hookID int64, event string, scope string, data any) error
- func (m *Manager) Close() error
- func (m *Manager) RegisterWebHook(url string, scopes []string) (WebHook, error)
- func (m *Manager) RemoveWebHook(id int64) error
- func (m *Manager) UpdateWebHook(id int64, url string, scopes []string) (WebHook, error)
- func (m *Manager) WebHooks() (hooks []WebHook, _ error)
- type Store
- type UID
- type WebHook
Constants ¶
View Source
const ( ScopeAll = "all" ScopeAlerts = "alerts" ScopeAlertsInfo = "alerts/info" ScopeAlertsWarning = "alerts/warning" ScopeAlertsError = "alerts/error" ScopeAlertsCritical = "alerts/critical" ScopeWallet = "wallet" ScopeTest = "test" )
event scope constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { ID UID `json:"id"` Event string `json:"event"` Scope string `json:"scope"` Data any `json:"data"` }
An Event is a notification sent to a WebHook callback.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager manages WebHook subscribers and broadcasts events
func NewManager ¶
NewManager creates a new WebHook Manager
func (*Manager) BroadcastEvent ¶
BroadcastEvent sends an event to all registered WebHooks that match the event's scope.
func (*Manager) BroadcastToWebhook ¶
BroadcastToWebhook sends an event to a specific WebHook subscriber.
func (*Manager) RegisterWebHook ¶
RegisterWebHook registers a new WebHook.
func (*Manager) RemoveWebHook ¶
RemoveWebHook removes a registered WebHook.
func (*Manager) UpdateWebHook ¶
UpdateWebHook updates the URL and scopes of a registered WebHook.
Click to show internal directories.
Click to hide internal directories.