pub trait WebhookEventHandler {
type Error;
// Provided methods
fn handle_topic_created(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_topic_edited(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_topic_destroyed(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_topic_recovered(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_post_created(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_post_edited(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_post_destroyed(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_post_recovered(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error> { ... }
fn handle_ping(&mut self) -> Result<(), Self::Error> { ... }
}
Expand description
Trait for handling different types of webhook events
Implement this trait to define custom behavior for each event type. All methods have default implementations that do nothing, so you only need to implement the events you care about.
Required Associated Types§
Provided Methods§
Sourcefn handle_topic_created(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error>
fn handle_topic_created( &mut self, event: &TopicWebhookEvent, ) -> Result<(), Self::Error>
Called when a new topic is created
Sourcefn handle_topic_edited(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error>
fn handle_topic_edited( &mut self, event: &TopicWebhookEvent, ) -> Result<(), Self::Error>
Called when a topic is edited
Sourcefn handle_topic_destroyed(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error>
fn handle_topic_destroyed( &mut self, event: &TopicWebhookEvent, ) -> Result<(), Self::Error>
Called when a topic is deleted/destroyed
Sourcefn handle_topic_recovered(
&mut self,
event: &TopicWebhookEvent,
) -> Result<(), Self::Error>
fn handle_topic_recovered( &mut self, event: &TopicWebhookEvent, ) -> Result<(), Self::Error>
Called when a deleted topic is recovered
Sourcefn handle_post_created(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error>
fn handle_post_created( &mut self, event: &PostWebhookEvent, ) -> Result<(), Self::Error>
Called when a new post is created
Sourcefn handle_post_edited(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error>
fn handle_post_edited( &mut self, event: &PostWebhookEvent, ) -> Result<(), Self::Error>
Called when a post is edited
Sourcefn handle_post_destroyed(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error>
fn handle_post_destroyed( &mut self, event: &PostWebhookEvent, ) -> Result<(), Self::Error>
Called when a post is deleted/destroyed
Sourcefn handle_post_recovered(
&mut self,
event: &PostWebhookEvent,
) -> Result<(), Self::Error>
fn handle_post_recovered( &mut self, event: &PostWebhookEvent, ) -> Result<(), Self::Error>
Called when a deleted post is recovered
Sourcefn handle_ping(&mut self) -> Result<(), Self::Error>
fn handle_ping(&mut self) -> Result<(), Self::Error>
Called when a ping event is received