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>,
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 follows: Vec<CommunityFollowerView>,
100 pub moderates: Vec<CommunityModeratorView>,
101 pub comments: Vec<CommentView>,
102 pub posts: Vec<PostView>,
106 pub struct GetRepliesResponse {
107 pub replies: Vec<CommentView>,
111 pub struct GetPersonMentionsResponse {
112 pub mentions: Vec<PersonMentionView>,
115 #[derive(Deserialize)]
116 pub struct MarkAllAsRead {
120 #[derive(Deserialize)]
121 pub struct AddAdmin {
122 pub person_id: PersonId,
127 #[derive(Serialize, Clone)]
128 pub struct AddAdminResponse {
129 pub admins: Vec<PersonViewSafe>,
132 #[derive(Deserialize)]
133 pub struct BanPerson {
134 pub person_id: PersonId,
136 pub remove_data: Option<bool>,
137 pub reason: Option<String>,
138 pub expires: Option<i64>,
142 #[derive(Serialize, Clone)]
143 pub struct BanPersonResponse {
144 pub person_view: PersonViewSafe,
148 #[derive(Deserialize)]
149 pub struct GetReplies {
150 pub sort: Option<String>,
151 pub page: Option<i64>,
152 pub limit: Option<i64>,
153 pub unread_only: Option<bool>,
157 #[derive(Deserialize)]
158 pub struct GetPersonMentions {
159 pub sort: Option<String>,
160 pub page: Option<i64>,
161 pub limit: Option<i64>,
162 pub unread_only: Option<bool>,
166 #[derive(Deserialize)]
167 pub struct MarkPersonMentionAsRead {
168 pub person_mention_id: PersonMentionId,
173 #[derive(Serialize, Clone)]
174 pub struct PersonMentionResponse {
175 pub person_mention_view: PersonMentionView,
178 #[derive(Deserialize)]
179 pub struct DeleteAccount {
180 pub password: String,
184 #[derive(Deserialize)]
185 pub struct PasswordReset {
189 #[derive(Serialize, Clone)]
190 pub struct PasswordResetResponse {}
192 #[derive(Deserialize)]
193 pub struct PasswordChange {
195 pub password: String,
196 pub password_verify: String,
199 #[derive(Deserialize)]
200 pub struct CreatePrivateMessage {
202 pub recipient_id: PersonId,
206 #[derive(Deserialize)]
207 pub struct EditPrivateMessage {
208 pub private_message_id: PrivateMessageId,
213 #[derive(Deserialize)]
214 pub struct DeletePrivateMessage {
215 pub private_message_id: PrivateMessageId,
220 #[derive(Deserialize)]
221 pub struct MarkPrivateMessageAsRead {
222 pub private_message_id: PrivateMessageId,
227 #[derive(Deserialize)]
228 pub struct GetPrivateMessages {
229 pub unread_only: Option<bool>,
230 pub page: Option<i64>,
231 pub limit: Option<i64>,
235 #[derive(Serialize, Clone)]
236 pub struct PrivateMessagesResponse {
237 pub private_messages: Vec<PrivateMessageView>,
240 #[derive(Serialize, Clone)]
241 pub struct PrivateMessageResponse {
242 pub private_message_view: PrivateMessageView,
245 #[derive(Serialize, Deserialize, Debug)]
246 pub struct GetReportCount {
247 pub community: Option<CommunityId>,
251 #[derive(Serialize, Deserialize, Clone, Debug)]
252 pub struct GetReportCountResponse {
253 pub community: Option<CommunityId>,
254 pub comment_reports: i64,
255 pub post_reports: i64,