public async Task <string> GetTokenisedUrlForAssetAsync(string token, string assetUrl) { _logger.Info($"Getting tokenised URL for asset with URL '{assetUrl}' using token '{token}'..."); var url = (await _f1tvClient.GetTokenisedUrlForAssetAsync(token, assetUrl)).Objects.First().TokenisedUrl.Url; _logger.Info($"Got tokenised URL '{url}'."); return(url); }
public async Task <string> GetTokenisedUrlAsync(string token, IPlayableContent playableContent) { _logger.Info($"Getting tokenised URL for content-type '{playableContent.ContentType}' and content-URL '{playableContent.ContentUrl}' using token '{token}'..."); return(playableContent.ContentType switch { ContentType.Channel => (await _client.GetTokenisedUrlForChannelAsync(token, playableContent.ContentUrl)).Url, ContentType.Asset => (await _client.GetTokenisedUrlForAssetAsync(token, playableContent.ContentUrl)).Objects.First().TokenisedUrl.Url, ContentType.Backup => (await _client.GetBackupStream()).StreamManifest, _ => throw new ArgumentException($"Could not generate tokenised URL for unsupported content-type '{playableContent.ContentType}'.", nameof(playableContent)) });