2 comment_view::CommentView,
4 private_message_view::PrivateMessageView,
6 use lemmy_db_views_actor::{
7 community_moderator_view::CommunityModeratorView,
8 person_mention_view::PersonMentionView,
9 person_view::PersonViewSafe,
11 use lemmy_utils::Sensitive;
12 use serde::{Deserialize, Serialize};
14 #[derive(Debug, Serialize, Deserialize)]
16 pub username_or_email: Sensitive<String>,
17 pub password: Sensitive<String>,
19 use lemmy_db_schema::newtypes::{CommunityId, PersonId, PersonMentionId, PrivateMessageId};
21 #[derive(Debug, Serialize, Deserialize)]
24 pub password: Sensitive<String>,
25 pub password_verify: Sensitive<String>,
27 /// email is mandatory if email verification is enabled on the server
28 pub email: Option<Sensitive<String>>,
29 pub captcha_uuid: Option<String>,
30 pub captcha_answer: Option<String>,
31 pub honeypot: Option<String>,
32 /// An answer is mandatory if require application is enabled on the server
33 pub answer: Option<String>,
36 #[derive(Debug, Serialize, Deserialize)]
37 pub struct GetCaptcha {}
39 #[derive(Debug, Serialize, Deserialize)]
40 pub struct GetCaptchaResponse {
41 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
44 #[derive(Debug, Serialize, Deserialize)]
45 pub struct CaptchaResponse {
46 pub png: String, // A Base64 encoded png
47 pub wav: String, // A Base64 encoded wav audio
51 #[derive(Debug, Serialize, Deserialize)]
52 pub struct SaveUserSettings {
53 pub show_nsfw: Option<bool>,
54 pub show_scores: Option<bool>,
55 pub theme: Option<String>,
56 pub default_sort_type: Option<i16>,
57 pub default_listing_type: Option<i16>,
58 pub lang: Option<String>,
59 pub avatar: Option<String>,
60 pub banner: Option<String>,
61 pub display_name: Option<String>,
62 pub email: Option<Sensitive<String>>,
63 pub bio: Option<String>,
64 pub matrix_user_id: Option<String>,
65 pub show_avatars: Option<bool>,
66 pub send_notifications_to_email: Option<bool>,
67 pub bot_account: Option<bool>,
68 pub show_bot_accounts: Option<bool>,
69 pub show_read_posts: Option<bool>,
70 pub show_new_post_notifs: Option<bool>,
71 pub auth: Sensitive<String>,
74 #[derive(Debug, Serialize, Deserialize)]
75 pub struct ChangePassword {
76 pub new_password: Sensitive<String>,
77 pub new_password_verify: Sensitive<String>,
78 pub old_password: Sensitive<String>,
79 pub auth: Sensitive<String>,
82 #[derive(Debug, Serialize, Deserialize)]
83 pub struct LoginResponse {
84 /// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
85 pub jwt: Option<Sensitive<String>>,
86 pub registration_created: bool,
87 pub verify_email_sent: bool,
90 #[derive(Debug, Serialize, Deserialize)]
91 pub struct GetPersonDetails {
92 pub person_id: Option<PersonId>, // One of these two are required
93 /// Example: dessalines , or dessalines@xyz.tld
94 pub username: Option<String>,
95 pub sort: Option<String>,
96 pub page: Option<i64>,
97 pub limit: Option<i64>,
98 pub community_id: Option<CommunityId>,
99 pub saved_only: Option<bool>,
100 pub auth: Option<Sensitive<String>>,
103 #[derive(Debug, Serialize, Deserialize)]
104 pub struct GetPersonDetailsResponse {
105 pub person_view: PersonViewSafe,
106 pub comments: Vec<CommentView>,
107 pub posts: Vec<PostView>,
108 pub moderates: Vec<CommunityModeratorView>,
111 #[derive(Debug, Serialize, Deserialize)]
112 pub struct GetRepliesResponse {
113 pub replies: Vec<CommentView>,
116 #[derive(Debug, Serialize, Deserialize)]
117 pub struct GetPersonMentionsResponse {
118 pub mentions: Vec<PersonMentionView>,
121 #[derive(Debug, Serialize, Deserialize)]
122 pub struct MarkAllAsRead {
123 pub auth: Sensitive<String>,
126 #[derive(Debug, Serialize, Deserialize)]
127 pub struct AddAdmin {
128 pub person_id: PersonId,
130 pub auth: Sensitive<String>,
133 #[derive(Debug, Serialize, Deserialize, Clone)]
134 pub struct AddAdminResponse {
135 pub admins: Vec<PersonViewSafe>,
138 #[derive(Debug, Serialize, Deserialize)]
139 pub struct BanPerson {
140 pub person_id: PersonId,
142 pub remove_data: Option<bool>,
143 pub reason: Option<String>,
144 pub expires: Option<i64>,
145 pub auth: Sensitive<String>,
148 #[derive(Debug, Serialize, Deserialize, Clone)]
149 pub struct BanPersonResponse {
150 pub person_view: PersonViewSafe,
154 #[derive(Debug, Serialize, Deserialize)]
155 pub struct BlockPerson {
156 pub person_id: PersonId,
158 pub auth: Sensitive<String>,
161 #[derive(Debug, Serialize, Deserialize, Clone)]
162 pub struct BlockPersonResponse {
163 pub person_view: PersonViewSafe,
167 #[derive(Debug, Serialize, Deserialize)]
168 pub struct GetReplies {
169 pub sort: Option<String>,
170 pub page: Option<i64>,
171 pub limit: Option<i64>,
172 pub unread_only: Option<bool>,
173 pub auth: Sensitive<String>,
176 #[derive(Debug, Serialize, Deserialize)]
177 pub struct GetPersonMentions {
178 pub sort: Option<String>,
179 pub page: Option<i64>,
180 pub limit: Option<i64>,
181 pub unread_only: Option<bool>,
182 pub auth: Sensitive<String>,
185 #[derive(Debug, Serialize, Deserialize)]
186 pub struct MarkPersonMentionAsRead {
187 pub person_mention_id: PersonMentionId,
189 pub auth: Sensitive<String>,
192 #[derive(Debug, Serialize, Deserialize, Clone)]
193 pub struct PersonMentionResponse {
194 pub person_mention_view: PersonMentionView,
197 #[derive(Debug, Serialize, Deserialize)]
198 pub struct DeleteAccount {
199 pub password: Sensitive<String>,
200 pub auth: Sensitive<String>,
203 #[derive(Debug, Serialize, Deserialize, Clone)]
204 pub struct DeleteAccountResponse {}
206 #[derive(Debug, Serialize, Deserialize)]
207 pub struct PasswordReset {
208 pub email: Sensitive<String>,
211 #[derive(Debug, Serialize, Deserialize, Clone)]
212 pub struct PasswordResetResponse {}
214 #[derive(Debug, Serialize, Deserialize)]
215 pub struct PasswordChange {
216 pub token: Sensitive<String>,
217 pub password: Sensitive<String>,
218 pub password_verify: Sensitive<String>,
221 #[derive(Debug, Serialize, Deserialize)]
222 pub struct CreatePrivateMessage {
224 pub recipient_id: PersonId,
225 pub auth: Sensitive<String>,
228 #[derive(Debug, Serialize, Deserialize)]
229 pub struct EditPrivateMessage {
230 pub private_message_id: PrivateMessageId,
232 pub auth: Sensitive<String>,
235 #[derive(Debug, Serialize, Deserialize)]
236 pub struct DeletePrivateMessage {
237 pub private_message_id: PrivateMessageId,
239 pub auth: Sensitive<String>,
242 #[derive(Debug, Serialize, Deserialize)]
243 pub struct MarkPrivateMessageAsRead {
244 pub private_message_id: PrivateMessageId,
246 pub auth: Sensitive<String>,
249 #[derive(Debug, Serialize, Deserialize)]
250 pub struct GetPrivateMessages {
251 pub unread_only: Option<bool>,
252 pub page: Option<i64>,
253 pub limit: Option<i64>,
254 pub auth: Sensitive<String>,
257 #[derive(Debug, Serialize, Deserialize, Clone)]
258 pub struct PrivateMessagesResponse {
259 pub private_messages: Vec<PrivateMessageView>,
262 #[derive(Debug, Serialize, Deserialize, Clone)]
263 pub struct PrivateMessageResponse {
264 pub private_message_view: PrivateMessageView,
267 #[derive(Debug, Serialize, Deserialize)]
268 pub struct GetReportCount {
269 pub community_id: Option<CommunityId>,
270 pub auth: Sensitive<String>,
273 #[derive(Debug, Serialize, Deserialize, Clone)]
274 pub struct GetReportCountResponse {
275 pub community_id: Option<CommunityId>,
276 pub comment_reports: i64,
277 pub post_reports: i64,
280 #[derive(Debug, Serialize, Deserialize)]
281 pub struct GetUnreadCount {
282 pub auth: Sensitive<String>,
285 #[derive(Debug, Serialize, Deserialize, Clone)]
286 pub struct GetUnreadCountResponse {
289 pub private_messages: i64,
292 #[derive(Serialize, Deserialize)]
293 pub struct VerifyEmail {
297 #[derive(Debug, Serialize, Deserialize, Clone)]
298 pub struct VerifyEmailResponse {}