pub struct WebhookManager { /* private fields */ }events only.Expand description
Webhook manager handles registration and delivery
Implementations§
Source§impl WebhookManager
impl WebhookManager
Sourcepub fn with_config(config: WebhookConfig) -> Self
pub fn with_config(config: WebhookConfig) -> Self
Create a new webhook manager with full configuration.
Sourcepub fn register(&self, webhook: Webhook) -> Uuid
pub fn register(&self, webhook: Webhook) -> Uuid
Register a new webhook using the legacy API.
Returns Uuid::nil() on failure to preserve compatibility with
older call sites. Use register_strict or
try_register for explicit handling.
Sourcepub fn register_strict(
&self,
webhook: Webhook,
) -> Result<Uuid, WebhookRegistrationError>
pub fn register_strict( &self, webhook: Webhook, ) -> Result<Uuid, WebhookRegistrationError>
Register a new webhook with explicit failure semantics.
Returns a registration error when the URL is rejected.
Sourcepub fn try_register(&self, webhook: Webhook) -> Option<Uuid>
pub fn try_register(&self, webhook: Webhook) -> Option<Uuid>
Register a new webhook, returning None when URL validation fails.
Sourcepub fn unregister(&self, id: Uuid) -> bool
pub fn unregister(&self, id: Uuid) -> bool
Unregister a webhook
Sourcepub fn deliveries(&self, webhook_id: Uuid) -> Vec<WebhookDelivery>
pub fn deliveries(&self, webhook_id: Uuid) -> Vec<WebhookDelivery>
Get delivery history for a webhook (newest-first)
Sourcepub fn set_active(&self, id: Uuid, active: bool) -> bool
pub fn set_active(&self, id: Uuid, active: bool) -> bool
Enable/disable a webhook
Sourcepub fn failed_deliveries(&self) -> Vec<WebhookDelivery>
pub fn failed_deliveries(&self) -> Vec<WebhookDelivery>
Get all failed deliveries across all webhooks.
Sourcepub fn failed_delivery_count(&self) -> usize
pub fn failed_delivery_count(&self) -> usize
Count of failed deliveries (for monitoring dashboards).
Sourcepub fn clear_failed_deliveries(&self, webhook_id: Uuid) -> usize
pub fn clear_failed_deliveries(&self, webhook_id: Uuid) -> usize
Clear failed deliveries for a specific webhook (after manual review).
Sourcepub fn deliver(&self, event: CommerceEvent)
pub fn deliver(&self, event: CommerceEvent)
Deliver an event to all matching webhooks (spawns async tasks)