1 use crate::sensitive::Sensitive;
3 newtypes::{CommunityId, PersonId},
8 use lemmy_db_views::structs::{
10 LocalUserSettingsView,
12 RegistrationApplicationView,
15 use lemmy_db_views_actor::structs::{
17 CommunityFollowerView,
18 CommunityModeratorView,
23 use lemmy_db_views_moderator::structs::{
26 ModBanFromCommunityView,
31 ModRemoveCommunityView,
34 ModTransferCommunityView,
36 use serde::{Deserialize, Serialize};
38 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
41 pub community_id: Option<CommunityId>,
42 pub community_name: Option<String>,
43 pub creator_id: Option<PersonId>,
44 pub type_: Option<SearchType>,
45 pub sort: Option<SortType>,
46 pub listing_type: Option<ListingType>,
47 pub page: Option<i64>,
48 pub limit: Option<i64>,
49 pub auth: Option<Sensitive<String>>,
52 #[derive(Debug, Serialize, Deserialize, Clone)]
53 pub struct SearchResponse {
55 pub comments: Vec<CommentView>,
56 pub posts: Vec<PostView>,
57 pub communities: Vec<CommunityView>,
58 pub users: Vec<PersonViewSafe>,
61 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
62 pub struct ResolveObject {
64 pub auth: Option<Sensitive<String>>,
67 #[derive(Debug, Serialize, Deserialize, Default)]
68 pub struct ResolveObjectResponse {
69 pub comment: Option<CommentView>,
70 pub post: Option<PostView>,
71 pub community: Option<CommunityView>,
72 pub person: Option<PersonViewSafe>,
75 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
76 pub struct GetModlog {
77 pub mod_person_id: Option<PersonId>,
78 pub community_id: Option<CommunityId>,
79 pub page: Option<i64>,
80 pub limit: Option<i64>,
81 pub auth: Option<Sensitive<String>>,
84 #[derive(Debug, Serialize, Deserialize, Clone)]
85 pub struct GetModlogResponse {
86 pub removed_posts: Vec<ModRemovePostView>,
87 pub locked_posts: Vec<ModLockPostView>,
88 pub stickied_posts: Vec<ModStickyPostView>,
89 pub removed_comments: Vec<ModRemoveCommentView>,
90 pub removed_communities: Vec<ModRemoveCommunityView>,
91 pub banned_from_community: Vec<ModBanFromCommunityView>,
92 pub banned: Vec<ModBanView>,
93 pub added_to_community: Vec<ModAddCommunityView>,
94 pub transferred_to_community: Vec<ModTransferCommunityView>,
95 pub added: Vec<ModAddView>,
96 pub hidden_communities: Vec<ModHideCommunityView>,
99 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
100 pub struct CreateSite {
102 pub sidebar: Option<String>,
103 pub description: Option<String>,
104 pub icon: Option<String>,
105 pub banner: Option<String>,
106 pub enable_downvotes: Option<bool>,
107 pub open_registration: Option<bool>,
108 pub enable_nsfw: Option<bool>,
109 pub community_creation_admin_only: Option<bool>,
110 pub require_email_verification: Option<bool>,
111 pub require_application: Option<bool>,
112 pub application_question: Option<String>,
113 pub private_instance: Option<bool>,
114 pub default_theme: Option<String>,
115 pub default_post_listing_type: Option<String>,
116 pub auth: Sensitive<String>,
119 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
120 pub struct EditSite {
121 pub name: Option<String>,
122 pub sidebar: Option<String>,
123 pub description: Option<String>,
124 pub icon: Option<String>,
125 pub banner: Option<String>,
126 pub enable_downvotes: Option<bool>,
127 pub open_registration: Option<bool>,
128 pub enable_nsfw: Option<bool>,
129 pub community_creation_admin_only: Option<bool>,
130 pub require_email_verification: Option<bool>,
131 pub require_application: Option<bool>,
132 pub application_question: Option<String>,
133 pub private_instance: Option<bool>,
134 pub default_theme: Option<String>,
135 pub default_post_listing_type: Option<String>,
136 pub legal_information: Option<String>,
137 pub auth: Sensitive<String>,
140 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
142 pub auth: Option<Sensitive<String>>,
145 #[derive(Debug, Serialize, Deserialize, Clone)]
146 pub struct SiteResponse {
147 pub site_view: SiteView,
150 #[derive(Debug, Serialize, Deserialize, Clone)]
151 pub struct GetSiteResponse {
152 pub site_view: Option<SiteView>, // Because the site might not be set up yet
153 pub admins: Vec<PersonViewSafe>,
156 pub my_user: Option<MyUserInfo>,
157 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
160 #[derive(Debug, Serialize, Deserialize, Clone)]
161 pub struct MyUserInfo {
162 pub local_user_view: LocalUserSettingsView,
163 pub follows: Vec<CommunityFollowerView>,
164 pub moderates: Vec<CommunityModeratorView>,
165 pub community_blocks: Vec<CommunityBlockView>,
166 pub person_blocks: Vec<PersonBlockView>,
169 #[derive(Debug, Serialize, Deserialize, Clone)]
170 pub struct LeaveAdmin {
171 pub auth: Sensitive<String>,
174 #[derive(Debug, Serialize, Deserialize, Clone)]
175 pub struct GetSiteConfig {
176 pub auth: Sensitive<String>,
179 #[derive(Debug, Serialize, Deserialize, Clone)]
180 pub struct GetSiteConfigResponse {
181 pub config_hjson: String,
184 #[derive(Debug, Serialize, Deserialize, Clone)]
185 pub struct SaveSiteConfig {
186 pub config_hjson: String,
187 pub auth: Sensitive<String>,
190 #[derive(Debug, Serialize, Deserialize, Clone)]
191 pub struct FederatedInstances {
192 pub linked: Vec<String>,
193 pub allowed: Option<Vec<String>>,
194 pub blocked: Option<Vec<String>>,
197 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
198 pub struct ListRegistrationApplications {
199 /// Only shows the unread applications (IE those without an admin actor)
200 pub unread_only: Option<bool>,
201 pub page: Option<i64>,
202 pub limit: Option<i64>,
206 #[derive(Debug, Serialize, Deserialize, Clone)]
207 pub struct ListRegistrationApplicationsResponse {
208 pub registration_applications: Vec<RegistrationApplicationView>,
211 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
212 pub struct ApproveRegistrationApplication {
215 pub deny_reason: Option<String>,
219 #[derive(Debug, Serialize, Deserialize, Clone)]
220 pub struct RegistrationApplicationResponse {
221 pub registration_application: RegistrationApplicationView,
224 #[derive(Debug, Serialize, Deserialize, Clone)]
225 pub struct GetUnreadRegistrationApplicationCount {
229 #[derive(Debug, Serialize, Deserialize, Clone)]
230 pub struct GetUnreadRegistrationApplicationCountResponse {
231 pub registration_applications: i64,