nominal_api/conjure/objects/scout/notebook/api/
notebook_metadata.rs1#[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 NotebookMetadata {
16 #[builder(default, into)]
17 #[serde(rename = "runRid", skip_serializing_if = "Option::is_none", default)]
18 run_rid: Option<super::super::super::run::api::RunRid>,
19 #[builder(custom(type = super::NotebookDataScope, convert = Box::new))]
20 #[serde(rename = "dataScope")]
21 data_scope: Box<super::NotebookDataScope>,
22 #[serde(rename = "notebookType")]
23 notebook_type: super::NotebookType,
24 #[builder(into)]
25 #[serde(rename = "title")]
26 title: String,
27 #[builder(into)]
28 #[serde(rename = "description")]
29 description: String,
30 #[serde(rename = "isDraft")]
31 is_draft: bool,
32 #[serde(rename = "isArchived")]
33 is_archived: bool,
34 #[builder(custom(type = super::Lock, convert = Box::new))]
35 #[serde(rename = "lock")]
36 lock: Box<super::Lock>,
37 #[serde(rename = "createdByRid")]
38 created_by_rid: super::super::super::rids::api::UserRid,
39 #[serde(rename = "createdAt")]
40 created_at: conjure_object::DateTime<conjure_object::Utc>,
41 #[builder(default, into)]
42 #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none", default)]
43 updated_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
44 #[builder(default, map(key(type = String, into), value(type = String, into)))]
45 #[serde(
46 rename = "properties",
47 skip_serializing_if = "std::collections::BTreeMap::is_empty",
48 default
49 )]
50 properties: std::collections::BTreeMap<String, String>,
51 #[builder(default, set(item(type = String, into)))]
52 #[serde(
53 rename = "labels",
54 skip_serializing_if = "std::collections::BTreeSet::is_empty",
55 default
56 )]
57 labels: std::collections::BTreeSet<String>,
58 #[builder(
59 default,
60 custom(
61 type = impl
62 Into<Option<super::super::super::super::api::ThemeAwareImage>>,
63 convert = |v|v.into().map(Box::new)
64 )
65 )]
66 #[serde(rename = "previewImage", skip_serializing_if = "Option::is_none", default)]
67 preview_image: Option<Box<super::super::super::super::api::ThemeAwareImage>>,
68}
69impl NotebookMetadata {
70 #[inline]
72 pub fn run_rid(&self) -> Option<&super::super::super::run::api::RunRid> {
73 self.run_rid.as_ref().map(|o| &*o)
74 }
75 #[inline]
76 pub fn data_scope(&self) -> &super::NotebookDataScope {
77 &*self.data_scope
78 }
79 #[inline]
80 pub fn notebook_type(&self) -> &super::NotebookType {
81 &self.notebook_type
82 }
83 #[inline]
84 pub fn title(&self) -> &str {
85 &*self.title
86 }
87 #[inline]
88 pub fn description(&self) -> &str {
89 &*self.description
90 }
91 #[inline]
92 pub fn is_draft(&self) -> bool {
93 self.is_draft
94 }
95 #[inline]
96 pub fn is_archived(&self) -> bool {
97 self.is_archived
98 }
99 #[inline]
100 pub fn lock(&self) -> &super::Lock {
101 &*self.lock
102 }
103 #[inline]
104 pub fn created_by_rid(&self) -> &super::super::super::rids::api::UserRid {
105 &self.created_by_rid
106 }
107 #[inline]
108 pub fn created_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
109 self.created_at
110 }
111 #[inline]
113 pub fn updated_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
114 self.updated_at.as_ref().map(|o| *o)
115 }
116 #[inline]
117 pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
118 &self.properties
119 }
120 #[inline]
121 pub fn labels(&self) -> &std::collections::BTreeSet<String> {
122 &self.labels
123 }
124 #[inline]
125 pub fn preview_image(
126 &self,
127 ) -> Option<&super::super::super::super::api::ThemeAwareImage> {
128 self.preview_image.as_ref().map(|o| &**o)
129 }
130}