Renamed methods across multiple client classes for consistency, shortening and aligning naming conventions (e.g., `CheckAttachmentsAsync` → `CheckAsync`, `ValidatePdfAsync` → `ValidateAsync`). Updated corresponding interfaces, unit tests, and documentation to reflect the new method names. Standardized method signatures to support both `Stream` and `byte[]` overloads consistently. Improved error handling in tests and updated examples in the README for batch processing and validation scenarios. Enhanced API endpoint overview for clarity.
64 lines
3.1 KiB
C#
64 lines
3.1 KiB
C#
using DocumentService.Application.Common.DTOs;
|
|
using DocumentService.Application.Common.DTOs.Requests;
|
|
|
|
namespace DocumentService.Client.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Client for PDF attachment operations (check, extract, add).
|
|
/// </summary>
|
|
public interface IPdfAttachmentClient
|
|
{
|
|
/// <summary>
|
|
/// Checks if PDF contains attachments (multipart).
|
|
/// </summary>
|
|
/// <param name="pdfStream">PDF file stream</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Attachment check result with metadata</returns>
|
|
Task<AttachmentCheckResult> CheckAsync(Stream pdfStream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Checks if PDF contains attachments (Base64).
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF file as byte array</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Attachment check result with metadata</returns>
|
|
Task<AttachmentCheckResult> CheckAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts all embedded attachments from a PDF (multipart).
|
|
/// The returned dictionary maps each file name to its decompressed content stream.
|
|
/// </summary>
|
|
/// <param name="pdfStream">PDF file stream</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Dictionary of file name ? content stream for each extracted attachment</returns>
|
|
Task<Dictionary<string, Stream>> ExtractAsync(Stream pdfStream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts all embedded attachments from a PDF (Base64).
|
|
/// The returned dictionary maps each file name to its decompressed content stream.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF file as byte array</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Dictionary of file name ? content stream for each extracted attachment</returns>
|
|
Task<Dictionary<string, Stream>> ExtractAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Adds attachments to PDF (multipart). ?? Not implemented yet in API.
|
|
/// </summary>
|
|
/// <param name="pdfStream">PDF file stream</param>
|
|
/// <param name="attachments">Attachments to add</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Modified PDF as stream</returns>
|
|
[Obsolete("API endpoint not implemented yet")]
|
|
Task<Stream> AddAsync(Stream pdfStream, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Adds attachments to PDF (Base64). ?? Not implemented yet in API.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF file as byte array</param>
|
|
/// <param name="attachments">Attachments to add</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Modified PDF as stream</returns>
|
|
[Obsolete("API endpoint not implemented yet")]
|
|
Task<Stream> AddAsync(byte[] pdfBytes, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default);
|
|
} |