]> Untitled Git - lemmy.git/blob - lemmy_api_structs/src/site.rs
Isomorphic docker (#1124)
[lemmy.git] / lemmy_api_structs / src / site.rs
1 use lemmy_db::{
2   category::*,
3   comment_view::*,
4   community_view::*,
5   moderator_views::*,
6   post_view::*,
7   site_view::*,
8   user::*,
9   user_view::*,
10 };
11 use serde::{Deserialize, Serialize};
12
13 #[derive(Deserialize)]
14 pub struct ListCategories {}
15
16 #[derive(Serialize)]
17 pub struct ListCategoriesResponse {
18   pub categories: Vec<Category>,
19 }
20
21 #[derive(Deserialize, Debug)]
22 pub struct Search {
23   pub q: String,
24   pub type_: String,
25   pub community_id: Option<i32>,
26   pub sort: String,
27   pub page: Option<i64>,
28   pub limit: Option<i64>,
29   pub auth: Option<String>,
30 }
31
32 #[derive(Serialize, Debug)]
33 pub struct SearchResponse {
34   pub type_: String,
35   pub comments: Vec<CommentView>,
36   pub posts: Vec<PostView>,
37   pub communities: Vec<CommunityView>,
38   pub users: Vec<UserView>,
39 }
40
41 #[derive(Deserialize)]
42 pub struct GetModlog {
43   pub mod_user_id: Option<i32>,
44   pub community_id: Option<i32>,
45   pub page: Option<i64>,
46   pub limit: Option<i64>,
47 }
48
49 #[derive(Serialize)]
50 pub struct GetModlogResponse {
51   pub removed_posts: Vec<ModRemovePostView>,
52   pub locked_posts: Vec<ModLockPostView>,
53   pub stickied_posts: Vec<ModStickyPostView>,
54   pub removed_comments: Vec<ModRemoveCommentView>,
55   pub removed_communities: Vec<ModRemoveCommunityView>,
56   pub banned_from_community: Vec<ModBanFromCommunityView>,
57   pub banned: Vec<ModBanView>,
58   pub added_to_community: Vec<ModAddCommunityView>,
59   pub added: Vec<ModAddView>,
60 }
61
62 #[derive(Deserialize)]
63 pub struct CreateSite {
64   pub name: String,
65   pub description: Option<String>,
66   pub icon: Option<String>,
67   pub banner: Option<String>,
68   pub enable_downvotes: bool,
69   pub open_registration: bool,
70   pub enable_nsfw: bool,
71   pub auth: String,
72 }
73
74 #[derive(Deserialize)]
75 pub struct EditSite {
76   pub name: String,
77   pub description: Option<String>,
78   pub icon: Option<String>,
79   pub banner: Option<String>,
80   pub enable_downvotes: bool,
81   pub open_registration: bool,
82   pub enable_nsfw: bool,
83   pub auth: String,
84 }
85
86 #[derive(Deserialize)]
87 pub struct GetSite {
88   pub auth: Option<String>,
89 }
90
91 #[derive(Serialize, Clone)]
92 pub struct SiteResponse {
93   pub site: SiteView,
94 }
95
96 #[derive(Serialize)]
97 pub struct GetSiteResponse {
98   pub site: Option<SiteView>,
99   pub admins: Vec<UserView>,
100   pub banned: Vec<UserView>,
101   pub online: usize,
102   pub version: String,
103   pub my_user: Option<User_>,
104   pub federated_instances: Vec<String>,
105 }
106
107 #[derive(Deserialize)]
108 pub struct TransferSite {
109   pub user_id: i32,
110   pub auth: String,
111 }
112
113 #[derive(Deserialize)]
114 pub struct GetSiteConfig {
115   pub auth: String,
116 }
117
118 #[derive(Serialize)]
119 pub struct GetSiteConfigResponse {
120   pub config_hjson: String,
121 }
122
123 #[derive(Deserialize)]
124 pub struct SaveSiteConfig {
125   pub config_hjson: String,
126   pub auth: String,
127 }