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)]
25 pub password_verify: String,
27 pub email: Option<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>,
63 pub bot_account: Option<bool>,
64 pub show_bot_accounts: Option<bool>,
65 pub show_read_posts: Option<bool>,
69 #[derive(Deserialize)]
70 pub struct ChangePassword {
71 pub new_password: String,
72 pub new_password_verify: String,
73 pub old_password: String,
78 pub struct LoginResponse {
82 #[derive(Deserialize)]
83 pub struct GetPersonDetails {
84 pub person_id: Option<PersonId>, // One of these two are required
85 /// Example: dessalines , or dessalines@xyz.tld
86 pub username: Option<String>,
87 pub sort: Option<String>,
88 pub page: Option<i64>,
89 pub limit: Option<i64>,
90 pub community_id: Option<CommunityId>,
91 pub saved_only: Option<bool>,
92 pub auth: Option<String>,
96 pub struct GetPersonDetailsResponse {
97 pub person_view: PersonViewSafe,
98 pub follows: Vec<CommunityFollowerView>,
99 pub moderates: Vec<CommunityModeratorView>,
100 pub comments: Vec<CommentView>,
101 pub posts: Vec<PostView>,
105 pub struct GetRepliesResponse {
106 pub replies: Vec<CommentView>,
110 pub struct GetPersonMentionsResponse {
111 pub mentions: Vec<PersonMentionView>,
114 #[derive(Deserialize)]
115 pub struct MarkAllAsRead {
119 #[derive(Deserialize)]
120 pub struct AddAdmin {
121 pub person_id: PersonId,
126 #[derive(Serialize, Clone)]
127 pub struct AddAdminResponse {
128 pub admins: Vec<PersonViewSafe>,
131 #[derive(Deserialize)]
132 pub struct BanPerson {
133 pub person_id: PersonId,
135 pub remove_data: Option<bool>,
136 pub reason: Option<String>,
137 pub expires: Option<i64>,
141 #[derive(Serialize, Clone)]
142 pub struct BanPersonResponse {
143 pub person_view: PersonViewSafe,
147 #[derive(Deserialize)]
148 pub struct GetReplies {
149 pub sort: Option<String>,
150 pub page: Option<i64>,
151 pub limit: Option<i64>,
152 pub unread_only: Option<bool>,
156 #[derive(Deserialize)]
157 pub struct GetPersonMentions {
158 pub sort: Option<String>,
159 pub page: Option<i64>,
160 pub limit: Option<i64>,
161 pub unread_only: Option<bool>,
165 #[derive(Deserialize)]
166 pub struct MarkPersonMentionAsRead {
167 pub person_mention_id: PersonMentionId,
172 #[derive(Serialize, Clone)]
173 pub struct PersonMentionResponse {
174 pub person_mention_view: PersonMentionView,
177 #[derive(Deserialize)]
178 pub struct DeleteAccount {
179 pub password: String,
183 #[derive(Deserialize)]
184 pub struct PasswordReset {
188 #[derive(Serialize, Clone)]
189 pub struct PasswordResetResponse {}
191 #[derive(Deserialize)]
192 pub struct PasswordChange {
194 pub password: String,
195 pub password_verify: String,
198 #[derive(Deserialize)]
199 pub struct CreatePrivateMessage {
201 pub recipient_id: PersonId,
205 #[derive(Deserialize)]
206 pub struct EditPrivateMessage {
207 pub private_message_id: PrivateMessageId,
212 #[derive(Deserialize)]
213 pub struct DeletePrivateMessage {
214 pub private_message_id: PrivateMessageId,
219 #[derive(Deserialize)]
220 pub struct MarkPrivateMessageAsRead {
221 pub private_message_id: PrivateMessageId,
226 #[derive(Deserialize)]
227 pub struct GetPrivateMessages {
228 pub unread_only: Option<bool>,
229 pub page: Option<i64>,
230 pub limit: Option<i64>,
234 #[derive(Serialize, Clone)]
235 pub struct PrivateMessagesResponse {
236 pub private_messages: Vec<PrivateMessageView>,
239 #[derive(Serialize, Clone)]
240 pub struct PrivateMessageResponse {
241 pub private_message_view: PrivateMessageView,
244 #[derive(Serialize, Deserialize, Debug)]
245 pub struct GetReportCount {
246 pub community: Option<CommunityId>,
250 #[derive(Serialize, Deserialize, Clone, Debug)]
251 pub struct GetReportCountResponse {
252 pub community: Option<CommunityId>,
253 pub comment_reports: i64,
254 pub post_reports: i64,