Files
csob/Services/ConsentsService.cs
T
JiriUhlir 09db30a3ca first
2026-06-18 11:05:46 +02:00

25 lines
886 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Text.Json.Nodes;
using Csob.Client;
namespace Csob.Services;
/// <summary>
/// Common PSU consent lifecycle (create / detail / revoke). The consent request body varies
/// across COBS profiles, so it is accepted and forwarded as raw JSON.
/// </summary>
public sealed class ConsentsService
{
private readonly CsobApiAccessor _accessor;
public ConsentsService(CsobApiAccessor accessor) => _accessor = accessor;
public Task<JsonNode?> CreateAsync(JsonNode request, CancellationToken ct)
=> _accessor.Client.PostAsync(CsobApiPaths.Consents, request, ct);
public Task<JsonNode?> DetailAsync(string id, CancellationToken ct)
=> _accessor.Client.GetAsync(CsobApiPaths.Consent(id), null, ct);
public Task<JsonNode?> DeleteAsync(string id, CancellationToken ct)
=> _accessor.Client.DeleteAsync(CsobApiPaths.Consent(id), ct);
}