more flex and filters
This commit is contained in:
@@ -21,10 +21,24 @@ public sealed class ContactsController : ControllerBase
|
||||
|
||||
public ContactsController(ContactsService service) => _service = service;
|
||||
|
||||
/// <summary>List contacts (paged).</summary>
|
||||
/// <summary>
|
||||
/// List contacts (paged, optionally filtered and sorted).
|
||||
/// </summary>
|
||||
/// <param name="filter">
|
||||
/// Optional iDoklad-style filter, e.g. <c>(IdentificationNumber~eq~12345678)</c> or
|
||||
/// <c>(CompanyName~ct~s.r.o.)</c>. Operators: eq, neq, gt, gte, lt, lte, ct, nct.
|
||||
/// </param>
|
||||
/// <param name="filtertype">How multiple conditions combine: <c>and</c> (default) or <c>or</c>.</param>
|
||||
/// <param name="sort">Optional sort, e.g. <c>CompanyName~asc</c>.</param>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> List([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> List(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
|
||||
/// <summary>Get a contact detail by id.</summary>
|
||||
[HttpGet("{id:int}")]
|
||||
|
||||
@@ -18,10 +18,24 @@ public sealed class IssuedInvoicesController : ControllerBase
|
||||
|
||||
public IssuedInvoicesController(IssuedInvoicesService service) => _service = service;
|
||||
|
||||
/// <summary>List issued invoices (paged).</summary>
|
||||
/// <summary>
|
||||
/// List issued invoices (paged, optionally filtered and sorted).
|
||||
/// </summary>
|
||||
/// <param name="filter">
|
||||
/// Optional iDoklad-style filter, e.g. <c>(DateOfTaxing~gte~2024-01-01),(IsPaid~eq~false)</c>.
|
||||
/// Operators: eq, neq, gt, gte, lt, lte, ct (contains), nct (not contains).
|
||||
/// </param>
|
||||
/// <param name="filtertype">How multiple conditions combine: <c>and</c> (default) or <c>or</c>.</param>
|
||||
/// <param name="sort">Optional sort, e.g. <c>DateOfIssue~desc,Id~asc</c>.</param>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> List([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> List(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
|
||||
/// <summary>Get an issued invoice detail by id.</summary>
|
||||
[HttpGet("{id:int}")]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using IdokladSdk.Models.Email;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Idoklad.Services;
|
||||
|
||||
namespace Idoklad.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Sends document e-mails through iDoklad. The request body carries the settings: the document id
|
||||
/// (<c>DocumentId</c>), recipients (<c>OtherRecipients</c>, <c>SendToPartner</c>, <c>SendToSelf</c>,
|
||||
/// <c>SendToAccountant</c>), optional subject/body and report language. Requires iDoklad credentials
|
||||
/// (headers or environment defaults).
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("mail")]
|
||||
[Produces("application/json")]
|
||||
[Tags("Mail")]
|
||||
public sealed class MailController : ControllerBase
|
||||
{
|
||||
private readonly MailService _service;
|
||||
|
||||
public MailController(MailService service) => _service = service;
|
||||
|
||||
/// <summary>Send an issued invoice by e-mail.</summary>
|
||||
[HttpPost("issued-invoices/send")]
|
||||
public async Task<IActionResult> SendIssuedInvoice([FromBody] IssuedInvoiceEmailSettings settings, CancellationToken ct)
|
||||
=> Ok(await _service.SendIssuedInvoiceAsync(settings, ct));
|
||||
|
||||
/// <summary>Send a proforma (advance) invoice by e-mail.</summary>
|
||||
[HttpPost("proforma-invoices/send")]
|
||||
public async Task<IActionResult> SendProformaInvoice([FromBody] ProformaInvoiceEmailSettings settings, CancellationToken ct)
|
||||
=> Ok(await _service.SendProformaInvoiceAsync(settings, ct));
|
||||
|
||||
/// <summary>Send a credit note by e-mail.</summary>
|
||||
[HttpPost("credit-notes/send")]
|
||||
public async Task<IActionResult> SendCreditNote([FromBody] CreditNoteEmailSettings settings, CancellationToken ct)
|
||||
=> Ok(await _service.SendCreditNoteAsync(settings, ct));
|
||||
|
||||
/// <summary>Send a received invoice by e-mail.</summary>
|
||||
[HttpPost("received-invoices/send")]
|
||||
public async Task<IActionResult> SendReceivedInvoice([FromBody] ReceivedInvoiceEmailSettings settings, CancellationToken ct)
|
||||
=> Ok(await _service.SendReceivedInvoiceAsync(settings, ct));
|
||||
|
||||
/// <summary>Send payment reminders by e-mail.</summary>
|
||||
[HttpPost("reminders/send")]
|
||||
public async Task<IActionResult> SendReminders([FromBody] RemindersEmailSettings settings, CancellationToken ct)
|
||||
=> Ok(await _service.SendRemindersAsync(settings, ct));
|
||||
}
|
||||
@@ -18,10 +18,21 @@ public sealed class ReceivedInvoicesController : ControllerBase
|
||||
|
||||
public ReceivedInvoicesController(ReceivedInvoicesService service) => _service = service;
|
||||
|
||||
/// <summary>List received invoices (paged).</summary>
|
||||
/// <summary>
|
||||
/// List received invoices (paged, optionally filtered and sorted).
|
||||
/// </summary>
|
||||
/// <param name="filter">Optional iDoklad-style filter (see IssuedInvoices for the syntax).</param>
|
||||
/// <param name="filtertype">How multiple conditions combine: <c>and</c> (default) or <c>or</c>.</param>
|
||||
/// <param name="sort">Optional sort, e.g. <c>DateOfReceiving~desc</c>.</param>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> List([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> List(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
|
||||
/// <summary>Get a received invoice detail by id.</summary>
|
||||
[HttpGet("{id:int}")]
|
||||
|
||||
@@ -20,10 +20,16 @@ public sealed class RegistersController : ControllerBase
|
||||
|
||||
// ---- Bank accounts ----
|
||||
|
||||
/// <summary>List bank accounts (paged).</summary>
|
||||
/// <summary>List bank accounts (paged, optionally filtered and sorted).</summary>
|
||||
[HttpGet("bank-accounts")]
|
||||
public async Task<IActionResult> ListBankAccounts([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListBankAccountsAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> ListBankAccounts(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListBankAccountsAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
|
||||
/// <summary>Get a bank account detail by id.</summary>
|
||||
[HttpGet("bank-accounts/{id:int}")]
|
||||
@@ -47,10 +53,16 @@ public sealed class RegistersController : ControllerBase
|
||||
|
||||
// ---- VAT rates (read-only) ----
|
||||
|
||||
/// <summary>List VAT rates (paged).</summary>
|
||||
/// <summary>List VAT rates (paged, optionally filtered and sorted).</summary>
|
||||
[HttpGet("vat-rates")]
|
||||
public async Task<IActionResult> ListVatRates([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListVatRatesAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> ListVatRates(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListVatRatesAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
|
||||
/// <summary>Get a VAT rate detail by id.</summary>
|
||||
[HttpGet("vat-rates/{id:int}")]
|
||||
@@ -59,8 +71,14 @@ public sealed class RegistersController : ControllerBase
|
||||
|
||||
// ---- Numeric sequences (read-only) ----
|
||||
|
||||
/// <summary>List numeric (document) sequences (paged).</summary>
|
||||
/// <summary>List numeric (document) sequences (paged, optionally filtered and sorted).</summary>
|
||||
[HttpGet("numeric-sequences")]
|
||||
public async Task<IActionResult> ListNumericSequences([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListNumericSequencesAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> ListNumericSequences(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListNumericSequencesAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
}
|
||||
|
||||
@@ -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