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 auth: Sensitive<String>,
139 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
141 pub auth: Option<Sensitive<String>>,
144 #[derive(Debug, Serialize, Deserialize, Clone)]
145 pub struct SiteResponse {
146 pub site_view: SiteView,
149 #[derive(Debug, Serialize, Deserialize, Clone)]
150 pub struct GetSiteResponse {
151 pub site_view: Option<SiteView>, // Because the site might not be set up yet
152 pub admins: Vec<PersonViewSafe>,
155 pub my_user: Option<MyUserInfo>,
156 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
159 #[derive(Debug, Serialize, Deserialize, Clone)]
160 pub struct MyUserInfo {
161 pub local_user_view: LocalUserSettingsView,
162 pub follows: Vec<CommunityFollowerView>,
163 pub moderates: Vec<CommunityModeratorView>,
164 pub community_blocks: Vec<CommunityBlockView>,
165 pub person_blocks: Vec<PersonBlockView>,
168 #[derive(Debug, Serialize, Deserialize, Clone)]
169 pub struct LeaveAdmin {
170 pub auth: Sensitive<String>,
173 #[derive(Debug, Serialize, Deserialize, Clone)]
174 pub struct GetSiteConfig {
175 pub auth: Sensitive<String>,
178 #[derive(Debug, Serialize, Deserialize, Clone)]
179 pub struct GetSiteConfigResponse {
180 pub config_hjson: String,
183 #[derive(Debug, Serialize, Deserialize, Clone)]
184 pub struct SaveSiteConfig {
185 pub config_hjson: String,
186 pub auth: Sensitive<String>,
189 #[derive(Debug, Serialize, Deserialize, Clone)]
190 pub struct FederatedInstances {
191 pub linked: Vec<String>,
192 pub allowed: Option<Vec<String>>,
193 pub blocked: Option<Vec<String>>,
196 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
197 pub struct ListRegistrationApplications {
198 /// Only shows the unread applications (IE those without an admin actor)
199 pub unread_only: Option<bool>,
200 pub page: Option<i64>,
201 pub limit: Option<i64>,
205 #[derive(Debug, Serialize, Deserialize, Clone)]
206 pub struct ListRegistrationApplicationsResponse {
207 pub registration_applications: Vec<RegistrationApplicationView>,
210 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
211 pub struct ApproveRegistrationApplication {
214 pub deny_reason: Option<String>,
218 #[derive(Debug, Serialize, Deserialize, Clone)]
219 pub struct RegistrationApplicationResponse {
220 pub registration_application: RegistrationApplicationView,
223 #[derive(Debug, Serialize, Deserialize, Clone)]
224 pub struct GetUnreadRegistrationApplicationCount {
228 #[derive(Debug, Serialize, Deserialize, Clone)]
229 pub struct GetUnreadRegistrationApplicationCountResponse {
230 pub registration_applications: i64,