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: String, // A Base64 encoded wav audio
47 #[derive(Deserialize)]
48 pub struct SaveUserSettings {
49 pub show_nsfw: Option<bool>,
50 pub show_scores: Option<bool>,
51 pub theme: Option<String>,
52 pub default_sort_type: Option<i16>,
53 pub default_listing_type: Option<i16>,
54 pub lang: Option<String>,
55 pub avatar: Option<String>,
56 pub banner: Option<String>,
57 pub display_name: Option<String>,
58 pub email: Option<String>,
59 pub bio: Option<String>,
60 pub matrix_user_id: Option<String>,
61 pub show_avatars: Option<bool>,
62 pub send_notifications_to_email: Option<bool>,
66 #[derive(Deserialize)]
67 pub struct ChangePassword {
68 pub new_password: String,
69 pub new_password_verify: String,
70 pub old_password: String,
75 pub struct LoginResponse {
79 #[derive(Deserialize)]
80 pub struct GetPersonDetails {
81 pub person_id: Option<PersonId>,
82 pub username: Option<String>,
84 pub page: Option<i64>,
85 pub limit: Option<i64>,
86 pub community_id: Option<CommunityId>,
88 pub auth: Option<String>,
92 pub struct GetPersonDetailsResponse {
93 pub person_view: PersonViewSafe,
94 pub follows: Vec<CommunityFollowerView>,
95 pub moderates: Vec<CommunityModeratorView>,
96 pub comments: Vec<CommentView>,
97 pub posts: Vec<PostView>,
101 pub struct GetRepliesResponse {
102 pub replies: Vec<CommentView>,
106 pub struct GetPersonMentionsResponse {
107 pub mentions: Vec<PersonMentionView>,
110 #[derive(Deserialize)]
111 pub struct MarkAllAsRead {
115 #[derive(Deserialize)]
116 pub struct AddAdmin {
117 pub person_id: PersonId,
122 #[derive(Serialize, Clone)]
123 pub struct AddAdminResponse {
124 pub admins: Vec<PersonViewSafe>,
127 #[derive(Deserialize)]
128 pub struct BanPerson {
129 pub person_id: PersonId,
131 pub remove_data: bool,
132 pub reason: Option<String>,
133 pub expires: Option<i64>,
137 #[derive(Serialize, Clone)]
138 pub struct BanPersonResponse {
139 pub person_view: PersonViewSafe,
143 #[derive(Deserialize)]
144 pub struct GetReplies {
146 pub page: Option<i64>,
147 pub limit: Option<i64>,
148 pub unread_only: bool,
152 #[derive(Deserialize)]
153 pub struct GetPersonMentions {
155 pub page: Option<i64>,
156 pub limit: Option<i64>,
157 pub unread_only: bool,
161 #[derive(Deserialize)]
162 pub struct MarkPersonMentionAsRead {
163 pub person_mention_id: PersonMentionId,
168 #[derive(Serialize, Clone)]
169 pub struct PersonMentionResponse {
170 pub person_mention_view: PersonMentionView,
173 #[derive(Deserialize)]
174 pub struct DeleteAccount {
175 pub password: String,
179 #[derive(Deserialize)]
180 pub struct PasswordReset {
184 #[derive(Serialize, Clone)]
185 pub struct PasswordResetResponse {}
187 #[derive(Deserialize)]
188 pub struct PasswordChange {
190 pub password: String,
191 pub password_verify: String,
194 #[derive(Deserialize)]
195 pub struct CreatePrivateMessage {
197 pub recipient_id: PersonId,
201 #[derive(Deserialize)]
202 pub struct EditPrivateMessage {
203 pub private_message_id: PrivateMessageId,
208 #[derive(Deserialize)]
209 pub struct DeletePrivateMessage {
210 pub private_message_id: PrivateMessageId,
215 #[derive(Deserialize)]
216 pub struct MarkPrivateMessageAsRead {
217 pub private_message_id: PrivateMessageId,
222 #[derive(Deserialize)]
223 pub struct GetPrivateMessages {
224 pub unread_only: bool,
225 pub page: Option<i64>,
226 pub limit: Option<i64>,
230 #[derive(Serialize, Clone)]
231 pub struct PrivateMessagesResponse {
232 pub private_messages: Vec<PrivateMessageView>,
235 #[derive(Serialize, Clone)]
236 pub struct PrivateMessageResponse {
237 pub private_message_view: PrivateMessageView,
240 #[derive(Serialize, Deserialize, Debug)]
241 pub struct GetReportCount {
242 pub community: Option<CommunityId>,
246 #[derive(Serialize, Deserialize, Clone, Debug)]
247 pub struct GetReportCountResponse {
248 pub community: Option<CommunityId>,
249 pub comment_reports: i64,
250 pub post_reports: i64,