pub struct PagedResponse<T> {
pub items: Vec<T>,
pub total_count: Option<u64>,
pub pagination: Pagination,
}Expand description
Paginated response wrapper.
GitHub API returns paginated results with Link headers for navigation.
See docs/spec/interfaces/pagination.md
Fields§
§items: Vec<T>Items in this page
total_count: Option<u64>Total count (if available from API)
pagination: PaginationPagination metadata
Implementations§
Source§impl<T> PagedResponse<T>
impl<T> PagedResponse<T>
Sourcepub fn has_next(&self) -> bool
pub fn has_next(&self) -> bool
Check if there are more pages available.
Returns true if a next page URL exists in the pagination metadata.
Sourcepub fn next_page_number(&self) -> Option<u32>
pub fn next_page_number(&self) -> Option<u32>
Get the next page number from the pagination URL.
Extracts the page number from the next page URL if available.
§Examples
use github_bot_sdk::client::{PagedResponse, Pagination};
let mut pagination = Pagination::default();
pagination.next = Some("https://api.github.com/repos/o/r/issues?page=3".to_string());
let response = PagedResponse {
items: vec![1, 2, 3],
total_count: None,
pagination,
};
assert_eq!(response.next_page_number(), Some(3));Sourcepub fn is_last_page(&self) -> bool
pub fn is_last_page(&self) -> bool
Check if this is the last page.
Returns true if there is no next page available.
Trait Implementations§
Source§impl<T: Clone> Clone for PagedResponse<T>
impl<T: Clone> Clone for PagedResponse<T>
Source§fn clone(&self) -> PagedResponse<T>
fn clone(&self) -> PagedResponse<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for PagedResponse<T>
impl<T: Debug> Debug for PagedResponse<T>
Source§impl<'de, T> Deserialize<'de> for PagedResponse<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for PagedResponse<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for PagedResponse<T>
impl<T> RefUnwindSafe for PagedResponse<T>where
T: RefUnwindSafe,
impl<T> Send for PagedResponse<T>where
T: Send,
impl<T> Sync for PagedResponse<T>where
T: Sync,
impl<T> Unpin for PagedResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for PagedResponse<T>
impl<T> UnwindSafe for PagedResponse<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more