Skip to content

Library

Module with the library endpoint

Library (Endpoint)

Library endpoint

Source code in async_spotify/api/_endpoints/library.py
class Library(Endpoint):
    """
    Library endpoint
    """

    async def contains_albums(self, album_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) \
            -> List[bool]:
        """
        Check Current User's Saved Albums

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-albums/](https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-albums/)

        Args:
            album_id_list: The ids of the albums
            auth_token: The auth token if you set the api class not to keep the token in memory

        Returns:
            Does the user library contain the Album
        """

        return await self.api_request_handler.make_request('GET', URLS.LIBRARY.CONTAINS_ALBUM,
                                                           {'ids': album_id_list}, auth_token)

    async def contains_shows(self, show_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> List[bool]:
        """
        Check Current User's Saved Shows

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-shows/](https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-shows/)

        Args:
            show_id_list:
            auth_token: The auth token if you set the api class not to keep the token in memory

        Returns:
            Does the user library contain the Show
        """

        return await self.api_request_handler.make_request('GET', URLS.LIBRARY.CONTAINS_SHOWS,
                                                           {'ids': show_id_list}, auth_token)

    async def contains_tracks(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) \
            -> List[bool]:
        """
        Check Current User's Saved Tracks

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-tracks/](https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-tracks/)

        Args:
            track_id_list:
            auth_token: The auth token if you set the api class not to keep the token in memory

        Returns:
            Does the user library contain the Track
        """

        return await self.api_request_handler.make_request('GET', URLS.LIBRARY.CONTAINS_TRACK,
                                                           {'ids': track_id_list}, auth_token)

    async def get_albums(self, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
        """
        Check User's Saved Albums

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-albums/](https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-albums/)

        Args:
            auth_token: The auth token if you set the api class not to keep the token in memory
            kwargs: Optional arguments as keyword args
        """

        return await self.api_request_handler.make_request('GET', URLS.LIBRARY.ALBUMS, kwargs, auth_token)

    async def get_shows(self, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
        """
        Check User's Saved Shows

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-shows/](https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-shows/)

        Args:
            auth_token: The auth token if you set the api class not to keep the token in memory
            kwargs: Optional arguments as keyword args
        """

        return await self.api_request_handler.make_request('GET', URLS.LIBRARY.SHOWS, kwargs, auth_token)

    async def get_tracks(self, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
        """
        Check User's Saved Tracks

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/](https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/)

        Args:
            auth_token: The auth token if you set the api class not to keep the token in memory
            kwargs: Optional arguments as keyword args
        """

        return await self.api_request_handler.make_request('GET', URLS.LIBRARY.TRACKS, kwargs, auth_token)

    async def remove_albums(self, album_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
        """
        Remove Albums for Current User

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/remove-albums-user/](https://developer.spotify.com/documentation/web-api/reference/library/remove-albums-user/)

        Args:
            album_id_list: The ids of the albums
            auth_token: The auth token if you set the api class not to keep the token in memory
        """

        await self.api_request_handler.make_request('DELETE', URLS.LIBRARY.ALBUMS,
                                                    {'ids': album_id_list}, auth_token)

    async def remove_shows(self, show_id_list: List[str], auth_token: SpotifyAuthorisationToken = None,
                           **kwargs) -> None:
        """
        Remove Shows for Current User

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/remove-shows-user/](https://developer.spotify.com/documentation/web-api/reference/library/remove-shows-user/)

        Args:
            show_id_list: The ids of the shows
            auth_token: The auth token if you set the api class not to keep the token in memory
            kwargs: Optional arguments as keyword args
        """

        await self.api_request_handler.make_request('DELETE', URLS.LIBRARY.SHOWS,
                                                    {**{'ids': show_id_list}, **kwargs}, auth_token)

    async def remove_tracks(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
        """
        Remove Tracks for Current User

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/remove-tracks-user/](https://developer.spotify.com/documentation/web-api/reference/library/remove-tracks-user/)

        Args:
            track_id_list: The ids of the tracks
            auth_token: The auth token if you set the api class not to keep the token in memory
        """

        await self.api_request_handler.make_request('DELETE', URLS.LIBRARY.TRACKS,
                                                    {'ids': track_id_list}, auth_token)

    async def add_album(self, album_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
        """
        Get User's Saved Albums

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/save-albums-user/](https://developer.spotify.com/documentation/web-api/reference/library/save-albums-user/)

        Args:
            album_id_list: The ids of the albums
            auth_token: The auth token if you set the api class not to keep the token in memory
        """

        await self.api_request_handler.make_request('PUT', URLS.LIBRARY.ALBUMS,
                                                    {**{'ids': album_id_list}}, auth_token)

    async def add_shows(self, show_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
        """
        Get User's Saved Shows

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/save-shows-user/](https://developer.spotify.com/documentation/web-api/reference/library/save-shows-user/)

        Args:
            show_id_list: The ids of the shows
            auth_token: The auth token if you set the api class not to keep the token in memory
        """

        await self.api_request_handler.make_request('PUT', URLS.LIBRARY.SHOWS,
                                                    {**{'ids': show_id_list}}, auth_token)

    async def add_tracks(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
        """
        Get User's Saved Tracks

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/library/save-tracks-user/](https://developer.spotify.com/documentation/web-api/reference/library/save-tracks-user/)

        Args:
            track_id_list: The ids of the tracks
            auth_token: The auth token if you set the api class not to keep the token in memory
        """

        await self.api_request_handler.make_request('PUT', URLS.LIBRARY.TRACKS,
                                                    {**{'ids': track_id_list}}, auth_token)

add_album(self, album_id_list, auth_token=None) async

Get User's Saved Albums

Parameters:

Name Type Description Default
album_id_list List[str]

The ids of the albums

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
Source code in async_spotify/api/_endpoints/library.py
async def add_album(self, album_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
    """
    Get User's Saved Albums

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/save-albums-user/](https://developer.spotify.com/documentation/web-api/reference/library/save-albums-user/)

    Args:
        album_id_list: The ids of the albums
        auth_token: The auth token if you set the api class not to keep the token in memory
    """

    await self.api_request_handler.make_request('PUT', URLS.LIBRARY.ALBUMS,
                                                {**{'ids': album_id_list}}, auth_token)

add_shows(self, show_id_list, auth_token=None) async

Get User's Saved Shows

Parameters:

Name Type Description Default
show_id_list List[str]

The ids of the shows

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
Source code in async_spotify/api/_endpoints/library.py
async def add_shows(self, show_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
    """
    Get User's Saved Shows

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/save-shows-user/](https://developer.spotify.com/documentation/web-api/reference/library/save-shows-user/)

    Args:
        show_id_list: The ids of the shows
        auth_token: The auth token if you set the api class not to keep the token in memory
    """

    await self.api_request_handler.make_request('PUT', URLS.LIBRARY.SHOWS,
                                                {**{'ids': show_id_list}}, auth_token)

add_tracks(self, track_id_list, auth_token=None) async

Get User's Saved Tracks

Parameters:

Name Type Description Default
track_id_list List[str]

The ids of the tracks

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
Source code in async_spotify/api/_endpoints/library.py
async def add_tracks(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
    """
    Get User's Saved Tracks

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/save-tracks-user/](https://developer.spotify.com/documentation/web-api/reference/library/save-tracks-user/)

    Args:
        track_id_list: The ids of the tracks
        auth_token: The auth token if you set the api class not to keep the token in memory
    """

    await self.api_request_handler.make_request('PUT', URLS.LIBRARY.TRACKS,
                                                {**{'ids': track_id_list}}, auth_token)

contains_albums(self, album_id_list, auth_token=None) async

Check Current User's Saved Albums

Parameters:

Name Type Description Default
album_id_list List[str]

The ids of the albums

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None

Returns:

Type Description
List[bool]

Does the user library contain the Album

Source code in async_spotify/api/_endpoints/library.py
async def contains_albums(self, album_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) \
        -> List[bool]:
    """
    Check Current User's Saved Albums

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-albums/](https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-albums/)

    Args:
        album_id_list: The ids of the albums
        auth_token: The auth token if you set the api class not to keep the token in memory

    Returns:
        Does the user library contain the Album
    """

    return await self.api_request_handler.make_request('GET', URLS.LIBRARY.CONTAINS_ALBUM,
                                                       {'ids': album_id_list}, auth_token)

contains_shows(self, show_id_list, auth_token=None) async

Check Current User's Saved Shows

Parameters:

Name Type Description Default
show_id_list List[str] required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None

Returns:

Type Description
List[bool]

Does the user library contain the Show

Source code in async_spotify/api/_endpoints/library.py
async def contains_shows(self, show_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> List[bool]:
    """
    Check Current User's Saved Shows

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-shows/](https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-shows/)

    Args:
        show_id_list:
        auth_token: The auth token if you set the api class not to keep the token in memory

    Returns:
        Does the user library contain the Show
    """

    return await self.api_request_handler.make_request('GET', URLS.LIBRARY.CONTAINS_SHOWS,
                                                       {'ids': show_id_list}, auth_token)

contains_tracks(self, track_id_list, auth_token=None) async

Check Current User's Saved Tracks

Parameters:

Name Type Description Default
track_id_list List[str] required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None

Returns:

Type Description
List[bool]

Does the user library contain the Track

Source code in async_spotify/api/_endpoints/library.py
async def contains_tracks(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) \
        -> List[bool]:
    """
    Check Current User's Saved Tracks

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-tracks/](https://developer.spotify.com/documentation/web-api/reference/library/check-users-saved-tracks/)

    Args:
        track_id_list:
        auth_token: The auth token if you set the api class not to keep the token in memory

    Returns:
        Does the user library contain the Track
    """

    return await self.api_request_handler.make_request('GET', URLS.LIBRARY.CONTAINS_TRACK,
                                                       {'ids': track_id_list}, auth_token)

get_albums(self, auth_token=None, **kwargs) async

Check User's Saved Albums

Parameters:

Name Type Description Default
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
kwargs

Optional arguments as keyword args

{}
Source code in async_spotify/api/_endpoints/library.py
async def get_albums(self, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
    """
    Check User's Saved Albums

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-albums/](https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-albums/)

    Args:
        auth_token: The auth token if you set the api class not to keep the token in memory
        kwargs: Optional arguments as keyword args
    """

    return await self.api_request_handler.make_request('GET', URLS.LIBRARY.ALBUMS, kwargs, auth_token)

get_shows(self, auth_token=None, **kwargs) async

Check User's Saved Shows

Parameters:

Name Type Description Default
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
kwargs

Optional arguments as keyword args

{}
Source code in async_spotify/api/_endpoints/library.py
async def get_shows(self, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
    """
    Check User's Saved Shows

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-shows/](https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-shows/)

    Args:
        auth_token: The auth token if you set the api class not to keep the token in memory
        kwargs: Optional arguments as keyword args
    """

    return await self.api_request_handler.make_request('GET', URLS.LIBRARY.SHOWS, kwargs, auth_token)

get_tracks(self, auth_token=None, **kwargs) async

Check User's Saved Tracks

Parameters:

Name Type Description Default
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
kwargs

Optional arguments as keyword args

{}
Source code in async_spotify/api/_endpoints/library.py
async def get_tracks(self, auth_token: SpotifyAuthorisationToken = None, **kwargs) -> dict:
    """
    Check User's Saved Tracks

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/](https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/)

    Args:
        auth_token: The auth token if you set the api class not to keep the token in memory
        kwargs: Optional arguments as keyword args
    """

    return await self.api_request_handler.make_request('GET', URLS.LIBRARY.TRACKS, kwargs, auth_token)

remove_albums(self, album_id_list, auth_token=None) async

Remove Albums for Current User

Parameters:

Name Type Description Default
album_id_list List[str]

The ids of the albums

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
Source code in async_spotify/api/_endpoints/library.py
async def remove_albums(self, album_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
    """
    Remove Albums for Current User

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/remove-albums-user/](https://developer.spotify.com/documentation/web-api/reference/library/remove-albums-user/)

    Args:
        album_id_list: The ids of the albums
        auth_token: The auth token if you set the api class not to keep the token in memory
    """

    await self.api_request_handler.make_request('DELETE', URLS.LIBRARY.ALBUMS,
                                                {'ids': album_id_list}, auth_token)

remove_shows(self, show_id_list, auth_token=None, **kwargs) async

Remove Shows for Current User

Parameters:

Name Type Description Default
show_id_list List[str]

The ids of the shows

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
kwargs

Optional arguments as keyword args

{}
Source code in async_spotify/api/_endpoints/library.py
async def remove_shows(self, show_id_list: List[str], auth_token: SpotifyAuthorisationToken = None,
                       **kwargs) -> None:
    """
    Remove Shows for Current User

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/remove-shows-user/](https://developer.spotify.com/documentation/web-api/reference/library/remove-shows-user/)

    Args:
        show_id_list: The ids of the shows
        auth_token: The auth token if you set the api class not to keep the token in memory
        kwargs: Optional arguments as keyword args
    """

    await self.api_request_handler.make_request('DELETE', URLS.LIBRARY.SHOWS,
                                                {**{'ids': show_id_list}, **kwargs}, auth_token)

remove_tracks(self, track_id_list, auth_token=None) async

Remove Tracks for Current User

Parameters:

Name Type Description Default
track_id_list List[str]

The ids of the tracks

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None
Source code in async_spotify/api/_endpoints/library.py
async def remove_tracks(self, track_id_list: List[str], auth_token: SpotifyAuthorisationToken = None) -> None:
    """
    Remove Tracks for Current User

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/library/remove-tracks-user/](https://developer.spotify.com/documentation/web-api/reference/library/remove-tracks-user/)

    Args:
        track_id_list: The ids of the tracks
        auth_token: The auth token if you set the api class not to keep the token in memory
    """

    await self.api_request_handler.make_request('DELETE', URLS.LIBRARY.TRACKS,
                                                {'ids': track_id_list}, auth_token)

Last update: April 27, 2020