Skip to main content

nominal_api_conjure/conjure/objects/scout/asset/api/
search_assets_request.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct SearchAssetsRequest {
13    #[builder(custom(type = super::AssetSortOptions, convert = Box::new))]
14    #[serde(rename = "sort")]
15    sort: Box<super::AssetSortOptions>,
16    #[builder(default, into)]
17    #[serde(rename = "pageSize", skip_serializing_if = "Option::is_none", default)]
18    page_size: Option<i32>,
19    #[builder(default, into)]
20    #[serde(rename = "nextPageToken", skip_serializing_if = "Option::is_none", default)]
21    next_page_token: Option<super::super::super::super::api::Token>,
22    #[builder(custom(type = super::SearchAssetsQuery, convert = Box::new))]
23    #[serde(rename = "query")]
24    query: Box<super::SearchAssetsQuery>,
25    #[builder(default, into)]
26    #[serde(
27        rename = "archivedStatuses",
28        skip_serializing_if = "Option::is_none",
29        default
30    )]
31    archived_statuses: Option<
32        std::collections::BTreeSet<super::super::super::super::api::ArchivedStatus>,
33    >,
34    #[builder(default, into)]
35    #[serde(
36        rename = "includeMatchCount",
37        skip_serializing_if = "Option::is_none",
38        default
39    )]
40    include_match_count: Option<bool>,
41}
42impl SearchAssetsRequest {
43    /// Constructs a new instance of the type.
44    #[inline]
45    pub fn new(sort: super::AssetSortOptions, query: super::SearchAssetsQuery) -> Self {
46        Self::builder().sort(sort).query(query).build()
47    }
48    #[inline]
49    pub fn sort(&self) -> &super::AssetSortOptions {
50        &*self.sort
51    }
52    /// Page sizes greater than 10_000 will be rejected. Default pageSize is 100.
53    #[inline]
54    pub fn page_size(&self) -> Option<i32> {
55        self.page_size.as_ref().map(|o| *o)
56    }
57    #[inline]
58    pub fn next_page_token(&self) -> Option<&super::super::super::super::api::Token> {
59        self.next_page_token.as_ref().map(|o| &*o)
60    }
61    #[inline]
62    pub fn query(&self) -> &super::SearchAssetsQuery {
63        &*self.query
64    }
65    /// Default search status is NOT_ARCHIVED if none are provided. Allows for including archived assets in search.
66    #[inline]
67    pub fn archived_statuses(
68        &self,
69    ) -> Option<
70        &std::collections::BTreeSet<super::super::super::super::api::ArchivedStatus>,
71    > {
72        self.archived_statuses.as_ref().map(|o| &*o)
73    }
74    /// When true, the response populates totalCount with the number of assets matching the query. Defaults to
75    /// false. Computing the count is an additional query whose cost grows with the size of the matching set, so
76    /// only set this when the count is needed.
77    #[inline]
78    pub fn include_match_count(&self) -> Option<bool> {
79        self.include_match_count.as_ref().map(|o| *o)
80    }
81}