refactor(quark): strip webhook code

This commit is contained in:
Paul Makles
2023-06-03 13:01:28 +01:00
parent e393e17b59
commit f9f5a30e2c
16 changed files with 43 additions and 259 deletions

View File

@@ -4,6 +4,7 @@ use indexmap::{IndexMap, IndexSet};
use iso8601_timestamp::Timestamp;
use once_cell::sync::Lazy;
use regex::Regex;
use revolt_models::v0::MessageWebhook;
use serde::{Deserialize, Serialize};
use validator::Validate;
@@ -109,15 +110,6 @@ pub struct Interactions {
pub restrict_reactions: bool,
}
/// Information about the webhook which
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, Validate, Default)]
pub struct MessageWebhook {
// The name of the webhook - 1 to 32 chars
pub name: String,
// The id of the avatar of the webhook, if it has one
pub avatar: Option<String>
}
/// Representation of a Message on Revolt
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, OptionalStruct, Default)]
#[optional_derive(Serialize, Deserialize, JsonSchema, Debug, Default, Clone)]
@@ -135,7 +127,7 @@ pub struct Message {
pub channel: String,
/// Id of the user or webhook that sent this message
pub author: String,
/// The webhook that sent this message, mutually exclusive with `author`
/// The webhook that sent this message
#[serde(skip_serializing_if = "Option::is_none")]
pub webhook: Option<MessageWebhook>,
/// Message content

View File

@@ -1,33 +0,0 @@
use crate::models::File;
use serde::{Deserialize, Serialize};
/// Respresents a webhook
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, OptionalStruct)]
#[optional_derive(Serialize, Deserialize, JsonSchema, Debug, Default, Clone)]
#[optional_name = "PartialWebhook"]
#[opt_skip_serializing_none]
#[opt_some_priority]
pub struct Webhook {
/// Unique Id
#[serde(rename = "_id")]
pub id: String,
/// The name of the webhook
pub name: String,
/// The avatar of the webhook
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<File>,
/// The channel this webhook belongs to
pub channel: String,
/// The private token for the webhook
pub token: Option<String>
}
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone)]
pub enum FieldsWebhook {
Avatar
}

View File

@@ -13,7 +13,6 @@ mod channels {
pub mod channel_invite;
pub mod channel_unread;
pub mod message;
pub mod webhook;
}
mod servers {
@@ -55,4 +54,3 @@ pub use simple::SimpleModel;
pub use snapshot::Snapshot;
pub use user::User;
pub use user_settings::UserSettings;
pub use webhook::Webhook;