2020-12-21 16:30:34 +00:00
|
|
|
use lemmy_db_views::{
|
2020-12-16 22:16:48 +00:00
|
|
|
comment_view::CommentView,
|
|
|
|
post_view::PostView,
|
|
|
|
private_message_view::PrivateMessageView,
|
2020-12-21 23:27:42 +00:00
|
|
|
};
|
|
|
|
use lemmy_db_views_actor::{
|
|
|
|
community_moderator_view::CommunityModeratorView,
|
2021-03-10 22:33:55 +00:00
|
|
|
person_mention_view::PersonMentionView,
|
|
|
|
person_view::PersonViewSafe,
|
2020-09-01 14:25:34 +00:00
|
|
|
};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize, Debug)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct Login {
|
|
|
|
pub username_or_email: String,
|
|
|
|
pub password: String,
|
|
|
|
}
|
2021-03-18 20:25:21 +00:00
|
|
|
use lemmy_db_schema::{CommunityId, PersonId, PersonMentionId, PrivateMessageId};
|
2020-09-01 14:25:34 +00:00
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct Register {
|
|
|
|
pub username: String,
|
|
|
|
pub password: String,
|
|
|
|
pub password_verify: String,
|
|
|
|
pub show_nsfw: bool,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub email: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub captcha_uuid: Option<String>,
|
|
|
|
pub captcha_answer: Option<String>,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetCaptcha {}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetCaptchaResponse {
|
2021-01-18 21:57:31 +00:00
|
|
|
pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CaptchaResponse {
|
2021-04-01 17:30:24 +00:00
|
|
|
pub png: String, // A Base64 encoded png
|
|
|
|
pub wav: String, // A Base64 encoded wav audio
|
2020-09-01 14:25:34 +00:00
|
|
|
pub uuid: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SaveUserSettings {
|
2021-03-11 04:43:11 +00:00
|
|
|
pub show_nsfw: Option<bool>,
|
2021-03-31 10:54:46 +00:00
|
|
|
pub show_scores: Option<bool>,
|
2021-03-11 04:43:11 +00:00
|
|
|
pub theme: Option<String>,
|
|
|
|
pub default_sort_type: Option<i16>,
|
|
|
|
pub default_listing_type: Option<i16>,
|
|
|
|
pub lang: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub avatar: Option<String>,
|
|
|
|
pub banner: Option<String>,
|
2021-04-01 17:57:45 +00:00
|
|
|
pub display_name: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub email: Option<String>,
|
|
|
|
pub bio: Option<String>,
|
|
|
|
pub matrix_user_id: Option<String>,
|
2021-03-11 04:43:11 +00:00
|
|
|
pub show_avatars: Option<bool>,
|
|
|
|
pub send_notifications_to_email: Option<bool>,
|
2021-04-21 21:41:14 +00:00
|
|
|
pub bot_account: Option<bool>,
|
|
|
|
pub show_bot_accounts: Option<bool>,
|
2021-04-24 22:26:50 +00:00
|
|
|
pub show_read_posts: Option<bool>,
|
2021-07-22 20:07:40 +00:00
|
|
|
pub show_new_post_notifs: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2021-04-01 21:39:01 +00:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct ChangePassword {
|
|
|
|
pub new_password: String,
|
|
|
|
pub new_password_verify: String,
|
|
|
|
pub old_password: String,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct LoginResponse {
|
|
|
|
pub jwt: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonDetails {
|
2021-04-15 03:37:51 +00:00
|
|
|
pub person_id: Option<PersonId>, // One of these two are required
|
2021-07-20 04:29:50 +00:00
|
|
|
/// Example: dessalines , or dessalines@xyz.tld
|
2020-09-01 14:25:34 +00:00
|
|
|
pub username: Option<String>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub sort: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub saved_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub auth: Option<String>,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonDetailsResponse {
|
|
|
|
pub person_view: PersonViewSafe,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub comments: Vec<CommentView>,
|
|
|
|
pub posts: Vec<PostView>,
|
2021-08-19 20:54:15 +00:00
|
|
|
pub moderates: Vec<CommunityModeratorView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetRepliesResponse {
|
2020-12-15 19:39:18 +00:00
|
|
|
pub replies: Vec<CommentView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonMentionsResponse {
|
|
|
|
pub mentions: Vec<PersonMentionView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct MarkAllAsRead {
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct AddAdmin {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub person_id: PersonId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub added: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct AddAdminResponse {
|
2021-03-10 22:33:55 +00:00
|
|
|
pub admins: Vec<PersonViewSafe>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct BanPerson {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub person_id: PersonId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub ban: bool,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub remove_data: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub expires: Option<i64>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct BanPersonResponse {
|
|
|
|
pub person_view: PersonViewSafe,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub banned: bool,
|
|
|
|
}
|
|
|
|
|
2021-08-19 20:54:15 +00:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct BlockPerson {
|
|
|
|
pub person_id: PersonId,
|
|
|
|
pub block: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Clone)]
|
|
|
|
pub struct BlockPersonResponse {
|
|
|
|
pub person_view: PersonViewSafe,
|
|
|
|
pub blocked: bool,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetReplies {
|
2021-04-15 03:37:51 +00:00
|
|
|
pub sort: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub unread_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct GetPersonMentions {
|
2021-04-15 03:37:51 +00:00
|
|
|
pub sort: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-04-15 03:37:51 +00:00
|
|
|
pub unread_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct MarkPersonMentionAsRead {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub person_mention_id: PersonMentionId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub read: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2021-03-10 22:33:55 +00:00
|
|
|
pub struct PersonMentionResponse {
|
|
|
|
pub person_mention_view: PersonMentionView,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct DeleteAccount {
|
|
|
|
pub password: String,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PasswordReset {
|
|
|
|
pub email: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PasswordResetResponse {}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PasswordChange {
|
|
|
|
pub token: String,
|
|
|
|
pub password: String,
|
|
|
|
pub password_verify: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CreatePrivateMessage {
|
|
|
|
pub content: String,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub recipient_id: PersonId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct EditPrivateMessage {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub private_message_id: PrivateMessageId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub content: String,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct DeletePrivateMessage {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub private_message_id: PrivateMessageId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub deleted: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct MarkPrivateMessageAsRead {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub private_message_id: PrivateMessageId,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub read: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetPrivateMessages {
|
2021-04-15 03:37:51 +00:00
|
|
|
pub unread_only: Option<bool>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PrivateMessagesResponse {
|
2020-12-20 01:10:47 +00:00
|
|
|
pub private_messages: Vec<PrivateMessageView>,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct PrivateMessageResponse {
|
2020-12-20 01:10:47 +00:00
|
|
|
pub private_message_view: PrivateMessageView,
|
2020-09-01 14:25:34 +00:00
|
|
|
}
|
|
|
|
|
2021-09-28 10:36:17 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct GetReportCount {
|
2021-09-28 10:36:17 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2020-10-25 02:59:13 +00:00
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2021-09-28 10:36:17 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2020-10-25 02:59:13 +00:00
|
|
|
pub struct GetReportCountResponse {
|
2021-09-28 10:36:17 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2020-11-04 02:15:11 +00:00
|
|
|
pub comment_reports: i64,
|
|
|
|
pub post_reports: i64,
|
2020-10-25 02:59:13 +00:00
|
|
|
}
|