Files
dnsmasq-webui/src/DnsmasqWebUI/Infrastructure/Client/ReloadClient.cs
T
alex b44dde2c77 Refactor: reorganise namespaces and move service DTOs to Models/Contracts
- Move Client/Http, Services, Parsers under Infrastructure/ (Client, Services, Parsers)
- Move config helpers (DnsmasqConfKeys, DnsmasqOptionTooltips, DnsmasqFileEncoding, EffectiveConfigFieldBuilder) to Infrastructure/Helpers/Config; ApiJsonOptions to Helpers/Http
- Move Configuration types (ApplicationOptions, DnsmasqOptions, DnsmasqOptionsValidator) to Models/Config
- Merge Models/Status and Models/EffectiveConfig into Models/Dnsmasq and Models/Dnsmasq/EffectiveConfig
- Move Client/Models and Client/Services to Models/Client and Infrastructure/Services
- Move ConfigSetSnapshot, HostsSnapshot, ProcessRunResult, ManagedConfigContent from Infrastructure/Services/Abstractions to Models/Contracts
- Update all namespaces and usings; tests pass
2026-02-05 23:08:40 +10:00

22 lines
786 B
C#

using DnsmasqWebUI.Infrastructure.Client.Abstractions;
using DnsmasqWebUI.Infrastructure.Helpers.Http;
using DnsmasqWebUI.Infrastructure.Services.Abstractions;
using System.Net.Http.Json;
namespace DnsmasqWebUI.Infrastructure.Client;
public sealed class ReloadClient : IReloadClient
{
private readonly HttpClient _http;
public ReloadClient(HttpClient http) => _http = http;
public async Task<ReloadResult> ReloadAsync(CancellationToken ct = default)
{
var response = await _http.PostAsync("api/reload", null, ct);
response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync<ReloadResult>(ApiJsonOptions.ClientOptions, ct)
?? throw new InvalidOperationException("Unexpected null from api/reload.");
}
}