pub struct Delivery<P = Value> { /* private fields */ }Expand description
A verified delivery, with the payload still typed as raw JSON.
Typed handlers receive Delivery with the payload already decoded into
the event’s own type; Webhooks::on_any and Webhooks::verify hand
back this untyped form because the event is only known at runtime.
Implementations§
Source§impl<P> Delivery<P>
impl<P> Delivery<P>
Sourcepub fn event_type(&self) -> Option<WebhookEventType>
pub fn event_type(&self) -> Option<WebhookEventType>
The event type as a known variant, or None for an event this SDK
build does not recognize - a subscription edited outside the SDK can
carry one.
Source§impl Delivery
impl Delivery
Sourcepub fn connection_key(&self) -> Result<Option<String>, Error>
pub fn connection_key(&self) -> Result<Option<String>, Error>
The connection key this delivery concerns, for the events that carry
one. None for account-level events (project.*, organization.*,
member.*) and for an oauth.failed that fired before the connection
existed. Every known event is decoded first, so a payload that does not
match its declared type returns a decode error even when it has no
connection key.
Sourcepub fn is_test(&self) -> bool
pub fn is_test(&self) -> bool
Whether this is a test delivery from the dashboard’s “send test” action.
A test delivery reuses a real event name but carries a synthetic
payload, so it cannot decode into that event’s type. Typed handlers are
skipped for it and only Webhooks::on_any runs - otherwise every test
send would fail to decode and be retried forever.