1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::Deserialize;

use crate::service::webhooks::{discord::DiscordWebhook, WebhookBatch};

#[derive(Deserialize, Clone)]
#[serde(tag = "type", rename_all = "lowercase")]
pub enum Webhook {
    Discord(DiscordWebhook),
}

impl Webhook {
    pub async fn send(&self, batch: &WebhookBatch) -> anyhow::Result<()> {
        match self {
            Self::Discord(d) => d.send(batch).await,
        }
    }
}