pub struct WebhookRouter { /* private fields */ }Expand description
Routes incoming HTTP POST webhooks to the matching registered workflow IDs.
This is an in-process routing layer. Callers are expected to extract the
HTTP path, raw body bytes, and optional signature header, then call
WebhookRouter::route to obtain the list of matching workflow IDs.
Implementations§
Source§impl WebhookRouter
impl WebhookRouter
Sourcepub fn register(
&mut self,
workflow_id: impl Into<String>,
trigger: WebhookTrigger,
)
pub fn register( &mut self, workflow_id: impl Into<String>, trigger: WebhookTrigger, )
Register a webhook trigger for a workflow.
Sourcepub fn route(
&self,
path: &str,
body_bytes: &[u8],
body_json: &Value,
signature: Option<&str>,
) -> Vec<String>
pub fn route( &self, path: &str, body_bytes: &[u8], body_json: &Value, signature: Option<&str>, ) -> Vec<String>
Evaluate an incoming HTTP POST and return workflow IDs that should be triggered.
§Parameters
path: The URL path of the request (e.g."/webhooks/ingest-ready").body_bytes: Raw request body bytes (used for HMAC verification).body_json: Parsed JSON body (used for field matching).signature: Optional value of theX-Hub-Signature-256header.
A workflow is triggered when at least one of its webhook triggers matches the path, passes signature verification, and satisfies all required body fields.
Sourcepub fn workflow_ids(&self) -> Vec<&str>
pub fn workflow_ids(&self) -> Vec<&str>
List all registered workflow IDs.
Sourcepub fn trigger_count(&self) -> usize
pub fn trigger_count(&self) -> usize
Count total registered triggers across all workflows.
Trait Implementations§
Source§impl Debug for WebhookRouter
impl Debug for WebhookRouter
Source§impl Default for WebhookRouter
impl Default for WebhookRouter
Source§fn default() -> WebhookRouter
fn default() -> WebhookRouter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WebhookRouter
impl RefUnwindSafe for WebhookRouter
impl Send for WebhookRouter
impl Sync for WebhookRouter
impl Unpin for WebhookRouter
impl UnsafeUnpin for WebhookRouter
impl UnwindSafe for WebhookRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more