mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-04 04:18:13 +10:00
- 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
22 lines
786 B
C#
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.");
|
|
}
|
|
}
|