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)]
24 pub email: Option<String>,
26 pub password_verify: 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 new_password: Option<String>,
63 pub new_password_verify: Option<String>,
64 pub old_password: Option<String>,
65 pub send_notifications_to_email: 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>,
85 pub username: Option<String>,
87 pub page: Option<i64>,
88 pub limit: Option<i64>,
89 pub community_id: Option<CommunityId>,
91 pub auth: Option<String>,
95 pub struct GetPersonDetailsResponse {
96 pub person_view: PersonViewSafe,
97 pub follows: Vec<CommunityFollowerView>,
98 pub moderates: Vec<CommunityModeratorView>,
99 pub comments: Vec<CommentView>,
100 pub posts: Vec<PostView>,
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: 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 GetReplies {
149 pub page: Option<i64>,
150 pub limit: Option<i64>,
151 pub unread_only: bool,
155 #[derive(Deserialize)]
156 pub struct GetPersonMentions {
158 pub page: Option<i64>,
159 pub limit: Option<i64>,
160 pub unread_only: bool,
164 #[derive(Deserialize)]
165 pub struct MarkPersonMentionAsRead {
166 pub person_mention_id: PersonMentionId,
171 #[derive(Serialize, Clone)]
172 pub struct PersonMentionResponse {
173 pub person_mention_view: PersonMentionView,
176 #[derive(Deserialize)]
177 pub struct DeleteAccount {
178 pub password: String,
182 #[derive(Deserialize)]
183 pub struct PasswordReset {
187 #[derive(Serialize, Clone)]
188 pub struct PasswordResetResponse {}
190 #[derive(Deserialize)]
191 pub struct PasswordChange {
193 pub password: String,
194 pub password_verify: String,
197 #[derive(Deserialize)]
198 pub struct CreatePrivateMessage {
200 pub recipient_id: PersonId,
204 #[derive(Deserialize)]
205 pub struct EditPrivateMessage {
206 pub private_message_id: PrivateMessageId,
211 #[derive(Deserialize)]
212 pub struct DeletePrivateMessage {
213 pub private_message_id: PrivateMessageId,
218 #[derive(Deserialize)]
219 pub struct MarkPrivateMessageAsRead {
220 pub private_message_id: PrivateMessageId,
225 #[derive(Deserialize)]
226 pub struct GetPrivateMessages {
227 pub unread_only: bool,
228 pub page: Option<i64>,
229 pub limit: Option<i64>,
233 #[derive(Serialize, Clone)]
234 pub struct PrivateMessagesResponse {
235 pub private_messages: Vec<PrivateMessageView>,
238 #[derive(Serialize, Clone)]
239 pub struct PrivateMessageResponse {
240 pub private_message_view: PrivateMessageView,
243 #[derive(Serialize, Deserialize, Debug)]
244 pub struct GetReportCount {
245 pub community: Option<CommunityId>,
249 #[derive(Serialize, Deserialize, Clone, Debug)]
250 pub struct GetReportCountResponse {
251 pub community: Option<CommunityId>,
252 pub comment_reports: i64,
253 pub post_reports: i64,