Skip to main content

nominal_api/conjure/objects/datasource/api/
search_channels_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 SearchChannelsRequest {
16    #[builder(into)]
17    #[serde(rename = "fuzzySearchText")]
18    fuzzy_search_text: String,
19    #[builder(default, into)]
20    #[serde(rename = "prefix", skip_serializing_if = "Option::is_none", default)]
21    prefix: Option<String>,
22    #[builder(default, set(item(type = String, into)))]
23    #[serde(
24        rename = "exactMatch",
25        skip_serializing_if = "std::collections::BTreeSet::is_empty",
26        default
27    )]
28    exact_match: std::collections::BTreeSet<String>,
29    #[builder(default, set(item(type = super::super::super::api::rids::DataSourceRid)))]
30    #[serde(
31        rename = "dataSources",
32        skip_serializing_if = "std::collections::BTreeSet::is_empty",
33        default
34    )]
35    data_sources: std::collections::BTreeSet<
36        super::super::super::api::rids::DataSourceRid,
37    >,
38    #[builder(default, set(item(type = super::super::super::api::SeriesDataType)))]
39    #[serde(
40        rename = "dataTypes",
41        skip_serializing_if = "std::collections::BTreeSet::is_empty",
42        default
43    )]
44    data_types: std::collections::BTreeSet<super::super::super::api::SeriesDataType>,
45    #[builder(default, into)]
46    #[serde(
47        rename = "previouslySelectedChannels",
48        skip_serializing_if = "Option::is_none",
49        default
50    )]
51    previously_selected_channels: Option<
52        std::collections::BTreeMap<
53            super::super::super::api::rids::DataSourceRid,
54            std::collections::BTreeSet<super::super::super::api::Channel>,
55        >,
56    >,
57    #[builder(default, into)]
58    #[serde(rename = "nextPageToken", skip_serializing_if = "Option::is_none", default)]
59    next_page_token: Option<super::super::super::api::Token>,
60    #[builder(default, into)]
61    #[serde(rename = "pageSize", skip_serializing_if = "Option::is_none", default)]
62    page_size: Option<i32>,
63}
64impl SearchChannelsRequest {
65    /// Constructs a new instance of the type.
66    #[inline]
67    pub fn new(fuzzy_search_text: impl Into<String>) -> Self {
68        Self::builder().fuzzy_search_text(fuzzy_search_text).build()
69    }
70    #[inline]
71    pub fn fuzzy_search_text(&self) -> &str {
72        &*self.fuzzy_search_text
73    }
74    #[deprecated(note = "Use `searchHierarchical` instead. Will be ignored.\n")]
75    #[inline]
76    pub fn prefix(&self) -> Option<&str> {
77        self.prefix.as_ref().map(|o| &**o)
78    }
79    /// Will return only channels that contain all strings specified as exact matches (case insensitive).
80    #[inline]
81    pub fn exact_match(&self) -> &std::collections::BTreeSet<String> {
82        &self.exact_match
83    }
84    #[inline]
85    pub fn data_sources(
86        &self,
87    ) -> &std::collections::BTreeSet<super::super::super::api::rids::DataSourceRid> {
88        &self.data_sources
89    }
90    /// Filter to only channels with these data types. An empty set means no filtering (all data types included).
91    #[inline]
92    pub fn data_types(
93        &self,
94    ) -> &std::collections::BTreeSet<super::super::super::api::SeriesDataType> {
95        &self.data_types
96    }
97    #[deprecated(note = "Will be ignored.\n")]
98    #[inline]
99    pub fn previously_selected_channels(
100        &self,
101    ) -> Option<
102        &std::collections::BTreeMap<
103            super::super::super::api::rids::DataSourceRid,
104            std::collections::BTreeSet<super::super::super::api::Channel>,
105        >,
106    > {
107        self.previously_selected_channels.as_ref().map(|o| &*o)
108    }
109    #[inline]
110    pub fn next_page_token(&self) -> Option<&super::super::super::api::Token> {
111        self.next_page_token.as_ref().map(|o| &*o)
112    }
113    /// Defaults to 1000. Will throw if larger than 1000.
114    #[inline]
115    pub fn page_size(&self) -> Option<i32> {
116        self.page_size.as_ref().map(|o| *o)
117    }
118}