Skip to main content

nominal_api/conjure/objects/comments/api/
create_comment_request.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 CreateCommentRequest {
16    #[builder(custom(type = super::CommentParent, convert = Box::new))]
17    #[serde(rename = "parent")]
18    parent: Box<super::CommentParent>,
19    #[builder(into)]
20    #[serde(rename = "content")]
21    content: String,
22    #[builder(default, set(item(type = super::super::super::api::rids::AttachmentRid)))]
23    #[serde(
24        rename = "attachments",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    attachments: std::collections::BTreeSet<
29        super::super::super::api::rids::AttachmentRid,
30    >,
31}
32impl CreateCommentRequest {
33    /// Constructs a new instance of the type.
34    #[inline]
35    pub fn new(parent: super::CommentParent, content: impl Into<String>) -> Self {
36        Self::builder().parent(parent).content(content).build()
37    }
38    #[inline]
39    pub fn parent(&self) -> &super::CommentParent {
40        &*self.parent
41    }
42    /// The content of the comment. Markdown supported.
43    #[inline]
44    pub fn content(&self) -> &str {
45        &*self.content
46    }
47    /// Attachments to the comment.
48    #[inline]
49    pub fn attachments(
50        &self,
51    ) -> &std::collections::BTreeSet<super::super::super::api::rids::AttachmentRid> {
52        &self.attachments
53    }
54}