more flex and filters
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using IdokladSdk.Enums;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Document PDF exports (iDoklad Reports). Each endpoint returns the document as a
|
||||
/// Base64-encoded string (the iDoklad API's native representation). Requires iDoklad credentials
|
||||
/// (headers or environment defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("reports")]
|
||||
[Produces("application/json")]
|
||||
[Tags("Reports")]
|
||||
public sealed class ReportsController : ControllerBase
|
||||
{
|
||||
private readonly ReportsService _service;
|
||||
|
||||
public ReportsController(ReportsService service) => _service = service;
|
||||
|
||||
/// <summary>Export an issued invoice as a Base64-encoded PDF.</summary>
|
||||
/// <param name="language">Optional report language: Cz, Sk, En or De.</param>
|
||||
/// <param name="compressed">When true, the returned PDF is compressed.</param>
|
||||
[HttpGet("issued-invoices/{id:int}/pdf")]
|
||||
public async Task<IActionResult> IssuedInvoicePdf(int id, [FromQuery] Language? language = null, [FromQuery] bool compressed = false, CancellationToken ct = default)
|
||||
=> Ok(await _service.IssuedInvoicePdfAsync(id, language, compressed, ct));
|
||||
|
||||
/// <summary>Export a proforma (advance) invoice as a Base64-encoded PDF.</summary>
|
||||
[HttpGet("proforma-invoices/{id:int}/pdf")]
|
||||
public async Task<IActionResult> ProformaInvoicePdf(int id, [FromQuery] Language? language = null, [FromQuery] bool compressed = false, CancellationToken ct = default)
|
||||
=> Ok(await _service.ProformaInvoicePdfAsync(id, language, compressed, ct));
|
||||
|
||||
/// <summary>Export a credit note as a Base64-encoded PDF.</summary>
|
||||
[HttpGet("credit-notes/{id:int}/pdf")]
|
||||
public async Task<IActionResult> CreditNotePdf(int id, [FromQuery] Language? language = null, [FromQuery] bool compressed = false, CancellationToken ct = default)
|
||||
=> Ok(await _service.CreditNotePdfAsync(id, language, compressed, ct));
|
||||
}
|
||||
Reference in New Issue
Block a user