Exspotify.Playlists (Exspotify v0.1.0)

View Source

Provides functions for interacting with the Playlists endpoints of the Spotify Web API. Deprecated endpoints (featured playlists, category playlists) are not included. See: https://developer.spotify.com/documentation/web-api/reference/playlists

Summary

Functions

Add a custom cover image to a playlist. Warning: This will change the playlist's cover image. Requires: playlist-modify-public or playlist-modify-private scope. The image must be a Base64-encoded JPEG.

Add items (tracks/episodes) to a playlist. Warning: This will change the playlist's items. Requires: playlist-modify-public or playlist-modify-private scope.

Change a playlist's details (name, description, public, collaborative). Warning: This will change the playlist's metadata. Requires: playlist-modify-public or playlist-modify-private scope.

Check if one or more users are following a playlist.

Create a playlist for a user. Warning: This will create a new playlist in the user's account. Requires: playlist-modify-public or playlist-modify-private scope.

Follow a playlist. Warning: This will add the playlist to the user's library. Requires: playlist-modify-public or playlist-modify-private scope.

Get a playlist by its Spotify ID. Requires: playlist-read-private or playlist-read-collaborative scope for private playlists.

Get the current image for a playlist.

Remove items (tracks/episodes) from a playlist. Warning: This will change the playlist's items. Requires: playlist-modify-public or playlist-modify-private scope.

Unfollow a playlist. Warning: This will remove the playlist from the user's library. Requires: playlist-modify-public or playlist-modify-private scope.

Update (reorder/replace) items in a playlist. Warning: This will change the playlist's items. Requires: playlist-modify-public or playlist-modify-private scope.

Functions

add_custom_playlist_cover_image(playlist_id, image_data, token)

@spec add_custom_playlist_cover_image(String.t(), String.t(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Add a custom cover image to a playlist. Warning: This will change the playlist's cover image. Requires: playlist-modify-public or playlist-modify-private scope. The image must be a Base64-encoded JPEG.

add_items_to_playlist(playlist_id, token, body)

@spec add_items_to_playlist(String.t(), String.t(), map()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Add items (tracks/episodes) to a playlist. Warning: This will change the playlist's items. Requires: playlist-modify-public or playlist-modify-private scope.

change_playlist_details(playlist_id, token, details)

@spec change_playlist_details(String.t(), String.t(), map()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Change a playlist's details (name, description, public, collaborative). Warning: This will change the playlist's metadata. Requires: playlist-modify-public or playlist-modify-private scope.

check_if_user_follows_playlist(playlist_id, token, user_ids)

@spec check_if_user_follows_playlist(String.t(), String.t(), [String.t()]) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Check if one or more users are following a playlist.

create_playlist(user_id, name, token, details \\ %{})

@spec create_playlist(String.t(), String.t(), String.t(), map()) ::
  {:ok, Exspotify.Structs.Playlist.t()} | {:error, Exspotify.Error.t()}

Create a playlist for a user. Warning: This will create a new playlist in the user's account. Requires: playlist-modify-public or playlist-modify-private scope.

follow_playlist(playlist_id, token, opts \\ %{})

@spec follow_playlist(String.t(), String.t(), map()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Follow a playlist. Warning: This will add the playlist to the user's library. Requires: playlist-modify-public or playlist-modify-private scope.

get_current_users_playlists(token, opts \\ [])

@spec get_current_users_playlists(
  String.t(),
  keyword()
) :: {:ok, Exspotify.Structs.Paging.t()} | {:error, Exspotify.Error.t()}

Get the current user's playlists (paginated). https://developer.spotify.com/documentation/web-api/reference/get-current-users-playlists

get_playlist(playlist_id, token)

@spec get_playlist(String.t(), String.t()) ::
  {:ok, Exspotify.Structs.Playlist.t()} | {:error, Exspotify.Error.t()}

Get a playlist by its Spotify ID. Requires: playlist-read-private or playlist-read-collaborative scope for private playlists.

get_playlist_cover_image(playlist_id, token)

@spec get_playlist_cover_image(String.t(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Get the current image for a playlist.

get_playlist_items(playlist_id, token, opts \\ [])

@spec get_playlist_items(String.t(), String.t(), keyword()) ::
  {:ok, Exspotify.Structs.Paging.t()} | {:error, Exspotify.Error.t()}

Get items (tracks/episodes) in a playlist (paginated). https://developer.spotify.com/documentation/web-api/reference/get-playlists-tracks

get_users_playlists(user_id, token, opts \\ [])

@spec get_users_playlists(String.t(), String.t(), keyword()) ::
  {:ok, Exspotify.Structs.Paging.t()} | {:error, Exspotify.Error.t()}

Get a user's public playlists (paginated). https://developer.spotify.com/documentation/web-api/reference/get-list-users-playlists

remove_playlist_items(playlist_id, token, body)

@spec remove_playlist_items(String.t(), String.t(), map()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Remove items (tracks/episodes) from a playlist. Warning: This will change the playlist's items. Requires: playlist-modify-public or playlist-modify-private scope.

unfollow_playlist(playlist_id, token)

@spec unfollow_playlist(String.t(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Unfollow a playlist. Warning: This will remove the playlist from the user's library. Requires: playlist-modify-public or playlist-modify-private scope.

update_playlist_items(playlist_id, token, body, opts \\ [])

@spec update_playlist_items(String.t(), String.t(), map(), keyword()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Update (reorder/replace) items in a playlist. Warning: This will change the playlist's items. Requires: playlist-modify-public or playlist-modify-private scope.