2023-03-20 17:32:31 -04:00
|
|
|
use lemmy_db_schema::newtypes::CustomEmojiId;
|
|
|
|
use lemmy_db_views::structs::CustomEmojiView;
|
|
|
|
use serde::{Deserialize, Serialize};
|
2024-09-19 05:15:04 -04:00
|
|
|
use serde_with::skip_serializing_none;
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2023-03-20 17:32:31 -04:00
|
|
|
use url::Url;
|
|
|
|
|
2024-02-11 00:32:14 -05:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 15:20:39 -04:00
|
|
|
/// Create a custom emoji.
|
2023-03-20 17:32:31 -04:00
|
|
|
pub struct CreateCustomEmoji {
|
|
|
|
pub category: String,
|
|
|
|
pub shortcode: String,
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg_attr(feature = "full", ts(type = "string"))]
|
2023-03-20 17:32:31 -04:00
|
|
|
pub image_url: Url,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub keywords: Vec<String>,
|
|
|
|
}
|
|
|
|
|
2024-02-11 00:32:14 -05:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 15:20:39 -04:00
|
|
|
/// Edit a custom emoji.
|
2023-03-20 17:32:31 -04:00
|
|
|
pub struct EditCustomEmoji {
|
|
|
|
pub id: CustomEmojiId,
|
|
|
|
pub category: String,
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg_attr(feature = "full", ts(type = "string"))]
|
2023-03-20 17:32:31 -04:00
|
|
|
pub image_url: Url,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub keywords: Vec<String>,
|
|
|
|
}
|
|
|
|
|
2024-02-11 00:32:14 -05:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 15:20:39 -04:00
|
|
|
/// Delete a custom emoji.
|
2023-03-20 17:32:31 -04:00
|
|
|
pub struct DeleteCustomEmoji {
|
|
|
|
pub id: CustomEmojiId,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 00:26:10 -04:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 15:20:39 -04:00
|
|
|
/// A response for a custom emoji.
|
2023-03-20 17:32:31 -04:00
|
|
|
pub struct CustomEmojiResponse {
|
|
|
|
pub custom_emoji: CustomEmojiView,
|
|
|
|
}
|
2024-09-19 05:15:04 -04:00
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// A response for custom emojis.
|
|
|
|
pub struct ListCustomEmojisResponse {
|
|
|
|
pub custom_emojis: Vec<CustomEmojiView>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// Fetches a list of custom emojis.
|
|
|
|
pub struct ListCustomEmojis {
|
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
|
|
|
pub category: Option<String>,
|
|
|
|
pub ignore_page_limits: Option<bool>,
|
|
|
|
}
|