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>,
68 #[derive(Deserialize)]
69 pub struct ChangePassword {
70 pub new_password: String,
71 pub new_password_verify: String,
72 pub old_password: String,
77 pub struct LoginResponse {
81 #[derive(Deserialize)]
82 pub struct GetPersonDetails {
83 pub person_id: Option<PersonId>, // One of these two are required
84 pub username: Option<String>,
85 pub sort: Option<String>,
86 pub page: Option<i64>,
87 pub limit: Option<i64>,
88 pub community_id: Option<CommunityId>,
89 pub saved_only: Option<bool>,
90 pub auth: Option<String>,
94 pub struct GetPersonDetailsResponse {
95 pub person_view: PersonViewSafe,
96 pub follows: Vec<CommunityFollowerView>,
97 pub moderates: Vec<CommunityModeratorView>,
98 pub comments: Vec<CommentView>,
99 pub posts: Vec<PostView>,
103 pub struct GetRepliesResponse {
104 pub replies: Vec<CommentView>,
108 pub struct GetPersonMentionsResponse {
109 pub mentions: Vec<PersonMentionView>,
112 #[derive(Deserialize)]
113 pub struct MarkAllAsRead {
117 #[derive(Deserialize)]
118 pub struct AddAdmin {
119 pub person_id: PersonId,
124 #[derive(Serialize, Clone)]
125 pub struct AddAdminResponse {
126 pub admins: Vec<PersonViewSafe>,
129 #[derive(Deserialize)]
130 pub struct BanPerson {
131 pub person_id: PersonId,
133 pub remove_data: Option<bool>,
134 pub reason: Option<String>,
135 pub expires: Option<i64>,
139 #[derive(Serialize, Clone)]
140 pub struct BanPersonResponse {
141 pub person_view: PersonViewSafe,
145 #[derive(Deserialize)]
146 pub struct GetReplies {
147 pub sort: Option<String>,
148 pub page: Option<i64>,
149 pub limit: Option<i64>,
150 pub unread_only: Option<bool>,
154 #[derive(Deserialize)]
155 pub struct GetPersonMentions {
156 pub sort: Option<String>,
157 pub page: Option<i64>,
158 pub limit: Option<i64>,
159 pub unread_only: Option<bool>,
163 #[derive(Deserialize)]
164 pub struct MarkPersonMentionAsRead {
165 pub person_mention_id: PersonMentionId,
170 #[derive(Serialize, Clone)]
171 pub struct PersonMentionResponse {
172 pub person_mention_view: PersonMentionView,
175 #[derive(Deserialize)]
176 pub struct DeleteAccount {
177 pub password: String,
181 #[derive(Deserialize)]
182 pub struct PasswordReset {
186 #[derive(Serialize, Clone)]
187 pub struct PasswordResetResponse {}
189 #[derive(Deserialize)]
190 pub struct PasswordChange {
192 pub password: String,
193 pub password_verify: String,
196 #[derive(Deserialize)]
197 pub struct CreatePrivateMessage {
199 pub recipient_id: PersonId,
203 #[derive(Deserialize)]
204 pub struct EditPrivateMessage {
205 pub private_message_id: PrivateMessageId,
210 #[derive(Deserialize)]
211 pub struct DeletePrivateMessage {
212 pub private_message_id: PrivateMessageId,
217 #[derive(Deserialize)]
218 pub struct MarkPrivateMessageAsRead {
219 pub private_message_id: PrivateMessageId,
224 #[derive(Deserialize)]
225 pub struct GetPrivateMessages {
226 pub unread_only: Option<bool>,
227 pub page: Option<i64>,
228 pub limit: Option<i64>,
232 #[derive(Serialize, Clone)]
233 pub struct PrivateMessagesResponse {
234 pub private_messages: Vec<PrivateMessageView>,
237 #[derive(Serialize, Clone)]
238 pub struct PrivateMessageResponse {
239 pub private_message_view: PrivateMessageView,
242 #[derive(Serialize, Deserialize, Debug)]
243 pub struct GetReportCount {
244 pub community: Option<CommunityId>,
248 #[derive(Serialize, Deserialize, Clone, Debug)]
249 pub struct GetReportCountResponse {
250 pub community: Option<CommunityId>,
251 pub comment_reports: i64,
252 pub post_reports: i64,