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