revolt_database/models/channel_webhooks/
ops.rs

1use revolt_result::Result;
2
3use crate::{FieldsWebhook, PartialWebhook, Webhook};
4
5#[cfg(feature = "mongodb")]
6mod mongodb;
7mod reference;
8
9#[async_trait]
10pub trait AbstractWebhooks: Sync + Send {
11    /// Insert new webhook into the database
12    async fn insert_webhook(&self, webhook: &Webhook) -> Result<()>;
13
14    /// Fetch webhook by id
15    async fn fetch_webhook(&self, webhook_id: &str) -> Result<Webhook>;
16
17    /// Fetch webhooks for channel
18    async fn fetch_webhooks_for_channel(&self, channel_id: &str) -> Result<Vec<Webhook>>;
19
20    /// Update webhook with new information
21    async fn update_webhook(
22        &self,
23        webhook_id: &str,
24        partial: &PartialWebhook,
25        remove: &[FieldsWebhook],
26    ) -> Result<()>;
27
28    /// Delete webhook by id
29    async fn delete_webhook(&self, webhook_id: &str) -> Result<()>;
30}