Files
OpenNest/OpenNest.Data/NestServerClient.cs
T
ajandClaude Opus 5.5 082a50bbcd refactor: remove duplicated client, geometry and desktop code
Share the nest server client setup and page validation, entity endpoints,
post marker checks and the repeated desktop list, cut-time and busy-warning
code. Persistence tests use NestArchiveJson. No behavior change intended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:13:26 -04:00

25 lines
746 B
C#

namespace OpenNest.Data;
/// <summary>The connection every nest server client holds: its HTTP client and the server's base address.</summary>
public abstract class NestServerClient : IDisposable
{
private protected readonly HttpClient _httpClient;
private readonly bool _ownsClient;
private readonly Uri _baseUri;
private protected NestServerClient(HttpClient httpClient, string baseUrl, bool ownsClient)
{
_httpClient = httpClient;
_ownsClient = ownsClient;
_baseUri = ServerUrl.ParseBase(baseUrl, nameof(baseUrl));
}
private protected Uri Url(string relative) => new(_baseUri, relative);
public void Dispose()
{
if (_ownsClient)
_httpClient.Dispose();
}
}