Show / Hide Table of Contents

Interface IDeleteResultHandler

Results handler for the delete file operation.

Inherited Members
IFailureRegistration.RegisterFailureAsync(Nullable<String>, IFailureDetails, CancellationToken)
IFailureRegistration.RegisterFailureAsync(IFailureDetails, CancellationToken)
Namespace: OpenText.Fusion.AdapterSdk.Api
Assembly: OpenText.Fusion.AdapterSdk.Api.dll
Syntax
public interface IDeleteResultHandler : IFailureRegistration
Remarks

This results handler allows queueing of successfully deleted files and sends a batch of records for status update.

Methods

QueueSuccessAsync(String, CancellationToken)

Queue successfully deleted files.

Declaration
ValueTask QueueSuccessAsync(string fileId, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.String fileId

The file identifier.

CancellationToken cancellationToken

The cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
ValueTask

A representing the result of the asynchronous operation.

Examples

Example of a simple implementation that queue successfully deleted files.

public async Task DeleteFilesAsync(RepositoryFilesRequest request, IDeleteResultHandler handler, CancellationToken cancellationToken)
{
var fileList = request.Files;
foreach (var file in fileList)
{
   if (File.Exists(file.Metadata.FileLocation))
   {
        File.Delete(file.Metadata.FileLocation);
        await handler.QueueSuccessAsync(file.FileId, cancellationToken);
   }
   else
   {
       _logger.LogInformation("This file already deleted : {FileName} ", file.Metadata.FileLocation);
   }
}
}
In This Article
Back to top Generated by DocFX