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)]
8 pub username_or_email: Sensitive<String>,
9 pub password: Sensitive<String>,
11 use lemmy_db_schema::newtypes::{CommunityId, PersonId, PersonMentionId, PrivateMessageId};
13 #[derive(Debug, Serialize, Deserialize)]
16 pub password: Sensitive<String>,
17 pub password_verify: Sensitive<String>,
19 /// email is mandatory if email verification is enabled on the server
20 pub email: Option<Sensitive<String>>,
21 pub captcha_uuid: Option<String>,
22 pub captcha_answer: Option<String>,
23 pub honeypot: Option<String>,
24 /// An answer is mandatory if require application is enabled on the server
25 pub answer: Option<String>,
28 #[derive(Debug, Serialize, Deserialize)]
29 pub struct GetCaptcha {}
31 #[derive(Debug, Serialize, Deserialize)]
32 pub struct GetCaptchaResponse {
33 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
36 #[derive(Debug, Serialize, Deserialize)]
37 pub struct CaptchaResponse {
38 pub png: String, // A Base64 encoded png
39 pub wav: String, // A Base64 encoded wav audio
43 #[derive(Debug, Serialize, Deserialize)]
44 pub struct SaveUserSettings {
45 pub show_nsfw: Option<bool>,
46 pub show_scores: Option<bool>,
47 pub theme: Option<String>,
48 pub default_sort_type: Option<i16>,
49 pub default_listing_type: Option<i16>,
50 pub lang: Option<String>,
51 pub avatar: Option<String>,
52 pub banner: Option<String>,
53 pub display_name: Option<String>,
54 pub email: Option<Sensitive<String>>,
55 pub bio: Option<String>,
56 pub matrix_user_id: Option<String>,
57 pub show_avatars: Option<bool>,
58 pub send_notifications_to_email: Option<bool>,
59 pub bot_account: Option<bool>,
60 pub show_bot_accounts: Option<bool>,
61 pub show_read_posts: Option<bool>,
62 pub show_new_post_notifs: Option<bool>,
63 pub auth: Sensitive<String>,
66 #[derive(Debug, Serialize, Deserialize)]
67 pub struct ChangePassword {
68 pub new_password: Sensitive<String>,
69 pub new_password_verify: Sensitive<String>,
70 pub old_password: Sensitive<String>,
71 pub auth: Sensitive<String>,
74 #[derive(Debug, Serialize, Deserialize)]
75 pub struct LoginResponse {
76 /// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
77 pub jwt: Option<Sensitive<String>>,
78 pub registration_created: bool,
79 pub verify_email_sent: bool,
82 #[derive(Debug, Serialize, Deserialize)]
83 pub struct GetPersonDetails {
84 pub person_id: Option<PersonId>, // One of these two are required
85 /// Example: dessalines , or dessalines@xyz.tld
86 pub username: Option<String>,
87 pub sort: Option<String>,
88 pub page: Option<i64>,
89 pub limit: Option<i64>,
90 pub community_id: Option<CommunityId>,
91 pub saved_only: Option<bool>,
92 pub auth: Option<Sensitive<String>>,
95 #[derive(Debug, Serialize, Deserialize)]
96 pub struct GetPersonDetailsResponse {
97 pub person_view: PersonViewSafe,
98 pub comments: Vec<CommentView>,
99 pub posts: Vec<PostView>,
100 pub moderates: Vec<CommunityModeratorView>,
103 #[derive(Debug, Serialize, Deserialize)]
104 pub struct GetRepliesResponse {
105 pub replies: Vec<CommentView>,
108 #[derive(Debug, Serialize, Deserialize)]
109 pub struct GetPersonMentionsResponse {
110 pub mentions: Vec<PersonMentionView>,
113 #[derive(Debug, Serialize, Deserialize)]
114 pub struct MarkAllAsRead {
115 pub auth: Sensitive<String>,
118 #[derive(Debug, Serialize, Deserialize)]
119 pub struct AddAdmin {
120 pub person_id: PersonId,
122 pub auth: Sensitive<String>,
125 #[derive(Debug, Serialize, Deserialize, Clone)]
126 pub struct AddAdminResponse {
127 pub admins: Vec<PersonViewSafe>,
130 #[derive(Debug, Serialize, Deserialize)]
131 pub struct BanPerson {
132 pub person_id: PersonId,
134 pub remove_data: Option<bool>,
135 pub reason: Option<String>,
136 pub expires: Option<i64>,
137 pub auth: Sensitive<String>,
140 #[derive(Debug, Serialize, Deserialize)]
141 pub struct GetBannedPersons {
145 #[derive(Debug, Serialize, Deserialize)]
146 pub struct BannedPersonsResponse {
147 pub banned: Vec<PersonViewSafe>,
150 #[derive(Debug, Serialize, Deserialize, Clone)]
151 pub struct BanPersonResponse {
152 pub person_view: PersonViewSafe,
156 #[derive(Debug, Serialize, Deserialize)]
157 pub struct BlockPerson {
158 pub person_id: PersonId,
160 pub auth: Sensitive<String>,
163 #[derive(Debug, Serialize, Deserialize, Clone)]
164 pub struct BlockPersonResponse {
165 pub person_view: PersonViewSafe,
169 #[derive(Debug, Serialize, Deserialize)]
170 pub struct GetReplies {
171 pub sort: Option<String>,
172 pub page: Option<i64>,
173 pub limit: Option<i64>,
174 pub unread_only: Option<bool>,
175 pub auth: Sensitive<String>,
178 #[derive(Debug, Serialize, Deserialize)]
179 pub struct GetPersonMentions {
180 pub sort: Option<String>,
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)]
188 pub struct MarkPersonMentionAsRead {
189 pub person_mention_id: PersonMentionId,
191 pub auth: Sensitive<String>,
194 #[derive(Debug, Serialize, Deserialize, Clone)]
195 pub struct PersonMentionResponse {
196 pub person_mention_view: PersonMentionView,
199 #[derive(Debug, Serialize, Deserialize)]
200 pub struct DeleteAccount {
201 pub password: Sensitive<String>,
202 pub auth: Sensitive<String>,
205 #[derive(Debug, Serialize, Deserialize, Clone)]
206 pub struct DeleteAccountResponse {}
208 #[derive(Debug, Serialize, Deserialize)]
209 pub struct PasswordReset {
210 pub email: Sensitive<String>,
213 #[derive(Debug, Serialize, Deserialize, Clone)]
214 pub struct PasswordResetResponse {}
216 #[derive(Debug, Serialize, Deserialize)]
217 pub struct PasswordChangeAfterReset {
218 pub token: Sensitive<String>,
219 pub password: Sensitive<String>,
220 pub password_verify: Sensitive<String>,
223 #[derive(Debug, Serialize, Deserialize)]
224 pub struct CreatePrivateMessage {
226 pub recipient_id: PersonId,
227 pub auth: Sensitive<String>,
230 #[derive(Debug, Serialize, Deserialize)]
231 pub struct EditPrivateMessage {
232 pub private_message_id: PrivateMessageId,
234 pub auth: Sensitive<String>,
237 #[derive(Debug, Serialize, Deserialize)]
238 pub struct DeletePrivateMessage {
239 pub private_message_id: PrivateMessageId,
241 pub auth: Sensitive<String>,
244 #[derive(Debug, Serialize, Deserialize)]
245 pub struct MarkPrivateMessageAsRead {
246 pub private_message_id: PrivateMessageId,
248 pub auth: Sensitive<String>,
251 #[derive(Debug, Serialize, Deserialize)]
252 pub struct GetPrivateMessages {
253 pub unread_only: Option<bool>,
254 pub page: Option<i64>,
255 pub limit: Option<i64>,
256 pub auth: Sensitive<String>,
259 #[derive(Debug, Serialize, Deserialize, Clone)]
260 pub struct PrivateMessagesResponse {
261 pub private_messages: Vec<PrivateMessageView>,
264 #[derive(Debug, Serialize, Deserialize, Clone)]
265 pub struct PrivateMessageResponse {
266 pub private_message_view: PrivateMessageView,
269 #[derive(Debug, Serialize, Deserialize)]
270 pub struct GetReportCount {
271 pub community_id: Option<CommunityId>,
272 pub auth: Sensitive<String>,
275 #[derive(Debug, Serialize, Deserialize, Clone)]
276 pub struct GetReportCountResponse {
277 pub community_id: Option<CommunityId>,
278 pub comment_reports: i64,
279 pub post_reports: i64,
282 #[derive(Debug, Serialize, Deserialize)]
283 pub struct GetUnreadCount {
284 pub auth: Sensitive<String>,
287 #[derive(Debug, Serialize, Deserialize, Clone)]
288 pub struct GetUnreadCountResponse {
291 pub private_messages: i64,
294 #[derive(Serialize, Deserialize)]
295 pub struct VerifyEmail {
299 #[derive(Debug, Serialize, Deserialize, Clone)]
300 pub struct VerifyEmailResponse {}