Trait BaseClient

Source
pub trait BaseClient:
    Send
    + Sync
    + Default
    + Clone
    + Debug {
Show 49 methods // Required methods fn get_config(&self) -> &Config; fn get_http(&self) -> &ReqwestClient; fn get_creds(&self) -> &Credentials; fn get_token(&self) -> Arc<Mutex<Option<Token>>>; fn refetch_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<Token>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided methods fn api_url(&self, url: &str) -> String { ... } fn auth_url(&self, url: &str) -> String { ... } fn auto_reauth<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn refresh_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn write_token_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn fetch_access_token<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, payload: &'life1 HashMap<&'life2 str, &'life2 str>, headers: Option<&'life3 HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<Token, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + 'async_trait { ... } fn track<'life0, 'life1, 'async_trait>( &'life0 self, track_id: TrackId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullTrack, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn tracks<'a, 'life0, 'async_trait>( &'life0 self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullTrack>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn artist<'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<FullArtist, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn artists<'a, 'life0, 'async_trait>( &'life0 self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'async_trait + 'a, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullArtist>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn artist_albums<'a>( &'a self, artist_id: ArtistId<'a>, include_groups: impl IntoIterator<Item = AlbumType> + Send + Copy + 'a, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedAlbum, ClientError>> + Send + 'a>> { ... } fn artist_albums_manual<'a, 'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, include_groups: impl IntoIterator<Item = AlbumType> + Send + 'async_trait + 'a, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedAlbum>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn artist_top_tracks<'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullTrack>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn artist_related_artists<'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullArtist>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn album<'life0, 'life1, 'async_trait>( &'life0 self, album_id: AlbumId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullAlbum, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn albums<'a, 'life0, 'async_trait>( &'life0 self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullAlbum>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn search<'life0, 'life1, 'async_trait>( &'life0 self, q: &'life1 str, _type: SearchType, market: Option<Market>, include_external: Option<IncludeExternal>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn album_track<'a>( &'a self, album_id: AlbumId<'a>, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedTrack, ClientError>> + Send + 'a>> { ... } fn album_track_manual<'life0, 'life1, 'async_trait>( &'life0 self, album_id: AlbumId<'life1>, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedTrack>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn user<'life0, 'life1, 'async_trait>( &'life0 self, user_id: UserId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<PublicUser, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn playlist<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, playlist_id: PlaylistId<'life1>, fields: Option<&'life2 str>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullPlaylist, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait { ... } fn user_playlist<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: UserId<'life1>, playlist_id: Option<PlaylistId<'life2>>, fields: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<FullPlaylist, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + 'async_trait { ... } fn playlist_check_follow<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, playlist_id: PlaylistId<'life1>, user_ids: &'life2 [UserId<'life3>], ) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + 'async_trait { ... } fn get_a_show<'life0, 'life1, 'async_trait>( &'life0 self, id: ShowId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullShow, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn get_several_shows<'a, 'life0, 'async_trait>( &'life0 self, ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SimplifiedShow>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn get_shows_episodes<'a>( &'a self, id: ShowId<'a>, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedEpisode, ClientError>> + Send + 'a>> { ... } fn get_shows_episodes_manual<'life0, 'life1, 'async_trait>( &'life0 self, id: ShowId<'life1>, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedEpisode>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn get_an_episode<'life0, 'life1, 'async_trait>( &'life0 self, id: EpisodeId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullEpisode, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn get_several_episodes<'a, 'life0, 'async_trait>( &'life0 self, ids: impl IntoIterator<Item = EpisodeId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullEpisode>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn track_features<'life0, 'life1, 'async_trait>( &'life0 self, track_id: TrackId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<AudioFeatures, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn tracks_features<'a, 'life0, 'async_trait>( &'life0 self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'async_trait + 'a, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<AudioFeatures>>, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn track_analysis<'life0, 'life1, 'async_trait>( &'life0 self, track_id: TrackId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<AudioAnalysis, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn categories<'a>( &'a self, locale: Option<&'a str>, country: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<Category, ClientError>> + Send + 'a>> { ... } fn categories_manual<'life0, 'life1, 'async_trait>( &'life0 self, locale: Option<&'life1 str>, country: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<Category>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn category_playlists<'a>( &'a self, category_id: &'a str, country: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedPlaylist, ClientError>> + Send + 'a>> { ... } fn category_playlists_manual<'life0, 'life1, 'async_trait>( &'life0 self, category_id: &'life1 str, country: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedPlaylist>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn featured_playlists<'life0, 'life1, 'async_trait>( &'life0 self, locale: Option<&'life1 str>, country: Option<Market>, timestamp: Option<DateTime<Utc>>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<FeaturedPlaylists, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... } fn new_releases( &self, country: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedAlbum, ClientError>> + Send + '_>> { ... } fn new_releases_manual<'life0, 'async_trait>( &'life0 self, country: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedAlbum>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn recommendations<'a, 'life0, 'async_trait>( &'life0 self, attributes: impl IntoIterator<Item = RecommendationsAttribute> + Send + 'async_trait + 'a, seed_artists: Option<impl IntoIterator<Item = ArtistId<'a>> + Send + 'async_trait + 'a>, seed_genres: Option<impl IntoIterator<Item = &'a str> + Send + 'async_trait + 'a>, seed_tracks: Option<impl IntoIterator<Item = TrackId<'a>> + Send + 'async_trait + 'a>, market: Option<Market>, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Recommendations, ClientError>> + Send + 'async_trait>> where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn playlist_items<'a>( &'a self, playlist_id: PlaylistId<'a>, fields: Option<&'a str>, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<PlaylistItem, ClientError>> + Send + 'a>> { ... } fn playlist_items_manual<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, playlist_id: PlaylistId<'life1>, fields: Option<&'life2 str>, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<PlaylistItem>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait { ... } fn user_playlists<'a>( &'a self, user_id: UserId<'a>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedPlaylist, ClientError>> + Send + 'a>> { ... } fn user_playlists_manual<'life0, 'life1, 'async_trait>( &'life0 self, user_id: UserId<'life1>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedPlaylist>, ClientError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait { ... }
}
Expand description

This trait implements the basic endpoints from the Spotify API that may be accessed without user authorization, including parts of the authentication flow that are shared, and the endpoints.

Required Methods§

Source

fn get_config(&self) -> &Config

Source

fn get_http(&self) -> &ReqwestClient

Source

fn get_creds(&self) -> &Credentials

Source

fn get_token(&self) -> Arc<Mutex<Option<Token>>>

Note that the token is wrapped by a Mutex in order to allow interior mutability. This is required so that the entire client doesn’t have to be mutable (the token is accessed to from every endpoint).

Source

fn refetch_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<Token>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Refetch the current access token given a refresh token.

Provided Methods§

Source

fn api_url(&self, url: &str) -> String

Returns the absolute URL for an endpoint in the API.

Source

fn auth_url(&self, url: &str) -> String

Returns the absolute URL for an authentication step in the API.

Source

fn auto_reauth<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Re-authenticate the client automatically if it’s configured to do so, which uses the refresh token to obtain a new access token.

Source

fn refresh_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Refreshes the current access token given a refresh token. The obtained token will be saved internally.

Source

fn write_token_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Updates the cache file at the internal cache path.

This should be used whenever it’s possible to, even if the cached token isn’t configured, because this will already check Config::token_cached and do nothing in that case already.

Source

fn fetch_access_token<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, payload: &'life1 HashMap<&'life2 str, &'life2 str>, headers: Option<&'life3 HashMap<String, String>>, ) -> Pin<Box<dyn Future<Output = Result<Token, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + 'async_trait,

Sends a request to Spotify for an access token.

Source

fn track<'life0, 'life1, 'async_trait>( &'life0 self, track_id: TrackId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullTrack, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Returns a single track given the track’s ID, URI or URL.

Parameters:

  • track_id - a spotify URI, URL or ID

Reference

Source

fn tracks<'a, 'life0, 'async_trait>( &'life0 self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullTrack>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns a list of tracks given a list of track IDs, URIs, or URLs.

Parameters:

  • track_ids - a list of spotify URIs, URLs or IDs
  • market - an ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Source

fn artist<'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<FullArtist, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Returns a single artist given the artist’s ID, URI or URL.

Parameters:

  • artist_id - an artist ID, URI or URL

Reference

Source

fn artists<'a, 'life0, 'async_trait>( &'life0 self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'async_trait + 'a, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullArtist>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns a list of artists given the artist IDs, URIs, or URLs.

Parameters:

  • artist_ids - a list of artist IDs, URIs or URLs

Reference

Source

fn artist_albums<'a>( &'a self, artist_id: ArtistId<'a>, include_groups: impl IntoIterator<Item = AlbumType> + Send + Copy + 'a, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedAlbum, ClientError>> + Send + 'a>>

Get Spotify catalog information about an artist’s albums.

Parameters:

  • artist_id - the artist ID, URI or URL
  • include_groups - a list of album type like ‘album’, ‘single’ that will be used to filter response. if not supplied, all album types will be returned.
  • market - limit the response to one particular country.
  • limit - the number of albums to return
  • offset - the index of the first album to return

See Self::artist_albums_manual for a manually paginated version of this.

Reference

Source

fn artist_albums_manual<'a, 'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, include_groups: impl IntoIterator<Item = AlbumType> + Send + 'async_trait + 'a, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedAlbum>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::artist_albums.

Source

fn artist_top_tracks<'life0, 'life1, 'async_trait>( &'life0 self, artist_id: ArtistId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullTrack>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Get Spotify catalog information about an artist’s top 10 tracks by country.

Parameters:

  • artist_id - the artist ID, URI or URL
  • market - limit the response to one particular country.

Reference

Get Spotify catalog information about artists similar to an identified artist. Similarity is based on analysis of the Spotify community’s listening history.

Parameters:

  • artist_id - the artist ID, URI or URL

Reference

Source

fn album<'life0, 'life1, 'async_trait>( &'life0 self, album_id: AlbumId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullAlbum, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Returns a single album given the album’s ID, URIs or URL.

Parameters:

  • album_id - the album ID, URI or URL

Reference

Source

fn albums<'a, 'life0, 'async_trait>( &'life0 self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullAlbum>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns a list of albums given the album IDs, URIs, or URLs.

Parameters:

  • albums_ids - a list of album IDs, URIs or URLs

Reference

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, q: &'life1 str, _type: SearchType, market: Option<Market>, include_external: Option<IncludeExternal>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Search for an Item. Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.

Parameters:

  • q - the search query
  • limit - the number of items to return
  • offset - the index of the first item to return
  • type - the type of item to return. One of ‘artist’, ‘album’, ‘track’, ‘playlist’, ‘show’ or ‘episode’
  • market - An ISO 3166-1 alpha-2 country code or the string from_token.
  • include_external: Optional.Possible values: audio. If include_external=audio is specified the response will include any relevant audio content that is hosted externally.

Reference

Source

fn album_track<'a>( &'a self, album_id: AlbumId<'a>, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedTrack, ClientError>> + Send + 'a>>

Get Spotify catalog information about an album’s tracks.

Parameters:

  • album_id - the album ID, URI or URL
  • limit - the number of items to return
  • offset - the index of the first item to return

See Self::album_track_manual for a manually paginated version of this.

Reference

Source

fn album_track_manual<'life0, 'life1, 'async_trait>( &'life0 self, album_id: AlbumId<'life1>, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedTrack>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::album_track.

Source

fn user<'life0, 'life1, 'async_trait>( &'life0 self, user_id: UserId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<PublicUser, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Gets basic profile information about a Spotify User.

Parameters:

  • user - the id of the usr

Reference

Source

fn playlist<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, playlist_id: PlaylistId<'life1>, fields: Option<&'life2 str>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullPlaylist, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait,

Get full details about Spotify playlist.

Parameters:

  • playlist_id - the id of the playlist
  • market - an ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Source

fn user_playlist<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: UserId<'life1>, playlist_id: Option<PlaylistId<'life2>>, fields: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<FullPlaylist, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + 'async_trait,

Gets playlist of a user.

Parameters:

  • user_id - the id of the user
  • playlist_id - the id of the playlist
  • fields - which fields to return

Reference

Source

fn playlist_check_follow<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, playlist_id: PlaylistId<'life1>, user_ids: &'life2 [UserId<'life3>], ) -> Pin<Box<dyn Future<Output = Result<Vec<bool>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Sync + 'async_trait,

Check to see if the given users are following the given playlist.

Parameters:

  • playlist_id - the id of the playlist
  • user_ids - the ids of the users that you want to check to see if they follow the playlist. Maximum: 5 ids.

Reference

Source

fn get_a_show<'life0, 'life1, 'async_trait>( &'life0 self, id: ShowId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullShow, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Get Spotify catalog information for a single show identified by its unique Spotify ID.

Path Parameters:

  • id: The Spotify ID for the show.

Query Parameters

  • market(Optional): An ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Source

fn get_several_shows<'a, 'life0, 'async_trait>( &'life0 self, ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SimplifiedShow>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Get Spotify catalog information for multiple shows based on their Spotify IDs.

Query Parameters

  • ids(Required) A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.
  • market(Optional) An ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Source

fn get_shows_episodes<'a>( &'a self, id: ShowId<'a>, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedEpisode, ClientError>> + Send + 'a>>

Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned.

Path Parameters

  • id: The Spotify ID for the show.

Query Parameters

  • limit: Optional. The maximum number of episodes to return. Default: 20. Minimum: 1. Maximum: 50.
  • offset: Optional. The index of the first episode to return. Default: 0 (the first object). Use with limit to get the next set of episodes.
  • market: Optional. An ISO 3166-1 alpha-2 country code or the string from_token.

See Self::get_shows_episodes_manual for a manually paginated version of this.

Reference

Source

fn get_shows_episodes_manual<'life0, 'life1, 'async_trait>( &'life0 self, id: ShowId<'life1>, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedEpisode>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::get_shows_episodes.

Source

fn get_an_episode<'life0, 'life1, 'async_trait>( &'life0 self, id: EpisodeId<'life1>, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<FullEpisode, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Get Spotify catalog information for a single episode identified by its unique Spotify ID.

Path Parameters

  • id: The Spotify ID for the episode.

Query Parameters

  • market: Optional. An ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Source

fn get_several_episodes<'a, 'life0, 'async_trait>( &'life0 self, ids: impl IntoIterator<Item = EpisodeId<'a>> + Send + 'async_trait + 'a, market: Option<Market>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FullEpisode>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Get Spotify catalog information for multiple episodes based on their Spotify IDs.

Query Parameters

  • ids: Required. A comma-separated list of the Spotify IDs for the episodes. Maximum: 50 IDs.
  • market: Optional. An ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Source

fn track_features<'life0, 'life1, 'async_trait>( &'life0 self, track_id: TrackId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<AudioFeatures, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Get audio features for a track

Parameters:

  • track - track URI, URL or ID

Reference

Source

fn tracks_features<'a, 'life0, 'async_trait>( &'life0 self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'async_trait + 'a, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<AudioFeatures>>, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Get Audio Features for Several Tracks

Parameters:

  • tracks a list of track URIs, URLs or IDs

Reference

Source

fn track_analysis<'life0, 'life1, 'async_trait>( &'life0 self, track_id: TrackId<'life1>, ) -> Pin<Box<dyn Future<Output = Result<AudioAnalysis, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Get Audio Analysis for a Track

Parameters:

  • track_id - a track URI, URL or ID

Reference

Source

fn categories<'a>( &'a self, locale: Option<&'a str>, country: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<Category, ClientError>> + Send + 'a>>

Get a list of new album releases featured in Spotify

Parameters:

  • country - An ISO 3166-1 alpha-2 country code or string from_token.
  • locale - The desired language, consisting of an ISO 639 language code and an ISO 3166-1 alpha-2 country code, joined by an underscore.
  • limit - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50
  • offset - The index of the first item to return. Default: 0 (the first object). Use with limit to get the next set of items.

See Self::categories_manual for a manually paginated version of this.

Reference

Source

fn categories_manual<'life0, 'life1, 'async_trait>( &'life0 self, locale: Option<&'life1 str>, country: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<Category>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::categories.

Source

fn category_playlists<'a>( &'a self, category_id: &'a str, country: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedPlaylist, ClientError>> + Send + 'a>>

Get a list of playlists in a category in Spotify

Parameters:

  • category_id - The category id to get playlists from.
  • country - An ISO 3166-1 alpha-2 country code or the string from_token.
  • limit - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50
  • offset - The index of the first item to return. Default: 0 (the first object). Use with limit to get the next set of items.

See Self::category_playlists_manual for a manually paginated version of this.

Reference

Source

fn category_playlists_manual<'life0, 'life1, 'async_trait>( &'life0 self, category_id: &'life1 str, country: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedPlaylist>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::category_playlists.

Source

fn featured_playlists<'life0, 'life1, 'async_trait>( &'life0 self, locale: Option<&'life1 str>, country: Option<Market>, timestamp: Option<DateTime<Utc>>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<FeaturedPlaylists, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Get a list of Spotify featured playlists.

Parameters:

  • locale - The desired language, consisting of a lowercase ISO 639 language code and an uppercase ISO 3166-1 alpha-2 country code, joined by an underscore.
  • country - An ISO 3166-1 alpha-2 country code or the string from_token.
  • timestamp - A timestamp in ISO 8601 format: yyyy-MM-ddTHH:mm:ss. Use this parameter to specify the user’s local time to get results tailored for that specific date and time in the day
  • limit - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50
  • offset - The index of the first item to return. Default: 0 (the first object). Use with limit to get the next set of items.

Reference

Source

fn new_releases( &self, country: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedAlbum, ClientError>> + Send + '_>>

Get a list of new album releases featured in Spotify.

Parameters:

  • country - An ISO 3166-1 alpha-2 country code or string from_token.
  • limit - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50
  • offset - The index of the first item to return. Default: 0 (the first object). Use with limit to get the next set of items.

See Self::new_releases_manual for a manually paginated version of this.

Reference

Source

fn new_releases_manual<'life0, 'async_trait>( &'life0 self, country: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedAlbum>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::new_releases.

Source

fn recommendations<'a, 'life0, 'async_trait>( &'life0 self, attributes: impl IntoIterator<Item = RecommendationsAttribute> + Send + 'async_trait + 'a, seed_artists: Option<impl IntoIterator<Item = ArtistId<'a>> + Send + 'async_trait + 'a>, seed_genres: Option<impl IntoIterator<Item = &'a str> + Send + 'async_trait + 'a>, seed_tracks: Option<impl IntoIterator<Item = TrackId<'a>> + Send + 'async_trait + 'a>, market: Option<Market>, limit: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Recommendations, ClientError>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Self: Sync + 'async_trait,

Get Recommendations Based on Seeds

Parameters:

  • attributes - restrictions on attributes for the selected tracks, such as min_acousticness or target_duration_ms.
  • seed_artists - a list of artist IDs, URIs or URLs
  • seed_tracks - a list of artist IDs, URIs or URLs
  • seed_genres - a list of genre names. Available genres for
  • market - An ISO 3166-1 alpha-2 country code or the string from_token. If provided, all results will be playable in this country.
  • limit - The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 100
  • min/max/target_<attribute> - For the tuneable track attributes listed in the documentation, these values provide filters and targeting on results.

Reference

Source

fn playlist_items<'a>( &'a self, playlist_id: PlaylistId<'a>, fields: Option<&'a str>, market: Option<Market>, ) -> Pin<Box<dyn Stream<Item = Result<PlaylistItem, ClientError>> + Send + 'a>>

Get full details of the items of a playlist owned by a user.

Parameters:

  • playlist_id - the id of the playlist
  • fields - which fields to return
  • limit - the maximum number of tracks to return
  • offset - the index of the first track to return
  • market - an ISO 3166-1 alpha-2 country code or the string from_token.

See Self::playlist_items_manual for a manually paginated version of this.

Reference

Source

fn playlist_items_manual<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, playlist_id: PlaylistId<'life1>, fields: Option<&'life2 str>, market: Option<Market>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<PlaylistItem>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::playlist_items.

Source

fn user_playlists<'a>( &'a self, user_id: UserId<'a>, ) -> Pin<Box<dyn Stream<Item = Result<SimplifiedPlaylist, ClientError>> + Send + 'a>>

Gets playlists of a user.

Parameters:

  • user_id - the id of the usr
  • limit - the number of items to return
  • offset - the index of the first item to return

See Self::user_playlists_manual for a manually paginated version of this.

Reference

Source

fn user_playlists_manual<'life0, 'life1, 'async_trait>( &'life0 self, user_id: UserId<'life1>, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Page<SimplifiedPlaylist>, ClientError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

The manually paginated version of Self::user_playlists.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl BaseClient for AuthCodeSpotify

This client has access to the base methods.

Source§

impl BaseClient for AuthCodePkceSpotify

This client has access to the base methods.

Source§

impl BaseClient for ClientCredsSpotify

This client has access to the base methods.