Skip to main content

nominal_api/conjure/objects/scout/compute/api/
summarize_cartesian.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct SummarizeCartesian {
13    #[builder(custom(type = super::Cartesian, convert = Box::new))]
14    #[serde(rename = "input")]
15    input: Box<super::Cartesian>,
16    #[builder(
17        default,
18        custom(
19            type = impl
20            Into<Option<super::CartesianBounds>>,
21            convert = |v|v.into().map(Box::new)
22        )
23    )]
24    #[serde(rename = "bounds", skip_serializing_if = "Option::is_none", default)]
25    bounds: Option<Box<super::CartesianBounds>>,
26    #[builder(
27        default,
28        custom(
29            type = impl
30            Into<Option<super::ScatterSummarizationStrategy>>,
31            convert = |v|v.into().map(Box::new)
32        )
33    )]
34    #[serde(
35        rename = "summarizationStrategy",
36        skip_serializing_if = "Option::is_none",
37        default
38    )]
39    summarization_strategy: Option<Box<super::ScatterSummarizationStrategy>>,
40    #[builder(default, into)]
41    #[serde(rename = "maxPoints", skip_serializing_if = "Option::is_none", default)]
42    max_points: Option<i32>,
43}
44impl SummarizeCartesian {
45    /// Constructs a new instance of the type.
46    #[inline]
47    pub fn new(input: super::Cartesian) -> Self {
48        Self::builder().input(input).build()
49    }
50    #[inline]
51    pub fn input(&self) -> &super::Cartesian {
52        &*self.input
53    }
54    #[inline]
55    pub fn bounds(&self) -> Option<&super::CartesianBounds> {
56        self.bounds.as_ref().map(|o| &**o)
57    }
58    /// The summarization strategy to use when there are more than `maxPoints`. Defaults to spatial.
59    #[inline]
60    pub fn summarization_strategy(
61        &self,
62    ) -> Option<&super::ScatterSummarizationStrategy> {
63        self.summarization_strategy.as_ref().map(|o| &**o)
64    }
65    /// The maximum number of points to return in the response. If more points are found, a BucketedCartesianPlot
66    /// will be returned. Maximum is 10,000. Defaults to 2,000 if not specified.
67    #[inline]
68    pub fn max_points(&self) -> Option<i32> {
69        self.max_points.as_ref().map(|o| *o)
70    }
71}