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 pub email: Option<Sensitive<String>>,
28 pub captcha_uuid: Option<String>,
29 pub captcha_answer: Option<String>,
30 pub honeypot: Option<String>,
33 #[derive(Debug, Serialize, Deserialize)]
34 pub struct GetCaptcha {}
36 #[derive(Debug, Serialize, Deserialize)]
37 pub struct GetCaptchaResponse {
38 pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
41 #[derive(Debug, Serialize, Deserialize)]
42 pub struct CaptchaResponse {
43 pub png: String, // A Base64 encoded png
44 pub wav: String, // A Base64 encoded wav audio
48 #[derive(Debug, Serialize, Deserialize)]
49 pub struct SaveUserSettings {
50 pub show_nsfw: Option<bool>,
51 pub show_scores: Option<bool>,
52 pub theme: Option<String>,
53 pub default_sort_type: Option<i16>,
54 pub default_listing_type: Option<i16>,
55 pub lang: Option<String>,
56 pub avatar: Option<String>,
57 pub banner: Option<String>,
58 pub display_name: Option<String>,
59 pub email: Option<Sensitive<String>>,
60 pub bio: Option<String>,
61 pub matrix_user_id: Option<String>,
62 pub show_avatars: Option<bool>,
63 pub send_notifications_to_email: Option<bool>,
64 pub bot_account: Option<bool>,
65 pub show_bot_accounts: Option<bool>,
66 pub show_read_posts: Option<bool>,
67 pub show_new_post_notifs: Option<bool>,
68 pub auth: Sensitive<String>,
71 #[derive(Debug, Serialize, Deserialize)]
72 pub struct ChangePassword {
73 pub new_password: Sensitive<String>,
74 pub new_password_verify: Sensitive<String>,
75 pub old_password: Sensitive<String>,
76 pub auth: Sensitive<String>,
79 #[derive(Debug, Serialize, Deserialize)]
80 pub struct LoginResponse {
81 pub jwt: Sensitive<String>,
84 #[derive(Debug, Serialize, Deserialize)]
85 pub struct GetPersonDetails {
86 pub person_id: Option<PersonId>, // One of these two are required
87 /// Example: dessalines , or dessalines@xyz.tld
88 pub username: Option<String>,
89 pub sort: Option<String>,
90 pub page: Option<i64>,
91 pub limit: Option<i64>,
92 pub community_id: Option<CommunityId>,
93 pub saved_only: Option<bool>,
94 pub auth: Option<Sensitive<String>>,
97 #[derive(Debug, Serialize, Deserialize)]
98 pub struct GetPersonDetailsResponse {
99 pub person_view: PersonViewSafe,
100 pub comments: Vec<CommentView>,
101 pub posts: Vec<PostView>,
102 pub moderates: Vec<CommunityModeratorView>,
105 #[derive(Debug, Serialize, Deserialize)]
106 pub struct GetRepliesResponse {
107 pub replies: Vec<CommentView>,
110 #[derive(Debug, Serialize, Deserialize)]
111 pub struct GetPersonMentionsResponse {
112 pub mentions: Vec<PersonMentionView>,
115 #[derive(Debug, Serialize, Deserialize)]
116 pub struct MarkAllAsRead {
117 pub auth: Sensitive<String>,
120 #[derive(Debug, Serialize, Deserialize)]
121 pub struct AddAdmin {
122 pub person_id: PersonId,
124 pub auth: Sensitive<String>,
127 #[derive(Debug, Serialize, Deserialize, Clone)]
128 pub struct AddAdminResponse {
129 pub admins: Vec<PersonViewSafe>,
132 #[derive(Debug, Serialize, Deserialize)]
133 pub struct BanPerson {
134 pub person_id: PersonId,
136 pub remove_data: Option<bool>,
137 pub reason: Option<String>,
138 pub expires: Option<i64>,
139 pub auth: Sensitive<String>,
142 #[derive(Debug, Serialize, Deserialize, Clone)]
143 pub struct BanPersonResponse {
144 pub person_view: PersonViewSafe,
148 #[derive(Debug, Serialize, Deserialize)]
149 pub struct BlockPerson {
150 pub person_id: PersonId,
152 pub auth: Sensitive<String>,
155 #[derive(Debug, Serialize, Deserialize, Clone)]
156 pub struct BlockPersonResponse {
157 pub person_view: PersonViewSafe,
161 #[derive(Debug, Serialize, Deserialize)]
162 pub struct GetReplies {
163 pub sort: Option<String>,
164 pub page: Option<i64>,
165 pub limit: Option<i64>,
166 pub unread_only: Option<bool>,
167 pub auth: Sensitive<String>,
170 #[derive(Debug, Serialize, Deserialize)]
171 pub struct GetPersonMentions {
172 pub sort: Option<String>,
173 pub page: Option<i64>,
174 pub limit: Option<i64>,
175 pub unread_only: Option<bool>,
176 pub auth: Sensitive<String>,
179 #[derive(Debug, Serialize, Deserialize)]
180 pub struct MarkPersonMentionAsRead {
181 pub person_mention_id: PersonMentionId,
183 pub auth: Sensitive<String>,
186 #[derive(Debug, Serialize, Deserialize, Clone)]
187 pub struct PersonMentionResponse {
188 pub person_mention_view: PersonMentionView,
191 #[derive(Debug, Serialize, Deserialize)]
192 pub struct DeleteAccount {
193 pub password: Sensitive<String>,
194 pub auth: Sensitive<String>,
197 #[derive(Debug, Serialize, Deserialize)]
198 pub struct PasswordReset {
199 pub email: Sensitive<String>,
202 #[derive(Debug, Serialize, Deserialize, Clone)]
203 pub struct PasswordResetResponse {}
205 #[derive(Debug, Serialize, Deserialize)]
206 pub struct PasswordChange {
207 pub token: Sensitive<String>,
208 pub password: Sensitive<String>,
209 pub password_verify: Sensitive<String>,
212 #[derive(Debug, Serialize, Deserialize)]
213 pub struct CreatePrivateMessage {
215 pub recipient_id: PersonId,
216 pub auth: Sensitive<String>,
219 #[derive(Debug, Serialize, Deserialize)]
220 pub struct EditPrivateMessage {
221 pub private_message_id: PrivateMessageId,
223 pub auth: Sensitive<String>,
226 #[derive(Debug, Serialize, Deserialize)]
227 pub struct DeletePrivateMessage {
228 pub private_message_id: PrivateMessageId,
230 pub auth: Sensitive<String>,
233 #[derive(Debug, Serialize, Deserialize)]
234 pub struct MarkPrivateMessageAsRead {
235 pub private_message_id: PrivateMessageId,
237 pub auth: Sensitive<String>,
240 #[derive(Debug, Serialize, Deserialize)]
241 pub struct GetPrivateMessages {
242 pub unread_only: Option<bool>,
243 pub page: Option<i64>,
244 pub limit: Option<i64>,
245 pub auth: Sensitive<String>,
248 #[derive(Debug, Serialize, Deserialize, Clone)]
249 pub struct PrivateMessagesResponse {
250 pub private_messages: Vec<PrivateMessageView>,
253 #[derive(Debug, Serialize, Deserialize, Clone)]
254 pub struct PrivateMessageResponse {
255 pub private_message_view: PrivateMessageView,
258 #[derive(Debug, Serialize, Deserialize)]
259 pub struct GetReportCount {
260 pub community_id: Option<CommunityId>,
261 pub auth: Sensitive<String>,
264 #[derive(Debug, Serialize, Deserialize, Clone)]
265 pub struct GetReportCountResponse {
266 pub community_id: Option<CommunityId>,
267 pub comment_reports: i64,
268 pub post_reports: i64,
271 #[derive(Debug, Serialize, Deserialize)]
272 pub struct GetUnreadCount {
273 pub auth: Sensitive<String>,
276 #[derive(Debug, Serialize, Deserialize, Clone)]
277 pub struct GetUnreadCountResponse {
280 pub private_messages: i64,