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>,
31 #[derive(Deserialize)]
32 pub struct GetCaptcha {}
35 pub struct GetCaptchaResponse {
36 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
40 pub struct CaptchaResponse {
41 pub png: String, // A Base64 encoded png
42 pub wav: String, // A Base64 encoded wav audio
46 #[derive(Deserialize)]
47 pub struct SaveUserSettings {
48 pub show_nsfw: Option<bool>,
49 pub show_scores: 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 display_name: 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>,
62 pub bot_account: Option<bool>,
63 pub show_bot_accounts: Option<bool>,
64 pub show_read_posts: Option<bool>,
65 pub show_new_post_notifs: 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 comments: Vec<CommentView>,
99 pub posts: Vec<PostView>,
100 pub moderates: Vec<CommunityModeratorView>,
104 pub struct GetRepliesResponse {
105 pub replies: Vec<CommentView>,
109 pub struct GetPersonMentionsResponse {
110 pub mentions: Vec<PersonMentionView>,
113 #[derive(Deserialize)]
114 pub struct MarkAllAsRead {
118 #[derive(Deserialize)]
119 pub struct AddAdmin {
120 pub person_id: PersonId,
125 #[derive(Serialize, Clone)]
126 pub struct AddAdminResponse {
127 pub admins: Vec<PersonViewSafe>,
130 #[derive(Deserialize)]
131 pub struct BanPerson {
132 pub person_id: PersonId,
134 pub remove_data: Option<bool>,
135 pub reason: Option<String>,
136 pub expires: Option<i64>,
140 #[derive(Serialize, Clone)]
141 pub struct BanPersonResponse {
142 pub person_view: PersonViewSafe,
146 #[derive(Deserialize)]
147 pub struct BlockPerson {
148 pub person_id: PersonId,
153 #[derive(Serialize, Clone)]
154 pub struct BlockPersonResponse {
155 pub person_view: PersonViewSafe,
159 #[derive(Deserialize)]
160 pub struct GetReplies {
161 pub sort: Option<String>,
162 pub page: Option<i64>,
163 pub limit: Option<i64>,
164 pub unread_only: Option<bool>,
168 #[derive(Deserialize)]
169 pub struct GetPersonMentions {
170 pub sort: Option<String>,
171 pub page: Option<i64>,
172 pub limit: Option<i64>,
173 pub unread_only: Option<bool>,
177 #[derive(Deserialize)]
178 pub struct MarkPersonMentionAsRead {
179 pub person_mention_id: PersonMentionId,
184 #[derive(Serialize, Clone)]
185 pub struct PersonMentionResponse {
186 pub person_mention_view: PersonMentionView,
189 #[derive(Deserialize)]
190 pub struct DeleteAccount {
191 pub password: String,
195 #[derive(Deserialize)]
196 pub struct PasswordReset {
200 #[derive(Serialize, Clone)]
201 pub struct PasswordResetResponse {}
203 #[derive(Deserialize)]
204 pub struct PasswordChange {
206 pub password: String,
207 pub password_verify: String,
210 #[derive(Deserialize)]
211 pub struct CreatePrivateMessage {
213 pub recipient_id: PersonId,
217 #[derive(Deserialize)]
218 pub struct EditPrivateMessage {
219 pub private_message_id: PrivateMessageId,
224 #[derive(Deserialize)]
225 pub struct DeletePrivateMessage {
226 pub private_message_id: PrivateMessageId,
231 #[derive(Deserialize)]
232 pub struct MarkPrivateMessageAsRead {
233 pub private_message_id: PrivateMessageId,
238 #[derive(Deserialize)]
239 pub struct GetPrivateMessages {
240 pub unread_only: Option<bool>,
241 pub page: Option<i64>,
242 pub limit: Option<i64>,
246 #[derive(Serialize, Clone)]
247 pub struct PrivateMessagesResponse {
248 pub private_messages: Vec<PrivateMessageView>,
251 #[derive(Serialize, Clone)]
252 pub struct PrivateMessageResponse {
253 pub private_message_view: PrivateMessageView,
256 #[derive(Deserialize)]
257 pub struct GetReportCount {
258 pub community_id: Option<CommunityId>,
262 #[derive(Serialize, Clone)]
263 pub struct GetReportCountResponse {
264 pub community_id: Option<CommunityId>,
265 pub comment_reports: i64,
266 pub post_reports: i64,