from utils.exceptions import BadGateway from external_api.playlists.providers.playlists_provider import PlaylistsProvider from external_api.base.clients.apollo_client import ApolloClient from external_api.playlists.schemas import PlaylistsQuery, PlaylistResults, PlaylistProvider class SpotifyPlaylistsProvider(PlaylistsProvider[ApolloClient]): async def fetch(self, query: PlaylistsQuery) -> PlaylistResults: try: return await self.client.get_spotify_playlists(query) except BadGateway: return PlaylistResults([], PlaylistProvider.Spotify)