meztide/api_models/
comment.rs

1use chrono::{DateTime, FixedOffset};
2use serde::Deserialize;
3
4use crate::ids::CommentId;
5
6use super::{Empty, JustId, JustUrl, List, MinimalAuthorInfo, MinimalPostInfo};
7
8#[derive(Debug, Deserialize)]
9pub struct MinimalCommentInfo {
10    pub id: CommentId,
11    pub remote_url: Option<Box<str>>,
12    pub sensitive: bool,
13    pub content_text: Option<Box<str>>,
14    pub content_html: Option<Box<str>>,
15}
16
17#[derive(Debug, Deserialize)]
18pub struct CommentInfo {
19    #[serde(flatten)]
20    pub base: MinimalCommentInfo,
21
22    pub attachments: Box<[JustUrl]>,
23    pub author: Option<MinimalAuthorInfo>,
24    pub content_markdown: Option<Box<str>>,
25    pub created: DateTime<FixedOffset>,
26    pub deleted: bool,
27    pub local: bool,
28    pub replies: Option<List<CommentInfo>>,
29    pub score: i64,
30    pub your_vote: Option<Empty>,
31    pub parent: Option<JustId<CommentId>>,
32    pub post: Option<MinimalPostInfo>,
33}
34
35#[derive(Debug, Deserialize)]
36pub struct CommentFromUser {
37    pub r#type: Box<str>,
38
39    #[serde(flatten)]
40    pub base: MinimalCommentInfo,
41
42    pub created: DateTime<FixedOffset>,
43    pub post: MinimalPostInfo,
44}