Skip to content

Commit 681672d

Browse files
committed
Add optional division filtering to GetPrinterLabelAsync method
- Add optional int? divisionId parameter with default value of null - Use Flurl.Http SetQueryParam for proper URL encoding of query parameters - Update XML documentation to describe the new filtering capability - Maintain backward compatibility for existing code - When divisionId is provided, API is called with query parameter: printer-label?divisionId={value} - When divisionId is null, API is called without query parameter: printer-label
1 parent 9c56980 commit 681672d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ProReception.DistributionServerInfrastructure/ProReceptionApi/PrinterLabel/PrinterLabelExtensions.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99
[PublicAPI]
1010
public static class PrinterLabelExtensions
1111
{
12-
public static async Task<LabelResponse?> GetPrinterLabelAsync(this IProReceptionApiClient proReceptionApiClient)
12+
/// <summary>
13+
/// Retrieves printer label data from the Pro Reception API with optional division filtering.
14+
/// </summary>
15+
/// <param name="proReceptionApiClient">The API client instance.</param>
16+
/// <param name="divisionId">Optional division ID to filter labels. When null, retrieves labels for all divisions.</param>
17+
/// <returns>A <see cref="LabelResponse"/> containing the label file data and version, or null if no label is found (HTTP 404).</returns>
18+
public static async Task<LabelResponse?> GetPrinterLabelAsync(this IProReceptionApiClient proReceptionApiClient, int? divisionId = null)
1319
{
1420
try
1521
{
16-
var response = await proReceptionApiClient.GetRaw("printer-label");
22+
var url = new Flurl.Url("printer-label");
23+
if (divisionId.HasValue)
24+
{
25+
url.SetQueryParam("divisionId", divisionId.Value);
26+
}
27+
var response = await proReceptionApiClient.GetRaw(url.ToString());
1728

1829
return new LabelResponse
1930
{

0 commit comments

Comments
 (0)