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