From 0e22ffb2c5d9c1bd659ac8e770c444c5a2a322f0 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 31 Aug 2026 15:35:14 +0200 Subject: [PATCH] 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. --- .../Clients/WorkflowsClient.cs | 31 +------------------ .../Interfaces/IWorkflowsClient.cs | 29 +++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DocumentService.Client/Clients/WorkflowsClient.cs b/DocumentService.Client/Clients/WorkflowsClient.cs index bc3e17a..823b37e 100644 --- a/DocumentService.Client/Clients/WorkflowsClient.cs +++ b/DocumentService.Client/Clients/WorkflowsClient.cs @@ -41,33 +41,4 @@ public class WorkflowsClient(IPdfValidationClient validation, ISwissQrCodeClient var qrCode = await swissQrCode.ExtractAsync(pdfStream, raw, cancellationToken); return new SwissQrCodeResult(qrCode, validationResult); } -} - -/// -/// Convenience extensions for that accept a file path as input. -/// Defined alongside so they are discoverable without an additional using directive. -/// -public static class WorkflowsClientExtensions -{ - /// - /// Validates the PDF at and attempts Swiss QR Code extraction - /// in a single call. Opens a and delegates to - /// . - /// - /// The workflows client. - /// Absolute or relative path to the PDF file. - /// - /// false (default) – returns a parsed Bill object.
- /// true – returns raw QR text lines without parsing. - /// - /// Cancellation token. - public static async Task 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); - } -} +} \ No newline at end of file diff --git a/DocumentService.Client/Interfaces/IWorkflowsClient.cs b/DocumentService.Client/Interfaces/IWorkflowsClient.cs index 93400cc..52d8e47 100644 --- a/DocumentService.Client/Interfaces/IWorkflowsClient.cs +++ b/DocumentService.Client/Interfaces/IWorkflowsClient.cs @@ -40,3 +40,32 @@ public interface IWorkflowsClient bool raw = false, CancellationToken cancellationToken = default); } + +/// +/// Convenience extensions for that accept a file path as input. +/// Defined alongside so they are discoverable without an additional using directive. +/// +public static class WorkflowsClientExtensions +{ + /// + /// Validates the PDF at and attempts Swiss QR Code extraction + /// in a single call. Opens a and delegates to + /// . + /// + /// The workflows client. + /// Absolute or relative path to the PDF file. + /// + /// false (default) – returns a parsed Bill object.
+ /// true – returns raw QR text lines without parsing. + /// + /// Cancellation token. + public static async Task 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); + } +} \ No newline at end of file