1 use crate::sensitive::Sensitive;
2 use lemmy_db_views::structs::{CommentView, PostView, PrivateMessageView};
3 use lemmy_db_views_actor::structs::{
5 CommunityModeratorView,
9 use serde::{Deserialize, Serialize};
11 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
13 pub username_or_email: Sensitive<String>,
14 pub password: Sensitive<String>,
16 use lemmy_db_schema::{
17 newtypes::{CommentReplyId, CommunityId, PersonId, PersonMentionId, PrivateMessageId},
22 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
25 pub password: Sensitive<String>,
26 pub password_verify: Sensitive<String>,
28 /// email is mandatory if email verification is enabled on the server
29 pub email: Option<Sensitive<String>>,
30 pub captcha_uuid: Option<String>,
31 pub captcha_answer: Option<String>,
32 pub honeypot: Option<String>,
33 /// An answer is mandatory if require application is enabled on the server
34 pub answer: Option<String>,
37 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
38 pub struct GetCaptcha {}
40 #[derive(Debug, Serialize, Deserialize, Clone)]
41 pub struct GetCaptchaResponse {
42 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
45 #[derive(Debug, Serialize, Deserialize, Clone)]
46 pub struct CaptchaResponse {
47 pub png: String, // A Base64 encoded png
48 pub wav: String, // A Base64 encoded wav audio
52 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
53 pub struct SaveUserSettings {
54 pub show_nsfw: Option<bool>,
55 pub show_scores: Option<bool>,
56 pub theme: Option<String>,
57 pub default_sort_type: Option<i16>,
58 pub default_listing_type: Option<i16>,
59 pub lang: Option<String>,
60 pub avatar: Option<String>,
61 pub banner: Option<String>,
62 pub display_name: Option<String>,
63 pub email: Option<Sensitive<String>>,
64 pub bio: Option<String>,
65 pub matrix_user_id: Option<String>,
66 pub show_avatars: Option<bool>,
67 pub send_notifications_to_email: Option<bool>,
68 pub bot_account: Option<bool>,
69 pub show_bot_accounts: Option<bool>,
70 pub show_read_posts: Option<bool>,
71 pub show_new_post_notifs: Option<bool>,
72 pub auth: Sensitive<String>,
75 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
76 pub struct ChangePassword {
77 pub new_password: Sensitive<String>,
78 pub new_password_verify: Sensitive<String>,
79 pub old_password: Sensitive<String>,
80 pub auth: Sensitive<String>,
83 #[derive(Debug, Serialize, Deserialize, Clone)]
84 pub struct LoginResponse {
85 /// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
86 pub jwt: Option<Sensitive<String>>,
87 pub registration_created: bool,
88 pub verify_email_sent: bool,
91 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
92 pub struct GetPersonDetails {
93 pub person_id: Option<PersonId>, // One of these two are required
94 /// Example: dessalines , or dessalines@xyz.tld
95 pub username: Option<String>,
96 pub sort: Option<SortType>,
97 pub page: Option<i64>,
98 pub limit: Option<i64>,
99 pub community_id: Option<CommunityId>,
100 pub saved_only: Option<bool>,
101 pub auth: Option<Sensitive<String>>,
104 #[derive(Debug, Serialize, Deserialize, Clone)]
105 pub struct GetPersonDetailsResponse {
106 pub person_view: PersonViewSafe,
107 pub comments: Vec<CommentView>,
108 pub posts: Vec<PostView>,
109 pub moderates: Vec<CommunityModeratorView>,
112 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
113 pub struct GetRepliesResponse {
114 pub replies: Vec<CommentReplyView>,
117 #[derive(Debug, Serialize, Deserialize, Clone)]
118 pub struct GetPersonMentionsResponse {
119 pub mentions: Vec<PersonMentionView>,
122 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
123 pub struct MarkAllAsRead {
124 pub auth: Sensitive<String>,
127 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
128 pub struct AddAdmin {
129 pub person_id: PersonId,
131 pub auth: Sensitive<String>,
134 #[derive(Debug, Serialize, Deserialize, Clone)]
135 pub struct AddAdminResponse {
136 pub admins: Vec<PersonViewSafe>,
139 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
140 pub struct BanPerson {
141 pub person_id: PersonId,
143 pub remove_data: Option<bool>,
144 pub reason: Option<String>,
145 pub expires: Option<i64>,
146 pub auth: Sensitive<String>,
149 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
150 pub struct GetBannedPersons {
154 #[derive(Debug, Serialize, Deserialize, Clone)]
155 pub struct BannedPersonsResponse {
156 pub banned: Vec<PersonViewSafe>,
159 #[derive(Debug, Serialize, Deserialize, Clone)]
160 pub struct BanPersonResponse {
161 pub person_view: PersonViewSafe,
165 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
166 pub struct BlockPerson {
167 pub person_id: PersonId,
169 pub auth: Sensitive<String>,
172 #[derive(Debug, Serialize, Deserialize, Clone)]
173 pub struct BlockPersonResponse {
174 pub person_view: PersonViewSafe,
178 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
179 pub struct GetReplies {
180 pub sort: Option<CommentSortType>,
181 pub page: Option<i64>,
182 pub limit: Option<i64>,
183 pub unread_only: Option<bool>,
184 pub auth: Sensitive<String>,
187 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
188 pub struct GetPersonMentions {
189 pub sort: Option<CommentSortType>,
190 pub page: Option<i64>,
191 pub limit: Option<i64>,
192 pub unread_only: Option<bool>,
193 pub auth: Sensitive<String>,
196 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
197 pub struct MarkPersonMentionAsRead {
198 pub person_mention_id: PersonMentionId,
200 pub auth: Sensitive<String>,
203 #[derive(Debug, Serialize, Deserialize, Clone)]
204 pub struct PersonMentionResponse {
205 pub person_mention_view: PersonMentionView,
208 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
209 pub struct MarkCommentReplyAsRead {
210 pub comment_reply_id: CommentReplyId,
212 pub auth: Sensitive<String>,
215 #[derive(Debug, Serialize, Deserialize, Clone)]
216 pub struct CommentReplyResponse {
217 pub comment_reply_view: CommentReplyView,
220 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
221 pub struct DeleteAccount {
222 pub password: Sensitive<String>,
223 pub auth: Sensitive<String>,
226 #[derive(Debug, Serialize, Deserialize, Clone)]
227 pub struct DeleteAccountResponse {}
229 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
230 pub struct PasswordReset {
231 pub email: Sensitive<String>,
234 #[derive(Debug, Serialize, Deserialize, Clone)]
235 pub struct PasswordResetResponse {}
237 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
238 pub struct PasswordChangeAfterReset {
239 pub token: Sensitive<String>,
240 pub password: Sensitive<String>,
241 pub password_verify: Sensitive<String>,
244 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
245 pub struct CreatePrivateMessage {
247 pub recipient_id: PersonId,
248 pub auth: Sensitive<String>,
251 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
252 pub struct EditPrivateMessage {
253 pub private_message_id: PrivateMessageId,
255 pub auth: Sensitive<String>,
258 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
259 pub struct DeletePrivateMessage {
260 pub private_message_id: PrivateMessageId,
262 pub auth: Sensitive<String>,
265 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
266 pub struct MarkPrivateMessageAsRead {
267 pub private_message_id: PrivateMessageId,
269 pub auth: Sensitive<String>,
272 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
273 pub struct GetPrivateMessages {
274 pub unread_only: Option<bool>,
275 pub page: Option<i64>,
276 pub limit: Option<i64>,
277 pub auth: Sensitive<String>,
280 #[derive(Debug, Serialize, Deserialize, Clone)]
281 pub struct PrivateMessagesResponse {
282 pub private_messages: Vec<PrivateMessageView>,
285 #[derive(Debug, Serialize, Deserialize, Clone)]
286 pub struct PrivateMessageResponse {
287 pub private_message_view: PrivateMessageView,
290 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
291 pub struct GetReportCount {
292 pub community_id: Option<CommunityId>,
293 pub auth: Sensitive<String>,
296 #[derive(Debug, Serialize, Deserialize, Clone)]
297 pub struct GetReportCountResponse {
298 pub community_id: Option<CommunityId>,
299 pub comment_reports: i64,
300 pub post_reports: i64,
303 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
304 pub struct GetUnreadCount {
305 pub auth: Sensitive<String>,
308 #[derive(Debug, Serialize, Deserialize, Clone)]
309 pub struct GetUnreadCountResponse {
312 pub private_messages: i64,
315 #[derive(Serialize, Deserialize, Clone, Default)]
316 pub struct VerifyEmail {
320 #[derive(Debug, Serialize, Deserialize, Clone)]
321 pub struct VerifyEmailResponse {}