pub struct Webhook {Show 17 fields
pub id: WebhookId,
pub name: String,
pub description: Option<String>,
pub workflow_id: Uuid,
pub secret: String,
pub enabled: bool,
pub event_types: Vec<String>,
pub required_headers: HashMap<String, String>,
pub ip_whitelist: Vec<String>,
pub max_body_size: usize,
pub timeout_seconds: u32,
pub owner_id: Uuid,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub last_triggered_at: Option<DateTime<Utc>>,
pub trigger_count: u64,
pub failed_count: u64,
}Expand description
Webhook configuration
Fields§
§id: WebhookIdUnique webhook identifier
name: StringWebhook name
description: Option<String>Optional description
workflow_id: UuidWorkflow to trigger
secret: StringWebhook secret for HMAC verification
enabled: boolWhether webhook is active
event_types: Vec<String>Event types to listen for (empty = all)
required_headers: HashMap<String, String>Custom headers to require
ip_whitelist: Vec<String>IP whitelist (empty = no restriction)
max_body_size: usizeMaximum request body size (bytes)
timeout_seconds: u32Timeout for workflow execution (seconds)
owner_id: UuidOwner user ID
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last updated timestamp
last_triggered_at: Option<DateTime<Utc>>Last triggered timestamp
trigger_count: u64Total trigger count
failed_count: u64Failed trigger count
Implementations§
Source§impl Webhook
impl Webhook
Sourcepub fn new(
name: String,
workflow_id: Uuid,
secret: String,
owner_id: Uuid,
) -> Self
pub fn new( name: String, workflow_id: Uuid, secret: String, owner_id: Uuid, ) -> Self
Create a new webhook
Sourcepub fn matches_event(&self, event_type: &str) -> bool
pub fn matches_event(&self, event_type: &str) -> bool
Check if event type matches
Sourcepub fn is_ip_allowed(&self, ip: &str) -> bool
pub fn is_ip_allowed(&self, ip: &str) -> bool
Check if IP is allowed
Sourcepub fn validates_headers(&self, headers: &HashMap<String, String>) -> bool
pub fn validates_headers(&self, headers: &HashMap<String, String>) -> bool
Check required headers
Sourcepub fn increment_trigger(&mut self)
pub fn increment_trigger(&mut self)
Increment trigger count
Sourcepub fn increment_failed(&mut self)
pub fn increment_failed(&mut self)
Increment failed count
Sourcepub fn to_safe_view(&self) -> WebhookView
pub fn to_safe_view(&self) -> WebhookView
Create safe view without secret
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Calculate success rate
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 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