pub struct Webhook {
pub id: u64,
pub repo_key: String,
pub url: String,
pub secret: Option<String>,
pub events: HashSet<WebhookEvent>,
pub active: bool,
pub content_type: String,
pub insecure_ssl: bool,
pub created_at: u64,
pub updated_at: u64,
pub delivery_count: u64,
pub failure_count: u64,
}Expand description
A webhook subscription for a repository.
Fields§
§id: u64Unique webhook ID.
repo_key: StringRepository key (e.g., “owner/repo”).
url: StringCallback URL for webhook delivery.
secret: Option<String>Optional HMAC secret for payload signing.
events: HashSet<WebhookEvent>Events that trigger this webhook.
active: boolWhether the webhook is active.
content_type: StringContent type for delivery (application/json or application/x-www-form-urlencoded).
insecure_ssl: boolWhether to send SSL verification.
created_at: u64When the webhook was created (Unix timestamp).
updated_at: u64When the webhook was last updated (Unix timestamp).
delivery_count: u64Number of recent deliveries.
failure_count: u64Number of failed deliveries.
Implementations§
Source§impl Webhook
impl Webhook
Sourcepub fn new(
id: u64,
repo_key: String,
url: String,
events: HashSet<WebhookEvent>,
) -> Self
pub fn new( id: u64, repo_key: String, url: String, events: HashSet<WebhookEvent>, ) -> Self
Create a new webhook.
Sourcepub fn with_secret(self, secret: String) -> Self
pub fn with_secret(self, secret: String) -> Self
Set the webhook secret for HMAC signing.
Sourcepub fn should_fire(&self, event: WebhookEvent) -> bool
pub fn should_fire(&self, event: WebhookEvent) -> bool
Check if this webhook should fire for an event.
Sourcepub fn add_event(&mut self, event: WebhookEvent)
pub fn add_event(&mut self, event: WebhookEvent)
Add an event to trigger this webhook.
Sourcepub fn remove_event(&mut self, event: WebhookEvent) -> bool
pub fn remove_event(&mut self, event: WebhookEvent) -> bool
Remove an event.
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Record a successful delivery.
Sourcepub fn record_failure(&mut self)
pub fn record_failure(&mut self)
Record a failed delivery.
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