Move WorkflowsClientExtensions to IWorkflowsClient.cs
Relocated the `WorkflowsClientExtensions` class from `WorkflowsClient.cs` to `IWorkflowsClient.cs` to improve discoverability by defining it alongside the `IWorkflowsClient` interface. The `InspectSwissQrCodeAsync` extension method was moved as part of this change. Its functionality remains unchanged, as it still opens a `FileStream` for the provided file path and delegates to the `IWorkflowsClient.InspectSwissQrCodeAsync(Stream, bool, CancellationToken)` method.
This commit is contained in:
@@ -42,32 +42,3 @@ public class WorkflowsClient(IPdfValidationClient validation, ISwissQrCodeClient
|
|||||||
return new SwissQrCodeResult(qrCode, validationResult);
|
return new SwissQrCodeResult(qrCode, validationResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Convenience extensions for <see cref="IWorkflowsClient"/> that accept a file path as input.
|
|
||||||
/// Defined alongside <see cref="WorkflowsClient"/> so they are discoverable without an additional using directive.
|
|
||||||
/// </summary>
|
|
||||||
public static class WorkflowsClientExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Validates the PDF at <paramref name="filePath"/> and attempts Swiss QR Code extraction
|
|
||||||
/// in a single call. Opens a <see cref="FileStream"/> and delegates to
|
|
||||||
/// <see cref="IWorkflowsClient.InspectSwissQrCodeAsync(Stream, bool, CancellationToken)"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client">The workflows client.</param>
|
|
||||||
/// <param name="filePath">Absolute or relative path to the PDF file.</param>
|
|
||||||
/// <param name="raw">
|
|
||||||
/// <c>false</c> (default) – returns a parsed Bill object.<br/>
|
|
||||||
/// <c>true</c> – returns raw QR text lines without parsing.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="cancellationToken">Cancellation token.</param>
|
|
||||||
public static async Task<SwissQrCodeResult> InspectSwissQrCodeAsync(
|
|
||||||
this IWorkflowsClient client,
|
|
||||||
string filePath,
|
|
||||||
bool raw = false,
|
|
||||||
CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
using var stream = File.OpenRead(filePath);
|
|
||||||
return await client.InspectSwissQrCodeAsync(stream, raw, cancellationToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -40,3 +40,32 @@ public interface IWorkflowsClient
|
|||||||
bool raw = false,
|
bool raw = false,
|
||||||
CancellationToken cancellationToken = default);
|
CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convenience extensions for <see cref="IWorkflowsClient"/> that accept a file path as input.
|
||||||
|
/// Defined alongside <see cref="IWorkflowsClient"/> so they are discoverable without an additional using directive.
|
||||||
|
/// </summary>
|
||||||
|
public static class WorkflowsClientExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Validates the PDF at <paramref name="filePath"/> and attempts Swiss QR Code extraction
|
||||||
|
/// in a single call. Opens a <see cref="FileStream"/> and delegates to
|
||||||
|
/// <see cref="IWorkflowsClient.InspectSwissQrCodeAsync(Stream, bool, CancellationToken)"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client">The workflows client.</param>
|
||||||
|
/// <param name="filePath">Absolute or relative path to the PDF file.</param>
|
||||||
|
/// <param name="raw">
|
||||||
|
/// <c>false</c> (default) – returns a parsed Bill object.<br/>
|
||||||
|
/// <c>true</c> – returns raw QR text lines without parsing.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
public static async Task<SwissQrCodeResult> InspectSwissQrCodeAsync(
|
||||||
|
this IWorkflowsClient client,
|
||||||
|
string filePath,
|
||||||
|
bool raw = false,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
using var stream = File.OpenRead(filePath);
|
||||||
|
return await client.InspectSwissQrCodeAsync(stream, raw, cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user