2023-03-20 21:32:31 +00:00
|
|
|
use crate::sensitive::Sensitive;
|
|
|
|
use lemmy_db_schema::newtypes::CustomEmojiId;
|
|
|
|
use lemmy_db_views::structs::CustomEmojiView;
|
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2023-03-20 21:32:31 +00:00
|
|
|
use url::Url;
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Create a custom emoji.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub struct CreateCustomEmoji {
|
|
|
|
pub category: String,
|
|
|
|
pub shortcode: String,
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(type = "string"))]
|
2023-03-20 21:32:31 +00:00
|
|
|
pub image_url: Url,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub keywords: Vec<String>,
|
|
|
|
pub auth: Sensitive<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Edit a custom emoji.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub struct EditCustomEmoji {
|
|
|
|
pub id: CustomEmojiId,
|
|
|
|
pub category: String,
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(type = "string"))]
|
2023-03-20 21:32:31 +00:00
|
|
|
pub image_url: Url,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub keywords: Vec<String>,
|
|
|
|
pub auth: Sensitive<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Delete a custom emoji.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub struct DeleteCustomEmoji {
|
|
|
|
pub id: CustomEmojiId,
|
|
|
|
pub auth: Sensitive<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The response for deleting a custom emoji.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub struct DeleteCustomEmojiResponse {
|
|
|
|
pub id: CustomEmojiId,
|
|
|
|
pub success: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A response for a custom emoji.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub struct CustomEmojiResponse {
|
|
|
|
pub custom_emoji: CustomEmojiView,
|
|
|
|
}
|