Struct rspotify::auth_code::AuthCodeSpotify
source · [−]pub struct AuthCodeSpotify {
pub creds: Credentials,
pub oauth: OAuth,
pub config: Config,
pub token: Arc<Mutex<Option<Token>>>,
/* private fields */
}
Expand description
The Authorization Code Flow client for the Spotify API.
This includes user authorization, and thus has access to endpoints related
to user private data, unlike the Client Credentials
Flow client. See BaseClient
and
OAuthClient
for the available endpoints.
If you’re developing a CLI application, you might be interested in the cli
feature. This brings the Self::prompt_for_token
utility to automatically
follow the flow steps via user interaction.
Otherwise, these are the steps to be followed to authenticate your app:
-
Generate a request URL with
Self::get_authorize_url
. -
The user logs in with the request URL. They will be redirected to the given redirect URI, including a code in the URL parameters. This happens on your side.
-
The code obtained in the previous step is parsed with
Self::parse_response_code
. -
The code is sent to Spotify in order to obtain an access token with
Self::request_token
. -
Finally, this access token can be used internally for the requests. It may expire relatively soon, so it can be refreshed with the refresh token (obtained in the previous step as well) using
Self::refresh_token
. Otherwise, a new access token may be generated from scratch by repeating these steps, but the advantage of refreshing it is that this doesn’t require the user to log in, and that it’s a simpler procedure.See this related example to learn more about refreshing tokens.
There’s a webapp example for more details on how you can implement it for something like a web server, or this one for a CLI use case.
An example of the CLI authentication:
Note: even if your script does not have an accessible URL, you will have to
specify a redirect URI. It doesn’t need to work, you can use
http://localhost:8888/callback
for example, which will also have the code
appended like so: http://localhost/?code=...
.
Fields
creds: Credentials
oauth: OAuth
config: Config
token: Arc<Mutex<Option<Token>>>
Implementations
sourceimpl AuthCodeSpotify
impl AuthCodeSpotify
sourcepub fn new(creds: Credentials, oauth: OAuth) -> Self
pub fn new(creds: Credentials, oauth: OAuth) -> Self
Builds a new AuthCodeSpotify
given a pair of client credentials and
OAuth information.
sourcepub fn from_token(token: Token) -> Self
pub fn from_token(token: Token) -> Self
Build a new AuthCodeSpotify
from an already generated token. Note
that once the token expires this will fail to make requests, as the
client credentials aren’t known.
sourcepub fn with_config(creds: Credentials, oauth: OAuth, config: Config) -> Self
pub fn with_config(creds: Credentials, oauth: OAuth, config: Config) -> Self
Same as Self::new
but with an extra parameter to configure the
client.
Returns the URL needed to authorize the current client as the first step in the authorization flow.
Trait Implementations
sourceimpl BaseClient for AuthCodeSpotify
impl BaseClient for AuthCodeSpotify
This client has access to the base methods.
sourcefn refetch_token(&self) -> ClientResult<Option<Token>>
fn refetch_token(&self) -> ClientResult<Option<Token>>
Refetch the current access token given a refresh token. May return
None
if there’s no access/refresh token.
fn get_http(&self) -> &HttpClient
sourcefn get_token(&self) -> Arc<Mutex<Option<Token>>>
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). Read more
fn get_creds(&self) -> &Credentials
fn get_config(&self) -> &Config
sourcefn endpoint_url(&self, url: &str) -> String
fn endpoint_url(&self, url: &str) -> String
If it’s a relative URL like “me”, the prefix is appended to it. Otherwise, the same URL is returned. Read more
sourcefn auto_reauth(&self) -> ClientResult<()>
fn auto_reauth(&self) -> ClientResult<()>
Re-authenticate the client automatically if it’s configured to do so, which uses the refresh token to obtain a new access token. Read more
sourcefn refresh_token(&self) -> ClientResult<()>
fn refresh_token(&self) -> ClientResult<()>
Refreshes the current access token given a refresh token. The obtained token will be saved internally. Read more
sourcefn write_token_cache(&self) -> ClientResult<()>
fn write_token_cache(&self) -> ClientResult<()>
Updates the cache file at the internal cache path. Read more
sourcefn fetch_access_token(
&self,
payload: &Form<'_>,
headers: Option<&Headers>
) -> ClientResult<Token>
fn fetch_access_token(
&self,
payload: &Form<'_>,
headers: Option<&Headers>
) -> ClientResult<Token>
Sends a request to Spotify for an access token.
sourcefn track(&self, track_id: &TrackId) -> ClientResult<FullTrack>
fn track(&self, track_id: &TrackId) -> ClientResult<FullTrack>
Returns a single track given the track’s ID, URI or URL. Read more
sourcefn tracks<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a,
market: Option<&Market>
) -> ClientResult<Vec<FullTrack>>
fn tracks<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a,
market: Option<&Market>
) -> ClientResult<Vec<FullTrack>>
Returns a list of tracks given a list of track IDs, URIs, or URLs. Read more
sourcefn artist(&self, artist_id: &ArtistId) -> ClientResult<FullArtist>
fn artist(&self, artist_id: &ArtistId) -> ClientResult<FullArtist>
Returns a single artist given the artist’s ID, URI or URL. Read more
sourcefn artists<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<Vec<FullArtist>>
fn artists<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<Vec<FullArtist>>
Returns a list of artists given the artist IDs, URIs, or URLs. Read more
sourcefn artist_albums<'a>(
&'a self,
artist_id: &'a ArtistId,
album_type: Option<&'a AlbumType>,
market: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedAlbum>>
fn artist_albums<'a>(
&'a self,
artist_id: &'a ArtistId,
album_type: Option<&'a AlbumType>,
market: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedAlbum>>
Get Spotify catalog information about an artist’s albums. Read more
sourcefn artist_albums_manual(
&self,
artist_id: &ArtistId,
album_type: Option<&AlbumType>,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedAlbum>>
fn artist_albums_manual(
&self,
artist_id: &ArtistId,
album_type: Option<&AlbumType>,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedAlbum>>
The manually paginated version of Self::artist_albums
.
sourcefn artist_top_tracks(
&self,
artist_id: &ArtistId,
market: &Market
) -> ClientResult<Vec<FullTrack>>
fn artist_top_tracks(
&self,
artist_id: &ArtistId,
market: &Market
) -> ClientResult<Vec<FullTrack>>
Get Spotify catalog information about an artist’s top 10 tracks by country. Read more
Get Spotify catalog information about artists similar to an identified artist. Similarity is based on analysis of the Spotify community’s listening history. Read more
sourcefn album(&self, album_id: &AlbumId) -> ClientResult<FullAlbum>
fn album(&self, album_id: &AlbumId) -> ClientResult<FullAlbum>
Returns a single album given the album’s ID, URIs or URL. Read more
sourcefn albums<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<Vec<FullAlbum>>
fn albums<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<Vec<FullAlbum>>
Returns a list of albums given the album IDs, URIs, or URLs. Read more
sourcefn search(
&self,
q: &str,
_type: &SearchType,
market: Option<&Market>,
include_external: Option<&IncludeExternal>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<SearchResult>
fn search(
&self,
q: &str,
_type: &SearchType,
market: Option<&Market>,
include_external: Option<&IncludeExternal>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<SearchResult>
Search for an Item. Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string. Read more
sourcefn album_track<'a>(
&'a self,
album_id: &'a AlbumId
) -> Paginator<'_, ClientResult<SimplifiedTrack>>
fn album_track<'a>(
&'a self,
album_id: &'a AlbumId
) -> Paginator<'_, ClientResult<SimplifiedTrack>>
Get Spotify catalog information about an album’s tracks. Read more
sourcefn album_track_manual(
&self,
album_id: &AlbumId,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedTrack>>
fn album_track_manual(
&self,
album_id: &AlbumId,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedTrack>>
The manually paginated version of Self::album_track
.
sourcefn user(&self, user_id: &UserId) -> ClientResult<PublicUser>
fn user(&self, user_id: &UserId) -> ClientResult<PublicUser>
Gets basic profile information about a Spotify User. Read more
sourcefn playlist(
&self,
playlist_id: &PlaylistId,
fields: Option<&str>,
market: Option<&Market>
) -> ClientResult<FullPlaylist>
fn playlist(
&self,
playlist_id: &PlaylistId,
fields: Option<&str>,
market: Option<&Market>
) -> ClientResult<FullPlaylist>
Get full details about Spotify playlist. Read more
sourcefn user_playlist(
&self,
user_id: &UserId,
playlist_id: Option<&PlaylistId>,
fields: Option<&str>
) -> ClientResult<FullPlaylist>
fn user_playlist(
&self,
user_id: &UserId,
playlist_id: Option<&PlaylistId>,
fields: Option<&str>
) -> ClientResult<FullPlaylist>
Gets playlist of a user. Read more
sourcefn playlist_check_follow(
&self,
playlist_id: &PlaylistId,
user_ids: &[&UserId]
) -> ClientResult<Vec<bool>>
fn playlist_check_follow(
&self,
playlist_id: &PlaylistId,
user_ids: &[&UserId]
) -> ClientResult<Vec<bool>>
Check to see if the given users are following the given playlist. Read more
sourcefn get_a_show(
&self,
id: &ShowId,
market: Option<&Market>
) -> ClientResult<FullShow>
fn get_a_show(
&self,
id: &ShowId,
market: Option<&Market>
) -> ClientResult<FullShow>
Get Spotify catalog information for a single show identified by its unique Spotify ID. Read more
sourcefn get_several_shows<'a>(
&self,
ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a,
market: Option<&Market>
) -> ClientResult<Vec<SimplifiedShow>>
fn get_several_shows<'a>(
&self,
ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a,
market: Option<&Market>
) -> ClientResult<Vec<SimplifiedShow>>
Get Spotify catalog information for multiple shows based on their Spotify IDs. Read more
sourcefn get_shows_episodes<'a>(
&'a self,
id: &'a ShowId,
market: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedEpisode>>
fn get_shows_episodes<'a>(
&'a self,
id: &'a ShowId,
market: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedEpisode>>
Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned. Read more
sourcefn get_shows_episodes_manual(
&self,
id: &ShowId,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedEpisode>>
fn get_shows_episodes_manual(
&self,
id: &ShowId,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedEpisode>>
The manually paginated version of Self::get_shows_episodes
.
sourcefn get_an_episode(
&self,
id: &EpisodeId,
market: Option<&Market>
) -> ClientResult<FullEpisode>
fn get_an_episode(
&self,
id: &EpisodeId,
market: Option<&Market>
) -> ClientResult<FullEpisode>
Get Spotify catalog information for a single episode identified by its unique Spotify ID. Read more
sourcefn get_several_episodes<'a>(
&self,
ids: impl IntoIterator<Item = &'a EpisodeId> + Send + 'a,
market: Option<&Market>
) -> ClientResult<Vec<FullEpisode>>
fn get_several_episodes<'a>(
&self,
ids: impl IntoIterator<Item = &'a EpisodeId> + Send + 'a,
market: Option<&Market>
) -> ClientResult<Vec<FullEpisode>>
Get Spotify catalog information for multiple episodes based on their Spotify IDs. Read more
sourcefn track_features(&self, track_id: &TrackId) -> ClientResult<AudioFeatures>
fn track_features(&self, track_id: &TrackId) -> ClientResult<AudioFeatures>
Get audio features for a track Read more
sourcefn tracks_features<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<Option<Vec<AudioFeatures>>>
fn tracks_features<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<Option<Vec<AudioFeatures>>>
Get Audio Features for Several Tracks Read more
sourcefn track_analysis(&self, track_id: &TrackId) -> ClientResult<AudioAnalysis>
fn track_analysis(&self, track_id: &TrackId) -> ClientResult<AudioAnalysis>
Get Audio Analysis for a Track Read more
sourcefn categories<'a>(
&'a self,
locale: Option<&'a str>,
country: Option<&'a Market>
) -> Paginator<'_, ClientResult<Category>>
fn categories<'a>(
&'a self,
locale: Option<&'a str>,
country: Option<&'a Market>
) -> Paginator<'_, ClientResult<Category>>
Get a list of new album releases featured in Spotify Read more
sourcefn categories_manual(
&self,
locale: Option<&str>,
country: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<Category>>
fn categories_manual(
&self,
locale: Option<&str>,
country: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<Category>>
The manually paginated version of Self::categories
.
sourcefn category_playlists<'a>(
&'a self,
category_id: &'a str,
country: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>
fn category_playlists<'a>(
&'a self,
category_id: &'a str,
country: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>
Get a list of playlists in a category in Spotify Read more
sourcefn category_playlists_manual(
&self,
category_id: &str,
country: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedPlaylist>>
fn category_playlists_manual(
&self,
category_id: &str,
country: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedPlaylist>>
The manually paginated version of Self::category_playlists
.
sourcefn featured_playlists(
&self,
locale: Option<&str>,
country: Option<&Market>,
timestamp: Option<&DateTime<Utc>>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<FeaturedPlaylists>
fn featured_playlists(
&self,
locale: Option<&str>,
country: Option<&Market>,
timestamp: Option<&DateTime<Utc>>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<FeaturedPlaylists>
Get a list of Spotify featured playlists. Read more
sourcefn new_releases<'a>(
&'a self,
country: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedAlbum>>
fn new_releases<'a>(
&'a self,
country: Option<&'a Market>
) -> Paginator<'_, ClientResult<SimplifiedAlbum>>
Get a list of new album releases featured in Spotify. Read more
sourcefn new_releases_manual(
&self,
country: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedAlbum>>
fn new_releases_manual(
&self,
country: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedAlbum>>
The manually paginated version of Self::new_releases
.
sourcefn recommendations<'a>(
&self,
attributes: impl IntoIterator<Item = RecommendationsAttribute> + Send + 'a,
seed_artists: Option<impl IntoIterator<Item = &'a ArtistId> + Send + 'a>,
seed_genres: Option<impl IntoIterator<Item = &'a str> + Send + 'a>,
seed_tracks: Option<impl IntoIterator<Item = &'a TrackId> + Send + 'a>,
market: Option<&Market>,
limit: Option<u32>
) -> ClientResult<Recommendations>
fn recommendations<'a>(
&self,
attributes: impl IntoIterator<Item = RecommendationsAttribute> + Send + 'a,
seed_artists: Option<impl IntoIterator<Item = &'a ArtistId> + Send + 'a>,
seed_genres: Option<impl IntoIterator<Item = &'a str> + Send + 'a>,
seed_tracks: Option<impl IntoIterator<Item = &'a TrackId> + Send + 'a>,
market: Option<&Market>,
limit: Option<u32>
) -> ClientResult<Recommendations>
Get Recommendations Based on Seeds Read more
sourcefn playlist_items<'a>(
&'a self,
playlist_id: &'a PlaylistId,
fields: Option<&'a str>,
market: Option<&'a Market>
) -> Paginator<'_, ClientResult<PlaylistItem>>
fn playlist_items<'a>(
&'a self,
playlist_id: &'a PlaylistId,
fields: Option<&'a str>,
market: Option<&'a Market>
) -> Paginator<'_, ClientResult<PlaylistItem>>
Get full details of the items of a playlist owned by a user. Read more
sourcefn playlist_items_manual(
&self,
playlist_id: &PlaylistId,
fields: Option<&str>,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<PlaylistItem>>
fn playlist_items_manual(
&self,
playlist_id: &PlaylistId,
fields: Option<&str>,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<PlaylistItem>>
The manually paginated version of Self::playlist_items
.
sourcefn user_playlists<'a>(
&'a self,
user_id: &'a UserId
) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>
fn user_playlists<'a>(
&'a self,
user_id: &'a UserId
) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>
Gets playlists of a user. Read more
sourcefn user_playlists_manual(
&self,
user_id: &UserId,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedPlaylist>>
fn user_playlists_manual(
&self,
user_id: &UserId,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedPlaylist>>
The manually paginated version of Self::user_playlists
.
sourceimpl Clone for AuthCodeSpotify
impl Clone for AuthCodeSpotify
sourcefn clone(&self) -> AuthCodeSpotify
fn clone(&self) -> AuthCodeSpotify
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AuthCodeSpotify
impl Debug for AuthCodeSpotify
sourceimpl Default for AuthCodeSpotify
impl Default for AuthCodeSpotify
sourcefn default() -> AuthCodeSpotify
fn default() -> AuthCodeSpotify
Returns the “default value” for a type. Read more
sourceimpl OAuthClient for AuthCodeSpotify
impl OAuthClient for AuthCodeSpotify
This client includes user authorization, so it has access to the user
private endpoints in OAuthClient
.
sourcefn request_token(&mut self, code: &str) -> ClientResult<()>
fn request_token(&mut self, code: &str) -> ClientResult<()>
Obtains a user access token given a code, as part of the OAuth authentication. The access token will be saved internally.
fn get_oauth(&self) -> &OAuth
sourcefn read_token_cache(
&mut self,
allow_expired: bool
) -> ClientResult<Option<Token>>
fn read_token_cache(
&mut self,
allow_expired: bool
) -> ClientResult<Option<Token>>
Tries to read the cache file’s token. Read more
sourcefn parse_response_code(&self, url: &str) -> Option<String>
fn parse_response_code(&self, url: &str) -> Option<String>
Parse the response code in the given response url. If the URL cannot be
parsed or the code
parameter is not present, this will return None
. Read more
sourcefn get_code_from_user(&self, url: &str) -> ClientResult<String>
fn get_code_from_user(&self, url: &str) -> ClientResult<String>
Tries to open the authorization URL in the user’s browser, and returns the obtained code. Read more
sourcefn prompt_for_token(&mut self, url: &str) -> ClientResult<()>
fn prompt_for_token(&mut self, url: &str) -> ClientResult<()>
Opens up the authorization URL in the user’s browser so that it can authenticate. It reads from the standard input the redirect URI in order to obtain the access token information. The resulting access token will be saved internally once the operation is successful. Read more
sourcefn current_user_playlists(
&self
) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>
fn current_user_playlists(
&self
) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>
Get current user playlists without required getting his profile. Read more
sourcefn current_user_playlists_manual(
&self,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedPlaylist>>
fn current_user_playlists_manual(
&self,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SimplifiedPlaylist>>
The manually paginated version of Self::current_user_playlists
.
sourcefn user_playlist_create(
&self,
user_id: &UserId,
name: &str,
public: Option<bool>,
collaborative: Option<bool>,
description: Option<&str>
) -> ClientResult<FullPlaylist>
fn user_playlist_create(
&self,
user_id: &UserId,
name: &str,
public: Option<bool>,
collaborative: Option<bool>,
description: Option<&str>
) -> ClientResult<FullPlaylist>
Creates a playlist for a user. Read more
sourcefn playlist_change_detail(
&self,
playlist_id: &PlaylistId,
name: Option<&str>,
public: Option<bool>,
description: Option<&str>,
collaborative: Option<bool>
) -> ClientResult<String>
fn playlist_change_detail(
&self,
playlist_id: &PlaylistId,
name: Option<&str>,
public: Option<bool>,
description: Option<&str>,
collaborative: Option<bool>
) -> ClientResult<String>
Changes a playlist’s name and/or public/private state. Read more
sourcefn playlist_unfollow(&self, playlist_id: &PlaylistId) -> ClientResult<()>
fn playlist_unfollow(&self, playlist_id: &PlaylistId) -> ClientResult<()>
Unfollows (deletes) a playlist for a user. Read more
sourcefn playlist_add_items<'a>(
&self,
playlist_id: &PlaylistId,
items: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a,
position: Option<i32>
) -> ClientResult<PlaylistResult>
fn playlist_add_items<'a>(
&self,
playlist_id: &PlaylistId,
items: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a,
position: Option<i32>
) -> ClientResult<PlaylistResult>
Adds items to a playlist. Read more
sourcefn playlist_replace_items<'a>(
&self,
playlist_id: &PlaylistId,
items: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a
) -> ClientResult<()>
fn playlist_replace_items<'a>(
&self,
playlist_id: &PlaylistId,
items: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a
) -> ClientResult<()>
Replace all items in a playlist Read more
sourcefn playlist_reorder_items(
&self,
playlist_id: &PlaylistId,
range_start: Option<i32>,
insert_before: Option<i32>,
range_length: Option<u32>,
snapshot_id: Option<&str>
) -> ClientResult<PlaylistResult>
fn playlist_reorder_items(
&self,
playlist_id: &PlaylistId,
range_start: Option<i32>,
insert_before: Option<i32>,
range_length: Option<u32>,
snapshot_id: Option<&str>
) -> ClientResult<PlaylistResult>
Reorder items in a playlist. Read more
sourcefn playlist_remove_all_occurrences_of_items<'a>(
&self,
playlist_id: &PlaylistId,
track_ids: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a,
snapshot_id: Option<&str>
) -> ClientResult<PlaylistResult>
fn playlist_remove_all_occurrences_of_items<'a>(
&self,
playlist_id: &PlaylistId,
track_ids: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a,
snapshot_id: Option<&str>
) -> ClientResult<PlaylistResult>
Removes all occurrences of the given items from the given playlist. Read more
sourcefn playlist_remove_specific_occurrences_of_items<'a>(
&self,
playlist_id: &PlaylistId,
items: impl IntoIterator<Item = ItemPositions<'a>> + Send + 'a,
snapshot_id: Option<&str>
) -> ClientResult<PlaylistResult>
fn playlist_remove_specific_occurrences_of_items<'a>(
&self,
playlist_id: &PlaylistId,
items: impl IntoIterator<Item = ItemPositions<'a>> + Send + 'a,
snapshot_id: Option<&str>
) -> ClientResult<PlaylistResult>
Removes specfic occurrences of the given items from the given playlist. Read more
sourcefn playlist_follow(
&self,
playlist_id: &PlaylistId,
public: Option<bool>
) -> ClientResult<()>
fn playlist_follow(
&self,
playlist_id: &PlaylistId,
public: Option<bool>
) -> ClientResult<()>
Add the current authenticated user as a follower of a playlist. Read more
sourcefn me(&self) -> ClientResult<PrivateUser>
fn me(&self) -> ClientResult<PrivateUser>
Get detailed profile information about the current user. An alias for the ‘current_user’ method. Read more
sourcefn current_user(&self) -> ClientResult<PrivateUser>
fn current_user(&self) -> ClientResult<PrivateUser>
Get detailed profile information about the current user. An alias for the ‘me’ method. Read more
sourcefn current_user_playing_item(
&self
) -> ClientResult<Option<CurrentlyPlayingContext>>
fn current_user_playing_item(
&self
) -> ClientResult<Option<CurrentlyPlayingContext>>
Get information about the current users currently playing item. Read more
sourcefn current_user_saved_albums<'a>(
&'a self,
market: Option<&'a Market>
) -> Paginator<'a, ClientResult<SavedAlbum>>
fn current_user_saved_albums<'a>(
&'a self,
market: Option<&'a Market>
) -> Paginator<'a, ClientResult<SavedAlbum>>
Gets a list of the albums saved in the current authorized user’s “Your Music” library Read more
sourcefn current_user_saved_albums_manual(
&self,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SavedAlbum>>
fn current_user_saved_albums_manual(
&self,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SavedAlbum>>
The manually paginated version of Self::current_user_saved_albums
.
sourcefn current_user_saved_tracks<'a>(
&'a self,
market: Option<&'a Market>
) -> Paginator<'a, ClientResult<SavedTrack>>
fn current_user_saved_tracks<'a>(
&'a self,
market: Option<&'a Market>
) -> Paginator<'a, ClientResult<SavedTrack>>
Get a list of the songs saved in the current Spotify user’s “Your Music” library. Read more
sourcefn current_user_saved_tracks_manual(
&self,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SavedTrack>>
fn current_user_saved_tracks_manual(
&self,
market: Option<&Market>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<SavedTrack>>
The manually paginated version of Self::current_user_saved_tracks
.
sourcefn current_user_followed_artists(
&self,
after: Option<&str>,
limit: Option<u32>
) -> ClientResult<CursorBasedPage<FullArtist>>
fn current_user_followed_artists(
&self,
after: Option<&str>,
limit: Option<u32>
) -> ClientResult<CursorBasedPage<FullArtist>>
Gets a list of the artists followed by the current authorized user. Read more
sourcefn current_user_saved_tracks_delete<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<()>
fn current_user_saved_tracks_delete<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<()>
Remove one or more tracks from the current user’s “Your Music” library. Read more
sourcefn current_user_saved_tracks_contains<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<Vec<bool>>
fn current_user_saved_tracks_contains<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<Vec<bool>>
Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library. Read more
sourcefn current_user_saved_tracks_add<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<()>
fn current_user_saved_tracks_add<'a>(
&self,
track_ids: impl IntoIterator<Item = &'a TrackId> + Send + 'a
) -> ClientResult<()>
Save one or more tracks to the current user’s “Your Music” library. Read more
sourcefn current_user_top_artists<'a>(
&'a self,
time_range: Option<&'a TimeRange>
) -> Paginator<'_, ClientResult<FullArtist>>
fn current_user_top_artists<'a>(
&'a self,
time_range: Option<&'a TimeRange>
) -> Paginator<'_, ClientResult<FullArtist>>
Get the current user’s top artists. Read more
sourcefn current_user_top_artists_manual(
&self,
time_range: Option<&TimeRange>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<FullArtist>>
fn current_user_top_artists_manual(
&self,
time_range: Option<&TimeRange>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<FullArtist>>
The manually paginated version of Self::current_user_top_artists
.
sourcefn current_user_top_tracks<'a>(
&'a self,
time_range: Option<&'a TimeRange>
) -> Paginator<'_, ClientResult<FullTrack>>
fn current_user_top_tracks<'a>(
&'a self,
time_range: Option<&'a TimeRange>
) -> Paginator<'_, ClientResult<FullTrack>>
Get the current user’s top tracks. Read more
sourcefn current_user_top_tracks_manual(
&self,
time_range: Option<&TimeRange>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<FullTrack>>
fn current_user_top_tracks_manual(
&self,
time_range: Option<&TimeRange>,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<FullTrack>>
The manually paginated version of Self::current_user_top_tracks
.
sourcefn current_user_recently_played(
&self,
limit: Option<u32>,
time_limit: Option<TimeLimits>
) -> ClientResult<CursorBasedPage<PlayHistory>>
fn current_user_recently_played(
&self,
limit: Option<u32>,
time_limit: Option<TimeLimits>
) -> ClientResult<CursorBasedPage<PlayHistory>>
Get the current user’s recently played tracks. Read more
sourcefn current_user_saved_albums_add<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<()>
fn current_user_saved_albums_add<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<()>
Add one or more albums to the current user’s “Your Music” library. Read more
sourcefn current_user_saved_albums_delete<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<()>
fn current_user_saved_albums_delete<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<()>
Remove one or more albums from the current user’s “Your Music” library. Read more
sourcefn current_user_saved_albums_contains<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<Vec<bool>>
fn current_user_saved_albums_contains<'a>(
&self,
album_ids: impl IntoIterator<Item = &'a AlbumId> + Send + 'a
) -> ClientResult<Vec<bool>>
Check if one or more albums is already saved in the current Spotify user’s “Your Music” library. Read more
sourcefn user_follow_artists<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<()>
fn user_follow_artists<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<()>
Follow one or more artists. Read more
sourcefn user_unfollow_artists<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<()>
fn user_unfollow_artists<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<()>
Unfollow one or more artists. Read more
sourcefn user_artist_check_follow<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<Vec<bool>>
fn user_artist_check_follow<'a>(
&self,
artist_ids: impl IntoIterator<Item = &'a ArtistId> + Send + 'a
) -> ClientResult<Vec<bool>>
Check to see if the current user is following one or more artists or other Spotify users. Read more
sourcefn user_follow_users<'a>(
&self,
user_ids: impl IntoIterator<Item = &'a UserId> + Send + 'a
) -> ClientResult<()>
fn user_follow_users<'a>(
&self,
user_ids: impl IntoIterator<Item = &'a UserId> + Send + 'a
) -> ClientResult<()>
Follow one or more users. Read more
sourcefn user_unfollow_users<'a>(
&self,
user_ids: impl IntoIterator<Item = &'a UserId> + Send + 'a
) -> ClientResult<()>
fn user_unfollow_users<'a>(
&self,
user_ids: impl IntoIterator<Item = &'a UserId> + Send + 'a
) -> ClientResult<()>
Unfollow one or more users. Read more
sourcefn current_playback<'a>(
&self,
country: Option<&Market>,
additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a>
) -> ClientResult<Option<CurrentPlaybackContext>>
fn current_playback<'a>(
&self,
country: Option<&Market>,
additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a>
) -> ClientResult<Option<CurrentPlaybackContext>>
Get Information About The User’s Current Playback Read more
sourcefn current_playing<'a>(
&self,
market: Option<&'a Market>,
additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a>
) -> ClientResult<Option<CurrentlyPlayingContext>>
fn current_playing<'a>(
&self,
market: Option<&'a Market>,
additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a>
) -> ClientResult<Option<CurrentlyPlayingContext>>
Get the User’s Currently Playing Track Read more
sourcefn transfer_playback(
&self,
device_id: &str,
play: Option<bool>
) -> ClientResult<()>
fn transfer_playback(
&self,
device_id: &str,
play: Option<bool>
) -> ClientResult<()>
Transfer a User’s Playback. Read more
sourcefn start_context_playback<T: PlayContextId>(
&self,
context_uri: &T,
device_id: Option<&str>,
offset: Option<Offset>,
position_ms: Option<Duration>
) -> ClientResult<()>
fn start_context_playback<T: PlayContextId>(
&self,
context_uri: &T,
device_id: Option<&str>,
offset: Option<Offset>,
position_ms: Option<Duration>
) -> ClientResult<()>
Start/Resume a User’s Playback. Read more
sourcefn start_uris_playback<'a>(
&self,
uris: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a,
device_id: Option<&str>,
offset: Option<Offset>,
position_ms: Option<u32>
) -> ClientResult<()>
fn start_uris_playback<'a>(
&self,
uris: impl IntoIterator<Item = &'a dyn PlayableId> + Send + 'a,
device_id: Option<&str>,
offset: Option<Offset>,
position_ms: Option<u32>
) -> ClientResult<()>
Start a user’s playback Read more
sourcefn pause_playback(&self, device_id: Option<&str>) -> ClientResult<()>
fn pause_playback(&self, device_id: Option<&str>) -> ClientResult<()>
Pause a User’s Playback. Read more
sourcefn resume_playback(
&self,
device_id: Option<&str>,
position_ms: Option<u32>
) -> ClientResult<()>
fn resume_playback(
&self,
device_id: Option<&str>,
position_ms: Option<u32>
) -> ClientResult<()>
Resume a User’s Playback. Read more
sourcefn next_track(&self, device_id: Option<&str>) -> ClientResult<()>
fn next_track(&self, device_id: Option<&str>) -> ClientResult<()>
Skip User’s Playback To Next Track. Read more
sourcefn previous_track(&self, device_id: Option<&str>) -> ClientResult<()>
fn previous_track(&self, device_id: Option<&str>) -> ClientResult<()>
Skip User’s Playback To Previous Track. Read more
sourcefn seek_track(
&self,
position_ms: u32,
device_id: Option<&str>
) -> ClientResult<()>
fn seek_track(
&self,
position_ms: u32,
device_id: Option<&str>
) -> ClientResult<()>
Seek To Position In Currently Playing Track. Read more
sourcefn repeat(
&self,
state: &RepeatState,
device_id: Option<&str>
) -> ClientResult<()>
fn repeat(
&self,
state: &RepeatState,
device_id: Option<&str>
) -> ClientResult<()>
Set Repeat Mode On User’s Playback. Read more
sourcefn volume(
&self,
volume_percent: u8,
device_id: Option<&str>
) -> ClientResult<()>
fn volume(
&self,
volume_percent: u8,
device_id: Option<&str>
) -> ClientResult<()>
Set Volume For User’s Playback. Read more
sourcefn shuffle(&self, state: bool, device_id: Option<&str>) -> ClientResult<()>
fn shuffle(&self, state: bool, device_id: Option<&str>) -> ClientResult<()>
Toggle Shuffle For User’s Playback. Read more
sourcefn add_item_to_queue<T: PlayableId>(
&self,
item: &T,
device_id: Option<&str>
) -> ClientResult<()>
fn add_item_to_queue<T: PlayableId>(
&self,
item: &T,
device_id: Option<&str>
) -> ClientResult<()>
Add an item to the end of the user’s playback queue. Read more
sourcefn save_shows<'a>(
&self,
show_ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a
) -> ClientResult<()>
fn save_shows<'a>(
&self,
show_ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a
) -> ClientResult<()>
Add a show or a list of shows to a user’s library. Read more
sourcefn get_saved_show(&self) -> Paginator<'_, ClientResult<Show>>
fn get_saved_show(&self) -> Paginator<'_, ClientResult<Show>>
Get a list of shows saved in the current Spotify user’s library. Optional parameters can be used to limit the number of shows returned. Read more
sourcefn get_saved_show_manual(
&self,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<Show>>
fn get_saved_show_manual(
&self,
limit: Option<u32>,
offset: Option<u32>
) -> ClientResult<Page<Show>>
The manually paginated version of Self::get_saved_show
.
sourcefn check_users_saved_shows<'a>(
&self,
ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a
) -> ClientResult<Vec<bool>>
fn check_users_saved_shows<'a>(
&self,
ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a
) -> ClientResult<Vec<bool>>
Check if one or more shows is already saved in the current Spotify user’s library. Read more
sourcefn remove_users_saved_shows<'a>(
&self,
show_ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a,
country: Option<&Market>
) -> ClientResult<()>
fn remove_users_saved_shows<'a>(
&self,
show_ids: impl IntoIterator<Item = &'a ShowId> + Send + 'a,
country: Option<&Market>
) -> ClientResult<()>
Delete one or more shows from current Spotify user’s library. Changes to a user’s saved shows may not be visible in other Spotify applications immediately. Read more
Auto Trait Implementations
impl RefUnwindSafe for AuthCodeSpotify
impl Send for AuthCodeSpotify
impl Sync for AuthCodeSpotify
impl Unpin for AuthCodeSpotify
impl UnwindSafe for AuthCodeSpotify
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more