2022-05-03 17:44:13 +00:00
|
|
|
use crate::sensitive::Sensitive;
|
2022-05-06 20:55:07 +00:00
|
|
|
use lemmy_db_schema::{
|
2022-06-13 19:15:04 +00:00
|
|
|
newtypes::{CommentId, CommunityId, PersonId, PostId},
|
2022-08-18 19:11:19 +00:00
|
|
|
source::language::Language,
|
2022-05-06 20:55:07 +00:00
|
|
|
ListingType,
|
2022-08-16 11:52:04 +00:00
|
|
|
ModlogActionType,
|
2022-05-06 20:55:07 +00:00
|
|
|
SearchType,
|
|
|
|
SortType,
|
|
|
|
};
|
2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_views::structs::{
|
|
|
|
CommentView,
|
|
|
|
LocalUserSettingsView,
|
|
|
|
PostView,
|
|
|
|
RegistrationApplicationView,
|
|
|
|
SiteView,
|
2021-03-11 04:43:11 +00:00
|
|
|
};
|
2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_views_actor::structs::{
|
|
|
|
CommunityBlockView,
|
|
|
|
CommunityFollowerView,
|
|
|
|
CommunityModeratorView,
|
|
|
|
CommunityView,
|
|
|
|
PersonBlockView,
|
|
|
|
PersonViewSafe,
|
2021-08-19 20:54:15 +00:00
|
|
|
};
|
2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_views_moderator::structs::{
|
2022-06-13 19:15:04 +00:00
|
|
|
AdminPurgeCommentView,
|
|
|
|
AdminPurgeCommunityView,
|
|
|
|
AdminPurgePersonView,
|
|
|
|
AdminPurgePostView,
|
2022-05-03 17:44:13 +00:00
|
|
|
ModAddCommunityView,
|
|
|
|
ModAddView,
|
|
|
|
ModBanFromCommunityView,
|
|
|
|
ModBanView,
|
|
|
|
ModHideCommunityView,
|
|
|
|
ModLockPostView,
|
|
|
|
ModRemoveCommentView,
|
|
|
|
ModRemoveCommunityView,
|
|
|
|
ModRemovePostView,
|
|
|
|
ModStickyPostView,
|
|
|
|
ModTransferCommunityView,
|
2020-09-01 14:25:34 +00:00
|
|
|
};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct Search {
|
|
|
|
pub q: String,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2020-10-05 00:57:35 +00:00
|
|
|
pub community_name: Option<String>,
|
2021-04-09 20:09:58 +00:00
|
|
|
pub creator_id: Option<PersonId>,
|
2022-05-06 20:55:07 +00:00
|
|
|
pub type_: Option<SearchType>,
|
|
|
|
pub sort: Option<SortType>,
|
|
|
|
pub listing_type: Option<ListingType>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SearchResponse {
|
|
|
|
pub type_: String,
|
|
|
|
pub comments: Vec<CommentView>,
|
|
|
|
pub posts: Vec<PostView>,
|
|
|
|
pub communities: Vec<CommunityView>,
|
2021-03-10 22:33:55 +00:00
|
|
|
pub users: Vec<PersonViewSafe>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2021-07-20 07:00:20 +00:00
|
|
|
pub struct ResolveObject {
|
|
|
|
pub q: String,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2021-07-20 07:00:20 +00:00
|
|
|
}
|
|
|
|
|
2021-12-06 14:54:47 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Default)]
|
2021-08-23 15:25:39 +00:00
|
|
|
pub struct ResolveObjectResponse {
|
|
|
|
pub comment: Option<CommentView>,
|
|
|
|
pub post: Option<PostView>,
|
|
|
|
pub community: Option<CommunityView>,
|
|
|
|
pub person: Option<PersonViewSafe>,
|
2021-07-20 07:00:20 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetModlog {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: Option<PersonId>,
|
|
|
|
pub community_id: Option<CommunityId>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-12-15 19:49:59 +00:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2022-08-16 11:52:04 +00:00
|
|
|
pub type_: Option<ModlogActionType>,
|
|
|
|
pub other_person_id: Option<PersonId>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetModlogResponse {
|
|
|
|
pub removed_posts: Vec<ModRemovePostView>,
|
|
|
|
pub locked_posts: Vec<ModLockPostView>,
|
|
|
|
pub stickied_posts: Vec<ModStickyPostView>,
|
|
|
|
pub removed_comments: Vec<ModRemoveCommentView>,
|
|
|
|
pub removed_communities: Vec<ModRemoveCommunityView>,
|
|
|
|
pub banned_from_community: Vec<ModBanFromCommunityView>,
|
|
|
|
pub banned: Vec<ModBanView>,
|
|
|
|
pub added_to_community: Vec<ModAddCommunityView>,
|
2021-08-17 21:52:28 +00:00
|
|
|
pub transferred_to_community: Vec<ModTransferCommunityView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub added: Vec<ModAddView>,
|
2022-06-13 19:15:04 +00:00
|
|
|
pub admin_purged_persons: Vec<AdminPurgePersonView>,
|
|
|
|
pub admin_purged_communities: Vec<AdminPurgeCommunityView>,
|
|
|
|
pub admin_purged_posts: Vec<AdminPurgePostView>,
|
|
|
|
pub admin_purged_comments: Vec<AdminPurgeCommentView>,
|
2022-02-18 02:30:47 +00:00
|
|
|
pub hidden_communities: Vec<ModHideCommunityView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CreateSite {
|
|
|
|
pub name: String,
|
2021-04-07 11:40:35 +00:00
|
|
|
pub sidebar: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub description: Option<String>,
|
2021-04-07 11:40:35 +00:00
|
|
|
pub icon: Option<String>,
|
|
|
|
pub banner: Option<String>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub enable_downvotes: Option<bool>,
|
|
|
|
pub open_registration: Option<bool>,
|
|
|
|
pub enable_nsfw: Option<bool>,
|
|
|
|
pub community_creation_admin_only: Option<bool>,
|
2021-12-15 19:49:59 +00:00
|
|
|
pub require_email_verification: Option<bool>,
|
|
|
|
pub require_application: Option<bool>,
|
|
|
|
pub application_question: Option<String>,
|
|
|
|
pub private_instance: Option<bool>,
|
2022-02-23 16:40:36 +00:00
|
|
|
pub default_theme: Option<String>,
|
2022-04-19 19:05:08 +00:00
|
|
|
pub default_post_listing_type: Option<String>,
|
2022-09-27 16:48:44 +00:00
|
|
|
pub application_email_admins: Option<bool>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2022-08-16 11:52:04 +00:00
|
|
|
pub hide_modlog_mod_names: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct EditSite {
|
2021-04-15 03:37:51 +00:00
|
|
|
pub name: Option<String>,
|
2021-04-07 11:40:35 +00:00
|
|
|
pub sidebar: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub description: Option<String>,
|
|
|
|
pub icon: Option<String>,
|
|
|
|
pub banner: Option<String>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub enable_downvotes: Option<bool>,
|
|
|
|
pub open_registration: Option<bool>,
|
|
|
|
pub enable_nsfw: Option<bool>,
|
2021-04-22 23:42:58 +00:00
|
|
|
pub community_creation_admin_only: Option<bool>,
|
2021-12-15 19:49:59 +00:00
|
|
|
pub require_email_verification: Option<bool>,
|
|
|
|
pub require_application: Option<bool>,
|
|
|
|
pub application_question: Option<String>,
|
|
|
|
pub private_instance: Option<bool>,
|
2022-02-23 16:40:36 +00:00
|
|
|
pub default_theme: Option<String>,
|
2022-04-19 19:05:08 +00:00
|
|
|
pub default_post_listing_type: Option<String>,
|
2022-05-19 20:32:40 +00:00
|
|
|
pub legal_information: Option<String>,
|
2022-09-27 16:48:44 +00:00
|
|
|
pub application_email_admins: Option<bool>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2022-08-16 11:52:04 +00:00
|
|
|
pub hide_modlog_mod_names: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetSite {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2021-12-06 14:54:47 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SiteResponse {
|
2020-12-20 01:10:47 +00:00
|
|
|
pub site_view: SiteView,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetSiteResponse {
|
2020-12-20 01:10:47 +00:00
|
|
|
pub site_view: Option<SiteView>, // Because the site might not be set up yet
|
2021-03-10 22:33:55 +00:00
|
|
|
pub admins: Vec<PersonViewSafe>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub online: usize,
|
|
|
|
pub version: String,
|
2021-08-19 20:54:15 +00:00
|
|
|
pub my_user: Option<MyUserInfo>,
|
2021-02-01 18:11:37 +00:00
|
|
|
pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
|
2022-08-18 19:11:19 +00:00
|
|
|
pub all_languages: Vec<Language>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-08-19 20:54:15 +00:00
|
|
|
pub struct MyUserInfo {
|
|
|
|
pub local_user_view: LocalUserSettingsView,
|
|
|
|
pub follows: Vec<CommunityFollowerView>,
|
|
|
|
pub moderates: Vec<CommunityModeratorView>,
|
|
|
|
pub community_blocks: Vec<CommunityBlockView>,
|
|
|
|
pub person_blocks: Vec<PersonBlockView>,
|
2022-08-18 19:11:19 +00:00
|
|
|
pub discussion_languages: Vec<Language>,
|
2021-08-19 20:54:15 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2022-01-26 17:57:16 +00:00
|
|
|
pub struct LeaveAdmin {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-02-01 18:11:37 +00:00
|
|
|
pub struct FederatedInstances {
|
|
|
|
pub linked: Vec<String>,
|
2021-03-01 17:24:11 +00:00
|
|
|
pub allowed: Option<Vec<String>>,
|
|
|
|
pub blocked: Option<Vec<String>>,
|
2021-02-01 18:11:37 +00:00
|
|
|
}
|
2021-12-15 19:49:59 +00:00
|
|
|
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct PurgePerson {
|
|
|
|
pub person_id: PersonId,
|
|
|
|
pub reason: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct PurgeCommunity {
|
|
|
|
pub community_id: CommunityId,
|
|
|
|
pub reason: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct PurgePost {
|
|
|
|
pub post_id: PostId,
|
|
|
|
pub reason: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct PurgeComment {
|
|
|
|
pub comment_id: CommentId,
|
|
|
|
pub reason: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
|
|
pub struct PurgeItemResponse {
|
|
|
|
pub success: bool,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct ListRegistrationApplications {
|
|
|
|
/// Only shows the unread applications (IE those without an admin actor)
|
|
|
|
pub unread_only: Option<bool>,
|
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct ListRegistrationApplicationsResponse {
|
|
|
|
pub registration_applications: Vec<RegistrationApplicationView>,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct ApproveRegistrationApplication {
|
|
|
|
pub id: i32,
|
|
|
|
pub approve: bool,
|
|
|
|
pub deny_reason: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct RegistrationApplicationResponse {
|
|
|
|
pub registration_application: RegistrationApplicationView,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct GetUnreadRegistrationApplicationCount {
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct GetUnreadRegistrationApplicationCountResponse {
|
|
|
|
pub registration_applications: i64,
|
|
|
|
}
|