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.
59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
using DocumentService.Application.Common.DTOs;
|
|
using DocumentService.Application.ExtractZugferd;
|
|
|
|
namespace DocumentService.Client.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Client for ZUGFeRD operations (detection, extraction).
|
|
/// </summary>
|
|
public interface IZugferdClient
|
|
{
|
|
/// <summary>
|
|
/// Checks whether a PDF contains a ZUGFeRD XML attachment (multipart).
|
|
/// </summary>
|
|
/// <param name="pdfStream">PDF file stream</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>ZUGFeRD check result</returns>
|
|
Task<ZugferdCheckResult> CheckAsync(Stream pdfStream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Checks whether a PDF contains a ZUGFeRD XML attachment (Base64).
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF file as byte array</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>ZUGFeRD check result</returns>
|
|
Task<ZugferdCheckResult> CheckAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts the ZUGFeRD XML from a PDF and returns the raw XML stream (multipart).
|
|
/// </summary>
|
|
/// <param name="pdfStream">PDF file stream</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>ZUGFeRD XML content as stream</returns>
|
|
Task<Stream> ExtractAsync(Stream pdfStream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts the ZUGFeRD XML from a PDF and returns the raw XML stream (Base64).
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF file as byte array</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>ZUGFeRD XML content as stream</returns>
|
|
Task<Stream> ExtractAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts ZUGFeRD metadata and XML content as a structured result (multipart).
|
|
/// </summary>
|
|
/// <param name="pdfStream">PDF file stream</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Structured ZUGFeRD extraction result</returns>
|
|
Task<ZugferdExtractionResult> ExtractAsResultAsync(Stream pdfStream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts ZUGFeRD metadata and XML content as a structured result (Base64).
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF file as byte array</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Structured ZUGFeRD extraction result</returns>
|
|
Task<ZugferdExtractionResult> ExtractAsResultAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
}
|