nominal_api/conjure/objects/comments/api/
comment.rs1#[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 Comment {
16 #[serde(rename = "rid")]
17 rid: super::CommentRid,
18 #[builder(custom(type = super::CommentParent, convert = Box::new))]
19 #[serde(rename = "parent")]
20 parent: Box<super::CommentParent>,
21 #[serde(rename = "authorRid")]
22 author_rid: conjure_object::ResourceIdentifier,
23 #[serde(rename = "createdAt")]
24 created_at: conjure_object::DateTime<conjure_object::Utc>,
25 #[builder(default, into)]
26 #[serde(rename = "editedAt", skip_serializing_if = "Option::is_none", default)]
27 edited_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
28 #[builder(default, into)]
29 #[serde(rename = "deletedAt", skip_serializing_if = "Option::is_none", default)]
30 deleted_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
31 #[builder(into)]
32 #[serde(rename = "content")]
33 content: String,
34 #[builder(default, into)]
35 #[serde(rename = "pinnedBy", skip_serializing_if = "Option::is_none", default)]
36 pinned_by: Option<conjure_object::ResourceIdentifier>,
37 #[builder(default, into)]
38 #[serde(rename = "pinnedAt", skip_serializing_if = "Option::is_none", default)]
39 pinned_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
40 #[builder(default, list(item(type = super::Reaction)))]
41 #[serde(rename = "reactions", skip_serializing_if = "Vec::is_empty", default)]
42 reactions: Vec<super::Reaction>,
43 #[builder(default, set(item(type = conjure_object::ResourceIdentifier)))]
44 #[serde(
45 rename = "attachments",
46 skip_serializing_if = "std::collections::BTreeSet::is_empty",
47 default
48 )]
49 attachments: std::collections::BTreeSet<conjure_object::ResourceIdentifier>,
50}
51impl Comment {
52 #[inline]
54 pub fn rid(&self) -> &super::CommentRid {
55 &self.rid
56 }
57 #[inline]
59 pub fn parent(&self) -> &super::CommentParent {
60 &*self.parent
61 }
62 #[inline]
64 pub fn author_rid(&self) -> &conjure_object::ResourceIdentifier {
65 &self.author_rid
66 }
67 #[inline]
69 pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
70 self.created_at
71 }
72 #[inline]
74 pub fn edited_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
75 self.edited_at.as_ref().map(|o| *o)
76 }
77 #[inline]
79 pub fn deleted_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
80 self.deleted_at.as_ref().map(|o| *o)
81 }
82 #[inline]
84 pub fn content(&self) -> &str {
85 &*self.content
86 }
87 #[inline]
89 pub fn pinned_by(&self) -> Option<&conjure_object::ResourceIdentifier> {
90 self.pinned_by.as_ref().map(|o| &*o)
91 }
92 #[inline]
94 pub fn pinned_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
95 self.pinned_at.as_ref().map(|o| *o)
96 }
97 #[inline]
99 pub fn reactions(&self) -> &[super::Reaction] {
100 &*self.reactions
101 }
102 #[inline]
104 pub fn attachments(
105 &self,
106 ) -> &std::collections::BTreeSet<conjure_object::ResourceIdentifier> {
107 &self.attachments
108 }
109}