pub struct Client { /* private fields */ }
Expand description
The application’s Spotify client
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(session: Session, auth_config: AuthConfig, client_id: String) -> Self
pub fn new(session: Session, auth_config: AuthConfig, client_id: String) -> Self
Construct a new client
Sourcepub async fn check_valid_session(&self) -> Result<()>
pub async fn check_valid_session(&self) -> Result<()>
Check if the current session is valid and if invalid, create a new session
Sourcepub async fn browse_categories(&self) -> Result<Vec<Category>>
pub async fn browse_categories(&self) -> Result<Vec<Category>>
Get Spotify’s available browse categories
Sourcepub async fn browse_category_playlists(
&self,
category_id: &str,
) -> Result<Vec<Playlist>>
pub async fn browse_category_playlists( &self, category_id: &str, ) -> Result<Vec<Playlist>>
Get Spotify’s available browse playlists of a given category
Sourcepub async fn current_user_saved_tracks(&self) -> Result<Vec<Track>>
pub async fn current_user_saved_tracks(&self) -> Result<Vec<Track>>
Get the saved (liked) tracks of the current user
Sourcepub async fn current_user_recently_played_tracks(&self) -> Result<Vec<Track>>
pub async fn current_user_recently_played_tracks(&self) -> Result<Vec<Track>>
Get the recently played tracks of the current user
Sourcepub async fn current_user_top_tracks(&self) -> Result<Vec<Track>>
pub async fn current_user_top_tracks(&self) -> Result<Vec<Track>>
Get the top tracks of the current user
Sourcepub async fn current_user_playlists(&self) -> Result<Vec<Playlist>>
pub async fn current_user_playlists(&self) -> Result<Vec<Playlist>>
Get all playlists of the current user
Sourcepub async fn current_user_followed_artists(&self) -> Result<Vec<Artist>>
pub async fn current_user_followed_artists(&self) -> Result<Vec<Artist>>
Get all followed artists of the current user
Sourcepub async fn current_user_saved_albums(&self) -> Result<Vec<Album>>
pub async fn current_user_saved_albums(&self) -> Result<Vec<Album>>
Get all saved albums of the current user
Sourcepub async fn artist_albums(&self, artist_id: ArtistId<'_>) -> Result<Vec<Album>>
pub async fn artist_albums(&self, artist_id: ArtistId<'_>) -> Result<Vec<Album>>
Get all albums of an artist
Sourcepub async fn radio_tracks(&self, seed_uri: String) -> Result<Vec<Track>>
pub async fn radio_tracks(&self, seed_uri: String) -> Result<Vec<Track>>
Get recommendation (radio) tracks based on a seed
Sourcepub async fn search(&self, query: &str) -> Result<SearchResults>
pub async fn search(&self, query: &str) -> Result<SearchResults>
Search for items (tracks, artists, albums, playlists) matching a given query
Sourcepub async fn search_specific_type(
&self,
query: &str,
_type: SearchType,
) -> Result<SearchResult>
pub async fn search_specific_type( &self, query: &str, _type: SearchType, ) -> Result<SearchResult>
Search for items of a specific type matching a given query
Sourcepub async fn add_track_to_playlist(
&self,
playlist_id: PlaylistId<'_>,
track_id: TrackId<'_>,
) -> Result<()>
pub async fn add_track_to_playlist( &self, playlist_id: PlaylistId<'_>, track_id: TrackId<'_>, ) -> Result<()>
Add a track to a playlist
pub async fn add_tracks_to_playlist(&self) -> Result<()>
Sourcepub async fn delete_track_from_playlist(
&self,
playlist_id: PlaylistId<'_>,
track_id: TrackId<'_>,
) -> Result<()>
pub async fn delete_track_from_playlist( &self, playlist_id: PlaylistId<'_>, track_id: TrackId<'_>, ) -> Result<()>
Remove a track from a playlist
Sourcepub async fn playlist_context(
&self,
playlist_id: PlaylistId<'_>,
) -> Result<Context>
pub async fn playlist_context( &self, playlist_id: PlaylistId<'_>, ) -> Result<Context>
Get a playlist context data
Sourcepub async fn album_context(&self, album_id: AlbumId<'_>) -> Result<Context>
pub async fn album_context(&self, album_id: AlbumId<'_>) -> Result<Context>
Get an album context data
Sourcepub async fn artist_context(&self, artist_id: ArtistId<'_>) -> Result<Context>
pub async fn artist_context(&self, artist_id: ArtistId<'_>) -> Result<Context>
Get an artist context data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more