mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-02 16:01:36 -05:00
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>
25 lines
746 B
C#
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();
|
|
}
|
|
}
|