Skip to content

Commit

Permalink
Xml comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mikasoukhov committed Feb 17, 2025
1 parent 479a882 commit 7a738ca
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Backup.Mega/MegaService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@

using Nito.AsyncEx;

/// <summary>
/// The data storage service based on Mega https://mega.nz/ .
/// </summary>
/// <param name="email">Email.</param>
/// <param name="password">Password.</param>
public class MegaService(string email, SecureString password) : Disposable, IBackupService
{
private readonly MegaApiClient _client = new();
private readonly string _email = email.ThrowIfEmpty(nameof(email));
private readonly SecureString _password = password ?? throw new ArgumentNullException(nameof(password));
private readonly List<INode> _nodes = [];

/// <inheritdoc />
protected override void DisposeManaged()
{
if (_client.IsLoggedIn)
Expand Down
1 change: 1 addition & 0 deletions Backup.Yandex/YandexDiskService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public YandexDiskService(SecureString token)
_client = new DiskHttpApi(token.UnSecure());
}

/// <inheritdoc />
protected override void DisposeManaged()
{
_client.Dispose();
Expand Down
4 changes: 4 additions & 0 deletions Backup/BackupEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public BackupEntry()
/// <inheritdoc />
public override string ToString() => GetFullPath();

/// <summary>
/// Gets the full path of the element.
/// </summary>
/// <returns>Full path.</returns>
public string GetFullPath()
{
var path = Name;
Expand Down
26 changes: 24 additions & 2 deletions Backup/IBackupService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,47 @@ public interface IBackupService : IDisposable
/// </summary>
bool CanPublish { get; }

/// <summary>
/// Is folders feature available.
/// </summary>
bool CanFolders { get; }

/// <summary>
/// Is partial download feature available.
/// </summary>
bool CanPartialDownload { get; }

/// <summary>
/// Is partial upload feature available.
/// </summary>
/// <param name="entry"><see cref="BackupEntry"/></param>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns><see cref="Task"/></returns>
Task CreateFolder(BackupEntry entry, CancellationToken cancellationToken = default);

/// <summary>
/// Find files by the specified criteria.
/// </summary>
/// <param name="parent">Parent element. Can be null.</param>
/// <param name="criteria">Criteria.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns>File list.</returns>
IAsyncEnumerable<BackupEntry> FindAsync(BackupEntry parent, string criteria, CancellationToken cancellationToken = default);

/// <summary>
/// Fill file info.
/// </summary>
/// <param name="entry">Element.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns><see cref="Task"/></returns>
Task FillInfoAsync(BackupEntry entry, CancellationToken cancellationToken = default);

/// <summary>
/// Delete file from the service.
/// </summary>
/// <param name="entry">Element.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns><see cref="Task"/></returns>
Task DeleteAsync(BackupEntry entry, CancellationToken cancellationToken = default);

/// <summary>
Expand All @@ -50,7 +67,8 @@ public interface IBackupService : IDisposable
/// <param name="offset"></param>
/// <param name="length"></param>
/// <param name="progress">Progress notification.</param>
/// <returns>Cancellation token.</returns>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns><see cref="Task"/></returns>
Task DownloadAsync(BackupEntry entry, Stream stream, long? offset, long? length, Action<int> progress, CancellationToken cancellationToken = default);

/// <summary>
Expand All @@ -59,20 +77,24 @@ public interface IBackupService : IDisposable
/// <param name="entry">Element.</param>
/// <param name="stream">The stream of the open file into which data from the service will be downloaded.</param>
/// <param name="progress">Progress notification.</param>
/// <returns>Cancellation token.</returns>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns><see cref="Task"/></returns>
Task UploadAsync(BackupEntry entry, Stream stream, Action<int> progress, CancellationToken cancellationToken = default);

/// <summary>
/// Get public url for the specified element.
/// </summary>
/// <param name="entry">Element.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns>Public url.</returns>
Task<string> PublishAsync(BackupEntry entry, CancellationToken cancellationToken = default);

/// <summary>
/// Remove public url for the specified element.
/// </summary>
/// <param name="entry">Element.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/></param>
/// <returns><see cref="Task"/></returns>
Task UnPublishAsync(BackupEntry entry, CancellationToken cancellationToken = default);
}
}

0 comments on commit 7a738ca

Please sign in to comment.