pub struct Webhook {
pub id: Uuid,
pub name: String,
pub url: String,
pub secret: Option<String>,
pub event_types: Vec<String>,
pub active: bool,
pub headers: HashMap<String, String>,
pub created_at: DateTime<Utc>,
}Available on crate feature
events only.Expand description
Webhook endpoint configuration
Fields§
§id: UuidUnique identifier
name: StringDisplay name
url: StringTarget URL for POST requests
secret: Option<String>Optional secret for HMAC signature
event_types: Vec<String>Event types to receive (empty = all events)
active: boolWhether the webhook is active
headers: HashMap<String, String>Custom headers to include
created_at: DateTime<Utc>Created timestamp
Implementations§
Source§impl Webhook
impl Webhook
Sourcepub fn with_secret(self, secret: impl Into<String>) -> Self
pub fn with_secret(self, secret: impl Into<String>) -> Self
Set the secret for HMAC signature
Sourcepub fn with_events(self, events: Vec<String>) -> Self
pub fn with_events(self, events: Vec<String>) -> Self
Filter to specific event types
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a custom header
Sourcepub fn should_receive(&self, event: &CommerceEvent) -> bool
pub fn should_receive(&self, event: &CommerceEvent) -> bool
Check if this webhook should receive an event
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Webhook
impl<'de> Deserialize<'de> for Webhook
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Webhook
impl RefUnwindSafe for Webhook
impl Send for Webhook
impl Sync for Webhook
impl Unpin for Webhook
impl UnsafeUnpin for Webhook
impl UnwindSafe for Webhook
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