1 use lemmy_db_schema::{CommunityId, PostId, PostReportId};
3 comment_view::CommentView,
4 post_report_view::PostReportView,
7 use lemmy_db_views_actor::{
8 community_moderator_view::CommunityModeratorView,
9 community_view::CommunityView,
11 use lemmy_utils::request::SiteMetadata;
12 use serde::{Deserialize, Serialize};
15 #[derive(Deserialize, Debug)]
16 pub struct CreatePost {
18 pub community_id: CommunityId,
20 pub body: Option<String>,
21 pub nsfw: Option<bool>,
25 #[derive(Serialize, Clone)]
26 pub struct PostResponse {
27 pub post_view: PostView,
30 #[derive(Deserialize)]
33 pub auth: Option<String>,
37 pub struct GetPostResponse {
38 pub post_view: PostView,
39 pub community_view: CommunityView,
40 pub comments: Vec<CommentView>,
41 pub moderators: Vec<CommunityModeratorView>,
45 #[derive(Deserialize, Debug)]
47 pub type_: Option<String>,
48 pub sort: Option<String>,
49 pub page: Option<i64>,
50 pub limit: Option<i64>,
51 pub community_id: Option<CommunityId>,
52 pub community_name: Option<String>,
53 pub saved_only: Option<bool>,
54 pub auth: Option<String>,
57 #[derive(Serialize, Debug)]
58 pub struct GetPostsResponse {
59 pub posts: Vec<PostView>,
62 #[derive(Deserialize)]
63 pub struct CreatePostLike {
69 #[derive(Deserialize)]
72 pub name: Option<String>,
74 pub body: Option<String>,
75 pub nsfw: Option<bool>,
79 #[derive(Deserialize)]
80 pub struct DeletePost {
86 #[derive(Deserialize)]
87 pub struct RemovePost {
90 pub reason: Option<String>,
94 #[derive(Deserialize)]
101 #[derive(Deserialize)]
102 pub struct StickyPost {
108 #[derive(Deserialize)]
109 pub struct SavePost {
115 #[derive(Deserialize)]
116 pub struct CreatePostReport {
122 #[derive(Serialize, Clone)]
123 pub struct PostReportResponse {
124 pub post_report_view: PostReportView,
127 #[derive(Deserialize)]
128 pub struct ResolvePostReport {
129 pub report_id: PostReportId,
134 #[derive(Deserialize)]
135 pub struct ListPostReports {
136 pub page: Option<i64>,
137 pub limit: Option<i64>,
138 /// Only shows the unresolved reports
139 pub unresolved_only: Option<bool>,
140 /// if no community is given, it returns reports for all communities moderated by the auth user
141 pub community_id: Option<CommunityId>,
146 pub struct ListPostReportsResponse {
147 pub post_reports: Vec<PostReportView>,
150 #[derive(Deserialize, Debug)]
151 pub struct GetSiteMetadata {
155 #[derive(Serialize, Clone, Debug)]
156 pub struct GetSiteMetadataResponse {
157 pub metadata: SiteMetadata,