2022-05-03 17:44:13 +00:00
|
|
|
use crate::sensitive::Sensitive;
|
2022-09-19 22:58:42 +00:00
|
|
|
use lemmy_db_schema::{
|
2023-09-06 09:37:03 +00:00
|
|
|
newtypes::{CommentReplyId, CommunityId, LanguageId, PersonId, PersonMentionId},
|
2024-03-26 16:06:11 +00:00
|
|
|
source::{images::LocalImage, site::Site},
|
2022-09-19 22:58:42 +00:00
|
|
|
CommentSortType,
|
2023-04-17 19:19:51 +00:00
|
|
|
ListingType,
|
2023-10-17 14:52:34 +00:00
|
|
|
PostListingMode,
|
2022-09-19 22:58:42 +00:00
|
|
|
SortType,
|
|
|
|
};
|
|
|
|
use lemmy_db_views::structs::{CommentView, PostView};
|
2022-07-30 03:55:59 +00:00
|
|
|
use lemmy_db_views_actor::structs::{
|
|
|
|
CommentReplyView,
|
|
|
|
CommunityModeratorView,
|
|
|
|
PersonMentionView,
|
2023-03-01 17:19:46 +00:00
|
|
|
PersonView,
|
2022-07-30 03:55:59 +00:00
|
|
|
};
|
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]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Logging into lemmy.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct Login {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub username_or_email: Sensitive<String>,
|
|
|
|
pub password: Sensitive<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// May be required, if totp is enabled for their account.
|
2023-03-02 20:37:41 +00:00
|
|
|
pub totp_2fa_token: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Register / Sign up to lemmy.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct Register {
|
|
|
|
pub username: String,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub password: Sensitive<String>,
|
|
|
|
pub password_verify: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub show_nsfw: bool,
|
2021-12-15 19:49:59 +00:00
|
|
|
/// email is mandatory if email verification is enabled on the server
|
2021-12-06 14:54:47 +00:00
|
|
|
pub email: Option<Sensitive<String>>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The UUID of the captcha item.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub captcha_uuid: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your captcha answer.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub captcha_answer: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A form field to trick signup bots. Should be None.
|
2021-10-01 11:37:39 +00:00
|
|
|
pub honeypot: Option<String>,
|
2021-12-15 19:49:59 +00:00
|
|
|
/// An answer is mandatory if require application is enabled on the server
|
|
|
|
pub answer: Option<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)]
|
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 wrapper for the captcha response.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetCaptchaResponse {
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Will be None if captchas are disabled.
|
|
|
|
pub ok: Option<CaptchaResponse>,
|
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 captcha response.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CaptchaResponse {
|
2023-07-03 15:10:25 +00:00
|
|
|
/// A Base64 encoded png
|
2023-04-26 04:26:10 +00:00
|
|
|
pub png: String,
|
2023-07-03 15:10:25 +00:00
|
|
|
/// A Base64 encoded wav audio
|
2023-04-26 04:26:10 +00:00
|
|
|
pub wav: String,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The UUID for the captcha item.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub uuid: String,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Saves settings for your user.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SaveUserSettings {
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Show nsfw posts.
|
2021-03-11 04:43:11 +00:00
|
|
|
pub show_nsfw: Option<bool>,
|
2023-07-26 11:53:45 +00:00
|
|
|
pub blur_nsfw: Option<bool>,
|
|
|
|
pub auto_expand: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your user's theme.
|
2021-03-11 04:43:11 +00:00
|
|
|
pub theme: Option<String>,
|
2023-04-17 19:19:51 +00:00
|
|
|
pub default_sort_type: Option<SortType>,
|
|
|
|
pub default_listing_type: Option<ListingType>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The language of the lemmy interface
|
2022-08-18 19:11:19 +00:00
|
|
|
pub interface_language: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A URL for your avatar.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub avatar: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A URL for your banner.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub banner: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your display name, which can contain strange characters, and does not need to be unique.
|
2021-04-01 17:57:45 +00:00
|
|
|
pub display_name: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your email.
|
2021-12-06 14:54:47 +00:00
|
|
|
pub email: Option<Sensitive<String>>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Your bio / info, in markdown.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub bio: Option<String>,
|
2023-07-03 15:10:25 +00:00
|
|
|
/// Your matrix user id. Ex: @my_user:matrix.org
|
2020-09-01 14:25:34 +00:00
|
|
|
pub matrix_user_id: Option<String>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to show or hide avatars.
|
2021-03-11 04:43:11 +00:00
|
|
|
pub show_avatars: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Sends notifications to your email.
|
2021-03-11 04:43:11 +00:00
|
|
|
pub send_notifications_to_email: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
2021-04-21 21:41:14 +00:00
|
|
|
pub bot_account: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to show bot accounts.
|
2021-04-21 21:41:14 +00:00
|
|
|
pub show_bot_accounts: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Whether to show read posts.
|
2021-04-24 22:26:50 +00:00
|
|
|
pub show_read_posts: Option<bool>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A list of languages you are able to see discussion in.
|
2022-08-18 19:11:19 +00:00
|
|
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
2023-07-03 15:10:25 +00:00
|
|
|
/// Open links in a new tab
|
|
|
|
pub open_links_in_new_tab: Option<bool>,
|
2023-07-12 13:12:01 +00:00
|
|
|
/// Enable infinite scroll
|
|
|
|
pub infinite_scroll_enabled: Option<bool>,
|
2024-03-13 16:10:58 +00:00
|
|
|
/// A post-view mode that changes how multiple post listings look.
|
2023-10-17 14:52:34 +00:00
|
|
|
pub post_listing_mode: Option<PostListingMode>,
|
2023-10-10 10:17:27 +00:00
|
|
|
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
|
|
|
pub enable_keyboard_navigation: Option<bool>,
|
2023-10-17 14:52:34 +00:00
|
|
|
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or should be paused
|
|
|
|
pub enable_animated_images: Option<bool>,
|
2023-11-06 21:09:12 +00:00
|
|
|
/// Whether to auto-collapse bot comments.
|
|
|
|
pub collapse_bot_comments: Option<bool>,
|
2024-03-13 16:10:58 +00:00
|
|
|
/// Some vote display mode settings
|
|
|
|
pub show_scores: Option<bool>,
|
|
|
|
pub show_upvotes: Option<bool>,
|
|
|
|
pub show_downvotes: Option<bool>,
|
|
|
|
pub show_upvote_percentage: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Changes your account password.
|
2021-04-01 21:39:01 +00:00
|
|
|
pub struct ChangePassword {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub new_password: Sensitive<String>,
|
|
|
|
pub new_password_verify: Sensitive<String>,
|
|
|
|
pub old_password: Sensitive<String>,
|
2021-04-01 21:39:01 +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
|
|
|
/// A response for your login.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct LoginResponse {
|
2021-12-15 19:49:59 +00:00
|
|
|
/// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
|
|
|
|
pub jwt: Option<Sensitive<String>>,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// If registration applications are required, this will return true for a signup response.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub registration_created: bool,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// If email verifications are required, this will return true for a signup response.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub verify_email_sent: bool,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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 person's details.
|
|
|
|
///
|
|
|
|
/// Either person_id, or username are required.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonDetails {
|
2023-05-10 19:20:39 +00:00
|
|
|
pub person_id: Option<PersonId>,
|
2021-07-20 04:29:50 +00:00
|
|
|
/// Example: dessalines , or dessalines@xyz.tld
|
2020-09-01 14:25:34 +00:00
|
|
|
pub username: Option<String>,
|
2022-05-06 20:55:07 +00:00
|
|
|
pub sort: Option<SortType>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub saved_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-01-24 14:58:58 +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
|
|
|
/// A person's details response.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonDetailsResponse {
|
2023-03-01 17:19:46 +00:00
|
|
|
pub person_view: PersonView,
|
2024-01-24 09:32:14 +00:00
|
|
|
pub site: Option<Site>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub comments: Vec<CommentView>,
|
|
|
|
pub posts: Vec<PostView>,
|
2021-08-19 20:54:15 +00:00
|
|
|
pub moderates: Vec<CommunityModeratorView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq)]
|
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
|
|
|
/// Adds an admin to a site.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct AddAdmin {
|
2023-09-06 09:37:03 +00:00
|
|
|
pub person_id: PersonId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub added: bool,
|
|
|
|
}
|
|
|
|
|
2023-10-20 00:15:55 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// The response of current admins.
|
|
|
|
pub struct AddAdminResponse {
|
|
|
|
pub admins: Vec<PersonView>,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Ban a person from the site.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct BanPerson {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub person_id: PersonId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub ban: bool,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Optionally remove all their data. Useful for new troll accounts.
|
2021-04-15 03:37:51 +00:00
|
|
|
pub remove_data: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub reason: Option<String>,
|
2024-01-25 15:45:42 +00:00
|
|
|
/// A time that the ban will expire, in unix epoch seconds.
|
|
|
|
///
|
|
|
|
/// An i64 unix timestamp is used for a simpler API client implementation.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub expires: Option<i64>,
|
|
|
|
}
|
|
|
|
|
2023-05-10 19:20:39 +00:00
|
|
|
// TODO, this should be paged, since the list can be quite long.
|
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 banned persons.
|
2021-11-19 20:56:41 +00:00
|
|
|
pub struct BannedPersonsResponse {
|
2023-03-01 17:19:46 +00:00
|
|
|
pub banned: Vec<PersonView>,
|
2021-11-19 20:56:41 +00:00
|
|
|
}
|
|
|
|
|
2023-10-20 00:15:55 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// A response for a banned person.
|
|
|
|
pub struct BanPersonResponse {
|
|
|
|
pub person_view: PersonView,
|
|
|
|
pub banned: bool,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Block a person.
|
2021-08-19 20:54:15 +00:00
|
|
|
pub struct BlockPerson {
|
|
|
|
pub person_id: PersonId,
|
|
|
|
pub block: bool,
|
|
|
|
}
|
|
|
|
|
2023-10-20 00:15:55 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// The response for a person block.
|
|
|
|
pub struct BlockPersonResponse {
|
|
|
|
pub person_view: PersonView,
|
|
|
|
pub blocked: bool,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Get comment replies.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetReplies {
|
2022-07-30 03:55:59 +00:00
|
|
|
pub sort: Option<CommentSortType>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub unread_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-05-10 19:20:39 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// Fetches your replies.
|
|
|
|
// TODO, replies and mentions below should be redone as tagged enums.
|
|
|
|
pub struct GetRepliesResponse {
|
|
|
|
pub replies: Vec<CommentReplyView>,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Get mentions for your user.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonMentions {
|
2022-07-30 03:55:59 +00:00
|
|
|
pub sort: Option<CommentSortType>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub unread_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-05-10 19:20:39 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// The response of mentions for your user.
|
|
|
|
pub struct GetPersonMentionsResponse {
|
|
|
|
pub mentions: Vec<PersonMentionView>,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Mark a person mention as read.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct MarkPersonMentionAsRead {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub person_mention_id: PersonMentionId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub read: bool,
|
|
|
|
}
|
|
|
|
|
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 person mention action.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct PersonMentionResponse {
|
|
|
|
pub person_mention_view: PersonMentionView,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Mark a comment reply as read.
|
2022-07-30 03:55:59 +00:00
|
|
|
pub struct MarkCommentReplyAsRead {
|
|
|
|
pub comment_reply_id: CommentReplyId,
|
|
|
|
pub read: bool,
|
|
|
|
}
|
|
|
|
|
2023-10-20 00:15:55 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// The response for a comment reply action.
|
|
|
|
pub struct CommentReplyResponse {
|
|
|
|
pub comment_reply_view: CommentReplyView,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Delete your account.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct DeleteAccount {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub password: Sensitive<String>,
|
2023-08-28 10:23:45 +00:00
|
|
|
pub delete_content: bool,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Reset your password via email.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PasswordReset {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub email: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Change your password after receiving a reset request.
|
2022-04-13 18:12:25 +00:00
|
|
|
pub struct PasswordChangeAfterReset {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub token: Sensitive<String>,
|
|
|
|
pub password: Sensitive<String>,
|
|
|
|
pub password_verify: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Get a count of the number of reports.
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct GetReportCount {
|
2021-09-28 10:36:17 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2020-10-25 02:59:13 +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, 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 for the number of reports.
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct GetReportCountResponse {
|
2021-09-28 10:36:17 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2020-11-04 02:15:11 +00:00
|
|
|
pub comment_reports: i64,
|
|
|
|
pub post_reports: i64,
|
2022-09-19 22:58:42 +00:00
|
|
|
pub private_message_reports: Option<i64>,
|
2020-10-25 02:59:13 +00:00
|
|
|
}
|
2021-10-16 10:43:41 +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
|
|
|
/// A response containing counts for your notifications.
|
2021-10-16 10:43:41 +00:00
|
|
|
pub struct GetUnreadCountResponse {
|
|
|
|
pub replies: i64,
|
|
|
|
pub mentions: i64,
|
|
|
|
pub private_messages: i64,
|
|
|
|
}
|
2021-12-15 19:49:59 +00:00
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)]
|
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
|
|
|
/// Verify your email.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct VerifyEmail {
|
|
|
|
pub token: String,
|
|
|
|
}
|
|
|
|
|
2023-09-20 14:49:54 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
pub struct GenerateTotpSecretResponse {
|
|
|
|
pub totp_secret_url: Sensitive<String>,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
2023-09-20 14:49:54 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
pub struct UpdateTotp {
|
|
|
|
pub totp_token: String,
|
|
|
|
pub enabled: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
pub struct UpdateTotpResponse {
|
|
|
|
pub enabled: bool,
|
|
|
|
}
|
2024-03-26 16:06:11 +00:00
|
|
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
/// Get your user's image / media uploads.
|
|
|
|
pub struct ListMedia {
|
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
pub struct ListMediaResponse {
|
|
|
|
pub images: Vec<LocalImage>,
|
|
|
|
}
|