mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-25 12:21:31 +00:00
df664d9d9a
* Upgrading ts_rs to 10.0.0 * Adding ts_option directives, and woodpecker test. * Fixing ts_options.
73 lines
2.3 KiB
Rust
73 lines
2.3 KiB
Rust
use lemmy_db_schema::newtypes::CustomEmojiId;
|
|
use lemmy_db_views::structs::CustomEmojiView;
|
|
use serde::{Deserialize, Serialize};
|
|
use serde_with::skip_serializing_none;
|
|
#[cfg(feature = "full")]
|
|
use ts_rs::TS;
|
|
use url::Url;
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// Create a custom emoji.
|
|
pub struct CreateCustomEmoji {
|
|
pub category: String,
|
|
pub shortcode: String,
|
|
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
pub image_url: Url,
|
|
pub alt_text: String,
|
|
pub keywords: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// Edit a custom emoji.
|
|
pub struct EditCustomEmoji {
|
|
pub id: CustomEmojiId,
|
|
pub category: String,
|
|
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
pub image_url: Url,
|
|
pub alt_text: String,
|
|
pub keywords: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// Delete a custom emoji.
|
|
pub struct DeleteCustomEmoji {
|
|
pub id: CustomEmojiId,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A response for a custom emoji.
|
|
pub struct CustomEmojiResponse {
|
|
pub custom_emoji: CustomEmojiView,
|
|
}
|
|
|
|
#[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 {
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
|
pub page: Option<i64>,
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
|
pub limit: Option<i64>,
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
|
pub category: Option<String>,
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
|
pub ignore_page_limits: Option<bool>,
|
|
}
|