pub trait OAuthClient: BaseClient {
Show 62 methods // Required methods fn get_oauth(&self) -> &OAuth; fn request_token(&self, code: &str) -> ClientResult<()>; // Provided methods fn read_token_cache( &self, allow_expired: bool ) -> ClientResult<Option<Token>> { ... } fn parse_response_code(&self, url: &str) -> Option<String> { ... } fn get_code_from_user(&self, url: &str) -> ClientResult<String> { ... } fn prompt_for_token(&self, url: &str) -> ClientResult<()> { ... } fn current_user_playlists( &self ) -> Paginator<'_, ClientResult<SimplifiedPlaylist>> { ... } fn current_user_playlists_manual( &self, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<SimplifiedPlaylist>> { ... } fn user_playlist_create( &self, user_id: UserId<'_>, name: &str, public: Option<bool>, collaborative: Option<bool>, description: Option<&str> ) -> ClientResult<FullPlaylist> { ... } fn playlist_change_detail( &self, playlist_id: PlaylistId<'_>, name: Option<&str>, public: Option<bool>, description: Option<&str>, collaborative: Option<bool> ) -> ClientResult<String> { ... } fn playlist_unfollow(&self, playlist_id: PlaylistId<'_>) -> ClientResult<()> { ... } fn playlist_add_items<'a>( &self, playlist_id: PlaylistId<'_>, items: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a, position: Option<u32> ) -> ClientResult<PlaylistResult> { ... } fn playlist_replace_items<'a>( &self, playlist_id: PlaylistId<'_>, items: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a ) -> ClientResult<()> { ... } 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> { ... } fn playlist_remove_all_occurrences_of_items<'a>( &self, playlist_id: PlaylistId<'_>, track_ids: impl IntoIterator<Item = PlayableId<'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> { ... } fn playlist_follow( &self, playlist_id: PlaylistId<'_>, public: Option<bool> ) -> ClientResult<()> { ... } fn me(&self) -> ClientResult<PrivateUser> { ... } fn current_user(&self) -> ClientResult<PrivateUser> { ... } fn current_user_playing_item( &self ) -> ClientResult<Option<CurrentlyPlayingContext>> { ... } fn current_user_saved_albums( &self, market: Option<Market> ) -> Paginator<'_, ClientResult<SavedAlbum>> { ... } fn current_user_saved_albums_manual( &self, market: Option<Market>, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<SavedAlbum>> { ... } fn current_user_saved_tracks( &self, market: Option<Market> ) -> Paginator<'_, ClientResult<SavedTrack>> { ... } fn current_user_saved_tracks_manual( &self, market: Option<Market>, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<SavedTrack>> { ... } fn current_user_followed_artists( &self, after: Option<&str>, limit: Option<u32> ) -> ClientResult<CursorBasedPage<FullArtist>> { ... } fn current_user_saved_tracks_delete<'a>( &self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn current_user_saved_tracks_contains<'a>( &self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>> { ... } fn current_user_saved_tracks_add<'a>( &self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn current_user_top_artists( &self, time_range: Option<TimeRange> ) -> Paginator<'_, ClientResult<FullArtist>> { ... } fn current_user_top_artists_manual( &self, time_range: Option<TimeRange>, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<FullArtist>> { ... } fn current_user_top_tracks( &self, time_range: Option<TimeRange> ) -> Paginator<'_, ClientResult<FullTrack>> { ... } fn current_user_top_tracks_manual( &self, time_range: Option<TimeRange>, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<FullTrack>> { ... } fn current_user_recently_played( &self, limit: Option<u32>, time_limit: Option<TimeLimits> ) -> ClientResult<CursorBasedPage<PlayHistory>> { ... } fn current_user_saved_albums_add<'a>( &self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn current_user_saved_albums_delete<'a>( &self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn current_user_saved_albums_contains<'a>( &self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>> { ... } fn user_follow_artists<'a>( &self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn user_unfollow_artists<'a>( &self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn user_artist_check_follow<'a>( &self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>> { ... } fn user_follow_users<'a>( &self, user_ids: impl IntoIterator<Item = UserId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn user_unfollow_users<'a>( &self, user_ids: impl IntoIterator<Item = UserId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn device(&self) -> ClientResult<Vec<Device>> { ... } fn current_playback<'a>( &self, country: Option<Market>, additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a> ) -> ClientResult<Option<CurrentPlaybackContext>> { ... } fn current_playing<'a>( &'a self, market: Option<Market>, additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a> ) -> ClientResult<Option<CurrentlyPlayingContext>> { ... } fn current_user_queue(&self) -> ClientResult<CurrentUserQueue> { ... } fn transfer_playback( &self, device_id: &str, play: Option<bool> ) -> ClientResult<()> { ... } fn start_context_playback( &self, context_uri: PlayContextId<'_>, device_id: Option<&str>, offset: Option<Offset>, position: Option<Duration> ) -> ClientResult<()> { ... } fn start_uris_playback<'a>( &self, uris: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a, device_id: Option<&str>, offset: Option<Offset>, position: Option<Duration> ) -> ClientResult<()> { ... } fn pause_playback(&self, device_id: Option<&str>) -> ClientResult<()> { ... } fn resume_playback( &self, device_id: Option<&str>, position: Option<Duration> ) -> ClientResult<()> { ... } fn next_track(&self, device_id: Option<&str>) -> ClientResult<()> { ... } fn previous_track(&self, device_id: Option<&str>) -> ClientResult<()> { ... } fn seek_track( &self, position: Duration, device_id: Option<&str> ) -> ClientResult<()> { ... } fn repeat( &self, state: RepeatState, device_id: Option<&str> ) -> ClientResult<()> { ... } fn volume( &self, volume_percent: u8, device_id: Option<&str> ) -> ClientResult<()> { ... } fn shuffle(&self, state: bool, device_id: Option<&str>) -> ClientResult<()> { ... } fn add_item_to_queue( &self, item: PlayableId<'_>, device_id: Option<&str> ) -> ClientResult<()> { ... } fn save_shows<'a>( &self, show_ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'a ) -> ClientResult<()> { ... } fn get_saved_show(&self) -> Paginator<'_, ClientResult<Show>> { ... } fn get_saved_show_manual( &self, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<Show>> { ... } fn check_users_saved_shows<'a>( &self, ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>> { ... } fn remove_users_saved_shows<'a>( &self, show_ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'a, country: Option<Market> ) -> ClientResult<()> { ... }
}
Expand description

This trait implements the methods available strictly to clients with user authorization, including some parts of the authentication flow that are shared, and the endpoints.

Note that the base trait BaseClient may have endpoints that conditionally require authorization like user_playlist. This trait only separates endpoints that always need authorization from the base ones.

Required Methods§

source

fn get_oauth(&self) -> &OAuth

source

fn request_token(&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.

Provided Methods§

source

fn read_token_cache(&self, allow_expired: bool) -> ClientResult<Option<Token>>

Tries to read the cache file’s token.

This will return an error if the token couldn’t be read (e.g. it’s not available or the JSON is malformed). It may return Ok(None) if:

  • The read token is expired and allow_expired is false
  • Its scopes don’t match with the current client (you will need to re-authenticate to gain access to more scopes)
  • The cached token is disabled in the config
§Note

This function’s implementation differs slightly from the implementation in ClientCredsSpotify::read_token_cache. The boolean parameter allow_expired allows users to load expired tokens from the cache. This functionality can be used to access the refresh token and obtain a new, valid token. This option is unavailable in the implementation of ClientCredsSpotify::read_token_cache since the client credentials authorization flow does not have a refresh token and instead requires the application re-authenticate.

source

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.

source

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.

Note: this method requires the cli feature.

source

fn prompt_for_token(&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.

If the Config::token_cached setting is enabled for this client, and a token exists in the cache, the token will be loaded and the client will attempt to automatically refresh the token if it is expired. If the token was unable to be refreshed, the client will then prompt the user for the token as normal.

Note: this method requires the cli feature.

source

fn current_user_playlists( &self ) -> Paginator<'_, ClientResult<SimplifiedPlaylist>>

Get current user playlists without required getting his profile.

Parameters:

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

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

Reference

source

fn current_user_playlists_manual( &self, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<SimplifiedPlaylist>>

The manually paginated version of Self::current_user_playlists.

source

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.

Parameters:

  • user_id - the id of the user
  • name - the name of the playlist
  • public - is the created playlist public
  • description - the description of the playlist
  • collaborative - if the playlist will be collaborative. Note: to create a collaborative playlist you must also set public to false

Reference

source

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.

Parameters:

  • playlist_id - the id of the playlist
  • name - optional name of the playlist
  • public - optional is the playlist public
  • collaborative - optional is the playlist collaborative
  • description - optional description of the playlist

Reference

source

fn playlist_unfollow(&self, playlist_id: PlaylistId<'_>) -> ClientResult<()>

Unfollows (deletes) a playlist for a user.

Parameters:

  • playlist_id - the id of the playlist

Reference

source

fn playlist_add_items<'a>( &self, playlist_id: PlaylistId<'_>, items: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a, position: Option<u32> ) -> ClientResult<PlaylistResult>

Adds items to a playlist.

Parameters:

  • playlist_id - the id of the playlist
  • track_ids - a list of track URIs, URLs or IDs
  • position - the position to add the items, a zero-based index

Reference

source

fn playlist_replace_items<'a>( &self, playlist_id: PlaylistId<'_>, items: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a ) -> ClientResult<()>

Replace all items in a playlist

Parameters:

  • user - the id of the user
  • playlist_id - the id of the playlist
  • tracks - the list of track ids to add to the playlist

Reference

source

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.

Parameters:

  • playlist_id - the id of the playlist
  • uris - a list of Spotify URIs to replace or clear
  • range_start - the position of the first track to be reordered
  • insert_before - the position where the tracks should be inserted
  • range_length - optional the number of tracks to be reordered (default:
  • snapshot_id - optional playlist’s snapshot ID

Reference

source

fn playlist_remove_all_occurrences_of_items<'a>( &self, playlist_id: PlaylistId<'_>, track_ids: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a, snapshot_id: Option<&str> ) -> ClientResult<PlaylistResult>

Removes all occurrences of the given items from the given playlist.

Parameters:

  • playlist_id - the id of the playlist
  • track_ids - the list of track ids to add to the playlist
  • snapshot_id - optional id of the playlist snapshot

Reference

source

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.

Parameters:

  • playlist_id: the id of the playlist
  • tracks: an array of map containing Spotify URIs of the tracks to remove with their current positions in the playlist. For example:
{
   "tracks":[
      {
         "uri":"spotify:track:4iV5W9uYEdYUVa79Axb7Rh",
         "positions":[
            0,
            3
         ]
      },
      {
         "uri":"spotify:track:1301WleyT98MSxVHPZCA6M",
         "positions":[
            7
         ]
      }
   ]
}
  • snapshot_id: optional id of the playlist snapshot

Reference

source

fn playlist_follow( &self, playlist_id: PlaylistId<'_>, public: Option<bool> ) -> ClientResult<()>

Add the current authenticated user as a follower of a playlist.

Parameters:

  • playlist_id - the id of the playlist

Reference

source

fn me(&self) -> ClientResult<PrivateUser>

Get detailed profile information about the current user. An alias for the ‘current_user’ method.

Reference

source

fn current_user(&self) -> ClientResult<PrivateUser>

Get detailed profile information about the current user. An alias for the ‘me’ method.

Reference

source

fn current_user_playing_item( &self ) -> ClientResult<Option<CurrentlyPlayingContext>>

Get information about the current users currently playing item.

Reference

source

fn current_user_saved_albums( &self, market: Option<Market> ) -> Paginator<'_, ClientResult<SavedAlbum>>

Gets a list of the albums saved in the current authorized user’s “Your Music” library

Parameters:

  • limit - the number of albums to return
  • offset - the index of the first album to return
  • market - Provide this parameter if you want to apply Track Relinking.

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

Reference

source

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.

source

fn current_user_saved_tracks( &self, market: Option<Market> ) -> Paginator<'_, ClientResult<SavedTrack>>

Get a list of the songs saved in the current Spotify user’s “Your Music” library.

Parameters:

  • limit - the number of tracks to return
  • offset - the index of the first track to return
  • market - Provide this parameter if you want to apply Track Relinking.

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

Reference

source

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.

source

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.

Parameters:

  • after - the last artist ID retrieved from the previous request
  • limit - the number of tracks to return

Reference

source

fn current_user_saved_tracks_delete<'a>( &self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'a ) -> ClientResult<()>

Remove one or more tracks from the current user’s “Your Music” library.

Parameters:

  • track_ids - a list of track URIs, URLs or IDs

Reference

source

fn current_user_saved_tracks_contains<'a>( &self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>>

Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library.

Parameters:

  • track_ids - a list of track URIs, URLs or IDs

Reference

source

fn current_user_saved_tracks_add<'a>( &self, track_ids: impl IntoIterator<Item = TrackId<'a>> + Send + 'a ) -> ClientResult<()>

Save one or more tracks to the current user’s “Your Music” library.

Parameters:

  • track_ids - a list of track URIs, URLs or IDs

Reference

source

fn current_user_top_artists( &self, time_range: Option<TimeRange> ) -> Paginator<'_, ClientResult<FullArtist>>

Get the current user’s top artists.

Parameters:

  • limit - the number of entities to return
  • offset - the index of the first entity to return
  • time_range - Over what time frame are the affinities computed

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

Reference

source

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.

source

fn current_user_top_tracks( &self, time_range: Option<TimeRange> ) -> Paginator<'_, ClientResult<FullTrack>>

Get the current user’s top tracks.

Parameters:

  • limit - the number of entities to return
  • offset - the index of the first entity to return
  • time_range - Over what time frame are the affinities computed

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

Reference

source

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.

source

fn current_user_recently_played( &self, limit: Option<u32>, time_limit: Option<TimeLimits> ) -> ClientResult<CursorBasedPage<PlayHistory>>

Get the current user’s recently played tracks.

Parameters:

  • limit - the number of entities to return
  • time_limit - a timestamp. The endpoint will return all items after or before (but not including) this cursor position.

Reference

source

fn current_user_saved_albums_add<'a>( &self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'a ) -> ClientResult<()>

Add one or more albums to the current user’s “Your Music” library.

Parameters:

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

Reference

source

fn current_user_saved_albums_delete<'a>( &self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'a ) -> ClientResult<()>

Remove one or more albums from the current user’s “Your Music” library.

Parameters:

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

Reference

source

fn current_user_saved_albums_contains<'a>( &self, album_ids: impl IntoIterator<Item = AlbumId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>>

Check if one or more albums is already saved in the current Spotify user’s “Your Music” library.

Parameters:

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

Reference

source

fn user_follow_artists<'a>( &self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'a ) -> ClientResult<()>

Follow one or more artists.

Parameters:

  • artist_ids - a list of artist IDs

Reference

source

fn user_unfollow_artists<'a>( &self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'a ) -> ClientResult<()>

Unfollow one or more artists.

Parameters:

  • artist_ids - a list of artist IDs

Reference

source

fn user_artist_check_follow<'a>( &self, artist_ids: impl IntoIterator<Item = ArtistId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>>

Check to see if the current user is following one or more artists or other Spotify users.

Parameters:

  • artist_ids - the ids of the users that you want to

Reference

source

fn user_follow_users<'a>( &self, user_ids: impl IntoIterator<Item = UserId<'a>> + Send + 'a ) -> ClientResult<()>

Follow one or more users.

Parameters:

  • user_ids - a list of artist IDs

Reference

source

fn user_unfollow_users<'a>( &self, user_ids: impl IntoIterator<Item = UserId<'a>> + Send + 'a ) -> ClientResult<()>

Unfollow one or more users.

Parameters:

  • user_ids - a list of artist IDs

Reference

source

fn device(&self) -> ClientResult<Vec<Device>>

Get a User’s Available Devices

Reference

source

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

Parameters:

  • market: Optional. an ISO 3166-1 alpha-2 country code or the string from_token.
  • additional_types: Optional. A list of item types that your client supports besides the default track type. Valid types are: track and episode.

Reference

source

fn current_playing<'a>( &'a self, market: Option<Market>, additional_types: Option<impl IntoIterator<Item = &'a AdditionalType> + Send + 'a> ) -> ClientResult<Option<CurrentlyPlayingContext>>

Get the User’s Currently Playing Track

Parameters:

  • market: Optional. an ISO 3166-1 alpha-2 country code or the string from_token.
  • additional_types: Optional. A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode.

Reference

source

fn current_user_queue(&self) -> ClientResult<CurrentUserQueue>

Get the Current User’s Queue

Reference

source

fn transfer_playback( &self, device_id: &str, play: Option<bool> ) -> ClientResult<()>

Transfer a User’s Playback.

Note: Although an array is accepted, only a single device_id is currently supported. Supplying more than one will return 400 Bad Request

Parameters:

  • device_id - transfer playback to this device
  • force_play - true: after transfer, play. false: keep current state.

Reference

source

fn start_context_playback( &self, context_uri: PlayContextId<'_>, device_id: Option<&str>, offset: Option<Offset>, position: Option<Duration> ) -> ClientResult<()>

Start/Resume a User’s Playback.

Provide a context_uri to start playback or a album, artist, or playlist. Provide a uris list to start playback of one or more tracks. Provide offset as {"position": <int>} or {"uri": "<track uri>"} to start playback at a particular offset.

Parameters:

  • device_id - device target for playback
  • context_uri - spotify context uri to play
  • uris - spotify track uris
  • offset - offset into context by index or track
  • position - Indicates from what position to start playback.

Reference

source

fn start_uris_playback<'a>( &self, uris: impl IntoIterator<Item = PlayableId<'a>> + Send + 'a, device_id: Option<&str>, offset: Option<Offset>, position: Option<Duration> ) -> ClientResult<()>

Start a user’s playback

Parameters:

  • uris
  • device_id
  • offset
  • position

Reference

source

fn pause_playback(&self, device_id: Option<&str>) -> ClientResult<()>

Pause a User’s Playback.

Parameters:

  • device_id - device target for playback

Reference

source

fn resume_playback( &self, device_id: Option<&str>, position: Option<Duration> ) -> ClientResult<()>

Resume a User’s Playback.

Parameters:

  • device_id - device target for playback
  • position

Reference

source

fn next_track(&self, device_id: Option<&str>) -> ClientResult<()>

Skip User’s Playback To Next Track.

Parameters:

  • device_id - device target for playback

Reference

source

fn previous_track(&self, device_id: Option<&str>) -> ClientResult<()>

Skip User’s Playback To Previous Track.

Parameters:

  • device_id - device target for playback

Reference

source

fn seek_track( &self, position: Duration, device_id: Option<&str> ) -> ClientResult<()>

Seek To Position In Currently Playing Track.

Parameters:

  • position - position in milliseconds to seek to
  • device_id - device target for playback

Reference

source

fn repeat( &self, state: RepeatState, device_id: Option<&str> ) -> ClientResult<()>

Set Repeat Mode On User’s Playback.

Parameters:

  • state - track, context, or off
  • device_id - device target for playback

Reference

source

fn volume( &self, volume_percent: u8, device_id: Option<&str> ) -> ClientResult<()>

Set Volume For User’s Playback.

Parameters:

  • volume_percent - volume between 0 and 100
  • device_id - device target for playback

Reference

source

fn shuffle(&self, state: bool, device_id: Option<&str>) -> ClientResult<()>

Toggle Shuffle For User’s Playback.

Parameters:

  • state - true or false
  • device_id - device target for playback

Reference

source

fn add_item_to_queue( &self, item: PlayableId<'_>, device_id: Option<&str> ) -> ClientResult<()>

Add an item to the end of the user’s playback queue.

Parameters:

  • uri - The uri of the item to add, Track or Episode
  • device id - The id of the device targeting
  • If no device ID provided the user’s currently active device is targeted

Reference

source

fn save_shows<'a>( &self, show_ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'a ) -> ClientResult<()>

Add a show or a list of shows to a user’s library.

Parameters:

  • ids(Required) A comma-separated list of Spotify IDs for the shows to be added to the user’s library.

Reference

source

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.

Parameters:

  • limit(Optional). The maximum number of shows to return. Default: 20. Minimum: 1. Maximum: 50.
  • offset(Optional). The index of the first show to return. Default: 0 (the first object). Use with limit to get the next set of shows.

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

Reference

source

fn get_saved_show_manual( &self, limit: Option<u32>, offset: Option<u32> ) -> ClientResult<Page<Show>>

The manually paginated version of Self::get_saved_show.

source

fn check_users_saved_shows<'a>( &self, ids: impl IntoIterator<Item = ShowId<'a>> + Send + 'a ) -> ClientResult<Vec<bool>>

Check if one or more shows is already saved in the current Spotify user’s library.

Query Parameters

  • ids: Required. A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.

Reference

source

fn remove_users_saved_shows<'a>( &self, show_ids: impl IntoIterator<Item = ShowId<'a>> + 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.

Query Parameters

  • ids: Required. A comma-separated list of Spotify IDs for the shows to be deleted from the user’s library.
  • market: Optional. An ISO 3166-1 alpha-2 country code or the string from_token.

Reference

Object Safety§

This trait is not object safe.

Implementors§

source§

impl OAuthClient for AuthCodePkceSpotify

This client includes user authorization, so it has access to the user private endpoints in OAuthClient.

source§

impl OAuthClient for AuthCodeSpotify

This client includes user authorization, so it has access to the user private endpoints in OAuthClient.