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 honeypot: Option<String>,
22 pub nsfw: Option<bool>,
26 #[derive(Serialize, Clone)]
27 pub struct PostResponse {
28 pub post_view: PostView,
31 #[derive(Deserialize)]
34 pub auth: Option<String>,
38 pub struct GetPostResponse {
39 pub post_view: PostView,
40 pub community_view: CommunityView,
41 pub comments: Vec<CommentView>,
42 pub moderators: Vec<CommunityModeratorView>,
46 #[derive(Deserialize, Debug)]
48 pub type_: Option<String>,
49 pub sort: Option<String>,
50 pub page: Option<i64>,
51 pub limit: Option<i64>,
52 pub community_id: Option<CommunityId>,
53 pub community_name: Option<String>,
54 pub saved_only: Option<bool>,
55 pub auth: Option<String>,
58 #[derive(Serialize, Debug)]
59 pub struct GetPostsResponse {
60 pub posts: Vec<PostView>,
63 #[derive(Deserialize)]
64 pub struct CreatePostLike {
70 #[derive(Deserialize)]
73 pub name: Option<String>,
75 pub body: Option<String>,
76 pub nsfw: Option<bool>,
80 #[derive(Deserialize)]
81 pub struct DeletePost {
87 #[derive(Deserialize)]
88 pub struct RemovePost {
91 pub reason: Option<String>,
95 #[derive(Deserialize)]
102 #[derive(Deserialize)]
103 pub struct StickyPost {
109 #[derive(Deserialize)]
110 pub struct SavePost {
116 #[derive(Deserialize)]
117 pub struct CreatePostReport {
123 #[derive(Serialize, Clone)]
124 pub struct PostReportResponse {
125 pub post_report_view: PostReportView,
128 #[derive(Deserialize)]
129 pub struct ResolvePostReport {
130 pub report_id: PostReportId,
135 #[derive(Deserialize)]
136 pub struct ListPostReports {
137 pub page: Option<i64>,
138 pub limit: Option<i64>,
139 /// Only shows the unresolved reports
140 pub unresolved_only: Option<bool>,
141 /// if no community is given, it returns reports for all communities moderated by the auth user
142 pub community_id: Option<CommunityId>,
147 pub struct ListPostReportsResponse {
148 pub post_reports: Vec<PostReportView>,
151 #[derive(Deserialize, Debug)]
152 pub struct GetSiteMetadata {
156 #[derive(Serialize, Clone, Debug)]
157 pub struct GetSiteMetadataResponse {
158 pub metadata: SiteMetadata,