How to use the tekore._client.decor.scopes function in tekore

To help you get started, we’ve selected a few tekore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felix-hilden / spotipy / tekore / _client / api / library.py View on Github external
    @scopes([scope.user_library_read])
    @send_and_process(single(SavedShowPaging))
    @maximise_limit(50)
    def saved_shows(
            self,
            market: str = None,
            limit: int = 20,
            offset: int = 0
    ) -> SavedShowPaging:
        """
        Get the shows saved in the current user's library.

        Parameters
        ----------
        market
            an ISO 3166-1 alpha-2 country code or 'from_token'
        limit
github felix-hilden / spotipy / tekore / _client / api / browse / __init__.py View on Github external
    @scopes()
    @send_and_process(multiple(
        top_item('message'),
        single(SimplePlaylistPaging, from_item='playlists')
    ))
    @maximise_limit(50)
    def featured_playlists(
            self,
            country: str = None,
            locale: str = None,
            timestamp: str = None,
            limit: int = 20,
            offset: int = 0
    ) -> Tuple[str, SimplePlaylistPaging]:
        """
        Get a list of Spotify featured playlists.
github felix-hilden / spotipy / tekore / _client / api / show.py View on Github external
    @scopes()
    @send_and_process(single(SimpleEpisodePaging))
    @maximise_limit(50)
    def show_episodes(
            self,
            show_id: str,
            market: str = None,
            limit: int = 20,
            offset: int = 0
    ) -> SimpleEpisodePaging:
        """
        Get episodes of a show.

        Parameters
        ----------
        show_id
            show ID
github felix-hilden / spotipy / tekore / _client / api / player / modify.py View on Github external
    @scopes([scope.user_modify_playback_state])
    @send_and_process(nothing)
    def playback_queue_add(self, uri: str, device_id: str = None) -> None:
        """
        Add a track or an episode to a user's queue.

        Parameters
        ----------
        uri
            resource to add, track or episode
        device_id
            devide to extend the queue on
        """
        return self._post('me/player/queue', uri=uri, device_id=device_id)
github felix-hilden / spotipy / tekore / _client / api / episode.py View on Github external
    @scopes()
    @send_and_process(single(FullEpisode))
    def episode(
            self,
            episode_id: str,
            market: str = None
    ) -> FullEpisode:
        """
        Get information for an episode.

        Parameters
        ----------
        episode_id
            episode ID
        market
            an ISO 3166-1 alpha-2 country code.
            If a user token is used to authenticate, the country associated
github felix-hilden / spotipy / tekore / _client / api / library.py View on Github external
    @scopes([scope.user_library_read])
    @chunked('show_ids', 1, 50, join_lists)
    @send_and_process(nothing)
    def saved_shows_contains(self, show_ids: list) -> List[bool]:
        """
        Check if user has saved shows.

        Parameters
        ----------
        show_ids
            list of show IDs, max 50 without chunking

        Returns
        -------
        List[bool]
            save statuses in the same order the show IDs were given
        """
github felix-hilden / spotipy / tekore / _client / api / playlist / items.py View on Github external
    @scopes([scope.playlist_modify_public], [scope.playlist_modify_private])
    @send_and_process(top_item('snapshot_id'))
    def playlist_remove_occurrences(
            self,
            playlist_id: str,
            refs: List[Tuple[str, int]],
            snapshot_id: str = None
    ) -> str:
        """
        Remove items by URI and position.

        Parameters
        ----------
        playlist_id
            playlist ID
        refs
            a list of tuples containing the URI and index of items to remove
github felix-hilden / spotipy / tekore / _client / api / player / modify.py View on Github external
    @scopes([scope.user_modify_playback_state])
    @send_and_process(nothing)
    def playback_previous(self, device_id: str = None) -> None:
        """
        Skip user's playback to previous track.

        Parameters
        ----------
        device_id
            device to skip track on
        """
        return self._post('me/player/previous', device_id=device_id)
github felix-hilden / spotipy / tekore / _client / api / player / modify.py View on Github external
    @scopes([scope.user_modify_playback_state])
    @send_and_process(nothing)
    def playback_seek(self, position_ms: int, device_id: str = None) -> None:
        """
        Seek to position in current playing track.

        Parameters
        ----------
        position_ms
            position on track
        device_id
            device to seek on
        """
        return self._put(
            'me/player/seek',
            position_ms=position_ms,
            device_id=device_id
github felix-hilden / spotipy / tekore / _client / api / playlist / items.py View on Github external
    @scopes([scope.playlist_modify_public], [scope.playlist_modify_private])
    @chunked('uris', 2, 100, return_last, reverse='position', reverse_pos=3)
    @send_and_process(top_item('snapshot_id'))
    def playlist_add(
            self,
            playlist_id: str,
            uris: list,
            position: int = None
    ) -> str:
        """
        Add items.

        Parameters
        ----------
        playlist_id
            playlist ID
        uris