Skip to main content

Paginated

Trait Paginated 

Source
pub trait Paginated {
    type Item: Send + Sync;

    // Required methods
    fn items(self) -> Vec<Self::Item>;
    fn next_cursor(&self) -> Option<&str>;
    fn has_more(&self) -> bool;
}
Expand description

Trait for paginated API response types.

Implement this trait on your response type to enable automatic pagination via PageStream. The SDK provides implementations for all built-in list response types.

§Required methods

  • items — Extract the items from this page (consumes self)
  • next_cursor — Return the cursor string for fetching the next page
  • has_more — Return whether more pages exist

Required Associated Types§

Source

type Item: Send + Sync

The individual item type within a page.

Required Methods§

Source

fn items(self) -> Vec<Self::Item>

Returns the items from this page.

Source

fn next_cursor(&self) -> Option<&str>

Returns the cursor for the next page, if any.

Source

fn has_more(&self) -> bool

Returns whether more pages are available.

Implementors§