]> Untitled Git - lemmy.git/blob - crates/api_common/src/custom_emoji.rs
Sanitize html (#3708)
[lemmy.git] / crates / api_common / src / custom_emoji.rs
1 use crate::sensitive::Sensitive;
2 use lemmy_db_schema::newtypes::CustomEmojiId;
3 use lemmy_db_views::structs::CustomEmojiView;
4 use serde::{Deserialize, Serialize};
5 #[cfg(feature = "full")]
6 use ts_rs::TS;
7 use url::Url;
8
9 #[derive(Debug, Serialize, Deserialize, Clone)]
10 #[cfg_attr(feature = "full", derive(TS))]
11 #[cfg_attr(feature = "full", ts(export))]
12 /// Create a custom emoji.
13 pub struct CreateCustomEmoji {
14   pub category: String,
15   pub shortcode: String,
16   #[cfg_attr(feature = "full", ts(type = "string"))]
17   pub image_url: Url,
18   pub alt_text: String,
19   pub keywords: Vec<String>,
20   pub auth: Sensitive<String>,
21 }
22
23 #[derive(Debug, Serialize, Deserialize, Clone)]
24 #[cfg_attr(feature = "full", derive(TS))]
25 #[cfg_attr(feature = "full", ts(export))]
26 /// Edit  a custom emoji.
27 pub struct EditCustomEmoji {
28   pub id: CustomEmojiId,
29   pub category: String,
30   #[cfg_attr(feature = "full", ts(type = "string"))]
31   pub image_url: Url,
32   pub alt_text: String,
33   pub keywords: Vec<String>,
34   pub auth: Sensitive<String>,
35 }
36
37 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
38 #[cfg_attr(feature = "full", derive(TS))]
39 #[cfg_attr(feature = "full", ts(export))]
40 /// Delete a custom emoji.
41 pub struct DeleteCustomEmoji {
42   pub id: CustomEmojiId,
43   pub auth: Sensitive<String>,
44 }
45
46 #[derive(Serialize, Deserialize, Clone)]
47 #[cfg_attr(feature = "full", derive(TS))]
48 #[cfg_attr(feature = "full", ts(export))]
49 /// The response for deleting a custom emoji.
50 pub struct DeleteCustomEmojiResponse {
51   pub id: CustomEmojiId,
52   pub success: bool,
53 }
54
55 #[derive(Debug, Serialize, Deserialize, Clone)]
56 #[cfg_attr(feature = "full", derive(TS))]
57 #[cfg_attr(feature = "full", ts(export))]
58 /// A response for a custom emoji.
59 pub struct CustomEmojiResponse {
60   pub custom_emoji: CustomEmojiView,
61 }