1 use crate::sensitive::Sensitive;
3 newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PostId, PostReportId},
7 use lemmy_db_views::structs::{PostReportView, PostView};
8 use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
9 use serde::{Deserialize, Serialize};
12 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
13 pub struct CreatePost {
15 pub community_id: CommunityId,
17 pub body: Option<String>,
18 pub honeypot: Option<String>,
19 pub nsfw: Option<bool>,
20 pub language_id: Option<LanguageId>,
21 pub auth: Sensitive<String>,
24 #[derive(Debug, Serialize, Deserialize, Clone)]
25 pub struct PostResponse {
26 pub post_view: PostView,
29 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
31 pub id: Option<PostId>,
32 pub comment_id: Option<CommentId>,
33 pub auth: Option<Sensitive<String>>,
36 #[derive(Debug, Serialize, Deserialize, Clone)]
37 pub struct GetPostResponse {
38 pub post_view: PostView,
39 pub community_view: CommunityView,
40 pub moderators: Vec<CommunityModeratorView>,
44 #[derive(Serialize, Deserialize, Debug, Clone, Default)]
46 pub type_: Option<ListingType>,
47 pub sort: Option<SortType>,
48 pub page: Option<i64>,
49 pub limit: Option<i64>,
50 pub community_id: Option<CommunityId>,
51 pub community_name: Option<String>,
52 pub saved_only: Option<bool>,
53 pub auth: Option<Sensitive<String>>,
56 #[derive(Serialize, Deserialize, Debug, Clone)]
57 pub struct GetPostsResponse {
58 pub posts: Vec<PostView>,
61 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
62 pub struct CreatePostLike {
65 pub auth: Sensitive<String>,
68 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
71 pub name: Option<String>,
73 pub body: Option<String>,
74 pub nsfw: Option<bool>,
75 pub language_id: Option<LanguageId>,
76 pub auth: Sensitive<String>,
79 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
80 pub struct DeletePost {
83 pub auth: Sensitive<String>,
86 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
87 pub struct RemovePost {
90 pub reason: Option<String>,
91 pub auth: Sensitive<String>,
94 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
95 pub struct MarkPostAsRead {
98 pub auth: Sensitive<String>,
101 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
102 pub struct LockPost {
105 pub auth: Sensitive<String>,
108 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
109 pub struct StickyPost {
112 pub auth: Sensitive<String>,
115 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
116 pub struct SavePost {
119 pub auth: Sensitive<String>,
122 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
123 pub struct CreatePostReport {
126 pub auth: Sensitive<String>,
129 #[derive(Debug, Serialize, Deserialize, Clone)]
130 pub struct PostReportResponse {
131 pub post_report_view: PostReportView,
134 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
135 pub struct ResolvePostReport {
136 pub report_id: PostReportId,
138 pub auth: Sensitive<String>,
141 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
142 pub struct ListPostReports {
143 pub page: Option<i64>,
144 pub limit: Option<i64>,
145 /// Only shows the unresolved reports
146 pub unresolved_only: Option<bool>,
147 /// if no community is given, it returns reports for all communities moderated by the auth user
148 pub community_id: Option<CommunityId>,
149 pub auth: Sensitive<String>,
152 #[derive(Debug, Serialize, Deserialize, Clone)]
153 pub struct ListPostReportsResponse {
154 pub post_reports: Vec<PostReportView>,
157 #[derive(Debug, Serialize, Deserialize, Clone)]
158 pub struct GetSiteMetadata {
162 #[derive(Debug, Serialize, Deserialize, Clone)]
163 pub struct GetSiteMetadataResponse {
164 pub metadata: SiteMetadata,
167 #[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
168 pub struct SiteMetadata {
169 pub title: Option<String>,
170 pub description: Option<String>,
171 pub(crate) image: Option<DbUrl>,
172 pub embed_video_url: Option<DbUrl>,