use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct PaginationInfo {
pub offset: Option<String>,
pub path: Option<String>,
pub uri: Option<String>,
}
impl PaginationInfo {
#[must_use]
pub fn offset(&self) -> Option<&str> {
self.offset.as_deref()
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct ListResponse<T> {
pub data: Vec<T>,
#[serde(default)]
pub next_page: Option<PaginationInfo>,
}
impl<T> ListResponse<T> {
#[must_use]
pub fn has_more(&self) -> bool {
self.next_page
.as_ref()
.and_then(PaginationInfo::offset)
.is_some()
}
}