1 use crate::sensitive::Sensitive;
3 newtypes::{CommentId, CommentReportId, CommunityId, LocalUserId, PostId},
7 use lemmy_db_views::structs::{CommentReportView, CommentView};
8 use serde::{Deserialize, Serialize};
10 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
11 pub struct CreateComment {
14 pub parent_id: Option<CommentId>,
15 pub form_id: Option<String>,
16 pub auth: Sensitive<String>,
19 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
20 pub struct GetComment {
22 pub auth: Option<Sensitive<String>>,
25 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
26 pub struct EditComment {
28 pub comment_id: CommentId,
29 pub form_id: Option<String>,
30 pub auth: Sensitive<String>,
33 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
34 pub struct DeleteComment {
35 pub comment_id: CommentId,
37 pub auth: Sensitive<String>,
40 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
41 pub struct RemoveComment {
42 pub comment_id: CommentId,
44 pub reason: Option<String>,
45 pub auth: Sensitive<String>,
48 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
49 pub struct SaveComment {
50 pub comment_id: CommentId,
52 pub auth: Sensitive<String>,
55 #[derive(Debug, Serialize, Deserialize, Clone)]
56 pub struct CommentResponse {
57 pub comment_view: CommentView,
58 pub recipient_ids: Vec<LocalUserId>,
59 pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
62 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
63 pub struct CreateCommentLike {
64 pub comment_id: CommentId,
66 pub auth: Sensitive<String>,
69 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
70 pub struct GetComments {
71 pub type_: Option<ListingType>,
72 pub sort: Option<CommentSortType>,
73 pub max_depth: Option<i32>,
74 pub page: Option<i64>,
75 pub limit: Option<i64>,
76 pub community_id: Option<CommunityId>,
77 pub community_name: Option<String>,
78 pub post_id: Option<PostId>,
79 pub parent_id: Option<CommentId>,
80 pub saved_only: Option<bool>,
81 pub auth: Option<Sensitive<String>>,
84 #[derive(Debug, Serialize, Deserialize, Clone)]
85 pub struct GetCommentsResponse {
86 pub comments: Vec<CommentView>,
89 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
90 pub struct CreateCommentReport {
91 pub comment_id: CommentId,
93 pub auth: Sensitive<String>,
96 #[derive(Debug, Serialize, Deserialize, Clone)]
97 pub struct CommentReportResponse {
98 pub comment_report_view: CommentReportView,
101 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
102 pub struct ResolveCommentReport {
103 pub report_id: CommentReportId,
105 pub auth: Sensitive<String>,
108 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
109 pub struct ListCommentReports {
110 pub page: Option<i64>,
111 pub limit: Option<i64>,
112 /// Only shows the unresolved reports
113 pub unresolved_only: Option<bool>,
114 /// if no community is given, it returns reports for all communities moderated by the auth user
115 pub community_id: Option<CommunityId>,
116 pub auth: Sensitive<String>,
119 #[derive(Debug, Serialize, Deserialize, Clone)]
120 pub struct ListCommentReportsResponse {
121 pub comment_reports: Vec<CommentReportView>,