use crate::sensitive::Sensitive; use lemmy_db_schema::{ newtypes::{CommentId, CommunityId, LanguageId, PersonId, PostId}, source::{language::Language, local_site::RegistrationMode, tagline::Tagline}, ListingType, ModlogActionType, SearchType, SortType, }; use lemmy_db_views::structs::{ CommentView, LocalUserSettingsView, PostView, RegistrationApplicationView, SiteView, }; use lemmy_db_views_actor::structs::{ CommunityBlockView, CommunityFollowerView, CommunityModeratorView, CommunityView, PersonBlockView, PersonViewSafe, }; use lemmy_db_views_moderator::structs::{ AdminPurgeCommentView, AdminPurgeCommunityView, AdminPurgePersonView, AdminPurgePostView, ModAddCommunityView, ModAddView, ModBanFromCommunityView, ModBanView, ModFeaturePostView, ModHideCommunityView, ModLockPostView, ModRemoveCommentView, ModRemoveCommunityView, ModRemovePostView, ModTransferCommunityView, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct Search { pub q: String, pub community_id: Option, pub community_name: Option, pub creator_id: Option, pub type_: Option, pub sort: Option, pub listing_type: Option, pub page: Option, pub limit: Option, pub auth: Option>, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct SearchResponse { pub type_: String, pub comments: Vec, pub posts: Vec, pub communities: Vec, pub users: Vec, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct ResolveObject { pub q: String, pub auth: Option>, } #[derive(Debug, Serialize, Deserialize, Default)] pub struct ResolveObjectResponse { pub comment: Option, pub post: Option, pub community: Option, pub person: Option, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct GetModlog { pub mod_person_id: Option, pub community_id: Option, pub page: Option, pub limit: Option, pub auth: Option>, pub type_: Option, pub other_person_id: Option, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct GetModlogResponse { pub removed_posts: Vec, pub locked_posts: Vec, pub featured_posts: Vec, pub removed_comments: Vec, pub removed_communities: Vec, pub banned_from_community: Vec, pub banned: Vec, pub added_to_community: Vec, pub transferred_to_community: Vec, pub added: Vec, pub admin_purged_persons: Vec, pub admin_purged_communities: Vec, pub admin_purged_posts: Vec, pub admin_purged_comments: Vec, pub hidden_communities: Vec, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct CreateSite { pub name: String, pub sidebar: Option, pub description: Option, pub icon: Option, pub banner: Option, pub enable_downvotes: Option, pub enable_nsfw: Option, pub community_creation_admin_only: Option, pub require_email_verification: Option, pub application_question: Option, pub private_instance: Option, pub default_theme: Option, pub default_post_listing_type: Option, pub legal_information: Option, pub application_email_admins: Option, pub hide_modlog_mod_names: Option, pub discussion_languages: Option>, pub slur_filter_regex: Option, pub actor_name_max_length: Option, pub rate_limit_message: Option, pub rate_limit_message_per_second: Option, pub rate_limit_post: Option, pub rate_limit_post_per_second: Option, pub rate_limit_register: Option, pub rate_limit_register_per_second: Option, pub rate_limit_image: Option, pub rate_limit_image_per_second: Option, pub rate_limit_comment: Option, pub rate_limit_comment_per_second: Option, pub rate_limit_search: Option, pub rate_limit_search_per_second: Option, pub federation_enabled: Option, pub federation_debug: Option, pub federation_worker_count: Option, pub captcha_enabled: Option, pub captcha_difficulty: Option, pub allowed_instances: Option>, pub blocked_instances: Option>, pub taglines: Option>, pub registration_mode: Option, pub auth: Sensitive, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct EditSite { pub name: Option, pub sidebar: Option, pub description: Option, pub icon: Option, pub banner: Option, pub enable_downvotes: Option, pub enable_nsfw: Option, pub community_creation_admin_only: Option, pub require_email_verification: Option, pub application_question: Option, pub private_instance: Option, pub default_theme: Option, pub default_post_listing_type: Option, pub legal_information: Option, pub application_email_admins: Option, pub hide_modlog_mod_names: Option, pub discussion_languages: Option>, pub slur_filter_regex: Option, pub actor_name_max_length: Option, pub rate_limit_message: Option, pub rate_limit_message_per_second: Option, pub rate_limit_post: Option, pub rate_limit_post_per_second: Option, pub rate_limit_register: Option, pub rate_limit_register_per_second: Option, pub rate_limit_image: Option, pub rate_limit_image_per_second: Option, pub rate_limit_comment: Option, pub rate_limit_comment_per_second: Option, pub rate_limit_search: Option, pub rate_limit_search_per_second: Option, pub federation_enabled: Option, pub federation_debug: Option, pub federation_worker_count: Option, pub captcha_enabled: Option, pub captcha_difficulty: Option, pub allowed_instances: Option>, pub blocked_instances: Option>, pub taglines: Option>, pub registration_mode: Option, pub auth: Sensitive, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct GetSite { pub auth: Option>, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct SiteResponse { pub site_view: SiteView, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct GetSiteResponse { pub site_view: SiteView, pub admins: Vec, pub online: usize, pub version: String, pub my_user: Option, pub federated_instances: Option, // Federation may be disabled pub all_languages: Vec, pub discussion_languages: Vec, pub taglines: Option>, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct MyUserInfo { pub local_user_view: LocalUserSettingsView, pub follows: Vec, pub moderates: Vec, pub community_blocks: Vec, pub person_blocks: Vec, pub discussion_languages: Vec, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct LeaveAdmin { pub auth: Sensitive, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct FederatedInstances { pub linked: Vec, pub allowed: Option>, pub blocked: Option>, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct PurgePerson { pub person_id: PersonId, pub reason: Option, pub auth: String, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct PurgeCommunity { pub community_id: CommunityId, pub reason: Option, pub auth: String, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct PurgePost { pub post_id: PostId, pub reason: Option, pub auth: String, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct PurgeComment { pub comment_id: CommentId, pub reason: Option, pub auth: String, } #[derive(Serialize, Deserialize)] pub struct PurgeItemResponse { pub success: bool, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct ListRegistrationApplications { /// Only shows the unread applications (IE those without an admin actor) pub unread_only: Option, pub page: Option, pub limit: Option, pub auth: String, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ListRegistrationApplicationsResponse { pub registration_applications: Vec, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct ApproveRegistrationApplication { pub id: i32, pub approve: bool, pub deny_reason: Option, pub auth: String, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct RegistrationApplicationResponse { pub registration_application: RegistrationApplicationView, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct GetUnreadRegistrationApplicationCount { pub auth: String, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct GetUnreadRegistrationApplicationCountResponse { pub registration_applications: i64, }