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::{
29 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
32 pub password: Sensitive<String>,
33 pub password_verify: Sensitive<String>,
35 /// email is mandatory if email verification is enabled on the server
36 pub email: Option<Sensitive<String>>,
37 pub captcha_uuid: Option<String>,
38 pub captcha_answer: Option<String>,
39 pub honeypot: Option<String>,
40 /// An answer is mandatory if require application is enabled on the server
41 pub answer: Option<String>,
44 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
45 pub struct GetCaptcha {}
47 #[derive(Debug, Serialize, Deserialize, Clone)]
48 pub struct GetCaptchaResponse {
49 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
52 #[derive(Debug, Serialize, Deserialize, Clone)]
53 pub struct CaptchaResponse {
54 pub png: String, // A Base64 encoded png
55 pub wav: String, // A Base64 encoded wav audio
59 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
60 pub struct SaveUserSettings {
61 pub show_nsfw: Option<bool>,
62 pub show_scores: Option<bool>,
63 pub theme: Option<String>,
64 pub default_sort_type: Option<i16>,
65 pub default_listing_type: Option<i16>,
66 pub interface_language: Option<String>,
67 pub avatar: Option<String>,
68 pub banner: Option<String>,
69 pub display_name: Option<String>,
70 pub email: Option<Sensitive<String>>,
71 pub bio: Option<String>,
72 pub matrix_user_id: Option<String>,
73 pub show_avatars: Option<bool>,
74 pub send_notifications_to_email: Option<bool>,
75 pub bot_account: Option<bool>,
76 pub show_bot_accounts: Option<bool>,
77 pub show_read_posts: Option<bool>,
78 pub show_new_post_notifs: Option<bool>,
79 pub discussion_languages: Option<Vec<LanguageId>>,
80 pub auth: Sensitive<String>,
83 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
84 pub struct ChangePassword {
85 pub new_password: Sensitive<String>,
86 pub new_password_verify: Sensitive<String>,
87 pub old_password: Sensitive<String>,
88 pub auth: Sensitive<String>,
91 #[derive(Debug, Serialize, Deserialize, Clone)]
92 pub struct LoginResponse {
93 /// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
94 pub jwt: Option<Sensitive<String>>,
95 pub registration_created: bool,
96 pub verify_email_sent: bool,
99 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
100 pub struct GetPersonDetails {
101 pub person_id: Option<PersonId>, // One of these two are required
102 /// Example: dessalines , or dessalines@xyz.tld
103 pub username: Option<String>,
104 pub sort: Option<SortType>,
105 pub page: Option<i64>,
106 pub limit: Option<i64>,
107 pub community_id: Option<CommunityId>,
108 pub saved_only: Option<bool>,
109 pub auth: Option<Sensitive<String>>,
112 #[derive(Debug, Serialize, Deserialize, Clone)]
113 pub struct GetPersonDetailsResponse {
114 pub person_view: PersonViewSafe,
115 pub comments: Vec<CommentView>,
116 pub posts: Vec<PostView>,
117 pub moderates: Vec<CommunityModeratorView>,
120 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
121 pub struct GetRepliesResponse {
122 pub replies: Vec<CommentReplyView>,
125 #[derive(Debug, Serialize, Deserialize, Clone)]
126 pub struct GetPersonMentionsResponse {
127 pub mentions: Vec<PersonMentionView>,
130 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
131 pub struct MarkAllAsRead {
132 pub auth: Sensitive<String>,
135 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
136 pub struct AddAdmin {
137 pub person_id: PersonId,
139 pub auth: Sensitive<String>,
142 #[derive(Debug, Serialize, Deserialize, Clone)]
143 pub struct AddAdminResponse {
144 pub admins: Vec<PersonViewSafe>,
147 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
148 pub struct BanPerson {
149 pub person_id: PersonId,
151 pub remove_data: Option<bool>,
152 pub reason: Option<String>,
153 pub expires: Option<i64>,
154 pub auth: Sensitive<String>,
157 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
158 pub struct GetBannedPersons {
162 #[derive(Debug, Serialize, Deserialize, Clone)]
163 pub struct BannedPersonsResponse {
164 pub banned: Vec<PersonViewSafe>,
167 #[derive(Debug, Serialize, Deserialize, Clone)]
168 pub struct BanPersonResponse {
169 pub person_view: PersonViewSafe,
173 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
174 pub struct BlockPerson {
175 pub person_id: PersonId,
177 pub auth: Sensitive<String>,
180 #[derive(Debug, Serialize, Deserialize, Clone)]
181 pub struct BlockPersonResponse {
182 pub person_view: PersonViewSafe,
186 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
187 pub struct GetReplies {
188 pub sort: Option<CommentSortType>,
189 pub page: Option<i64>,
190 pub limit: Option<i64>,
191 pub unread_only: Option<bool>,
192 pub auth: Sensitive<String>,
195 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
196 pub struct GetPersonMentions {
197 pub sort: Option<CommentSortType>,
198 pub page: Option<i64>,
199 pub limit: Option<i64>,
200 pub unread_only: Option<bool>,
201 pub auth: Sensitive<String>,
204 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
205 pub struct MarkPersonMentionAsRead {
206 pub person_mention_id: PersonMentionId,
208 pub auth: Sensitive<String>,
211 #[derive(Debug, Serialize, Deserialize, Clone)]
212 pub struct PersonMentionResponse {
213 pub person_mention_view: PersonMentionView,
216 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
217 pub struct MarkCommentReplyAsRead {
218 pub comment_reply_id: CommentReplyId,
220 pub auth: Sensitive<String>,
223 #[derive(Debug, Serialize, Deserialize, Clone)]
224 pub struct CommentReplyResponse {
225 pub comment_reply_view: CommentReplyView,
228 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
229 pub struct DeleteAccount {
230 pub password: Sensitive<String>,
231 pub auth: Sensitive<String>,
234 #[derive(Debug, Serialize, Deserialize, Clone)]
235 pub struct DeleteAccountResponse {}
237 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
238 pub struct PasswordReset {
239 pub email: Sensitive<String>,
242 #[derive(Debug, Serialize, Deserialize, Clone)]
243 pub struct PasswordResetResponse {}
245 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
246 pub struct PasswordChangeAfterReset {
247 pub token: Sensitive<String>,
248 pub password: Sensitive<String>,
249 pub password_verify: Sensitive<String>,
252 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
253 pub struct CreatePrivateMessage {
255 pub recipient_id: PersonId,
256 pub auth: Sensitive<String>,
259 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
260 pub struct EditPrivateMessage {
261 pub private_message_id: PrivateMessageId,
263 pub auth: Sensitive<String>,
266 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
267 pub struct DeletePrivateMessage {
268 pub private_message_id: PrivateMessageId,
270 pub auth: Sensitive<String>,
273 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
274 pub struct MarkPrivateMessageAsRead {
275 pub private_message_id: PrivateMessageId,
277 pub auth: Sensitive<String>,
280 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
281 pub struct GetPrivateMessages {
282 pub unread_only: Option<bool>,
283 pub page: Option<i64>,
284 pub limit: Option<i64>,
285 pub auth: Sensitive<String>,
288 #[derive(Debug, Serialize, Deserialize, Clone)]
289 pub struct PrivateMessagesResponse {
290 pub private_messages: Vec<PrivateMessageView>,
293 #[derive(Debug, Serialize, Deserialize, Clone)]
294 pub struct PrivateMessageResponse {
295 pub private_message_view: PrivateMessageView,
298 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
299 pub struct GetReportCount {
300 pub community_id: Option<CommunityId>,
301 pub auth: Sensitive<String>,
304 #[derive(Debug, Serialize, Deserialize, Clone)]
305 pub struct GetReportCountResponse {
306 pub community_id: Option<CommunityId>,
307 pub comment_reports: i64,
308 pub post_reports: i64,
311 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
312 pub struct GetUnreadCount {
313 pub auth: Sensitive<String>,
316 #[derive(Debug, Serialize, Deserialize, Clone)]
317 pub struct GetUnreadCountResponse {
320 pub private_messages: i64,
323 #[derive(Serialize, Deserialize, Clone, Default)]
324 pub struct VerifyEmail {
328 #[derive(Debug, Serialize, Deserialize, Clone)]
329 pub struct VerifyEmailResponse {}