2022-05-06 20:55:07 +00:00
|
|
|
use lemmy_db_schema::{
|
2022-08-18 19:11:19 +00:00
|
|
|
newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PostId, PostReportId},
|
2022-05-06 20:55:07 +00:00
|
|
|
ListingType,
|
2022-12-12 11:17:10 +00:00
|
|
|
PostFeatureType,
|
2024-09-19 08:03:58 +00:00
|
|
|
PostSortType,
|
2022-05-06 20:55:07 +00:00
|
|
|
};
|
2024-01-03 18:39:21 +00:00
|
|
|
use lemmy_db_views::structs::{PaginationCursor, PostReportView, PostView, VoteView};
|
2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
|
2020-09-01 14:25:34 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 04:26:10 +00:00
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2020-09-01 14:25:34 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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 post.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CreatePost {
|
|
|
|
pub name: String,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub community_id: CommunityId,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-06-06 13:55:08 +00:00
|
|
|
pub url: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// An optional body for the post in markdown.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub body: Option<String>,
|
2024-03-05 10:34:57 +00:00
|
|
|
/// An optional alt_text, usable for image posts.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-03-05 10:34:57 +00:00
|
|
|
pub alt_text: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A honeypot to catch bots. Should be None.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-10-01 11:37:39 +00:00
|
|
|
pub honeypot: Option<String>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-04-15 03:37:51 +00:00
|
|
|
pub nsfw: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-08-18 19:11:19 +00:00
|
|
|
pub language_id: Option<LanguageId>,
|
2024-02-15 09:42:23 +00:00
|
|
|
/// Instead of fetching a thumbnail, use a custom one.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-06-06 13:55:08 +00:00
|
|
|
pub custom_thumbnail: Option<String>,
|
2024-09-24 09:39:40 +00:00
|
|
|
/// Time when this post should be scheduled. Null means publish immediately.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-09-24 09:39:40 +00:00
|
|
|
pub scheduled_publish_time: Option<i64>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2021-12-06 14:54:47 +00:00
|
|
|
#[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))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PostResponse {
|
2020-12-11 15:27:33 +00:00
|
|
|
pub post_view: PostView,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2024-11-06 14:50:13 +00:00
|
|
|
// TODO this should be made into a tagged enum
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Get a post. Needs either the post id, or comment_id.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetPost {
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-07-30 03:55:59 +00:00
|
|
|
pub id: Option<PostId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-07-30 03:55:59 +00:00
|
|
|
pub comment_id: Option<CommentId>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-10-23 16:40:29 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[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
|
|
|
/// The post response.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetPostResponse {
|
2020-12-11 15:27:33 +00:00
|
|
|
pub post_view: PostView,
|
2020-12-23 21:56:20 +00:00
|
|
|
pub community_view: CommunityView,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub moderators: Vec<CommunityModeratorView>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of cross-posts, or other times / communities this link has been posted to.
|
2023-04-19 20:16:19 +00:00
|
|
|
pub cross_posts: Vec<PostView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Get a list of posts.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetPosts {
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-05-06 20:55:07 +00:00
|
|
|
pub type_: Option<ListingType>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-09-19 08:03:58 +00:00
|
|
|
pub sort: Option<PostSortType>,
|
2023-09-18 13:44:48 +00:00
|
|
|
/// DEPRECATED, use page_cursor
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub limit: Option<i64>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-03-18 20:25:21 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub community_name: Option<String>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-04-15 03:37:51 +00:00
|
|
|
pub saved_only: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2023-08-08 09:40:28 +00:00
|
|
|
pub liked_only: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2023-08-08 09:40:28 +00:00
|
|
|
pub disliked_only: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-02-29 15:42:34 +00:00
|
|
|
pub show_hidden: Option<bool>,
|
2024-06-21 21:39:40 +00:00
|
|
|
/// If true, then show the read posts (even if your user setting is to hide them)
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-06-21 21:39:40 +00:00
|
|
|
pub show_read: Option<bool>,
|
2024-07-09 17:44:23 +00:00
|
|
|
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-07-09 17:44:23 +00:00
|
|
|
pub show_nsfw: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-11-05 17:09:25 +00:00
|
|
|
/// If true, then only show posts with no comments
|
|
|
|
pub no_comments_only: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2023-09-18 13:44:48 +00:00
|
|
|
pub page_cursor: Option<PaginationCursor>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-09-20 09:49:26 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Serialize, Deserialize, Debug, 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
|
|
|
/// The post list response.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetPostsResponse {
|
|
|
|
pub posts: Vec<PostView>,
|
2023-09-18 13:44:48 +00:00
|
|
|
/// the pagination cursor to use to fetch the next page
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2023-09-18 13:44:48 +00:00
|
|
|
pub next_page: Option<PaginationCursor>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Like a post.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CreatePostLike {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Score must be -1, 0, or 1.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub score: i16,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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 post.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct EditPost {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-04-15 03:37:51 +00:00
|
|
|
pub name: Option<String>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-06-06 13:55:08 +00:00
|
|
|
pub url: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// An optional body for the post in markdown.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub body: Option<String>,
|
2024-03-05 10:34:57 +00:00
|
|
|
/// An optional alt_text, usable for image posts.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-03-05 10:34:57 +00:00
|
|
|
pub alt_text: Option<String>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-04-15 03:37:51 +00:00
|
|
|
pub nsfw: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-08-18 19:11:19 +00:00
|
|
|
pub language_id: Option<LanguageId>,
|
2024-02-15 09:42:23 +00:00
|
|
|
/// Instead of fetching a thumbnail, use a custom one.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-06-06 13:55:08 +00:00
|
|
|
pub custom_thumbnail: Option<String>,
|
2024-09-24 09:39:40 +00:00
|
|
|
/// Time when this post should be scheduled. Null means publish immediately.
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-09-24 09:39:40 +00:00
|
|
|
pub scheduled_publish_time: Option<i64>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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 post.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct DeletePost {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub deleted: bool,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Remove a post (only doable by mods).
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct RemovePost {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub removed: bool,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
}
|
|
|
|
|
2023-10-20 00:16:23 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Mark a post as read.
|
2021-11-23 14:15:43 +00:00
|
|
|
pub struct MarkPostAsRead {
|
2024-11-13 14:36:18 +00:00
|
|
|
pub post_id: PostId,
|
2021-11-23 14:15:43 +00:00
|
|
|
pub read: bool,
|
|
|
|
}
|
|
|
|
|
2024-02-29 15:42:34 +00:00
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// Hide a post from list views
|
|
|
|
pub struct HidePost {
|
2024-11-13 14:36:18 +00:00
|
|
|
pub post_id: PostId,
|
2024-02-29 15:42:34 +00:00
|
|
|
pub hide: bool,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Lock a post (prevent new comments).
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct LockPost {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub locked: bool,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Feature a post (stickies / pins to the top).
|
2022-12-12 11:17:10 +00:00
|
|
|
pub struct FeaturePost {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2022-12-12 11:17:10 +00:00
|
|
|
pub featured: bool,
|
|
|
|
pub feature_type: PostFeatureType,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Save / bookmark a post.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SavePost {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub save: bool,
|
|
|
|
}
|
2020-09-15 19:26:47 +00:00
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[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
|
|
|
/// Create a post report.
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct CreatePostReport {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub post_id: PostId,
|
2020-10-25 02:59:13 +00:00
|
|
|
pub reason: String,
|
|
|
|
}
|
|
|
|
|
2021-12-06 14:54:47 +00:00
|
|
|
#[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
|
|
|
/// The post report response.
|
2021-09-28 10:36:17 +00:00
|
|
|
pub struct PostReportResponse {
|
|
|
|
pub post_report_view: PostReportView,
|
2020-10-25 02:59:13 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Resolve a post report (mods only).
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct ResolvePostReport {
|
2021-09-28 10:36:17 +00:00
|
|
|
pub report_id: PostReportId,
|
2020-10-25 02:59:13 +00:00
|
|
|
pub resolved: bool,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// List post reports.
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct ListPostReports {
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-10-25 02:59:13 +00:00
|
|
|
pub page: Option<i64>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2020-10-25 02:59:13 +00:00
|
|
|
pub limit: Option<i64>,
|
2021-09-28 10:36:17 +00:00
|
|
|
/// Only shows the unresolved reports
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-09-28 10:36:17 +00:00
|
|
|
pub unresolved_only: Option<bool>,
|
2024-11-06 14:50:13 +00:00
|
|
|
// TODO make into tagged enum at some point
|
2021-09-28 10:36:17 +00:00
|
|
|
/// if no community is given, it returns reports for all communities moderated by the auth user
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2021-09-28 10:36:17 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-03-05 10:31:40 +00:00
|
|
|
pub post_id: Option<PostId>,
|
2020-10-25 02:59:13 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[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
|
|
|
/// The post reports response.
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct ListPostReportsResponse {
|
2021-09-28 10:36:17 +00:00
|
|
|
pub post_reports: Vec<PostReportView>,
|
2020-10-25 02:59:13 +00:00
|
|
|
}
|
2021-08-19 14:12:49 +00:00
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Get metadata for a given site.
|
2021-08-19 14:12:49 +00:00
|
|
|
pub struct GetSiteMetadata {
|
2024-06-06 13:55:08 +00:00
|
|
|
pub url: String,
|
2021-08-19 14:12:49 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[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
|
|
|
/// The site metadata response.
|
2021-08-19 14:12:49 +00:00
|
|
|
pub struct GetSiteMetadataResponse {
|
2024-01-25 14:22:11 +00:00
|
|
|
pub metadata: LinkMetadata,
|
2021-08-19 14:12:49 +00:00
|
|
|
}
|
2022-05-03 17:44:13 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
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
|
|
|
/// Site metadata, from its opengraph tags.
|
2024-01-25 14:22:11 +00:00
|
|
|
pub struct LinkMetadata {
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub opengraph_data: OpenGraphData,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-01-25 14:22:11 +00:00
|
|
|
pub content_type: Option<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
2024-01-25 14:22:11 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// Site metadata, from its opengraph tags.
|
|
|
|
pub struct OpenGraphData {
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub title: Option<String>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub description: Option<String>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-06-02 21:44:47 +00:00
|
|
|
pub(crate) image: Option<DbUrl>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-06-02 21:44:47 +00:00
|
|
|
pub embed_video_url: Option<DbUrl>,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
2024-01-03 18:39:21 +00:00
|
|
|
|
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
2024-01-03 18:39:21 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// List post likes. Admins-only.
|
|
|
|
pub struct ListPostLikes {
|
|
|
|
pub post_id: PostId,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-01-03 18:39:21 +00:00
|
|
|
pub page: Option<i64>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-01-03 18:39:21 +00:00
|
|
|
pub limit: Option<i64>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// The post likes response
|
|
|
|
pub struct ListPostLikesResponse {
|
|
|
|
pub post_likes: Vec<VoteView>,
|
|
|
|
}
|