Skip to main content

nominal_api/conjure/objects/comments/api/
conversation_node.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct ConversationNode {
16    #[builder(custom(type = super::Comment, convert = Box::new))]
17    #[serde(rename = "comment")]
18    comment: Box<super::Comment>,
19    #[builder(default, list(item(type = super::ConversationNode)))]
20    #[serde(rename = "replies", skip_serializing_if = "Vec::is_empty", default)]
21    replies: Vec<super::ConversationNode>,
22}
23impl ConversationNode {
24    /// Constructs a new instance of the type.
25    #[inline]
26    pub fn new(comment: super::Comment) -> Self {
27        Self::builder().comment(comment).build()
28    }
29    /// The comment
30    #[inline]
31    pub fn comment(&self) -> &super::Comment {
32        &*self.comment
33    }
34    /// The comments on (aka replies to) the comment ordered by creation time. Empty if the comment has no replies.
35    #[inline]
36    pub fn replies(&self) -> &[super::ConversationNode] {
37        &*self.replies
38    }
39}