spotify_ex v2.2.1 Spotify.Library View Source

Functions for retrieving information about, and managing, tracks that the current user has saved in their "Your Music" library. If you are looking for functions for retrieving the current user's saved albums, see Spotify.Album

There are two function for each endpoint; one that actually makes the request, and one that provides the endpoint:

Spotify.Library.get_saved_tracks(conn, params) # makes the GET request Spotify.Library.get_saved_tracks_url(params) # provides the url for the request

https://developer.spotify.com/web-api/library-endpoints/

Link to this section Summary

Functions

Implement the callback required by the Responder behavior

Check if one or more tracks is already saved in the current user’s library

Get url to check if one or more tracks is already saved in the current user’s library

Get a list of the songs saved in the current user's library. Spotify Documentation

Remove one or more tracks from the current user's library. Spotify Documentation

Save one or more tracks to the current user’s library. Spotify Documentation

Get url for saved tracks in the current user’s library

Link to this section Functions

Implement the callback required by the Responder behavior

Link to this function

check_saved_tracks(conn, params) View Source

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

Method: GET

Optional Params:

  • ids - A comma-separated string of the Spotify IDs. Maximum: 50 IDs.

    iex> Spotify.Library.check_saved_tracks(conn, ids: "1,4")

Link to this function

check_saved_tracks_url(params) View Source

Get url to check if one or more tracks is already saved in the current user’s library.

iex> Spotify.Library.check_saved_tracks_url(id: "1,4") "https://api.spotify.com/v1/me/tracks/contains?ids=1%2C4"

Link to this function

get_saved_tracks(conn, params \\ []) View Source

Get a list of the songs saved in the current user's library. Spotify Documentation

Method: GET

Optional Params:

  • limit - The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50
  • offset - The index of the first object to return. Default: 0 (i.e., the first object). Use with limit to get the next set of objects.
  • market - An ISO 3166-1 alpha-2 country code.

    iex> Spotify.Library.get_saved_tracks(conn, limit: "1") {:ok, [%Spotify.Track{}]}

Link to this function

remove_saved_tracks(conn, params \\ []) View Source

Remove one or more tracks from the current user's library. Spotify Documentation

Method: DELETE

Optional Params:

  • ids - A comma-separated string of the Spotify IDs. Maximum: 50 IDs.

    iex> Spotify.Library.remove_saved_tracks(conn, ids: "1,4") :ok

Link to this function

save_tracks(conn, params) View Source

Save one or more tracks to the current user’s library. Spotify Documentation

Method: PUT

Optional Params:

  • ids - A comma-separated string of the Spotify IDs. Maximum: 50 IDs.

    iex> Spotify.Library.save_tracks(conn, ids: "1,4") :ok

Link to this function

saved_tracks_url(params) View Source

Get url for saved tracks in the current user’s library.

iex> Spotify.Library.save_tracks_url(ids: "1,4")
"https://api.spotify.com/v1/me/tracks?ids=1%2C4"