Skip to main content

nominal_api/conjure/objects/module/
search_modules_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 SearchModulesRequest {
16    #[builder(custom(type = super::SearchModulesQuery, convert = Box::new))]
17    #[serde(rename = "query")]
18    query: Box<super::SearchModulesQuery>,
19    #[builder(
20        default,
21        custom(
22            type = impl
23            Into<Option<super::SearchModulesSortOptions>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(rename = "sort", skip_serializing_if = "Option::is_none", default)]
28    sort: Option<Box<super::SearchModulesSortOptions>>,
29    #[serde(rename = "pageSize")]
30    page_size: i32,
31    #[builder(default, into)]
32    #[serde(rename = "nextPageToken", skip_serializing_if = "Option::is_none", default)]
33    next_page_token: Option<super::super::api::Token>,
34    #[builder(default, into)]
35    #[serde(
36        rename = "archivedStatuses",
37        skip_serializing_if = "Option::is_none",
38        default
39    )]
40    archived_statuses: Option<
41        std::collections::BTreeSet<super::super::api::ArchivedStatus>,
42    >,
43}
44impl SearchModulesRequest {
45    /// Constructs a new instance of the type.
46    #[inline]
47    pub fn new(query: super::SearchModulesQuery, page_size: i32) -> Self {
48        Self::builder().query(query).page_size(page_size).build()
49    }
50    #[inline]
51    pub fn query(&self) -> &super::SearchModulesQuery {
52        &*self.query
53    }
54    #[inline]
55    pub fn sort(&self) -> Option<&super::SearchModulesSortOptions> {
56        self.sort.as_ref().map(|o| &**o)
57    }
58    #[inline]
59    pub fn page_size(&self) -> i32 {
60        self.page_size
61    }
62    #[inline]
63    pub fn next_page_token(&self) -> Option<&super::super::api::Token> {
64        self.next_page_token.as_ref().map(|o| &*o)
65    }
66    /// Default search status is NOT_ARCHIVED if none are provided. Allows for including archived modules in search.
67    #[inline]
68    pub fn archived_statuses(
69        &self,
70    ) -> Option<&std::collections::BTreeSet<super::super::api::ArchivedStatus>> {
71        self.archived_statuses.as_ref().map(|o| &*o)
72    }
73}