Skip to main content

nominal_api/conjure/objects/scout/channel/api/
search_channels_response.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 SearchChannelsResponse {
16    #[builder(default, set(item(type = super::Locator)))]
17    #[serde(
18        rename = "allExpandedLocators",
19        skip_serializing_if = "std::collections::BTreeSet::is_empty",
20        default
21    )]
22    all_expanded_locators: std::collections::BTreeSet<super::Locator>,
23    #[builder(default, list(item(type = super::ChannelEntry)))]
24    #[serde(rename = "results", skip_serializing_if = "Vec::is_empty", default)]
25    results: Vec<super::ChannelEntry>,
26}
27impl SearchChannelsResponse {
28    /// Constructs a new instance of the type.
29    #[inline]
30    pub fn new() -> Self {
31        Self::builder().build()
32    }
33    /// All locators expanded from the request scope, independent of which channels exist within them.
34    /// Useful for callers that need to know the complete locator topology (e.g. to render empty
35    /// locators in a tree view) even when no matching channel was found in some of them or if the channel
36    /// only exists in a subset of locators.
37    #[inline]
38    pub fn all_expanded_locators(&self) -> &std::collections::BTreeSet<super::Locator> {
39        &self.all_expanded_locators
40    }
41    /// Channels matching the query, ordered by global relevance score (descending) from the
42    /// underlying search.
43    #[inline]
44    pub fn results(&self) -> &[super::ChannelEntry] {
45        &*self.results
46    }
47}