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,
19 use lemmy_db_schema::{CommunityId, PersonId, PersonMentionId, PrivateMessageId};
21 #[derive(Deserialize)]
24 pub email: Option<String>,
26 pub password_verify: String,
28 pub captcha_uuid: Option<String>,
29 pub captcha_answer: Option<String>,
32 #[derive(Deserialize)]
33 pub struct GetCaptcha {}
36 pub struct GetCaptchaResponse {
37 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
41 pub struct CaptchaResponse {
42 pub png: String, // A Base64 encoded png
43 pub wav: Option<String>, // A Base64 encoded wav audio
47 #[derive(Deserialize)]
48 pub struct SaveUserSettings {
49 pub show_nsfw: Option<bool>,
50 pub theme: Option<String>,
51 pub default_sort_type: Option<i16>,
52 pub default_listing_type: Option<i16>,
53 pub lang: Option<String>,
54 pub avatar: Option<String>,
55 pub banner: Option<String>,
56 pub preferred_username: Option<String>,
57 pub email: Option<String>,
58 pub bio: Option<String>,
59 pub matrix_user_id: Option<String>,
60 pub show_avatars: Option<bool>,
61 pub send_notifications_to_email: Option<bool>,
65 #[derive(Deserialize)]
66 pub struct ChangePassword {
67 pub new_password: String,
68 pub new_password_verify: String,
69 pub old_password: String,
74 pub struct LoginResponse {
78 #[derive(Deserialize)]
79 pub struct GetPersonDetails {
80 pub person_id: Option<PersonId>,
81 pub username: Option<String>,
83 pub page: Option<i64>,
84 pub limit: Option<i64>,
85 pub community_id: Option<CommunityId>,
87 pub auth: Option<String>,
91 pub struct GetPersonDetailsResponse {
92 pub person_view: PersonViewSafe,
93 pub follows: Vec<CommunityFollowerView>,
94 pub moderates: Vec<CommunityModeratorView>,
95 pub comments: Vec<CommentView>,
96 pub posts: Vec<PostView>,
100 pub struct GetRepliesResponse {
101 pub replies: Vec<CommentView>,
105 pub struct GetPersonMentionsResponse {
106 pub mentions: Vec<PersonMentionView>,
109 #[derive(Deserialize)]
110 pub struct MarkAllAsRead {
114 #[derive(Deserialize)]
115 pub struct AddAdmin {
116 pub person_id: PersonId,
121 #[derive(Serialize, Clone)]
122 pub struct AddAdminResponse {
123 pub admins: Vec<PersonViewSafe>,
126 #[derive(Deserialize)]
127 pub struct BanPerson {
128 pub person_id: PersonId,
130 pub remove_data: bool,
131 pub reason: Option<String>,
132 pub expires: Option<i64>,
136 #[derive(Serialize, Clone)]
137 pub struct BanPersonResponse {
138 pub person_view: PersonViewSafe,
142 #[derive(Deserialize)]
143 pub struct GetReplies {
145 pub page: Option<i64>,
146 pub limit: Option<i64>,
147 pub unread_only: bool,
151 #[derive(Deserialize)]
152 pub struct GetPersonMentions {
154 pub page: Option<i64>,
155 pub limit: Option<i64>,
156 pub unread_only: bool,
160 #[derive(Deserialize)]
161 pub struct MarkPersonMentionAsRead {
162 pub person_mention_id: PersonMentionId,
167 #[derive(Serialize, Clone)]
168 pub struct PersonMentionResponse {
169 pub person_mention_view: PersonMentionView,
172 #[derive(Deserialize)]
173 pub struct DeleteAccount {
174 pub password: String,
178 #[derive(Deserialize)]
179 pub struct PasswordReset {
183 #[derive(Serialize, Clone)]
184 pub struct PasswordResetResponse {}
186 #[derive(Deserialize)]
187 pub struct PasswordChange {
189 pub password: String,
190 pub password_verify: String,
193 #[derive(Deserialize)]
194 pub struct CreatePrivateMessage {
196 pub recipient_id: PersonId,
200 #[derive(Deserialize)]
201 pub struct EditPrivateMessage {
202 pub private_message_id: PrivateMessageId,
207 #[derive(Deserialize)]
208 pub struct DeletePrivateMessage {
209 pub private_message_id: PrivateMessageId,
214 #[derive(Deserialize)]
215 pub struct MarkPrivateMessageAsRead {
216 pub private_message_id: PrivateMessageId,
221 #[derive(Deserialize)]
222 pub struct GetPrivateMessages {
223 pub unread_only: bool,
224 pub page: Option<i64>,
225 pub limit: Option<i64>,
229 #[derive(Serialize, Clone)]
230 pub struct PrivateMessagesResponse {
231 pub private_messages: Vec<PrivateMessageView>,
234 #[derive(Serialize, Clone)]
235 pub struct PrivateMessageResponse {
236 pub private_message_view: PrivateMessageView,
239 #[derive(Serialize, Deserialize, Debug)]
240 pub struct GetReportCount {
241 pub community: Option<CommunityId>,
245 #[derive(Serialize, Deserialize, Clone, Debug)]
246 pub struct GetReportCountResponse {
247 pub community: Option<CommunityId>,
248 pub comment_reports: i64,
249 pub post_reports: i64,