Skip to main content

nominal_api/conjure/objects/themes/api/
create_chart_theme_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 CreateChartThemeRequest {
16    #[builder(into)]
17    #[serde(rename = "name")]
18    name: String,
19    #[builder(custom(type = super::ChartThemeContent, convert = Box::new))]
20    #[serde(rename = "content")]
21    content: Box<super::ChartThemeContent>,
22    #[builder(default, into)]
23    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
24    workspace: Option<super::super::super::api::rids::WorkspaceRid>,
25}
26impl CreateChartThemeRequest {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(name: impl Into<String>, content: super::ChartThemeContent) -> Self {
30        Self::builder().name(name).content(content).build()
31    }
32    /// The name of the theme.
33    #[inline]
34    pub fn name(&self) -> &str {
35        &*self.name
36    }
37    /// The theme fields.
38    #[inline]
39    pub fn content(&self) -> &super::ChartThemeContent {
40        &*self.content
41    }
42    /// The workspace in which to create the theme. If not provided, the theme will be created in the default workspace for
43    /// the user's organization, if the default workspace for the organization is configured.
44    #[inline]
45    pub fn workspace(&self) -> Option<&super::super::super::api::rids::WorkspaceRid> {
46        self.workspace.as_ref().map(|o| &*o)
47    }
48}