Skip to main content

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