Refactor: Standardize method names across clients
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.
This commit is contained in:
@@ -14,7 +14,7 @@ public class PdfAttachmentClient(HttpClient httpClient, ILogger<PdfAttachmentCli
|
||||
: BaseDocumentClient(httpClient, logger), IPdfAttachmentClient
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<AttachmentCheckResult> CheckAttachmentsAsync(Stream pdfStream, CancellationToken cancellationToken = default)
|
||||
public async Task<AttachmentCheckResult> CheckAsync(Stream pdfStream, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Logger.LogDebug("Checking PDF attachments from stream (multipart)");
|
||||
|
||||
@@ -28,7 +28,7 @@ public class PdfAttachmentClient(HttpClient httpClient, ILogger<PdfAttachmentCli
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<AttachmentCheckResult> CheckAttachmentsAsync(byte[] pdfBytes, CancellationToken cancellationToken = default)
|
||||
public async Task<AttachmentCheckResult> CheckAsync(byte[] pdfBytes, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Logger.LogDebug("Checking PDF attachments from byte array (Base64 JSON)");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class PdfAttachmentClient(HttpClient httpClient, ILogger<PdfAttachmentCli
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Dictionary<string, Stream>> ExtractAttachmentsAsync(Stream pdfStream, CancellationToken cancellationToken = default)
|
||||
public async Task<Dictionary<string, Stream>> ExtractAsync(Stream pdfStream, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Logger.LogDebug("Extracting PDF attachments from stream (multipart)");
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PdfAttachmentClient(HttpClient httpClient, ILogger<PdfAttachmentCli
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Dictionary<string, Stream>> ExtractAttachmentsAsync(byte[] pdfBytes, CancellationToken cancellationToken = default)
|
||||
public async Task<Dictionary<string, Stream>> ExtractAsync(byte[] pdfBytes, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Logger.LogDebug("Extracting PDF attachments from byte array (Base64 JSON)");
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PdfAttachmentClient(HttpClient httpClient, ILogger<PdfAttachmentCli
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("API endpoint not implemented yet")]
|
||||
public Task<Stream> AddAttachmentsAsync(Stream pdfStream, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default)
|
||||
public Task<Stream> AddAsync(Stream pdfStream, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Logger.LogWarning("AddAttachments endpoint is not implemented yet in API");
|
||||
throw new NotImplementedException("API endpoint /api/pdf/attachments/add is not implemented yet");
|
||||
@@ -81,7 +81,7 @@ public class PdfAttachmentClient(HttpClient httpClient, ILogger<PdfAttachmentCli
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("API endpoint not implemented yet")]
|
||||
public Task<Stream> AddAttachmentsAsync(byte[] pdfBytes, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default)
|
||||
public Task<Stream> AddAsync(byte[] pdfBytes, List<AttachmentRequestDto> attachments, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Logger.LogWarning("AddAttachments endpoint is not implemented yet in API");
|
||||
throw new NotImplementedException("API endpoint /api/pdf/attachments/add is not implemented yet");
|
||||
|
||||
Reference in New Issue
Block a user