예제 #1
0
        public async Task <DocumentToDownload> GetSecureDocument(string assetId, string groupSlug)
        {
            try
            {
                var document = await _documentsRepository.GetSecureDocument(assetId, groupSlug);

                if (document == null)
                {
                    _logger.LogWarning($"No document was returned for assetId: {assetId}");
                    return(null);
                }

                var result = await _httpClient.GetAsync($"https:{document.Url}");

                return(new DocumentToDownload
                {
                    FileData = await result.Content.ReadAsByteArrayAsync(),
                    MediaType = document.MediaType
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(new EventId(0), ex, $"There was a problem getting document with assetId: {assetId} for group {groupSlug}");
                return(null);
            }
        }