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