1 use crate::sensitive::Sensitive;
3 newtypes::{CommentId, CommunityId, PersonId, PostId},
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::{
24 AdminPurgeCommentView,
25 AdminPurgeCommunityView,
30 ModBanFromCommunityView,
35 ModRemoveCommunityView,
38 ModTransferCommunityView,
40 use serde::{Deserialize, Serialize};
42 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
45 pub community_id: Option<CommunityId>,
46 pub community_name: Option<String>,
47 pub creator_id: Option<PersonId>,
48 pub type_: Option<SearchType>,
49 pub sort: Option<SortType>,
50 pub listing_type: Option<ListingType>,
51 pub page: Option<i64>,
52 pub limit: Option<i64>,
53 pub auth: Option<Sensitive<String>>,
56 #[derive(Debug, Serialize, Deserialize, Clone)]
57 pub struct SearchResponse {
59 pub comments: Vec<CommentView>,
60 pub posts: Vec<PostView>,
61 pub communities: Vec<CommunityView>,
62 pub users: Vec<PersonViewSafe>,
65 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
66 pub struct ResolveObject {
68 pub auth: Option<Sensitive<String>>,
71 #[derive(Debug, Serialize, Deserialize, Default)]
72 pub struct ResolveObjectResponse {
73 pub comment: Option<CommentView>,
74 pub post: Option<PostView>,
75 pub community: Option<CommunityView>,
76 pub person: Option<PersonViewSafe>,
79 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
80 pub struct GetModlog {
81 pub mod_person_id: Option<PersonId>,
82 pub community_id: Option<CommunityId>,
83 pub page: Option<i64>,
84 pub limit: Option<i64>,
85 pub auth: Option<Sensitive<String>>,
88 #[derive(Debug, Serialize, Deserialize, Clone)]
89 pub struct GetModlogResponse {
90 pub removed_posts: Vec<ModRemovePostView>,
91 pub locked_posts: Vec<ModLockPostView>,
92 pub stickied_posts: Vec<ModStickyPostView>,
93 pub removed_comments: Vec<ModRemoveCommentView>,
94 pub removed_communities: Vec<ModRemoveCommunityView>,
95 pub banned_from_community: Vec<ModBanFromCommunityView>,
96 pub banned: Vec<ModBanView>,
97 pub added_to_community: Vec<ModAddCommunityView>,
98 pub transferred_to_community: Vec<ModTransferCommunityView>,
99 pub added: Vec<ModAddView>,
100 pub admin_purged_persons: Vec<AdminPurgePersonView>,
101 pub admin_purged_communities: Vec<AdminPurgeCommunityView>,
102 pub admin_purged_posts: Vec<AdminPurgePostView>,
103 pub admin_purged_comments: Vec<AdminPurgeCommentView>,
104 pub hidden_communities: Vec<ModHideCommunityView>,
107 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
108 pub struct CreateSite {
110 pub sidebar: Option<String>,
111 pub description: Option<String>,
112 pub icon: Option<String>,
113 pub banner: Option<String>,
114 pub enable_downvotes: Option<bool>,
115 pub open_registration: Option<bool>,
116 pub enable_nsfw: Option<bool>,
117 pub community_creation_admin_only: Option<bool>,
118 pub require_email_verification: Option<bool>,
119 pub require_application: Option<bool>,
120 pub application_question: Option<String>,
121 pub private_instance: Option<bool>,
122 pub default_theme: Option<String>,
123 pub default_post_listing_type: Option<String>,
124 pub auth: Sensitive<String>,
127 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
128 pub struct EditSite {
129 pub name: Option<String>,
130 pub sidebar: Option<String>,
131 pub description: Option<String>,
132 pub icon: Option<String>,
133 pub banner: Option<String>,
134 pub enable_downvotes: Option<bool>,
135 pub open_registration: Option<bool>,
136 pub enable_nsfw: Option<bool>,
137 pub community_creation_admin_only: Option<bool>,
138 pub require_email_verification: Option<bool>,
139 pub require_application: Option<bool>,
140 pub application_question: Option<String>,
141 pub private_instance: Option<bool>,
142 pub default_theme: Option<String>,
143 pub default_post_listing_type: Option<String>,
144 pub legal_information: Option<String>,
145 pub auth: Sensitive<String>,
148 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
150 pub auth: Option<Sensitive<String>>,
153 #[derive(Debug, Serialize, Deserialize, Clone)]
154 pub struct SiteResponse {
155 pub site_view: SiteView,
158 #[derive(Debug, Serialize, Deserialize, Clone)]
159 pub struct GetSiteResponse {
160 pub site_view: Option<SiteView>, // Because the site might not be set up yet
161 pub admins: Vec<PersonViewSafe>,
164 pub my_user: Option<MyUserInfo>,
165 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
168 #[derive(Debug, Serialize, Deserialize, Clone)]
169 pub struct MyUserInfo {
170 pub local_user_view: LocalUserSettingsView,
171 pub follows: Vec<CommunityFollowerView>,
172 pub moderates: Vec<CommunityModeratorView>,
173 pub community_blocks: Vec<CommunityBlockView>,
174 pub person_blocks: Vec<PersonBlockView>,
177 #[derive(Debug, Serialize, Deserialize, Clone)]
178 pub struct LeaveAdmin {
179 pub auth: Sensitive<String>,
182 #[derive(Debug, Serialize, Deserialize, Clone)]
183 pub struct FederatedInstances {
184 pub linked: Vec<String>,
185 pub allowed: Option<Vec<String>>,
186 pub blocked: Option<Vec<String>>,
189 #[derive(Debug, Serialize, Deserialize, Clone)]
190 pub struct PurgePerson {
191 pub person_id: PersonId,
192 pub reason: Option<String>,
196 #[derive(Debug, Serialize, Deserialize, Clone)]
197 pub struct PurgeCommunity {
198 pub community_id: CommunityId,
199 pub reason: Option<String>,
203 #[derive(Debug, Serialize, Deserialize, Clone)]
204 pub struct PurgePost {
206 pub reason: Option<String>,
210 #[derive(Debug, Serialize, Deserialize, Clone)]
211 pub struct PurgeComment {
212 pub comment_id: CommentId,
213 pub reason: Option<String>,
217 #[derive(Serialize, Deserialize)]
218 pub struct PurgeItemResponse {
222 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
223 pub struct ListRegistrationApplications {
224 /// Only shows the unread applications (IE those without an admin actor)
225 pub unread_only: Option<bool>,
226 pub page: Option<i64>,
227 pub limit: Option<i64>,
231 #[derive(Debug, Serialize, Deserialize, Clone)]
232 pub struct ListRegistrationApplicationsResponse {
233 pub registration_applications: Vec<RegistrationApplicationView>,
236 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
237 pub struct ApproveRegistrationApplication {
240 pub deny_reason: Option<String>,
244 #[derive(Debug, Serialize, Deserialize, Clone)]
245 pub struct RegistrationApplicationResponse {
246 pub registration_application: RegistrationApplicationView,
249 #[derive(Debug, Serialize, Deserialize, Clone)]
250 pub struct GetUnreadRegistrationApplicationCount {
254 #[derive(Debug, Serialize, Deserialize, Clone)]
255 pub struct GetUnreadRegistrationApplicationCountResponse {
256 pub registration_applications: i64,