1 use crate::sensitive::Sensitive;
2 use lemmy_db_views::structs::{CommentView, PostView, PrivateMessageView};
3 use lemmy_db_views_actor::structs::{CommunityModeratorView, PersonMentionView, PersonViewSafe};
4 use serde::{Deserialize, Serialize};
6 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
8 pub username_or_email: Sensitive<String>,
9 pub password: Sensitive<String>,
11 use lemmy_db_schema::{
12 newtypes::{CommunityId, PersonId, PersonMentionId, PrivateMessageId},
16 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
19 pub password: Sensitive<String>,
20 pub password_verify: Sensitive<String>,
22 /// email is mandatory if email verification is enabled on the server
23 pub email: Option<Sensitive<String>>,
24 pub captcha_uuid: Option<String>,
25 pub captcha_answer: Option<String>,
26 pub honeypot: Option<String>,
27 /// An answer is mandatory if require application is enabled on the server
28 pub answer: Option<String>,
31 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
32 pub struct GetCaptcha {}
34 #[derive(Debug, Serialize, Deserialize, Clone)]
35 pub struct GetCaptchaResponse {
36 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
39 #[derive(Debug, Serialize, Deserialize, Clone)]
40 pub struct CaptchaResponse {
41 pub png: String, // A Base64 encoded png
42 pub wav: String, // A Base64 encoded wav audio
46 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
47 pub struct SaveUserSettings {
48 pub show_nsfw: Option<bool>,
49 pub show_scores: 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 display_name: Option<String>,
57 pub email: Option<Sensitive<String>>,
58 pub bio: Option<String>,
59 pub matrix_user_id: Option<String>,
60 pub show_avatars: Option<bool>,
61 pub send_notifications_to_email: Option<bool>,
62 pub bot_account: Option<bool>,
63 pub show_bot_accounts: Option<bool>,
64 pub show_read_posts: Option<bool>,
65 pub show_new_post_notifs: Option<bool>,
66 pub auth: Sensitive<String>,
69 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
70 pub struct ChangePassword {
71 pub new_password: Sensitive<String>,
72 pub new_password_verify: Sensitive<String>,
73 pub old_password: Sensitive<String>,
74 pub auth: Sensitive<String>,
77 #[derive(Debug, Serialize, Deserialize, Clone)]
78 pub struct LoginResponse {
79 /// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
80 pub jwt: Option<Sensitive<String>>,
81 pub registration_created: bool,
82 pub verify_email_sent: bool,
85 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
86 pub struct GetPersonDetails {
87 pub person_id: Option<PersonId>, // One of these two are required
88 /// Example: dessalines , or dessalines@xyz.tld
89 pub username: Option<String>,
90 pub sort: Option<SortType>,
91 pub page: Option<i64>,
92 pub limit: Option<i64>,
93 pub community_id: Option<CommunityId>,
94 pub saved_only: Option<bool>,
95 pub auth: Option<Sensitive<String>>,
98 #[derive(Debug, Serialize, Deserialize, Clone)]
99 pub struct GetPersonDetailsResponse {
100 pub person_view: PersonViewSafe,
101 pub comments: Vec<CommentView>,
102 pub posts: Vec<PostView>,
103 pub moderates: Vec<CommunityModeratorView>,
106 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
107 pub struct GetRepliesResponse {
108 pub replies: Vec<CommentView>,
111 #[derive(Debug, Serialize, Deserialize, Clone)]
112 pub struct GetPersonMentionsResponse {
113 pub mentions: Vec<PersonMentionView>,
116 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
117 pub struct MarkAllAsRead {
118 pub auth: Sensitive<String>,
121 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
122 pub struct AddAdmin {
123 pub person_id: PersonId,
125 pub auth: Sensitive<String>,
128 #[derive(Debug, Serialize, Deserialize, Clone)]
129 pub struct AddAdminResponse {
130 pub admins: Vec<PersonViewSafe>,
133 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
134 pub struct BanPerson {
135 pub person_id: PersonId,
137 pub remove_data: Option<bool>,
138 pub reason: Option<String>,
139 pub expires: Option<i64>,
140 pub auth: Sensitive<String>,
143 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
144 pub struct GetBannedPersons {
148 #[derive(Debug, Serialize, Deserialize, Clone)]
149 pub struct BannedPersonsResponse {
150 pub banned: Vec<PersonViewSafe>,
153 #[derive(Debug, Serialize, Deserialize, Clone)]
154 pub struct BanPersonResponse {
155 pub person_view: PersonViewSafe,
159 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
160 pub struct BlockPerson {
161 pub person_id: PersonId,
163 pub auth: Sensitive<String>,
166 #[derive(Debug, Serialize, Deserialize, Clone)]
167 pub struct BlockPersonResponse {
168 pub person_view: PersonViewSafe,
172 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
173 pub struct GetReplies {
174 pub sort: Option<SortType>,
175 pub page: Option<i64>,
176 pub limit: Option<i64>,
177 pub unread_only: Option<bool>,
178 pub auth: Sensitive<String>,
181 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
182 pub struct GetPersonMentions {
183 pub sort: Option<SortType>,
184 pub page: Option<i64>,
185 pub limit: Option<i64>,
186 pub unread_only: Option<bool>,
187 pub auth: Sensitive<String>,
190 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
191 pub struct MarkPersonMentionAsRead {
192 pub person_mention_id: PersonMentionId,
194 pub auth: Sensitive<String>,
197 #[derive(Debug, Serialize, Deserialize, Clone)]
198 pub struct PersonMentionResponse {
199 pub person_mention_view: PersonMentionView,
202 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
203 pub struct DeleteAccount {
204 pub password: Sensitive<String>,
205 pub auth: Sensitive<String>,
208 #[derive(Debug, Serialize, Deserialize, Clone)]
209 pub struct DeleteAccountResponse {}
211 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
212 pub struct PasswordReset {
213 pub email: Sensitive<String>,
216 #[derive(Debug, Serialize, Deserialize, Clone)]
217 pub struct PasswordResetResponse {}
219 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
220 pub struct PasswordChangeAfterReset {
221 pub token: Sensitive<String>,
222 pub password: Sensitive<String>,
223 pub password_verify: Sensitive<String>,
226 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
227 pub struct CreatePrivateMessage {
229 pub recipient_id: PersonId,
230 pub auth: Sensitive<String>,
233 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
234 pub struct EditPrivateMessage {
235 pub private_message_id: PrivateMessageId,
237 pub auth: Sensitive<String>,
240 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
241 pub struct DeletePrivateMessage {
242 pub private_message_id: PrivateMessageId,
244 pub auth: Sensitive<String>,
247 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
248 pub struct MarkPrivateMessageAsRead {
249 pub private_message_id: PrivateMessageId,
251 pub auth: Sensitive<String>,
254 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
255 pub struct GetPrivateMessages {
256 pub unread_only: Option<bool>,
257 pub page: Option<i64>,
258 pub limit: Option<i64>,
259 pub auth: Sensitive<String>,
262 #[derive(Debug, Serialize, Deserialize, Clone)]
263 pub struct PrivateMessagesResponse {
264 pub private_messages: Vec<PrivateMessageView>,
267 #[derive(Debug, Serialize, Deserialize, Clone)]
268 pub struct PrivateMessageResponse {
269 pub private_message_view: PrivateMessageView,
272 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
273 pub struct GetReportCount {
274 pub community_id: Option<CommunityId>,
275 pub auth: Sensitive<String>,
278 #[derive(Debug, Serialize, Deserialize, Clone)]
279 pub struct GetReportCountResponse {
280 pub community_id: Option<CommunityId>,
281 pub comment_reports: i64,
282 pub post_reports: i64,
285 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
286 pub struct GetUnreadCount {
287 pub auth: Sensitive<String>,
290 #[derive(Debug, Serialize, Deserialize, Clone)]
291 pub struct GetUnreadCountResponse {
294 pub private_messages: i64,
297 #[derive(Serialize, Deserialize, Clone, Default)]
298 pub struct VerifyEmail {
302 #[derive(Debug, Serialize, Deserialize, Clone)]
303 pub struct VerifyEmailResponse {}