Skip to main content

nominal_api/conjure/objects/scout/channel/api/
batch_search_channels_request.rs

1/// Batched form of `searchChannels`. The map key of `requests` can be an arbitrary string
2/// identifier. It will be returned in the response as part of `BatchedLocator`.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct BatchSearchChannelsRequest {
15    #[builder(
16        default,
17        map(key(type = String, into), value(type = super::BatchSearchChannelsEntry))
18    )]
19    #[serde(
20        rename = "requests",
21        skip_serializing_if = "std::collections::BTreeMap::is_empty",
22        default
23    )]
24    requests: std::collections::BTreeMap<String, super::BatchSearchChannelsEntry>,
25    #[builder(custom(type = super::ChannelSearchQuery, convert = Box::new))]
26    #[serde(rename = "query")]
27    query: Box<super::ChannelSearchQuery>,
28    #[builder(custom(type = super::super::super::super::api::Range, convert = Box::new))]
29    #[serde(rename = "timeRange")]
30    time_range: Box<super::super::super::super::api::Range>,
31    #[builder(default, into)]
32    #[serde(
33        rename = "maxResultChannels",
34        skip_serializing_if = "Option::is_none",
35        default
36    )]
37    max_result_channels: Option<i32>,
38}
39impl BatchSearchChannelsRequest {
40    /// Constructs a new instance of the type.
41    #[inline]
42    pub fn new(
43        query: super::ChannelSearchQuery,
44        time_range: super::super::super::super::api::Range,
45    ) -> Self {
46        Self::builder().query(query).time_range(time_range).build()
47    }
48    #[inline]
49    pub fn requests(
50        &self,
51    ) -> &std::collections::BTreeMap<String, super::BatchSearchChannelsEntry> {
52        &self.requests
53    }
54    #[inline]
55    pub fn query(&self) -> &super::ChannelSearchQuery {
56        &*self.query
57    }
58    /// Time filter applied to the search. Only channels with data within this time range will be returned.
59    /// A shorter time range will improve performance!
60    #[inline]
61    pub fn time_range(&self) -> &super::super::super::super::api::Range {
62        &*self.time_range
63    }
64    /// Global cap on the merged channel result list. Defaults to 1000. Capped at 1000.
65    #[inline]
66    pub fn max_result_channels(&self) -> Option<i32> {
67        self.max_result_channels.as_ref().map(|o| *o)
68    }
69}