2 comment_view::CommentView,
4 private_message_view::PrivateMessageView,
6 use lemmy_db_views_actor::{
7 community_follower_view::CommunityFollowerView,
8 community_moderator_view::CommunityModeratorView,
9 person_mention_view::PersonMentionView,
10 person_view::PersonViewSafe,
12 use serde::{Deserialize, Serialize};
14 #[derive(Deserialize, Debug)]
16 pub username_or_email: String,
20 #[derive(Deserialize)]
23 pub email: Option<String>,
25 pub password_verify: String,
27 pub captcha_uuid: Option<String>,
28 pub captcha_answer: Option<String>,
31 #[derive(Deserialize)]
32 pub struct GetCaptcha {}
35 pub struct GetCaptchaResponse {
36 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
40 pub struct CaptchaResponse {
41 pub png: String, // A Base64 encoded png
42 pub wav: Option<String>, // A Base64 encoded wav audio
46 #[derive(Deserialize)]
47 pub struct SaveUserSettings {
48 pub show_nsfw: Option<bool>,
49 pub theme: Option<String>,
50 pub default_sort_type: Option<i16>,
51 pub default_listing_type: Option<i16>,
52 pub lang: Option<String>,
53 pub avatar: Option<String>,
54 pub banner: Option<String>,
55 pub preferred_username: Option<String>,
56 pub email: Option<String>,
57 pub bio: Option<String>,
58 pub matrix_user_id: Option<String>,
59 pub new_password: Option<String>,
60 pub new_password_verify: Option<String>,
61 pub old_password: Option<String>,
62 pub show_avatars: Option<bool>,
63 pub send_notifications_to_email: Option<bool>,
68 pub struct LoginResponse {
72 #[derive(Deserialize)]
73 pub struct GetPersonDetails {
74 pub person_id: Option<i32>,
75 pub username: Option<String>,
77 pub page: Option<i64>,
78 pub limit: Option<i64>,
79 pub community_id: Option<i32>,
81 pub auth: Option<String>,
85 pub struct GetPersonDetailsResponse {
86 pub person_view: PersonViewSafe,
87 pub follows: Vec<CommunityFollowerView>,
88 pub moderates: Vec<CommunityModeratorView>,
89 pub comments: Vec<CommentView>,
90 pub posts: Vec<PostView>,
94 pub struct GetRepliesResponse {
95 pub replies: Vec<CommentView>,
99 pub struct GetPersonMentionsResponse {
100 pub mentions: Vec<PersonMentionView>,
103 #[derive(Deserialize)]
104 pub struct MarkAllAsRead {
108 #[derive(Deserialize)]
109 pub struct AddAdmin {
115 #[derive(Serialize, Clone)]
116 pub struct AddAdminResponse {
117 pub admins: Vec<PersonViewSafe>,
120 #[derive(Deserialize)]
121 pub struct BanPerson {
124 pub remove_data: bool,
125 pub reason: Option<String>,
126 pub expires: Option<i64>,
130 #[derive(Serialize, Clone)]
131 pub struct BanPersonResponse {
132 pub person_view: PersonViewSafe,
136 #[derive(Deserialize)]
137 pub struct GetReplies {
139 pub page: Option<i64>,
140 pub limit: Option<i64>,
141 pub unread_only: bool,
145 #[derive(Deserialize)]
146 pub struct GetPersonMentions {
148 pub page: Option<i64>,
149 pub limit: Option<i64>,
150 pub unread_only: bool,
154 #[derive(Deserialize)]
155 pub struct MarkPersonMentionAsRead {
156 pub person_mention_id: i32,
161 #[derive(Serialize, Clone)]
162 pub struct PersonMentionResponse {
163 pub person_mention_view: PersonMentionView,
166 #[derive(Deserialize)]
167 pub struct DeleteAccount {
168 pub password: String,
172 #[derive(Deserialize)]
173 pub struct PasswordReset {
177 #[derive(Serialize, Clone)]
178 pub struct PasswordResetResponse {}
180 #[derive(Deserialize)]
181 pub struct PasswordChange {
183 pub password: String,
184 pub password_verify: String,
187 #[derive(Deserialize)]
188 pub struct CreatePrivateMessage {
190 pub recipient_id: i32,
194 #[derive(Deserialize)]
195 pub struct EditPrivateMessage {
196 pub private_message_id: i32,
201 #[derive(Deserialize)]
202 pub struct DeletePrivateMessage {
203 pub private_message_id: i32,
208 #[derive(Deserialize)]
209 pub struct MarkPrivateMessageAsRead {
210 pub private_message_id: i32,
215 #[derive(Deserialize)]
216 pub struct GetPrivateMessages {
217 pub unread_only: bool,
218 pub page: Option<i64>,
219 pub limit: Option<i64>,
223 #[derive(Serialize, Clone)]
224 pub struct PrivateMessagesResponse {
225 pub private_messages: Vec<PrivateMessageView>,
228 #[derive(Serialize, Clone)]
229 pub struct PrivateMessageResponse {
230 pub private_message_view: PrivateMessageView,
233 #[derive(Serialize, Deserialize, Debug)]
234 pub struct GetReportCount {
235 pub community: Option<i32>,
239 #[derive(Serialize, Deserialize, Clone, Debug)]
240 pub struct GetReportCountResponse {
241 pub community: Option<i32>,
242 pub comment_reports: i64,
243 pub post_reports: i64,