Skip to main content

nominal_api/conjure/objects/scout/template/api/
template_metadata.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 TemplateMetadata {
16    #[builder(into)]
17    #[serde(rename = "title")]
18    title: String,
19    #[builder(into)]
20    #[serde(rename = "description")]
21    description: String,
22    #[builder(default, set(item(type = super::super::super::super::api::Label)))]
23    #[serde(
24        rename = "labels",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    labels: std::collections::BTreeSet<super::super::super::super::api::Label>,
29    #[builder(
30        default,
31        map(
32            key(type = super::super::super::super::api::PropertyName),
33            value(type = super::super::super::super::api::PropertyValue)
34        )
35    )]
36    #[serde(
37        rename = "properties",
38        skip_serializing_if = "std::collections::BTreeMap::is_empty",
39        default
40    )]
41    properties: std::collections::BTreeMap<
42        super::super::super::super::api::PropertyName,
43        super::super::super::super::api::PropertyValue,
44    >,
45    #[serde(rename = "isArchived")]
46    is_archived: bool,
47    #[serde(rename = "isPublished")]
48    is_published: bool,
49    #[serde(rename = "createdBy")]
50    created_by: super::super::super::rids::api::UserRid,
51    #[serde(rename = "createdAt")]
52    created_at: conjure_object::DateTime<conjure_object::Utc>,
53    #[serde(rename = "updatedAt")]
54    updated_at: conjure_object::DateTime<conjure_object::Utc>,
55    #[serde(rename = "editedAt")]
56    edited_at: conjure_object::DateTime<conjure_object::Utc>,
57    #[builder(
58        default,
59        custom(
60            type = impl
61            Into<Option<super::super::super::super::api::ThemeAwareImage>>,
62            convert = |v|v.into().map(Box::new)
63        )
64    )]
65    #[serde(rename = "previewImage", skip_serializing_if = "Option::is_none", default)]
66    preview_image: Option<Box<super::super::super::super::api::ThemeAwareImage>>,
67}
68impl TemplateMetadata {
69    #[inline]
70    pub fn title(&self) -> &str {
71        &*self.title
72    }
73    #[inline]
74    pub fn description(&self) -> &str {
75        &*self.description
76    }
77    #[inline]
78    pub fn labels(
79        &self,
80    ) -> &std::collections::BTreeSet<super::super::super::super::api::Label> {
81        &self.labels
82    }
83    #[inline]
84    pub fn properties(
85        &self,
86    ) -> &std::collections::BTreeMap<
87        super::super::super::super::api::PropertyName,
88        super::super::super::super::api::PropertyValue,
89    > {
90        &self.properties
91    }
92    #[inline]
93    pub fn is_archived(&self) -> bool {
94        self.is_archived
95    }
96    #[inline]
97    pub fn is_published(&self) -> bool {
98        self.is_published
99    }
100    #[inline]
101    pub fn created_by(&self) -> &super::super::super::rids::api::UserRid {
102        &self.created_by
103    }
104    #[inline]
105    pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
106        self.created_at
107    }
108    #[inline]
109    pub fn updated_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
110        self.updated_at
111    }
112    /// The time of the last permanent commit to the main branch.
113    #[inline]
114    pub fn edited_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
115        self.edited_at
116    }
117    #[inline]
118    pub fn preview_image(
119        &self,
120    ) -> Option<&super::super::super::super::api::ThemeAwareImage> {
121        self.preview_image.as_ref().map(|o| &**o)
122    }
123}