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-10-06 18:27:58 +00:00
|
|
|
newtypes::{CommentId, CommunityId, LanguageId, PersonId, PostId},
|
2023-04-17 19:19:51 +00:00
|
|
|
source::{instance::Instance, language::Language, tagline::Tagline},
|
2022-05-06 20:55:07 +00:00
|
|
|
ListingType,
|
2022-08-16 11:52:04 +00:00
|
|
|
ModlogActionType,
|
2023-04-17 19:19:51 +00:00
|
|
|
RegistrationMode,
|
2022-05-06 20:55:07 +00:00
|
|
|
SearchType,
|
|
|
|
SortType,
|
|
|
|
};
|
2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_views::structs::{
|
|
|
|
CommentView,
|
2023-03-20 21:32:31 +00:00
|
|
|
CustomEmojiView,
|
2023-03-01 17:19:46 +00:00
|
|
|
LocalUserView,
|
2022-05-03 17:44:13 +00:00
|
|
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
PersonView,
|
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,
|
2022-12-12 11:17:10 +00:00
|
|
|
ModFeaturePostView,
|
2022-05-03 17:44:13 +00:00
|
|
|
ModHideCommunityView,
|
|
|
|
ModLockPostView,
|
|
|
|
ModRemoveCommentView,
|
|
|
|
ModRemoveCommunityView,
|
|
|
|
ModRemovePostView,
|
|
|
|
ModTransferCommunityView,
|
2020-09-01 14:25:34 +00:00
|
|
|
};
|
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 04:26:10 +00:00
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2020-09-01 14:25:34 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Searches the site, given a query string, and some optional filters.
|
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)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The search response, containing lists of the return type possibilities
|
|
|
|
// TODO this should be redone as a list of tagged enums
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SearchResponse {
|
2023-04-26 04:26:10 +00:00
|
|
|
pub type_: SearchType,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub comments: Vec<CommentView>,
|
|
|
|
pub posts: Vec<PostView>,
|
|
|
|
pub communities: Vec<CommunityView>,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub users: Vec<PersonView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Does an apub fetch for an object.
|
2021-07-20 07:00:20 +00:00
|
|
|
pub struct ResolveObject {
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Can be the full url, or a shortened version like: !fediverse@lemmy.ml
|
2021-07-20 07:00:20 +00:00
|
|
|
pub q: String,
|
2023-07-26 16:17:42 +00:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2021-07-20 07:00:20 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2021-12-06 14:54:47 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
// TODO Change this to an enum
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The response of an apub object fetch.
|
2021-08-23 15:25:39 +00:00
|
|
|
pub struct ResolveObjectResponse {
|
|
|
|
pub comment: Option<CommentView>,
|
|
|
|
pub post: Option<PostView>,
|
|
|
|
pub community: Option<CommunityView>,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub person: Option<PersonView>,
|
2021-07-20 07:00:20 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Fetches the modlog.
|
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>,
|
2022-08-16 11:52:04 +00:00
|
|
|
pub type_: Option<ModlogActionType>,
|
|
|
|
pub other_person_id: Option<PersonId>,
|
2023-04-26 04:26:10 +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)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The modlog fetch response.
|
|
|
|
// TODO this should be redone as a list of tagged enums
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetModlogResponse {
|
|
|
|
pub removed_posts: Vec<ModRemovePostView>,
|
|
|
|
pub locked_posts: Vec<ModLockPostView>,
|
2022-12-12 11:17:10 +00:00
|
|
|
pub featured_posts: Vec<ModFeaturePostView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Creates a site. Should be done after first running lemmy.
|
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 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 application_question: Option<String>,
|
|
|
|
pub private_instance: Option<bool>,
|
2022-02-23 16:40:36 +00:00
|
|
|
pub default_theme: Option<String>,
|
2023-04-17 19:19:51 +00:00
|
|
|
pub default_post_listing_type: Option<ListingType>,
|
2022-11-09 10:05:00 +00:00
|
|
|
pub legal_information: Option<String>,
|
2022-09-27 16:48:44 +00:00
|
|
|
pub application_email_admins: Option<bool>,
|
2022-08-16 11:52:04 +00:00
|
|
|
pub hide_modlog_mod_names: Option<bool>,
|
2022-11-09 10:05:00 +00:00
|
|
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
2022-10-27 09:24:07 +00:00
|
|
|
pub slur_filter_regex: Option<String>,
|
|
|
|
pub actor_name_max_length: Option<i32>,
|
|
|
|
pub rate_limit_message: Option<i32>,
|
|
|
|
pub rate_limit_message_per_second: Option<i32>,
|
|
|
|
pub rate_limit_post: Option<i32>,
|
|
|
|
pub rate_limit_post_per_second: Option<i32>,
|
|
|
|
pub rate_limit_register: Option<i32>,
|
|
|
|
pub rate_limit_register_per_second: Option<i32>,
|
|
|
|
pub rate_limit_image: Option<i32>,
|
|
|
|
pub rate_limit_image_per_second: Option<i32>,
|
|
|
|
pub rate_limit_comment: Option<i32>,
|
|
|
|
pub rate_limit_comment_per_second: Option<i32>,
|
|
|
|
pub rate_limit_search: Option<i32>,
|
|
|
|
pub rate_limit_search_per_second: Option<i32>,
|
|
|
|
pub federation_enabled: Option<bool>,
|
|
|
|
pub federation_debug: Option<bool>,
|
|
|
|
pub captcha_enabled: Option<bool>,
|
|
|
|
pub captcha_difficulty: Option<String>,
|
|
|
|
pub allowed_instances: Option<Vec<String>>,
|
|
|
|
pub blocked_instances: Option<Vec<String>>,
|
2022-12-19 11:40:22 +00:00
|
|
|
pub taglines: Option<Vec<String>>,
|
2023-01-05 01:42:30 +00:00
|
|
|
pub registration_mode: Option<RegistrationMode>,
|
2022-11-09 10:05:00 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Edits a site.
|
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>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A shorter, one line description of your site.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub description: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A url for your site's icon.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub icon: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A url for your site's banner.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub banner: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to enable downvotes.
|
2021-04-15 03:37:51 +00:00
|
|
|
pub enable_downvotes: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to enable NSFW.
|
2021-04-15 03:37:51 +00:00
|
|
|
pub enable_nsfw: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Limits community creation to admins only.
|
2021-04-22 23:42:58 +00:00
|
|
|
pub community_creation_admin_only: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to require email verification.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub require_email_verification: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your application question form. This is in markdown, and can be many questions.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub application_question: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether your instance is public, or private.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub private_instance: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The default theme. Usually "browser"
|
2022-02-23 16:40:36 +00:00
|
|
|
pub default_theme: Option<String>,
|
2023-04-17 19:19:51 +00:00
|
|
|
pub default_post_listing_type: Option<ListingType>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// An optional page of legal information
|
2022-05-19 20:32:40 +00:00
|
|
|
pub legal_information: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to email admins when receiving a new application.
|
2022-09-27 16:48:44 +00:00
|
|
|
pub application_email_admins: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to hide moderator names from the modlog.
|
2022-08-16 11:52:04 +00:00
|
|
|
pub hide_modlog_mod_names: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of allowed discussion languages.
|
2022-10-06 18:27:58 +00:00
|
|
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A regex string of items to filter.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub slur_filter_regex: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The max length of actor names.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub actor_name_max_length: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The number of messages allowed in a given time frame.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub rate_limit_message: Option<i32>,
|
|
|
|
pub rate_limit_message_per_second: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The number of posts allowed in a given time frame.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub rate_limit_post: Option<i32>,
|
|
|
|
pub rate_limit_post_per_second: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The number of registrations allowed in a given time frame.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub rate_limit_register: Option<i32>,
|
|
|
|
pub rate_limit_register_per_second: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The number of image uploads allowed in a given time frame.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub rate_limit_image: Option<i32>,
|
|
|
|
pub rate_limit_image_per_second: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The number of comments allowed in a given time frame.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub rate_limit_comment: Option<i32>,
|
|
|
|
pub rate_limit_comment_per_second: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The number of searches allowed in a given time frame.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub rate_limit_search: Option<i32>,
|
|
|
|
pub rate_limit_search_per_second: Option<i32>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to enable federation.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub federation_enabled: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Enables federation debugging.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub federation_debug: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to enable captchas for signups.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub captcha_enabled: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The captcha difficulty. Can be easy, medium, or hard
|
2022-10-27 09:24:07 +00:00
|
|
|
pub captcha_difficulty: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of allowed instances. If none are set, federation is open.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub allowed_instances: Option<Vec<String>>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of blocked instances.
|
2022-10-27 09:24:07 +00:00
|
|
|
pub blocked_instances: Option<Vec<String>>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of taglines shown at the top of the front page.
|
2022-11-19 14:48:29 +00:00
|
|
|
pub taglines: Option<Vec<String>>,
|
2023-01-05 01:42:30 +00:00
|
|
|
pub registration_mode: Option<RegistrationMode>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to email admins for new reports.
|
2023-02-14 15:57:08 +00:00
|
|
|
pub reports_email_admins: Option<bool>,
|
2022-10-06 18:27:58 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Fetches the site.
|
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)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The response for a site.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SiteResponse {
|
2020-12-20 01:10:47 +00:00
|
|
|
pub site_view: SiteView,
|
2023-06-06 12:59:34 +00:00
|
|
|
pub taglines: Vec<Tagline>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// An expanded response for a site.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetSiteResponse {
|
2022-10-27 09:24:07 +00:00
|
|
|
pub site_view: SiteView,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admins: Vec<PersonView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub version: String,
|
2021-08-19 20:54:15 +00:00
|
|
|
pub my_user: Option<MyUserInfo>,
|
2022-08-18 19:11:19 +00:00
|
|
|
pub all_languages: Vec<Language>,
|
2022-10-06 18:27:58 +00:00
|
|
|
pub discussion_languages: Vec<LanguageId>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of taglines shown at the top of the front page.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub taglines: Vec<Tagline>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of custom emojis your site supports.
|
2023-03-20 21:32:31 +00:00
|
|
|
pub custom_emojis: Vec<CustomEmojiView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-05-11 19:20:45 +00:00
|
|
|
#[skip_serializing_none]
|
2023-04-16 21:00:31 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Fetches the federated instances for your site.
|
2023-05-11 19:20:45 +00:00
|
|
|
pub struct GetFederatedInstances {
|
|
|
|
pub auth: Option<Sensitive<String>>,
|
|
|
|
}
|
2023-04-16 21:00:31 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2023-04-16 21:00:31 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A response of federated instances.
|
2023-04-16 21:00:31 +00:00
|
|
|
pub struct GetFederatedInstancesResponse {
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Optional, because federation may be disabled.
|
|
|
|
pub federated_instances: Option<FederatedInstances>,
|
2023-04-16 21:00:31 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your user info.
|
2021-08-19 20:54:15 +00:00
|
|
|
pub struct MyUserInfo {
|
2023-03-01 17:19:46 +00:00
|
|
|
pub local_user_view: LocalUserView,
|
2021-08-19 20:54:15 +00:00
|
|
|
pub follows: Vec<CommunityFollowerView>,
|
|
|
|
pub moderates: Vec<CommunityModeratorView>,
|
|
|
|
pub community_blocks: Vec<CommunityBlockView>,
|
|
|
|
pub person_blocks: Vec<PersonBlockView>,
|
2022-12-19 11:40:22 +00:00
|
|
|
pub discussion_languages: Vec<LanguageId>,
|
2021-08-19 20:54:15 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Leaves the admin team.
|
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)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of federated instances.
|
2021-02-01 18:11:37 +00:00
|
|
|
pub struct FederatedInstances {
|
2023-02-18 14:36:12 +00:00
|
|
|
pub linked: Vec<Instance>,
|
2023-04-21 21:41:03 +00:00
|
|
|
pub allowed: Vec<Instance>,
|
|
|
|
pub blocked: Vec<Instance>,
|
2021-02-01 18:11:37 +00:00
|
|
|
}
|
2021-12-15 19:49:59 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Purges a person from the database. This will delete all content attached to that person.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct PurgePerson {
|
|
|
|
pub person_id: PersonId,
|
|
|
|
pub reason: Option<String>,
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Purges a community from the database. This will delete all content attached to that community.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct PurgeCommunity {
|
|
|
|
pub community_id: CommunityId,
|
|
|
|
pub reason: Option<String>,
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Purges a post from the database. This will delete all content attached to that post.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct PurgePost {
|
|
|
|
pub post_id: PostId,
|
|
|
|
pub reason: Option<String>,
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Purges a comment from the database. This will delete all content attached to that comment.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct PurgeComment {
|
|
|
|
pub comment_id: CommentId,
|
|
|
|
pub reason: Option<String>,
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
|
|
|
|
2023-07-10 10:27:49 +00:00
|
|
|
#[derive(Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The response for purged items.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct PurgeItemResponse {
|
|
|
|
pub success: bool,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Fetches a list of registration applications.
|
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>,
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2021-12-15 19:49:59 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The list of registration applications.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct ListRegistrationApplicationsResponse {
|
|
|
|
pub registration_applications: Vec<RegistrationApplicationView>,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Approves a registration application.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct ApproveRegistrationApplication {
|
|
|
|
pub id: i32,
|
|
|
|
pub approve: bool,
|
|
|
|
pub deny_reason: Option<String>,
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2021-12-15 19:49:59 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The response of an action done to a registration application.
|
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)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Gets a count of unread registration applications.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct GetUnreadRegistrationApplicationCount {
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2021-12-15 19:49:59 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The count of unread registration applications.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct GetUnreadRegistrationApplicationCountResponse {
|
|
|
|
pub registration_applications: i64,
|
|
|
|
}
|