2 comment_view::CommentView,
4 private_message_view::PrivateMessageView,
6 use lemmy_db_views_actor::{
7 community_moderator_view::CommunityModeratorView,
8 person_mention_view::PersonMentionView,
9 person_view::PersonViewSafe,
11 use serde::{Deserialize, Serialize};
13 #[derive(Deserialize, Debug)]
15 pub username_or_email: String,
18 use lemmy_db_schema::{CommunityId, PersonId, PersonMentionId, PrivateMessageId};
20 #[derive(Deserialize)]
24 pub password_verify: String,
26 pub email: Option<String>,
27 pub captcha_uuid: Option<String>,
28 pub captcha_answer: Option<String>,
29 pub honeypot: 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>,
66 pub show_new_post_notifs: Option<bool>,
70 #[derive(Deserialize)]
71 pub struct ChangePassword {
72 pub new_password: String,
73 pub new_password_verify: String,
74 pub old_password: String,
79 pub struct LoginResponse {
83 #[derive(Deserialize)]
84 pub struct GetPersonDetails {
85 pub person_id: Option<PersonId>, // One of these two are required
86 /// Example: dessalines , or dessalines@xyz.tld
87 pub username: Option<String>,
88 pub sort: Option<String>,
89 pub page: Option<i64>,
90 pub limit: Option<i64>,
91 pub community_id: Option<CommunityId>,
92 pub saved_only: Option<bool>,
93 pub auth: Option<String>,
97 pub struct GetPersonDetailsResponse {
98 pub person_view: PersonViewSafe,
99 pub comments: Vec<CommentView>,
100 pub posts: Vec<PostView>,
101 pub moderates: Vec<CommunityModeratorView>,
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 BlockPerson {
149 pub person_id: PersonId,
154 #[derive(Serialize, Clone)]
155 pub struct BlockPersonResponse {
156 pub person_view: PersonViewSafe,
160 #[derive(Deserialize)]
161 pub struct GetReplies {
162 pub sort: Option<String>,
163 pub page: Option<i64>,
164 pub limit: Option<i64>,
165 pub unread_only: Option<bool>,
169 #[derive(Deserialize)]
170 pub struct GetPersonMentions {
171 pub sort: Option<String>,
172 pub page: Option<i64>,
173 pub limit: Option<i64>,
174 pub unread_only: Option<bool>,
178 #[derive(Deserialize)]
179 pub struct MarkPersonMentionAsRead {
180 pub person_mention_id: PersonMentionId,
185 #[derive(Serialize, Clone)]
186 pub struct PersonMentionResponse {
187 pub person_mention_view: PersonMentionView,
190 #[derive(Deserialize)]
191 pub struct DeleteAccount {
192 pub password: String,
196 #[derive(Deserialize)]
197 pub struct PasswordReset {
201 #[derive(Serialize, Clone)]
202 pub struct PasswordResetResponse {}
204 #[derive(Deserialize)]
205 pub struct PasswordChange {
207 pub password: String,
208 pub password_verify: String,
211 #[derive(Deserialize)]
212 pub struct CreatePrivateMessage {
214 pub recipient_id: PersonId,
218 #[derive(Deserialize)]
219 pub struct EditPrivateMessage {
220 pub private_message_id: PrivateMessageId,
225 #[derive(Deserialize)]
226 pub struct DeletePrivateMessage {
227 pub private_message_id: PrivateMessageId,
232 #[derive(Deserialize)]
233 pub struct MarkPrivateMessageAsRead {
234 pub private_message_id: PrivateMessageId,
239 #[derive(Deserialize)]
240 pub struct GetPrivateMessages {
241 pub unread_only: Option<bool>,
242 pub page: Option<i64>,
243 pub limit: Option<i64>,
247 #[derive(Serialize, Clone)]
248 pub struct PrivateMessagesResponse {
249 pub private_messages: Vec<PrivateMessageView>,
252 #[derive(Serialize, Clone)]
253 pub struct PrivateMessageResponse {
254 pub private_message_view: PrivateMessageView,
257 #[derive(Deserialize)]
258 pub struct GetReportCount {
259 pub community_id: Option<CommunityId>,
263 #[derive(Serialize, Clone)]
264 pub struct GetReportCountResponse {
265 pub community_id: Option<CommunityId>,
266 pub comment_reports: i64,
267 pub post_reports: i64,
270 #[derive(Deserialize)]
271 pub struct GetUnreadCount {
275 #[derive(Serialize, Clone)]
276 pub struct GetUnreadCountResponse {
279 pub private_messages: i64,