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