2022-05-03 17:44:13 +00:00
|
|
|
use crate::sensitive::Sensitive;
|
2022-09-19 22:58:42 +00:00
|
|
|
use lemmy_db_schema::{
|
|
|
|
newtypes::{CommentReplyId, CommunityId, LanguageId, PersonId, PersonMentionId},
|
|
|
|
CommentSortType,
|
2023-04-17 19:19:51 +00:00
|
|
|
ListingType,
|
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]
|
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
|
|
|
/// 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]
|
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
|
|
|
/// 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-05-11 19:20:45 +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 Captcha item.
|
2023-05-11 19:20:45 +00:00
|
|
|
pub struct GetCaptcha {
|
|
|
|
pub auth: Option<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)]
|
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]
|
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
|
|
|
/// 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
|
|
|
/// Show post and comment scores.
|
2021-03-31 10:54:46 +00:00
|
|
|
pub show_scores: 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
|
|
|
/// Whether to show notifications for new posts.
|
|
|
|
// TODO notifs need to be reworked.
|
2021-07-22 20:07:40 +00:00
|
|
|
pub show_new_post_notifs: 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-05-10 19:20:39 +00:00
|
|
|
/// Generates a TOTP / 2-factor authentication token.
|
|
|
|
///
|
|
|
|
/// None leaves it as is, true will generate or regenerate it, false clears it out.
|
2023-03-02 20:37:41 +00:00
|
|
|
pub generate_totp_2fa: Option<bool>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
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>,
|
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
|
|
|
/// 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>,
|
|
|
|
pub auth: 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]
|
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
|
|
|
/// 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>,
|
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
|
|
|
/// 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,
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
/// Marks all notifications as read.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct MarkAllAsRead {
|
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, 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
|
|
|
/// Adds an admin to a site.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct AddAdmin {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub person_id: PersonId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub added: bool,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: 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 of current admins.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct AddAdminResponse {
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admins: Vec<PersonView>,
|
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
|
|
|
/// 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>,
|
|
|
|
pub expires: Option<i64>,
|
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, 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
|
|
|
/// Get a list of banned persons.
|
|
|
|
// TODO, this should be paged, since the list can be quite long.
|
2021-11-19 20:56:41 +00:00
|
|
|
pub struct GetBannedPersons {
|
2023-04-26 04:26:10 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2021-11-19 20:56:41 +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 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
|
|
|
}
|
|
|
|
|
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 a banned person.
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct BanPersonResponse {
|
2023-03-01 17:19:46 +00:00
|
|
|
pub person_view: PersonView,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub banned: bool,
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// Block a person.
|
2021-08-19 20:54:15 +00:00
|
|
|
pub struct BlockPerson {
|
|
|
|
pub person_id: PersonId,
|
|
|
|
pub block: bool,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
2021-08-19 20:54:15 +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 person block.
|
2021-08-19 20:54:15 +00:00
|
|
|
pub struct BlockPersonResponse {
|
2023-03-01 17:19:46 +00:00
|
|
|
pub person_view: PersonView,
|
2021-08-19 20:54:15 +00:00
|
|
|
pub blocked: 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
|
|
|
/// 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>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
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]
|
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
|
|
|
/// 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>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
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>,
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// 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
|
|
|
pub auth: 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 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
|
|
|
}
|
|
|
|
|
2022-07-30 03:55:59 +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
|
|
|
/// 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,
|
|
|
|
pub auth: Sensitive<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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 comment reply action.
|
2022-07-30 03:55:59 +00:00
|
|
|
pub struct CommentReplyResponse {
|
|
|
|
pub comment_reply_view: CommentReplyView,
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/// 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>,
|
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2021-12-15 19:49:59 +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 deleting your account.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct DeleteAccountResponse {}
|
|
|
|
|
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
|
|
|
/// 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
|
|
|
}
|
|
|
|
|
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 of a password reset.
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PasswordResetResponse {}
|
|
|
|
|
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
|
|
|
/// 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]
|
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
|
|
|
/// 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>,
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
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
|
|
|
|
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
|
|
|
/// Get a count of unread notifications.
|
2021-10-16 10:43:41 +00:00
|
|
|
pub struct GetUnreadCount {
|
2021-12-06 14:54:47 +00:00
|
|
|
pub auth: Sensitive<String>,
|
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
|
|
|
|
2022-11-28 14:29:33 +00:00
|
|
|
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
|
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,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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 to verifying your email.
|
2021-12-15 19:49:59 +00:00
|
|
|
pub struct VerifyEmailResponse {}
|