1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use serde::{Deserialize, Serialize};

use crate::attachment::Attachment;

/// Webhook information
#[derive(Deserialize, Debug, Clone)]
pub struct Webhook {
    /// Webhook ID
    pub id: String,

    /// The name of the webhook
    pub name: String,

    /// The avatar of the webhook
    pub avatar: Option<Attachment>,

    /// The channel this webhook belongs to
    pub channel_id: String,

    /// The private token for the webhook
    pub token: Option<String>,
}

/// Partial webhook data
#[derive(Deserialize, Debug, Clone)]
pub struct PartialWebhook {
    /// The name of the webhook
    pub name: Option<String>,

    /// The avatar of the webhook
    pub avatar: Option<Attachment>,

    /// The channel this webhook belongs to
    pub channel_id: Option<String>,

    /// The private token for the webhook
    pub token: Option<String>,
}

/// Optional fields on webhook object
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum FieldsWebhook {
    Avatar,
}