]> Untitled Git - lemmy.git/blob - lemmy_api_structs/src/comment.rs
routes.api: fix get_captcha endpoint (#1135)
[lemmy.git] / lemmy_api_structs / src / comment.rs
1 use lemmy_db::comment_view::CommentView;
2 use serde::{Deserialize, Serialize};
3
4 #[derive(Deserialize)]
5 pub struct CreateComment {
6   pub content: String,
7   pub parent_id: Option<i32>,
8   pub post_id: i32,
9   pub form_id: Option<String>,
10   pub auth: String,
11 }
12
13 #[derive(Deserialize)]
14 pub struct EditComment {
15   pub content: String,
16   pub edit_id: i32,
17   pub form_id: Option<String>,
18   pub auth: String,
19 }
20
21 #[derive(Deserialize)]
22 pub struct DeleteComment {
23   pub edit_id: i32,
24   pub deleted: bool,
25   pub auth: String,
26 }
27
28 #[derive(Deserialize)]
29 pub struct RemoveComment {
30   pub edit_id: i32,
31   pub removed: bool,
32   pub reason: Option<String>,
33   pub auth: String,
34 }
35
36 #[derive(Deserialize)]
37 pub struct MarkCommentAsRead {
38   pub edit_id: i32,
39   pub read: bool,
40   pub auth: String,
41 }
42
43 #[derive(Deserialize)]
44 pub struct SaveComment {
45   pub comment_id: i32,
46   pub save: bool,
47   pub auth: String,
48 }
49
50 #[derive(Serialize, Clone)]
51 pub struct CommentResponse {
52   pub comment: CommentView,
53   pub recipient_ids: Vec<i32>,
54   pub form_id: Option<String>,
55 }
56
57 #[derive(Deserialize)]
58 pub struct CreateCommentLike {
59   pub comment_id: i32,
60   pub score: i16,
61   pub auth: String,
62 }
63
64 #[derive(Deserialize)]
65 pub struct GetComments {
66   pub type_: String,
67   pub sort: String,
68   pub page: Option<i64>,
69   pub limit: Option<i64>,
70   pub community_id: Option<i32>,
71   pub community_name: Option<String>,
72   pub auth: Option<String>,
73 }
74
75 #[derive(Serialize)]
76 pub struct GetCommentsResponse {
77   pub comments: Vec<CommentView>,
78 }