1 use lemmy_db_schema::source::user::UserSafeSettings;
2 use lemmy_db_views::{comment_view::CommentView, post_view::PostView, site_view::SiteView};
3 use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
4 use lemmy_db_views_moderator::{
5 mod_add_community_view::ModAddCommunityView,
6 mod_add_view::ModAddView,
7 mod_ban_from_community_view::ModBanFromCommunityView,
8 mod_ban_view::ModBanView,
9 mod_lock_post_view::ModLockPostView,
10 mod_remove_comment_view::ModRemoveCommentView,
11 mod_remove_community_view::ModRemoveCommunityView,
12 mod_remove_post_view::ModRemovePostView,
13 mod_sticky_post_view::ModStickyPostView,
15 use serde::{Deserialize, Serialize};
18 #[derive(Deserialize, Debug)]
22 pub community_id: Option<i32>,
23 pub community_name: Option<String>,
25 pub page: Option<i64>,
26 pub limit: Option<i64>,
27 pub auth: Option<String>,
30 #[derive(Serialize, Debug)]
31 pub struct SearchResponse {
33 pub comments: Vec<CommentView>,
34 pub posts: Vec<PostView>,
35 pub communities: Vec<CommunityView>,
36 pub users: Vec<UserViewSafe>,
39 #[derive(Deserialize)]
40 pub struct GetModlog {
41 pub mod_user_id: Option<i32>,
42 pub community_id: Option<i32>,
43 pub page: Option<i64>,
44 pub limit: Option<i64>,
48 pub struct GetModlogResponse {
49 pub removed_posts: Vec<ModRemovePostView>,
50 pub locked_posts: Vec<ModLockPostView>,
51 pub stickied_posts: Vec<ModStickyPostView>,
52 pub removed_comments: Vec<ModRemoveCommentView>,
53 pub removed_communities: Vec<ModRemoveCommunityView>,
54 pub banned_from_community: Vec<ModBanFromCommunityView>,
55 pub banned: Vec<ModBanView>,
56 pub added_to_community: Vec<ModAddCommunityView>,
57 pub added: Vec<ModAddView>,
60 #[derive(Deserialize)]
61 pub struct CreateSite {
63 pub description: Option<String>,
64 pub icon: Option<Url>,
65 pub banner: Option<Url>,
66 pub enable_downvotes: bool,
67 pub open_registration: bool,
68 pub enable_nsfw: bool,
72 #[derive(Deserialize)]
75 pub description: Option<String>,
76 pub icon: Option<String>,
77 pub banner: Option<String>,
78 pub enable_downvotes: bool,
79 pub open_registration: bool,
80 pub enable_nsfw: bool,
84 #[derive(Deserialize)]
86 pub auth: Option<String>,
89 #[derive(Serialize, Clone)]
90 pub struct SiteResponse {
91 pub site_view: SiteView,
95 pub struct GetSiteResponse {
96 pub site_view: Option<SiteView>, // Because the site might not be set up yet
97 pub admins: Vec<UserViewSafe>,
98 pub banned: Vec<UserViewSafe>,
101 pub my_user: Option<UserSafeSettings>,
102 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
105 #[derive(Deserialize)]
106 pub struct TransferSite {
111 #[derive(Deserialize)]
112 pub struct GetSiteConfig {
117 pub struct GetSiteConfigResponse {
118 pub config_hjson: String,
121 #[derive(Deserialize)]
122 pub struct SaveSiteConfig {
123 pub config_hjson: String,
128 pub struct FederatedInstances {
129 pub linked: Vec<String>,
130 pub allowed: Option<Vec<String>>,
131 pub blocked: Option<Vec<String>>,