GetDownloadUrl() private method

private GetDownloadUrl ( string apiKey ) : Uri
apiKey string
return System.Uri
Beispiel #1
0
        /// <summary>
        /// Downloads the file requested by the
        /// <see cref="GetFileAsync(string,System.Threading.CancellationToken)" /> method.
        /// </summary>
        /// <param name="file">
        /// The file info received by calling
        /// <see cref="GetFileAsync(string,System.Threading.CancellationToken)" />.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of
        /// cancellation.
        /// </param>
        /// <exception cref="ArgumentNullException">File cannot be null.</exception>
        /// <returns>
        /// Returns a task containing the downloaded file as a stream.
        /// </returns>
        public Task <Stream> DownloadFileAsync([NotNull] File file, CancellationToken cancellationToken = default(CancellationToken))
        {
            Contracts.EnsureNotNull(file, nameof(file));

            var url = file.GetDownloadUrl(this.ApiKey);

            return(this.Client.GetStreamAsync(url));
        }