more flex and filters

This commit is contained in:
JiriUhlir
2026-07-14 06:21:37 +02:00
parent 1a898b95f9
commit d9e3c59d69
15 changed files with 488 additions and 32 deletions
+31
View File
@@ -0,0 +1,31 @@
using IdokladSdk.Enums;
using IdokladSdk.Models.Report;
using Idoklad.Client;
namespace Idoklad.Services;
/// <summary>
/// Document PDF exports (iDoklad Reports). Each method returns the report as a Base64-encoded
/// string — the iDoklad API's native representation; decode it to obtain the raw PDF bytes.
/// </summary>
public sealed class ReportsService
{
private readonly IdokladApiAccessor _accessor;
public ReportsService(IdokladApiAccessor accessor) => _accessor = accessor;
/// <summary>Export an issued invoice as a Base64-encoded PDF.</summary>
public async Task<string> IssuedInvoicePdfAsync(int id, Language? language, bool compressed, CancellationToken ct)
=> (await _accessor.Api.ReportClient.IssuedInvoice.Detail(id).GetAsync(Option(language, compressed), ct)).Unwrap();
/// <summary>Export a proforma (advance) invoice as a Base64-encoded PDF.</summary>
public async Task<string> ProformaInvoicePdfAsync(int id, Language? language, bool compressed, CancellationToken ct)
=> (await _accessor.Api.ReportClient.ProformaInvoice.Detail(id).GetAsync(Option(language, compressed), ct)).Unwrap();
/// <summary>Export a credit note as a Base64-encoded PDF.</summary>
public async Task<string> CreditNotePdfAsync(int id, Language? language, bool compressed, CancellationToken ct)
=> (await _accessor.Api.ReportClient.CreditNote.Detail(id).GetAsync(Option(language, compressed), ct)).Unwrap();
private static ExtendedReportOption Option(Language? language, bool compressed)
=> new() { Language = language, Compressed = compressed };
}