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 = conjure_object::ResourceIdentifier)))]
23    #[serde(
24        rename = "attachments",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    attachments: std::collections::BTreeSet<conjure_object::ResourceIdentifier>,
29}
30impl CreateCommentRequest {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(parent: super::CommentParent, content: impl Into<String>) -> Self {
34        Self::builder().parent(parent).content(content).build()
35    }
36    #[inline]
37    pub fn parent(&self) -> &super::CommentParent {
38        &*self.parent
39    }
40    /// The content of the comment. Markdown supported.
41    #[inline]
42    pub fn content(&self) -> &str {
43        &*self.content
44    }
45    /// Attachments to the comment.
46    #[inline]
47    pub fn attachments(
48        &self,
49    ) -> &std::collections::BTreeSet<conjure_object::ResourceIdentifier> {
50        &self.attachments
51    }
52}