1 use crate::sensitive::Sensitive;
2 use lemmy_db_schema::newtypes::{CommunityId, PostId, PostReportId};
3 use lemmy_db_views::structs::{CommentView, PostReportView, PostView};
4 use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
5 use serde::{Deserialize, Serialize};
8 #[derive(Serialize, Deserialize, Debug)]
9 pub struct CreatePost {
11 pub community_id: CommunityId,
13 pub body: Option<String>,
14 pub honeypot: Option<String>,
15 pub nsfw: Option<bool>,
16 pub auth: Sensitive<String>,
19 #[derive(Debug, Serialize, Deserialize, Clone)]
20 pub struct PostResponse {
21 pub post_view: PostView,
24 #[derive(Debug, Serialize, Deserialize)]
27 pub auth: Option<Sensitive<String>>,
30 #[derive(Debug, Serialize, Deserialize)]
31 pub struct GetPostResponse {
32 pub post_view: PostView,
33 pub community_view: CommunityView,
34 pub comments: Vec<CommentView>,
35 pub moderators: Vec<CommunityModeratorView>,
39 #[derive(Serialize, Deserialize, Debug)]
41 pub type_: Option<String>,
42 pub sort: Option<String>,
43 pub page: Option<i64>,
44 pub limit: Option<i64>,
45 pub community_id: Option<CommunityId>,
46 pub community_name: Option<String>,
47 pub saved_only: Option<bool>,
48 pub auth: Option<Sensitive<String>>,
51 #[derive(Serialize, Deserialize, Debug)]
52 pub struct GetPostsResponse {
53 pub posts: Vec<PostView>,
56 #[derive(Debug, Serialize, Deserialize)]
57 pub struct CreatePostLike {
60 pub auth: Sensitive<String>,
63 #[derive(Debug, Serialize, Deserialize)]
66 pub name: Option<String>,
68 pub body: Option<String>,
69 pub nsfw: Option<bool>,
70 pub auth: Sensitive<String>,
73 #[derive(Debug, Serialize, Deserialize)]
74 pub struct DeletePost {
77 pub auth: Sensitive<String>,
80 #[derive(Debug, Serialize, Deserialize)]
81 pub struct RemovePost {
84 pub reason: Option<String>,
85 pub auth: Sensitive<String>,
88 #[derive(Debug, Serialize, Deserialize)]
89 pub struct MarkPostAsRead {
92 pub auth: Sensitive<String>,
95 #[derive(Debug, Serialize, Deserialize)]
99 pub auth: Sensitive<String>,
102 #[derive(Debug, Serialize, Deserialize)]
103 pub struct StickyPost {
106 pub auth: Sensitive<String>,
109 #[derive(Debug, Serialize, Deserialize)]
110 pub struct SavePost {
113 pub auth: Sensitive<String>,
116 #[derive(Debug, Serialize, Deserialize)]
117 pub struct CreatePostReport {
120 pub auth: Sensitive<String>,
123 #[derive(Debug, Serialize, Deserialize, Clone)]
124 pub struct PostReportResponse {
125 pub post_report_view: PostReportView,
128 #[derive(Debug, Serialize, Deserialize)]
129 pub struct ResolvePostReport {
130 pub report_id: PostReportId,
132 pub auth: Sensitive<String>,
135 #[derive(Debug, Serialize, 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>,
143 pub auth: Sensitive<String>,
146 #[derive(Debug, Serialize, Deserialize)]
147 pub struct ListPostReportsResponse {
148 pub post_reports: Vec<PostReportView>,
151 #[derive(Serialize, Deserialize, Debug)]
152 pub struct GetSiteMetadata {
156 #[derive(Serialize, Deserialize, Clone, Debug)]
157 pub struct GetSiteMetadataResponse {
158 pub metadata: SiteMetadata,
161 #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)]
162 pub struct SiteMetadata {
163 pub title: Option<String>,
164 pub description: Option<String>,
165 pub(crate) image: Option<Url>,
166 pub html: Option<String>,