asana_cli/api/
pagination.rs1use serde::Deserialize;
4
5#[derive(Debug, Clone, Deserialize)]
7pub struct PaginationInfo {
8 pub offset: Option<String>,
10 pub path: Option<String>,
12 pub uri: Option<String>,
14}
15
16impl PaginationInfo {
17 #[must_use]
19 pub fn offset(&self) -> Option<&str> {
20 self.offset.as_deref()
21 }
22}
23
24#[derive(Debug, Clone, Deserialize)]
26pub struct ListResponse<T> {
27 pub data: Vec<T>,
29 #[serde(default)]
31 pub next_page: Option<PaginationInfo>,
32}
33
34impl<T> ListResponse<T> {
35 #[must_use]
37 pub fn has_more(&self) -> bool {
38 self.next_page
39 .as_ref()
40 .and_then(PaginationInfo::offset)
41 .is_some()
42 }
43}