Skip to main content

nominal_api/conjure/objects/comments/api/
conversation.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 Conversation {
16    #[serde(rename = "resourceRid")]
17    resource_rid: conjure_object::ResourceIdentifier,
18    #[serde(rename = "resourceType")]
19    resource_type: super::ResourceType,
20    #[builder(default, list(item(type = super::ConversationNode)))]
21    #[serde(rename = "comments", skip_serializing_if = "Vec::is_empty", default)]
22    comments: Vec<super::ConversationNode>,
23}
24impl Conversation {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(
28        resource_rid: conjure_object::ResourceIdentifier,
29        resource_type: super::ResourceType,
30    ) -> Self {
31        Self::builder().resource_rid(resource_rid).resource_type(resource_type).build()
32    }
33    /// RID for the resource that the conversation is associated with.
34    #[inline]
35    pub fn resource_rid(&self) -> &conjure_object::ResourceIdentifier {
36        &self.resource_rid
37    }
38    /// The type of the resource that the conversation is associated with.
39    #[inline]
40    pub fn resource_type(&self) -> &super::ResourceType {
41        &self.resource_type
42    }
43    /// The comments on the conversation ordered by creation time.
44    /// Empty if the comment has no replies.
45    #[inline]
46    pub fn comments(&self) -> &[super::ConversationNode] {
47        &*self.comments
48    }
49}