Esempio n. 1
0
        /// <summary>
        /// <see cref="ITableauWorkbookService.DownloadWorkbookBytesAsync"/>
        /// </summary>
        public async Task <TableauFileBytes> DownloadWorkbookBytesAsync(string id)
        {
            _logger?.Debug($"Downloading workbook {id}");

            var workbook = await GetWorkbookAsync(id).ConfigureAwait(false);

            var url = _tableauApiService.SiteUrl.AppendUri($"workbooks/{id}/content");

            var fileBytes = await _tableauApiService.DownloadFileBytesAsync(url).ConfigureAwait(false);

            _logger?.Debug(
                String.Format(
                    "Workbook {0} ({1}, {2}) downloaded, {3} bytes",
                    id,
                    workbook.Name,
                    fileBytes.Name,
                    fileBytes.Bytes.Length
                    )
                );

            return(fileBytes);
        }
Esempio n. 2
0
        /// <summary>
        /// <see cref="ITableauDatasourceService.DownloadDatasourceBytesAsync"/>
        /// </summary>
        public async Task <TableauFileBytes> DownloadDatasourceBytesAsync(string id)
        {
            _logger?.Debug($"Downloading datasource {id}");

            var datasource = await GetDatasourceAsync(id).ConfigureAwait(false);

            var url = _tableauApiService.SiteUrl.AppendUri($"datasources/{id}/content");

            var fileDownload = await _tableauApiService.DownloadFileBytesAsync(url).ConfigureAwait(false);

            _logger?.Debug(
                String.Format(
                    "Datasource {0} ({1}, {2}) downloaded, {3} bytes",
                    id,
                    datasource.Name,
                    fileDownload.Name,
                    fileDownload.Bytes.Length
                    )
                );

            return(fileDownload);
        }