public IEnumerable <Playlist> GetCurrentUserPlaylists()
 {
     using (var user = StateManager.CurrentUser)
     {
         if (user.SpotifyAuthTokens != null)
         {
             var playlistsResponse = SpotifyServices.GetPlaylists(user.SpotifyAuthTokens);
             if (playlistsResponse != null && playlistsResponse.PlayLists != null)
             {
                 return(playlistsResponse.PlayLists);
             }
         }
     }
     return(Enumerable.Empty <PlaylistWithLoadedTracks>());
 }
        public GetTracksFromCurrentUserPlaylistResponse GetTracksFromCurrentUserPlaylist(string listId)
        {
            GetTracksFromCurrentUserPlaylistResponse response = new GetTracksFromCurrentUserPlaylistResponse
            {
                PlaylistId = listId
            };

            using (var user = StateManager.CurrentUser)
            {
                var playlistsResponse = SpotifyServices.GetPlaylists(user.SpotifyAuthTokens);

                var playlist = playlistsResponse.PlayLists.FirstOrDefault(list => list.Id == listId);
                if (playlist != null)
                {
                    response.Tracks = SpotifyServices.GetTracksFromPlaylist(playlist, user.SpotifyAuthTokens).ToArray();
                }
            }
            return(response);
        }
        public SpotifyGetTracksResponse GetTracks([FromBody] GetTracksRequest request)
        {
            var game = StateManager.Db.GetGame(request.GameId);

            return(SpotifyServices.GetTracks(game, request.Tracks));
        }
        public SpotifySearchResponse Search([FromBody] SearchRequest request)
        {
            var game = StateManager.Db.GetGame(request.GameId);

            return(SpotifyServices.SearchForTracks(game, request.Query));
        }