1 use crate::sensitive::Sensitive;
3 newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PostId, PostReportId},
8 use lemmy_db_views::structs::{PostReportView, PostView};
9 use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
10 use serde::{Deserialize, Serialize};
13 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
14 pub struct CreatePost {
16 pub community_id: CommunityId,
18 pub body: Option<String>,
19 pub honeypot: Option<String>,
20 pub nsfw: Option<bool>,
21 pub language_id: Option<LanguageId>,
22 pub auth: Sensitive<String>,
25 #[derive(Debug, Serialize, Deserialize, Clone)]
26 pub struct PostResponse {
27 pub post_view: PostView,
30 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
32 pub id: Option<PostId>,
33 pub comment_id: Option<CommentId>,
34 pub auth: Option<Sensitive<String>>,
37 #[derive(Debug, Serialize, Deserialize, Clone)]
38 pub struct GetPostResponse {
39 pub post_view: PostView,
40 pub community_view: CommunityView,
41 pub moderators: Vec<CommunityModeratorView>,
45 #[derive(Serialize, Deserialize, Debug, Clone, Default)]
47 pub type_: Option<ListingType>,
48 pub sort: Option<SortType>,
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<Sensitive<String>>,
57 #[derive(Serialize, Deserialize, Debug, Clone)]
58 pub struct GetPostsResponse {
59 pub posts: Vec<PostView>,
62 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
63 pub struct CreatePostLike {
66 pub auth: Sensitive<String>,
69 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
72 pub name: Option<String>,
74 pub body: Option<String>,
75 pub nsfw: Option<bool>,
76 pub language_id: Option<LanguageId>,
77 pub auth: Sensitive<String>,
80 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
81 pub struct DeletePost {
84 pub auth: Sensitive<String>,
87 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
88 pub struct RemovePost {
91 pub reason: Option<String>,
92 pub auth: Sensitive<String>,
95 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
96 pub struct MarkPostAsRead {
99 pub auth: Sensitive<String>,
102 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
103 pub struct LockPost {
106 pub auth: Sensitive<String>,
109 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
110 pub struct FeaturePost {
113 pub feature_type: PostFeatureType,
114 pub auth: Sensitive<String>,
117 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
118 pub struct SavePost {
121 pub auth: Sensitive<String>,
124 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
125 pub struct CreatePostReport {
128 pub auth: Sensitive<String>,
131 #[derive(Debug, Serialize, Deserialize, Clone)]
132 pub struct PostReportResponse {
133 pub post_report_view: PostReportView,
136 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
137 pub struct ResolvePostReport {
138 pub report_id: PostReportId,
140 pub auth: Sensitive<String>,
143 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
144 pub struct ListPostReports {
145 pub page: Option<i64>,
146 pub limit: Option<i64>,
147 /// Only shows the unresolved reports
148 pub unresolved_only: Option<bool>,
149 /// if no community is given, it returns reports for all communities moderated by the auth user
150 pub community_id: Option<CommunityId>,
151 pub auth: Sensitive<String>,
154 #[derive(Debug, Serialize, Deserialize, Clone)]
155 pub struct ListPostReportsResponse {
156 pub post_reports: Vec<PostReportView>,
159 #[derive(Debug, Serialize, Deserialize, Clone)]
160 pub struct GetSiteMetadata {
164 #[derive(Debug, Serialize, Deserialize, Clone)]
165 pub struct GetSiteMetadataResponse {
166 pub metadata: SiteMetadata,
169 #[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
170 pub struct SiteMetadata {
171 pub title: Option<String>,
172 pub description: Option<String>,
173 pub(crate) image: Option<DbUrl>,
174 pub embed_video_url: Option<DbUrl>,