Client

Ecng.Backup.Mega.Native

Minimal MEGA client implementation used by Ecng.Backup.

Implementa: IDisposable

Constructores

Client
public Client(HttpClient httpClient)
client = Client(httpClient)

Creates a new client instance.

Propiedades

IsLoggedIn
public bool IsLoggedIn { get; }
value = client.IsLoggedIn

Whether the client has an active session.

Métodos

CreateFolderAsync
public Task<Node> CreateFolderAsync(string parentId, string name, CancellationToken cancellationToken)
result = client.CreateFolderAsync(parentId, name, cancellationToken)

Creates a folder under the given parent node id.

DeleteAsync
public Task DeleteAsync(string nodeId, CancellationToken cancellationToken)
result = client.DeleteAsync(nodeId, cancellationToken)

Deletes a node by its id.

Dispose
public void Dispose()
client.Dispose()

Disposes the client.

DownloadAsync
public Task DownloadAsync(Node node, Stream destination, IProgress<double> progress, CancellationToken cancellationToken)
result = client.DownloadAsync(node, destination, progress, cancellationToken)

Downloads a file node into the destination stream.

GetNodesAsync
public Task<IReadOnlyList<Node>> GetNodesAsync(CancellationToken cancellationToken)
result = client.GetNodesAsync(cancellationToken)

Retrieves the node tree (files/folders) for the current account.

GetPublicDownloadUrlAsync
public Task<DownloadUrlResponse> GetPublicDownloadUrlAsync(string publicHandle, CancellationToken cancellationToken)
result = client.GetPublicDownloadUrlAsync(publicHandle, cancellationToken)

Resolves a public file handle (export link) to a direct download URL.

LoginAsync
public Task LoginAsync(string email, string password, CancellationToken cancellationToken)
result = client.LoginAsync(email, password, cancellationToken)

Logs in using email and password.

LogoutAsync
public Task LogoutAsync(CancellationToken cancellationToken)
result = client.LogoutAsync(cancellationToken)

Logs out and clears the current session.

PublishAsync
public Task<string> PublishAsync(Node node, CancellationToken cancellationToken)
result = client.PublishAsync(node, cancellationToken)

Creates a public link (export) for a node and returns the URL.

UnpublishAsync
public Task UnpublishAsync(string nodeId, CancellationToken cancellationToken)
result = client.UnpublishAsync(nodeId, cancellationToken)

Removes a public link (export) for a node.

UploadAsync
public Task<Node> UploadAsync(string parentId, string name, Stream stream, DateTime? modificationDate, IProgress<double> progress, CancellationToken cancellationToken)
result = client.UploadAsync(parentId, name, stream, modificationDate, progress, cancellationToken)

Uploads a stream as a file under the given parent node id.