Exemple #1
0
        public async Task <IActionResult> GetCurrentPlayingPlaylistId(string applicationId)
        {
            if (string.IsNullOrWhiteSpace(applicationId) || !Guid.TryParse(applicationId, out var guidOutput))
            {
                return(WarningLogBadRequest("Error: Invalid parameters given.")); //Generic error to not give too much information
            }

            try
            {
                return(Ok(await _spotifyService.GetCurrentPlayingPlaylistId(applicationId)));
            }
            catch (InvalidApplicationIdException ex)
            {
                return(WarningLogBadRequest("Failed to find a matching application id. Please disconnect from Spotify and try again.", ex));
            }
            catch (Exception ex)
            {
                return(WarningLogBadRequest("Failed to retrieve current playing playlist id.", ex));
            }
        }