]> Untitled Git - lemmy.git/blob - server/lemmy_api_structs/src/post.rs
routes.api: fix get_captcha endpoint (#1135)
[lemmy.git] / server / lemmy_api_structs / src / post.rs
1 use lemmy_db::{
2   comment_view::CommentView,
3   community_view::{CommunityModeratorView, CommunityView},
4   post_view::PostView,
5 };
6 use serde::{Deserialize, Serialize};
7
8 #[derive(Deserialize, Debug)]
9 pub struct CreatePost {
10   pub name: String,
11   pub url: Option<String>,
12   pub body: Option<String>,
13   pub nsfw: bool,
14   pub community_id: i32,
15   pub auth: String,
16 }
17
18 #[derive(Serialize, Clone)]
19 pub struct PostResponse {
20   pub post: PostView,
21 }
22
23 #[derive(Deserialize)]
24 pub struct GetPost {
25   pub id: i32,
26   pub auth: Option<String>,
27 }
28
29 #[derive(Serialize)]
30 pub struct GetPostResponse {
31   pub post: PostView,
32   pub comments: Vec<CommentView>,
33   pub community: CommunityView,
34   pub moderators: Vec<CommunityModeratorView>,
35   pub online: usize,
36 }
37
38 #[derive(Deserialize, Debug)]
39 pub struct GetPosts {
40   pub type_: String,
41   pub sort: String,
42   pub page: Option<i64>,
43   pub limit: Option<i64>,
44   pub community_id: Option<i32>,
45   pub community_name: Option<String>,
46   pub auth: Option<String>,
47 }
48
49 #[derive(Serialize, Debug)]
50 pub struct GetPostsResponse {
51   pub posts: Vec<PostView>,
52 }
53
54 #[derive(Deserialize)]
55 pub struct CreatePostLike {
56   pub post_id: i32,
57   pub score: i16,
58   pub auth: String,
59 }
60
61 #[derive(Deserialize)]
62 pub struct EditPost {
63   pub edit_id: i32,
64   pub name: String,
65   pub url: Option<String>,
66   pub body: Option<String>,
67   pub nsfw: bool,
68   pub auth: String,
69 }
70
71 #[derive(Deserialize)]
72 pub struct DeletePost {
73   pub edit_id: i32,
74   pub deleted: bool,
75   pub auth: String,
76 }
77
78 #[derive(Deserialize)]
79 pub struct RemovePost {
80   pub edit_id: i32,
81   pub removed: bool,
82   pub reason: Option<String>,
83   pub auth: String,
84 }
85
86 #[derive(Deserialize)]
87 pub struct LockPost {
88   pub edit_id: i32,
89   pub locked: bool,
90   pub auth: String,
91 }
92
93 #[derive(Deserialize)]
94 pub struct StickyPost {
95   pub edit_id: i32,
96   pub stickied: bool,
97   pub auth: String,
98 }
99
100 #[derive(Deserialize)]
101 pub struct SavePost {
102   pub post_id: i32,
103   pub save: bool,
104   pub auth: String,
105 }