1 use crate::sensitive::Sensitive;
3 newtypes::{CommunityId, PostId, PostReportId},
7 use lemmy_db_views::structs::{CommentView, 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 auth: Sensitive<String>,
23 #[derive(Debug, Serialize, Deserialize, Clone)]
24 pub struct PostResponse {
25 pub post_view: PostView,
28 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
31 pub auth: Option<Sensitive<String>>,
34 #[derive(Debug, Serialize, Deserialize, Clone)]
35 pub struct GetPostResponse {
36 pub post_view: PostView,
37 pub community_view: CommunityView,
38 pub comments: Vec<CommentView>,
39 pub moderators: Vec<CommunityModeratorView>,
43 #[derive(Serialize, Deserialize, Debug, Clone, Default)]
45 pub type_: Option<ListingType>,
46 pub sort: Option<SortType>,
47 pub page: Option<i64>,
48 pub limit: Option<i64>,
49 pub community_id: Option<CommunityId>,
50 pub community_name: Option<String>,
51 pub saved_only: Option<bool>,
52 pub auth: Option<Sensitive<String>>,
55 #[derive(Serialize, Deserialize, Debug, Clone)]
56 pub struct GetPostsResponse {
57 pub posts: Vec<PostView>,
60 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
61 pub struct CreatePostLike {
64 pub auth: Sensitive<String>,
67 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
70 pub name: Option<String>,
72 pub body: Option<String>,
73 pub nsfw: Option<bool>,
74 pub auth: Sensitive<String>,
77 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
78 pub struct DeletePost {
81 pub auth: Sensitive<String>,
84 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
85 pub struct RemovePost {
88 pub reason: Option<String>,
89 pub auth: Sensitive<String>,
92 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
93 pub struct MarkPostAsRead {
96 pub auth: Sensitive<String>,
99 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
100 pub struct LockPost {
103 pub auth: Sensitive<String>,
106 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
107 pub struct StickyPost {
110 pub auth: Sensitive<String>,
113 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
114 pub struct SavePost {
117 pub auth: Sensitive<String>,
120 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
121 pub struct CreatePostReport {
124 pub auth: Sensitive<String>,
127 #[derive(Debug, Serialize, Deserialize, Clone)]
128 pub struct PostReportResponse {
129 pub post_report_view: PostReportView,
132 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
133 pub struct ResolvePostReport {
134 pub report_id: PostReportId,
136 pub auth: Sensitive<String>,
139 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
140 pub struct ListPostReports {
141 pub page: Option<i64>,
142 pub limit: Option<i64>,
143 /// Only shows the unresolved reports
144 pub unresolved_only: Option<bool>,
145 /// if no community is given, it returns reports for all communities moderated by the auth user
146 pub community_id: Option<CommunityId>,
147 pub auth: Sensitive<String>,
150 #[derive(Debug, Serialize, Deserialize, Clone)]
151 pub struct ListPostReportsResponse {
152 pub post_reports: Vec<PostReportView>,
155 #[derive(Debug, Serialize, Deserialize, Clone)]
156 pub struct GetSiteMetadata {
160 #[derive(Debug, Serialize, Deserialize, Clone)]
161 pub struct GetSiteMetadataResponse {
162 pub metadata: SiteMetadata,
165 #[derive(Debug, Deserialize, Serialize, PartialEq, Clone)]
166 pub struct SiteMetadata {
167 pub title: Option<String>,
168 pub description: Option<String>,
169 pub(crate) image: Option<Url>,
170 pub html: Option<String>,