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)]
149 pub struct GetBannedPersons {
153 #[derive(Debug, Serialize, Deserialize)]
154 pub struct BannedPersonsResponse {
155 pub banned: Vec<PersonViewSafe>,
158 #[derive(Debug, Serialize, Deserialize, Clone)]
159 pub struct BanPersonResponse {
160 pub person_view: PersonViewSafe,
164 #[derive(Debug, Serialize, Deserialize)]
165 pub struct BlockPerson {
166 pub person_id: PersonId,
168 pub auth: Sensitive<String>,
171 #[derive(Debug, Serialize, Deserialize, Clone)]
172 pub struct BlockPersonResponse {
173 pub person_view: PersonViewSafe,
177 #[derive(Debug, Serialize, Deserialize)]
178 pub struct GetReplies {
179 pub sort: Option<String>,
180 pub page: Option<i64>,
181 pub limit: Option<i64>,
182 pub unread_only: Option<bool>,
183 pub auth: Sensitive<String>,
186 #[derive(Debug, Serialize, Deserialize)]
187 pub struct GetPersonMentions {
188 pub sort: Option<String>,
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)]
196 pub struct MarkPersonMentionAsRead {
197 pub person_mention_id: PersonMentionId,
199 pub auth: Sensitive<String>,
202 #[derive(Debug, Serialize, Deserialize, Clone)]
203 pub struct PersonMentionResponse {
204 pub person_mention_view: PersonMentionView,
207 #[derive(Debug, Serialize, Deserialize)]
208 pub struct DeleteAccount {
209 pub password: Sensitive<String>,
210 pub auth: Sensitive<String>,
213 #[derive(Debug, Serialize, Deserialize, Clone)]
214 pub struct DeleteAccountResponse {}
216 #[derive(Debug, Serialize, Deserialize)]
217 pub struct PasswordReset {
218 pub email: Sensitive<String>,
221 #[derive(Debug, Serialize, Deserialize, Clone)]
222 pub struct PasswordResetResponse {}
224 #[derive(Debug, Serialize, Deserialize)]
225 pub struct PasswordChangeAfterReset {
226 pub token: Sensitive<String>,
227 pub password: Sensitive<String>,
228 pub password_verify: Sensitive<String>,
231 #[derive(Debug, Serialize, Deserialize)]
232 pub struct CreatePrivateMessage {
234 pub recipient_id: PersonId,
235 pub auth: Sensitive<String>,
238 #[derive(Debug, Serialize, Deserialize)]
239 pub struct EditPrivateMessage {
240 pub private_message_id: PrivateMessageId,
242 pub auth: Sensitive<String>,
245 #[derive(Debug, Serialize, Deserialize)]
246 pub struct DeletePrivateMessage {
247 pub private_message_id: PrivateMessageId,
249 pub auth: Sensitive<String>,
252 #[derive(Debug, Serialize, Deserialize)]
253 pub struct MarkPrivateMessageAsRead {
254 pub private_message_id: PrivateMessageId,
256 pub auth: Sensitive<String>,
259 #[derive(Debug, Serialize, Deserialize)]
260 pub struct GetPrivateMessages {
261 pub unread_only: Option<bool>,
262 pub page: Option<i64>,
263 pub limit: Option<i64>,
264 pub auth: Sensitive<String>,
267 #[derive(Debug, Serialize, Deserialize, Clone)]
268 pub struct PrivateMessagesResponse {
269 pub private_messages: Vec<PrivateMessageView>,
272 #[derive(Debug, Serialize, Deserialize, Clone)]
273 pub struct PrivateMessageResponse {
274 pub private_message_view: PrivateMessageView,
277 #[derive(Debug, Serialize, Deserialize)]
278 pub struct GetReportCount {
279 pub community_id: Option<CommunityId>,
280 pub auth: Sensitive<String>,
283 #[derive(Debug, Serialize, Deserialize, Clone)]
284 pub struct GetReportCountResponse {
285 pub community_id: Option<CommunityId>,
286 pub comment_reports: i64,
287 pub post_reports: i64,
290 #[derive(Debug, Serialize, Deserialize)]
291 pub struct GetUnreadCount {
292 pub auth: Sensitive<String>,
295 #[derive(Debug, Serialize, Deserialize, Clone)]
296 pub struct GetUnreadCountResponse {
299 pub private_messages: i64,
302 #[derive(Serialize, Deserialize)]
303 pub struct VerifyEmail {
307 #[derive(Debug, Serialize, Deserialize, Clone)]
308 pub struct VerifyEmailResponse {}