#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct Comment {
#[serde(rename = "rid")]
rid: super::CommentRid,
#[builder(custom(type = super::CommentParent, convert = Box::new))]
#[serde(rename = "parent")]
parent: Box<super::CommentParent>,
#[serde(rename = "authorRid")]
author_rid: conjure_object::ResourceIdentifier,
#[serde(rename = "createdAt")]
created_at: conjure_object::DateTime<conjure_object::Utc>,
#[builder(default, into)]
#[serde(rename = "editedAt", skip_serializing_if = "Option::is_none", default)]
edited_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
#[builder(default, into)]
#[serde(rename = "deletedAt", skip_serializing_if = "Option::is_none", default)]
deleted_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
#[builder(into)]
#[serde(rename = "content")]
content: String,
#[builder(default, into)]
#[serde(rename = "pinnedBy", skip_serializing_if = "Option::is_none", default)]
pinned_by: Option<conjure_object::ResourceIdentifier>,
#[builder(default, into)]
#[serde(rename = "pinnedAt", skip_serializing_if = "Option::is_none", default)]
pinned_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
#[builder(default, list(item(type = super::Reaction)))]
#[serde(rename = "reactions", skip_serializing_if = "Vec::is_empty", default)]
reactions: Vec<super::Reaction>,
#[builder(default, set(item(type = super::super::super::api::rids::AttachmentRid)))]
#[serde(
rename = "attachments",
skip_serializing_if = "std::collections::BTreeSet::is_empty",
default
)]
attachments: std::collections::BTreeSet<
super::super::super::api::rids::AttachmentRid,
>,
}
impl Comment {
#[inline]
pub fn rid(&self) -> &super::CommentRid {
&self.rid
}
#[inline]
pub fn parent(&self) -> &super::CommentParent {
&*self.parent
}
#[inline]
pub fn author_rid(&self) -> &conjure_object::ResourceIdentifier {
&self.author_rid
}
#[inline]
pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
self.created_at
}
#[inline]
pub fn edited_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
self.edited_at.as_ref().map(|o| *o)
}
#[inline]
pub fn deleted_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
self.deleted_at.as_ref().map(|o| *o)
}
#[inline]
pub fn content(&self) -> &str {
&*self.content
}
#[inline]
pub fn pinned_by(&self) -> Option<&conjure_object::ResourceIdentifier> {
self.pinned_by.as_ref().map(|o| &*o)
}
#[inline]
pub fn pinned_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
self.pinned_at.as_ref().map(|o| *o)
}
#[inline]
pub fn reactions(&self) -> &[super::Reaction] {
&*self.reactions
}
#[inline]
pub fn attachments(
&self,
) -> &std::collections::BTreeSet<super::super::super::api::rids::AttachmentRid> {
&self.attachments
}
}