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 show_avatars: Option<bool>,
52 pub theme: Option<String>,
53 pub default_sort_type: Option<i16>,
54 pub default_listing_type: Option<i16>,
55 pub lang: Option<String>,
56 pub avatar: Option<String>,
57 pub banner: Option<String>,
58 pub display_name: Option<String>,
59 pub email: Option<String>,
60 pub bio: Option<String>,
61 pub matrix_user_id: Option<String>,
62 pub new_password: Option<String>,
63 pub new_password_verify: Option<String>,
64 pub old_password: Option<String>,
65 pub send_notifications_to_email: Option<bool>,
70 pub struct LoginResponse {
74 #[derive(Deserialize)]
75 pub struct GetPersonDetails {
76 pub person_id: Option<PersonId>,
77 pub username: Option<String>,
79 pub page: Option<i64>,
80 pub limit: Option<i64>,
81 pub community_id: Option<CommunityId>,
83 pub auth: Option<String>,
87 pub struct GetPersonDetailsResponse {
88 pub person_view: PersonViewSafe,
89 pub follows: Vec<CommunityFollowerView>,
90 pub moderates: Vec<CommunityModeratorView>,
91 pub comments: Vec<CommentView>,
92 pub posts: Vec<PostView>,
96 pub struct GetRepliesResponse {
97 pub replies: Vec<CommentView>,
101 pub struct GetPersonMentionsResponse {
102 pub mentions: Vec<PersonMentionView>,
105 #[derive(Deserialize)]
106 pub struct MarkAllAsRead {
110 #[derive(Deserialize)]
111 pub struct AddAdmin {
112 pub person_id: PersonId,
117 #[derive(Serialize, Clone)]
118 pub struct AddAdminResponse {
119 pub admins: Vec<PersonViewSafe>,
122 #[derive(Deserialize)]
123 pub struct BanPerson {
124 pub person_id: PersonId,
126 pub remove_data: bool,
127 pub reason: Option<String>,
128 pub expires: Option<i64>,
132 #[derive(Serialize, Clone)]
133 pub struct BanPersonResponse {
134 pub person_view: PersonViewSafe,
138 #[derive(Deserialize)]
139 pub struct GetReplies {
141 pub page: Option<i64>,
142 pub limit: Option<i64>,
143 pub unread_only: bool,
147 #[derive(Deserialize)]
148 pub struct GetPersonMentions {
150 pub page: Option<i64>,
151 pub limit: Option<i64>,
152 pub unread_only: bool,
156 #[derive(Deserialize)]
157 pub struct MarkPersonMentionAsRead {
158 pub person_mention_id: PersonMentionId,
163 #[derive(Serialize, Clone)]
164 pub struct PersonMentionResponse {
165 pub person_mention_view: PersonMentionView,
168 #[derive(Deserialize)]
169 pub struct DeleteAccount {
170 pub password: String,
174 #[derive(Deserialize)]
175 pub struct PasswordReset {
179 #[derive(Serialize, Clone)]
180 pub struct PasswordResetResponse {}
182 #[derive(Deserialize)]
183 pub struct PasswordChange {
185 pub password: String,
186 pub password_verify: String,
189 #[derive(Deserialize)]
190 pub struct CreatePrivateMessage {
192 pub recipient_id: PersonId,
196 #[derive(Deserialize)]
197 pub struct EditPrivateMessage {
198 pub private_message_id: PrivateMessageId,
203 #[derive(Deserialize)]
204 pub struct DeletePrivateMessage {
205 pub private_message_id: PrivateMessageId,
210 #[derive(Deserialize)]
211 pub struct MarkPrivateMessageAsRead {
212 pub private_message_id: PrivateMessageId,
217 #[derive(Deserialize)]
218 pub struct GetPrivateMessages {
219 pub unread_only: bool,
220 pub page: Option<i64>,
221 pub limit: Option<i64>,
225 #[derive(Serialize, Clone)]
226 pub struct PrivateMessagesResponse {
227 pub private_messages: Vec<PrivateMessageView>,
230 #[derive(Serialize, Clone)]
231 pub struct PrivateMessageResponse {
232 pub private_message_view: PrivateMessageView,
235 #[derive(Serialize, Deserialize, Debug)]
236 pub struct GetReportCount {
237 pub community: Option<CommunityId>,
241 #[derive(Serialize, Deserialize, Clone, Debug)]
242 pub struct GetReportCountResponse {
243 pub community: Option<CommunityId>,
244 pub comment_reports: i64,
245 pub post_reports: i64,