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-05-17 00:41:57 +00:00
|
|
|
sensitive::SensitiveString,
|
2024-09-10 10:41:30 +00:00
|
|
|
source::{login_token::LoginToken, 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,
|
2024-09-19 08:03:58 +00:00
|
|
|
PostSortType,
|
2022-09-19 22:58:42 +00:00
|
|
|
};
|
2024-04-16 23:20:44 +00:00
|
|
|
use lemmy_db_views::structs::{CommentView, LocalImageView, 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 {
|
2024-05-17 00:41:57 +00:00
|
|
|
pub username_or_email: SensitiveString,
|
|
|
|
pub password: SensitiveString,
|
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,
|
2024-05-17 00:41:57 +00:00
|
|
|
pub password: SensitiveString,
|
|
|
|
pub password_verify: SensitiveString,
|
2024-05-07 20:18:58 +00:00
|
|
|
pub show_nsfw: Option<bool>,
|
2021-12-15 19:49:59 +00:00
|
|
|
/// email is mandatory if email verification is enabled on the server
|
2024-05-17 00:41:57 +00:00
|
|
|
pub email: Option<SensitiveString>,
|
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>,
|
2024-09-19 08:03:58 +00:00
|
|
|
/// The default post listing type, usually "local"
|
2023-04-17 19:19:51 +00:00
|
|
|
pub default_listing_type: Option<ListingType>,
|
2024-09-19 08:03:58 +00:00
|
|
|
/// A post-view mode that changes how multiple post listings look.
|
|
|
|
pub post_listing_mode: Option<PostListingMode>,
|
|
|
|
/// The default post sort, usually "active"
|
|
|
|
pub default_post_sort_type: Option<PostSortType>,
|
|
|
|
/// The default comment sort, usually "hot"
|
|
|
|
pub default_comment_sort_type: Option<CommentSortType>,
|
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.
|
2024-05-17 00:41:57 +00:00
|
|
|
pub email: Option<SensitiveString>,
|
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>,
|
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>,
|
2024-05-23 12:46:26 +00:00
|
|
|
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
|
|
|
/// should be paused
|
2023-10-17 14:52:34 +00:00
|
|
|
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 {
|
2024-05-17 00:41:57 +00:00
|
|
|
pub new_password: SensitiveString,
|
|
|
|
pub new_password_verify: SensitiveString,
|
|
|
|
pub old_password: SensitiveString,
|
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 {
|
2024-05-23 12:46:26 +00:00
|
|
|
/// This is None in response to `Register` if email verification is enabled, or the server
|
|
|
|
/// requires registration applications.
|
2024-05-17 00:41:57 +00:00
|
|
|
pub jwt: Option<SensitiveString>,
|
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>,
|
2024-09-19 08:03:58 +00:00
|
|
|
pub sort: Option<PostSortType>,
|
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,
|
2024-09-18 13:11:42 +00:00
|
|
|
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
|
|
|
/// If ban is true, then this means remove. If ban is false, it means restore.
|
|
|
|
pub remove_or_restore_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 {
|
2024-05-17 00:41:57 +00:00
|
|
|
pub password: SensitiveString,
|
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 {
|
2024-05-17 00:41:57 +00:00
|
|
|
pub email: SensitiveString,
|
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 {
|
2024-05-17 00:41:57 +00:00
|
|
|
pub token: SensitiveString,
|
|
|
|
pub password: SensitiveString,
|
|
|
|
pub password_verify: SensitiveString,
|
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 {
|
2024-05-17 00:41:57 +00:00
|
|
|
pub totp_secret_url: SensitiveString,
|
2023-09-20 14:49:54 +00:00
|
|
|
}
|
|
|
|
|
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 {
|
2024-04-16 23:20:44 +00:00
|
|
|
pub images: Vec<LocalImageView>,
|
2024-03-26 16:06:11 +00:00
|
|
|
}
|
2024-09-10 10:41:30 +00:00
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
pub struct ListLoginsResponse {
|
|
|
|
pub logins: Vec<LoginToken>,
|
|
|
|
}
|