summaryrefslogtreecommitdiff
path: root/common/rust/src/discord_models/webhook.rs
diff options
context:
space:
mode:
authorn1c00o <git.n1c00o@gmail.com>2021-10-04 20:24:16 +0200
committern1c00o <git.n1c00o@gmail.com>2021-10-04 20:24:16 +0200
commit11c7478a0597609006df55610f08796ac7709c4e (patch)
tree6c69d13c50231ec6f007473c1057eba9315d5670 /common/rust/src/discord_models/webhook.rs
parent2310289660ffc41a338dbf02d07410c3163ec08e (diff)
Add structures
Diffstat (limited to 'common/rust/src/discord_models/webhook.rs')
-rw-r--r--common/rust/src/discord_models/webhook.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/common/rust/src/discord_models/webhook.rs b/common/rust/src/discord_models/webhook.rs
new file mode 100644
index 0000000..4648772
--- /dev/null
+++ b/common/rust/src/discord_models/webhook.rs
@@ -0,0 +1,29 @@
+use serde::{Deserialize, Serialize};
+use serde_repr::{Deserialize_repr, Serialize_repr};
+
+use super::{channel::Channel, guild::Guild, user::User};
+
+#[derive(Debug, Clone, Deserialize_repr, Serialize_repr)]
+#[repr(u8)]
+pub enum WebhookTypes {
+ Incoming = 1,
+ ChannelFollower = 2,
+ Application = 3,
+}
+
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub struct Webhook {
+ pub id: String,
+ #[serde(rename = "type")]
+ pub type_: WebhookTypes,
+ pub guild_id: Option<String>,
+ pub channel_id: Option<String>,
+ pub user: Option<User>,
+ pub name: Option<String>,
+ pub avatar: Option<String>,
+ pub token: Option<String>,
+ pub application_id: Option<String>,
+ pub source_guild: Option<Guild>,
+ pub source_channel: Option<Channel>,
+ pub url: String,
+}