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 {
27 pub comment_id: CommentId,
28 pub content: Option<String>,
29 pub distinguished: Option<bool>,
30 pub form_id: Option<String>,
31 pub auth: Sensitive<String>,
34 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
35 pub struct DeleteComment {
36 pub comment_id: CommentId,
38 pub auth: Sensitive<String>,
41 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
42 pub struct RemoveComment {
43 pub comment_id: CommentId,
45 pub reason: Option<String>,
46 pub auth: Sensitive<String>,
49 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
50 pub struct SaveComment {
51 pub comment_id: CommentId,
53 pub auth: Sensitive<String>,
56 #[derive(Debug, Serialize, Deserialize, Clone)]
57 pub struct CommentResponse {
58 pub comment_view: CommentView,
59 pub recipient_ids: Vec<LocalUserId>,
60 pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
63 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
64 pub struct CreateCommentLike {
65 pub comment_id: CommentId,
67 pub auth: Sensitive<String>,
70 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
71 pub struct GetComments {
72 pub type_: Option<ListingType>,
73 pub sort: Option<CommentSortType>,
74 pub max_depth: Option<i32>,
75 pub page: Option<i64>,
76 pub limit: Option<i64>,
77 pub community_id: Option<CommunityId>,
78 pub community_name: Option<String>,
79 pub post_id: Option<PostId>,
80 pub parent_id: Option<CommentId>,
81 pub saved_only: Option<bool>,
82 pub auth: Option<Sensitive<String>>,
85 #[derive(Debug, Serialize, Deserialize, Clone)]
86 pub struct GetCommentsResponse {
87 pub comments: Vec<CommentView>,
90 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
91 pub struct CreateCommentReport {
92 pub comment_id: CommentId,
94 pub auth: Sensitive<String>,
97 #[derive(Debug, Serialize, Deserialize, Clone)]
98 pub struct CommentReportResponse {
99 pub comment_report_view: CommentReportView,
102 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
103 pub struct ResolveCommentReport {
104 pub report_id: CommentReportId,
106 pub auth: Sensitive<String>,
109 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
110 pub struct ListCommentReports {
111 pub page: Option<i64>,
112 pub limit: Option<i64>,
113 /// Only shows the unresolved reports
114 pub unresolved_only: Option<bool>,
115 /// if no community is given, it returns reports for all communities moderated by the auth user
116 pub community_id: Option<CommunityId>,
117 pub auth: Sensitive<String>,
120 #[derive(Debug, Serialize, Deserialize, Clone)]
121 pub struct ListCommentReportsResponse {
122 pub comment_reports: Vec<CommentReportView>,