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: Option<String>, // A Base64 encoded wav audio
47 #[derive(Deserialize)]
48 pub struct SaveUserSettings {
49 pub show_nsfw: 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 preferred_username: Option<String>,
57 pub email: Option<String>,
58 pub bio: Option<String>,
59 pub matrix_user_id: Option<String>,
60 pub new_password: Option<String>,
61 pub new_password_verify: Option<String>,
62 pub old_password: Option<String>,
63 pub show_avatars: Option<bool>,
64 pub send_notifications_to_email: Option<bool>,
69 pub struct LoginResponse {
73 #[derive(Deserialize)]
74 pub struct GetPersonDetails {
75 pub person_id: Option<PersonId>,
76 pub username: Option<String>,
78 pub page: Option<i64>,
79 pub limit: Option<i64>,
80 pub community_id: Option<CommunityId>,
82 pub auth: Option<String>,
86 pub struct GetPersonDetailsResponse {
87 pub person_view: PersonViewSafe,
88 pub follows: Vec<CommunityFollowerView>,
89 pub moderates: Vec<CommunityModeratorView>,
90 pub comments: Vec<CommentView>,
91 pub posts: Vec<PostView>,
95 pub struct GetRepliesResponse {
96 pub replies: Vec<CommentView>,
100 pub struct GetPersonMentionsResponse {
101 pub mentions: Vec<PersonMentionView>,
104 #[derive(Deserialize)]
105 pub struct MarkAllAsRead {
109 #[derive(Deserialize)]
110 pub struct AddAdmin {
111 pub person_id: PersonId,
116 #[derive(Serialize, Clone)]
117 pub struct AddAdminResponse {
118 pub admins: Vec<PersonViewSafe>,
121 #[derive(Deserialize)]
122 pub struct BanPerson {
123 pub person_id: PersonId,
125 pub remove_data: bool,
126 pub reason: Option<String>,
127 pub expires: Option<i64>,
131 #[derive(Serialize, Clone)]
132 pub struct BanPersonResponse {
133 pub person_view: PersonViewSafe,
137 #[derive(Deserialize)]
138 pub struct GetReplies {
140 pub page: Option<i64>,
141 pub limit: Option<i64>,
142 pub unread_only: bool,
146 #[derive(Deserialize)]
147 pub struct GetPersonMentions {
149 pub page: Option<i64>,
150 pub limit: Option<i64>,
151 pub unread_only: bool,
155 #[derive(Deserialize)]
156 pub struct MarkPersonMentionAsRead {
157 pub person_mention_id: PersonMentionId,
162 #[derive(Serialize, Clone)]
163 pub struct PersonMentionResponse {
164 pub person_mention_view: PersonMentionView,
167 #[derive(Deserialize)]
168 pub struct DeleteAccount {
169 pub password: String,
173 #[derive(Deserialize)]
174 pub struct PasswordReset {
178 #[derive(Serialize, Clone)]
179 pub struct PasswordResetResponse {}
181 #[derive(Deserialize)]
182 pub struct PasswordChange {
184 pub password: String,
185 pub password_verify: String,
188 #[derive(Deserialize)]
189 pub struct CreatePrivateMessage {
191 pub recipient_id: PersonId,
195 #[derive(Deserialize)]
196 pub struct EditPrivateMessage {
197 pub private_message_id: PrivateMessageId,
202 #[derive(Deserialize)]
203 pub struct DeletePrivateMessage {
204 pub private_message_id: PrivateMessageId,
209 #[derive(Deserialize)]
210 pub struct MarkPrivateMessageAsRead {
211 pub private_message_id: PrivateMessageId,
216 #[derive(Deserialize)]
217 pub struct GetPrivateMessages {
218 pub unread_only: bool,
219 pub page: Option<i64>,
220 pub limit: Option<i64>,
224 #[derive(Serialize, Clone)]
225 pub struct PrivateMessagesResponse {
226 pub private_messages: Vec<PrivateMessageView>,
229 #[derive(Serialize, Clone)]
230 pub struct PrivateMessageResponse {
231 pub private_message_view: PrivateMessageView,
234 #[derive(Serialize, Deserialize, Debug)]
235 pub struct GetReportCount {
236 pub community: Option<CommunityId>,
240 #[derive(Serialize, Deserialize, Clone, Debug)]
241 pub struct GetReportCountResponse {
242 pub community: Option<CommunityId>,
243 pub comment_reports: i64,
244 pub post_reports: i64,