nominal-api 0.1239.0

API bindings for the Nominal platform
Documentation
/// Request to duplicate a template. All content fields (layout, content) are copied from the
/// source template. Metadata fields can be optionally overridden; if not provided, they default
/// to the source template's values (except isPublished, which defaults to false).
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct DuplicateTemplateRequest {
    #[builder(default, into)]
    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
    title: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "titleSuffix", skip_serializing_if = "Option::is_none", default)]
    title_suffix: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "isPublished", skip_serializing_if = "Option::is_none", default)]
    is_published: Option<bool>,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<super::super::super::super::api::rids::WorkspaceRid>,
    #[builder(default, into)]
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none", default)]
    labels: Option<std::collections::BTreeSet<super::super::super::super::api::Label>>,
    #[builder(default, into)]
    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
    properties: Option<
        std::collections::BTreeMap<
            super::super::super::super::api::PropertyName,
            super::super::super::super::api::PropertyValue,
        >,
    >,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::ThemeAwareImage>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "previewImage", skip_serializing_if = "Option::is_none", default)]
    preview_image: Option<Box<super::super::super::super::api::ThemeAwareImage>>,
}
impl DuplicateTemplateRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    /// Override the title of the duplicated template. If not provided, generates a copy title
    /// from the source using the titleSuffix.
    #[inline]
    pub fn title(&self) -> Option<&str> {
        self.title.as_ref().map(|o| &**o)
    }
    /// Custom suffix for generating the copy title (e.g., "v2").
    /// Defaults to "copy". Ignored if title is explicitly provided.
    #[inline]
    pub fn title_suffix(&self) -> Option<&str> {
        self.title_suffix.as_ref().map(|o| &**o)
    }
    /// Override description. Defaults to the source template's description.
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    /// Override published status. Defaults to false.
    #[inline]
    pub fn is_published(&self) -> Option<bool> {
        self.is_published.as_ref().map(|o| *o)
    }
    /// The workspace for the duplicated template. If not provided, the template will be created
    /// in the default workspace for the user's organization.
    #[inline]
    pub fn workspace(
        &self,
    ) -> Option<&super::super::super::super::api::rids::WorkspaceRid> {
        self.workspace.as_ref().map(|o| &*o)
    }
    /// Override labels. Defaults to the source template's labels.
    #[inline]
    pub fn labels(
        &self,
    ) -> Option<&std::collections::BTreeSet<super::super::super::super::api::Label>> {
        self.labels.as_ref().map(|o| &*o)
    }
    /// Override properties. Defaults to the source template's properties.
    #[inline]
    pub fn properties(
        &self,
    ) -> Option<
        &std::collections::BTreeMap<
            super::super::super::super::api::PropertyName,
            super::super::super::super::api::PropertyValue,
        >,
    > {
        self.properties.as_ref().map(|o| &*o)
    }
    /// Override preview image. Defaults to the source template's preview image.
    #[inline]
    pub fn preview_image(
        &self,
    ) -> Option<&super::super::super::super::api::ThemeAwareImage> {
        self.preview_image.as_ref().map(|o| &**o)
    }
}