Skip to main content

nominal_api/conjure/objects/timeseries/channelmetadata/api/
update_channel_metadata_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 UpdateChannelMetadataRequest {
16    #[builder(custom(type = super::ChannelIdentifier, convert = Box::new))]
17    #[serde(rename = "channelIdentifier")]
18    channel_identifier: Box<super::ChannelIdentifier>,
19    #[builder(default, into)]
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21    description: Option<String>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::super::super::logicalseries::api::UnitUpdate>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "unitUpdate", skip_serializing_if = "Option::is_none", default)]
31    unit_update: Option<Box<super::super::super::logicalseries::api::UnitUpdate>>,
32}
33impl UpdateChannelMetadataRequest {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new(channel_identifier: super::ChannelIdentifier) -> Self {
37        Self::builder().channel_identifier(channel_identifier).build()
38    }
39    #[inline]
40    pub fn channel_identifier(&self) -> &super::ChannelIdentifier {
41        &*self.channel_identifier
42    }
43    #[inline]
44    pub fn description(&self) -> Option<&str> {
45        self.description.as_ref().map(|o| &**o)
46    }
47    #[inline]
48    pub fn unit_update(
49        &self,
50    ) -> Option<&super::super::super::logicalseries::api::UnitUpdate> {
51        self.unit_update.as_ref().map(|o| &**o)
52    }
53}