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