use lemmy_db_views::{ comment_view::CommentView, post_view::PostView, private_message_view::PrivateMessageView, }; use lemmy_db_views_actor::{ community_follower_view::CommunityFollowerView, community_moderator_view::CommunityModeratorView, user_mention_view::UserMentionView, user_view::{UserViewDangerous, UserViewSafe}, }; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Debug)] pub struct Login { pub username_or_email: String, pub password: String, } #[derive(Deserialize)] pub struct Register { pub username: String, pub email: Option, pub password: String, pub password_verify: String, pub admin: bool, pub show_nsfw: bool, pub captcha_uuid: Option, pub captcha_answer: Option, } #[derive(Deserialize)] pub struct GetCaptcha {} #[derive(Serialize)] pub struct GetCaptchaResponse { pub ok: Option, } #[derive(Serialize)] pub struct CaptchaResponse { pub png: String, // A Base64 encoded png pub wav: Option, // A Base64 encoded wav audio pub uuid: String, } #[derive(Deserialize)] pub struct SaveUserSettings { pub show_nsfw: bool, pub theme: String, pub default_sort_type: String, pub default_listing_type: String, pub lang: String, pub avatar: Option, pub banner: Option, pub preferred_username: Option, pub email: Option, pub bio: Option, pub matrix_user_id: Option, pub new_password: Option, pub new_password_verify: Option, pub old_password: Option, pub show_avatars: bool, pub send_notifications_to_email: bool, pub auth: String, } #[derive(Serialize)] pub struct LoginResponse { pub jwt: String, } #[derive(Deserialize)] pub struct GetUserDetails { pub user_id: Option, pub username: Option, pub sort: String, pub page: Option, pub limit: Option, pub community_id: Option, pub saved_only: bool, pub auth: Option, } #[derive(Serialize)] pub struct GetUserDetailsResponse { pub user_view: Option, pub user_view_dangerous: Option, pub follows: Vec, pub moderates: Vec, pub comments: Vec, pub posts: Vec, } #[derive(Serialize)] pub struct GetRepliesResponse { pub replies: Vec, } #[derive(Serialize)] pub struct GetUserMentionsResponse { pub mentions: Vec, } #[derive(Deserialize)] pub struct MarkAllAsRead { pub auth: String, } #[derive(Deserialize)] pub struct AddAdmin { pub user_id: i32, pub added: bool, pub auth: String, } #[derive(Serialize, Clone)] pub struct AddAdminResponse { pub admins: Vec, } #[derive(Deserialize)] pub struct BanUser { pub user_id: i32, pub ban: bool, pub remove_data: bool, pub reason: Option, pub expires: Option, pub auth: String, } #[derive(Serialize, Clone)] pub struct BanUserResponse { pub user_view: UserViewSafe, pub banned: bool, } #[derive(Deserialize)] pub struct GetReplies { pub sort: String, pub page: Option, pub limit: Option, pub unread_only: bool, pub auth: String, } #[derive(Deserialize)] pub struct GetUserMentions { pub sort: String, pub page: Option, pub limit: Option, pub unread_only: bool, pub auth: String, } #[derive(Deserialize)] pub struct MarkUserMentionAsRead { pub user_mention_id: i32, pub read: bool, pub auth: String, } #[derive(Serialize, Clone)] pub struct UserMentionResponse { pub user_mention_view: UserMentionView, } #[derive(Deserialize)] pub struct DeleteAccount { pub password: String, pub auth: String, } #[derive(Deserialize)] pub struct PasswordReset { pub email: String, } #[derive(Serialize, Clone)] pub struct PasswordResetResponse {} #[derive(Deserialize)] pub struct PasswordChange { pub token: String, pub password: String, pub password_verify: String, } #[derive(Deserialize)] pub struct CreatePrivateMessage { pub content: String, pub recipient_id: i32, pub auth: String, } #[derive(Deserialize)] pub struct EditPrivateMessage { pub edit_id: i32, pub content: String, pub auth: String, } #[derive(Deserialize)] pub struct DeletePrivateMessage { pub edit_id: i32, pub deleted: bool, pub auth: String, } #[derive(Deserialize)] pub struct MarkPrivateMessageAsRead { pub edit_id: i32, pub read: bool, pub auth: String, } #[derive(Deserialize)] pub struct GetPrivateMessages { pub unread_only: bool, pub page: Option, pub limit: Option, pub auth: String, } #[derive(Serialize, Clone)] pub struct PrivateMessagesResponse { pub private_messages: Vec, } #[derive(Serialize, Clone)] pub struct PrivateMessageResponse { pub private_message_view: PrivateMessageView, } #[derive(Deserialize, Debug)] pub struct UserJoin { pub auth: String, } #[derive(Serialize, Clone)] pub struct UserJoinResponse { pub joined: bool, } #[derive(Serialize, Deserialize, Debug)] pub struct GetReportCount { pub community: Option, pub auth: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct GetReportCountResponse { pub community: Option, pub comment_reports: i64, pub post_reports: i64, }