nominal-api 0.1239.0

API bindings for the Nominal platform
Documentation
/// DEPRECATED. Use a dedicated group-by-and-aggregate nodes instead.
///
/// Aggregates values with duplicate timestamps in the input series values into a single value using the
/// specified aggregation function.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct AggregateNumericSeries {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[serde(rename = "function")]
    function: super::NumericAggregationFunction,
    #[builder(default, set(item(type = super::StringConstant)))]
    #[serde(
        rename = "groupByTags",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    group_by_tags: std::collections::BTreeSet<super::StringConstant>,
    #[builder(default, into)]
    #[serde(
        rename = "aggregateByAllGroupings",
        skip_serializing_if = "Option::is_none",
        default
    )]
    aggregate_by_all_groupings: Option<bool>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::InterpolationConfiguration>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "interpolationConfiguration",
        skip_serializing_if = "Option::is_none",
        default
    )]
    interpolation_configuration: Option<Box<super::InterpolationConfiguration>>,
}
impl AggregateNumericSeries {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        input: super::NumericSeries,
        function: super::NumericAggregationFunction,
    ) -> Self {
        Self::builder().input(input).function(function).build()
    }
    #[inline]
    pub fn input(&self) -> &super::NumericSeries {
        &*self.input
    }
    #[inline]
    pub fn function(&self) -> &super::NumericAggregationFunction {
        &self.function
    }
    /// Tags to group by for the aggregation.
    /// If left empty, the tags to group by will be equivalent to those in the input series.
    /// If specified, the result will be grouped ONLY by the specified tags.
    /// The tags specified here MUST be a (non-strict) subset of the input series's group by tags.
    #[inline]
    pub fn group_by_tags(&self) -> &std::collections::BTreeSet<super::StringConstant> {
        &self.group_by_tags
    }
    /// This field's purpose is to distinguish between the two flavors of groupByTags being empty. It has no
    /// effect when groupByTags is non-empty.
    /// When true and groupByTags is empty, aggregate across all series in the input.
    /// When false and groupByTags is empty, the result will be grouped by the same tags as the input series.
    #[inline]
    pub fn aggregate_by_all_groupings(&self) -> Option<bool> {
        self.aggregate_by_all_groupings.as_ref().map(|o| *o)
    }
    /// If provided, interpolates values at timestamps where the input series has values before aggregating.
    /// If not provided, only aggregates when timestamps match exactly (existing behavior).
    #[inline]
    pub fn interpolation_configuration(
        &self,
    ) -> Option<&super::InterpolationConfiguration> {
        self.interpolation_configuration.as_ref().map(|o| &**o)
    }
}