-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathIDownloader.cs
More file actions
53 lines (49 loc) · 2.99 KB
/
Copy pathIDownloader.cs
File metadata and controls
53 lines (49 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Threading;
using System.Threading.Tasks;
using ManagedCode.Communication;
using ManagedCode.Storage.Core.Models;
namespace ManagedCode.Storage.Core
{
/// <summary>
/// Represents a downloader interface for downloading files.
/// </summary>
public interface IDownloader
{
/// <summary>
/// Downloads a file asynchronously.
/// </summary>
/// <param name="fileName">The name of the file to download.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the downloaded file.</returns>
Task<Result<LocalFile>> DownloadAsync(string fileName, CancellationToken cancellationToken = default);
/// <summary>
/// Downloads a file asynchronously using blob metadata.
/// </summary>
/// <param name="metadata">The metadata of the blob to be downloaded, containing information such as file name, size, and location.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the download operation. The default value is default(CancellationToken).</param>
/// <returns>
/// A task that represents the asynchronous operation. The task result contains a <see cref="Result{T}"/>
/// that wraps the downloaded <see cref="LocalFile"/>.
/// </returns>
/// <remarks>
/// The method uses the provided blob metadata to locate and download the file from storage.
/// The downloaded file is returned as a LocalFile object wrapped in a Result type for error handling.
/// </remarks>
Task<Result<LocalFile>> DownloadAsync(BlobMetadata metadata, CancellationToken cancellationToken = default);
/// <summary>
/// Downloads a file asynchronously with the specified download options.
/// </summary>
/// <param name="options">The options to use when downloading the file.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the downloaded file.</returns>
Task<Result<LocalFile>> DownloadAsync(DownloadOptions options, CancellationToken cancellationToken = default);
/// <summary>
/// Downloads a file asynchronously with the specified action to configure the download options.
/// </summary>
/// <param name="action">An action to configure the download options.</param>
/// <param name="cancellationToken">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the downloaded file.</returns>
Task<Result<LocalFile>> DownloadAsync(Action<DownloadOptions> action, CancellationToken cancellationToken = default);
}
}