Skip to main content

nominal_api/conjure/objects/scout/compute/api/
page_info.rs

1/// Specification of a page for a series. Returns full resolution points beginning nearest to the given page
2/// token, advancing pageSize points in the time direction specified by the sign of the page size.
3/// Paging cursors are not guaranteed to distinguish exact duplicate non-log points with the same timestamp,
4/// tags, and value. If those duplicates straddle a page boundary, later duplicates may be skipped.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    PartialEq,
11    Eq,
12    PartialOrd,
13    Ord,
14    Hash
15)]
16#[serde(crate = "conjure_object::serde")]
17#[conjure_object::private::staged_builder::staged_builder]
18#[builder(crate = conjure_object::private::staged_builder, update, inline)]
19pub struct PageInfo {
20    #[builder(
21        default,
22        custom(
23            type = impl
24            Into<Option<super::PageToken>>,
25            convert = |v|v.into().map(Box::new)
26        )
27    )]
28    #[serde(rename = "pageToken", skip_serializing_if = "Option::is_none", default)]
29    page_token: Option<Box<super::PageToken>>,
30    #[serde(rename = "pageSize")]
31    page_size: i32,
32}
33impl PageInfo {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new(page_size: i32) -> Self {
37        Self::builder().page_size(page_size).build()
38    }
39    #[inline]
40    pub fn page_token(&self) -> Option<&super::PageToken> {
41        self.page_token.as_ref().map(|o| &**o)
42    }
43    #[inline]
44    pub fn page_size(&self) -> i32 {
45        self.page_size
46    }
47}