pub struct CursorPage<T: Clone, E: Endpoint + Default> {
pub href: String,
pub limit: u32,
pub next: Option<String>,
pub cursors: Option<Cursor>,
pub total: Option<u32>,
pub items: Vec<Option<T>>,
/* private fields */
}Expand description
This represents a page of items, which is a segment of data returned by the Spotify API.
It’s similar to Page, except that it uses a different approach for
pagination - instead of using a next and previous field to get another
page, it uses a Unix timestamp (in miliseconds).
To get the rest of the data, the cursors field (and others), or, preferably,
the get_before and get_after methods can be used.
Fields§
§href: StringThe URL to the API endpoint returning this page.
limit: u32The maximum amount of items in the response.
next: Option<String>The URL to the next page.
cursors: Option<Cursor>The cursor object used to get the previous/next page.
total: Option<u32>The amount of returned items.
items: Vec<Option<T>>A list of the items, which includes null values.
Implementations§
Source§impl<T: Clone + DeserializeOwned, E: Endpoint + Default + Clone> CursorPage<T, E>
impl<T: Clone + DeserializeOwned, E: Endpoint + Default + Clone> CursorPage<T, E>
Sourcepub fn filtered_items(&self) -> Vec<T>
pub fn filtered_items(&self) -> Vec<T>
Get a list of only the Some values from a Cursor Page’s items.
Sourcepub async fn get_before(
&self,
spotify: &Client<Token, impl AuthFlow>,
) -> Result<Self>
pub async fn get_before( &self, spotify: &Client<Token, impl AuthFlow>, ) -> Result<Self>
Get the page chronologically before the current one.
If there is no previous page, this will return an
Error::NoRemainingPages.
Sourcepub async fn get_after(
&self,
spotify: &Client<Token, impl AuthFlow>,
) -> Result<Self>
pub async fn get_after( &self, spotify: &Client<Token, impl AuthFlow>, ) -> Result<Self>
Get the page chronologically after the current one.
If there is no next page, this will return an
Error::NoRemainingPages.
Sourcepub async fn get_remaining(
self,
spotify: &Client<Token, impl AuthFlow>,
) -> Result<Vec<Option<T>>>
pub async fn get_remaining( self, spotify: &Client<Token, impl AuthFlow>, ) -> Result<Vec<Option<T>>>
Get the items of all the remaining pages - that is, all the pages found after the current one.
pub async fn get_all( self, spotify: &Client<Token, impl AuthFlow>, ) -> Result<Vec<Option<T>>>
Trait Implementations§
Source§impl<T: Clone + Clone, E: Clone + Endpoint + Default> Clone for CursorPage<T, E>
impl<T: Clone + Clone, E: Clone + Endpoint + Default> Clone for CursorPage<T, E>
Source§fn clone(&self) -> CursorPage<T, E>
fn clone(&self) -> CursorPage<T, E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, T, E> Deserialize<'de> for CursorPage<T, E>
impl<'de, T, E> Deserialize<'de> for CursorPage<T, E>
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>,
Source§impl<T: PartialEq + Clone, E: PartialEq + Endpoint + Default> PartialEq for CursorPage<T, E>
impl<T: PartialEq + Clone, E: PartialEq + Endpoint + Default> PartialEq for CursorPage<T, E>
Source§fn eq(&self, other: &CursorPage<T, E>) -> bool
fn eq(&self, other: &CursorPage<T, E>) -> bool
self and other values to be equal, and is used by ==.