1 use lemmy_db_schema::{CommunityId, PersonId};
3 comment_view::CommentView,
4 local_user_view::LocalUserSettingsView,
8 use lemmy_db_views_actor::{
9 community_block_view::CommunityBlockView,
10 community_follower_view::CommunityFollowerView,
11 community_moderator_view::CommunityModeratorView,
12 community_view::CommunityView,
13 person_block_view::PersonBlockView,
14 person_view::PersonViewSafe,
16 use lemmy_db_views_moderator::{
17 mod_add_community_view::ModAddCommunityView,
18 mod_add_view::ModAddView,
19 mod_ban_from_community_view::ModBanFromCommunityView,
20 mod_ban_view::ModBanView,
21 mod_lock_post_view::ModLockPostView,
22 mod_remove_comment_view::ModRemoveCommentView,
23 mod_remove_community_view::ModRemoveCommunityView,
24 mod_remove_post_view::ModRemovePostView,
25 mod_sticky_post_view::ModStickyPostView,
26 mod_transfer_community_view::ModTransferCommunityView,
28 use serde::{Deserialize, Serialize};
30 #[derive(Deserialize, Debug)]
33 pub community_id: Option<CommunityId>,
34 pub community_name: Option<String>,
35 pub creator_id: Option<PersonId>,
36 pub type_: Option<String>,
37 pub sort: Option<String>,
38 pub listing_type: Option<String>,
39 pub page: Option<i64>,
40 pub limit: Option<i64>,
41 pub auth: Option<String>,
44 #[derive(Serialize, Debug)]
45 pub struct SearchResponse {
47 pub comments: Vec<CommentView>,
48 pub posts: Vec<PostView>,
49 pub communities: Vec<CommunityView>,
50 pub users: Vec<PersonViewSafe>,
53 #[derive(Deserialize, Debug)]
54 pub struct ResolveObject {
56 pub auth: Option<String>,
59 #[derive(Serialize, Debug)]
60 pub enum ResolveObjectResponse {
63 Community(CommunityView),
64 Person(PersonViewSafe),
67 #[derive(Deserialize)]
68 pub struct GetModlog {
69 pub mod_person_id: Option<PersonId>,
70 pub community_id: Option<CommunityId>,
71 pub page: Option<i64>,
72 pub limit: Option<i64>,
76 pub struct GetModlogResponse {
77 pub removed_posts: Vec<ModRemovePostView>,
78 pub locked_posts: Vec<ModLockPostView>,
79 pub stickied_posts: Vec<ModStickyPostView>,
80 pub removed_comments: Vec<ModRemoveCommentView>,
81 pub removed_communities: Vec<ModRemoveCommunityView>,
82 pub banned_from_community: Vec<ModBanFromCommunityView>,
83 pub banned: Vec<ModBanView>,
84 pub added_to_community: Vec<ModAddCommunityView>,
85 pub transferred_to_community: Vec<ModTransferCommunityView>,
86 pub added: Vec<ModAddView>,
89 #[derive(Deserialize)]
90 pub struct CreateSite {
92 pub sidebar: Option<String>,
93 pub description: Option<String>,
94 pub icon: Option<String>,
95 pub banner: Option<String>,
96 pub enable_downvotes: Option<bool>,
97 pub open_registration: Option<bool>,
98 pub enable_nsfw: Option<bool>,
99 pub community_creation_admin_only: Option<bool>,
103 #[derive(Deserialize)]
104 pub struct EditSite {
105 pub name: Option<String>,
106 pub sidebar: Option<String>,
107 pub description: Option<String>,
108 pub icon: Option<String>,
109 pub banner: Option<String>,
110 pub enable_downvotes: Option<bool>,
111 pub open_registration: Option<bool>,
112 pub enable_nsfw: Option<bool>,
113 pub community_creation_admin_only: Option<bool>,
117 #[derive(Deserialize)]
119 pub auth: Option<String>,
122 #[derive(Serialize, Clone)]
123 pub struct SiteResponse {
124 pub site_view: SiteView,
128 pub struct GetSiteResponse {
129 pub site_view: Option<SiteView>, // Because the site might not be set up yet
130 pub admins: Vec<PersonViewSafe>,
131 pub banned: Vec<PersonViewSafe>,
134 pub my_user: Option<MyUserInfo>,
135 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
139 pub struct MyUserInfo {
140 pub local_user_view: LocalUserSettingsView,
141 pub follows: Vec<CommunityFollowerView>,
142 pub moderates: Vec<CommunityModeratorView>,
143 pub community_blocks: Vec<CommunityBlockView>,
144 pub person_blocks: Vec<PersonBlockView>,
147 #[derive(Deserialize)]
148 pub struct TransferSite {
149 pub person_id: PersonId,
153 #[derive(Deserialize)]
154 pub struct GetSiteConfig {
159 pub struct GetSiteConfigResponse {
160 pub config_hjson: String,
163 #[derive(Deserialize)]
164 pub struct SaveSiteConfig {
165 pub config_hjson: String,
170 pub struct FederatedInstances {
171 pub linked: Vec<String>,
172 pub allowed: Option<Vec<String>>,
173 pub blocked: Option<Vec<String>>,