From a5887a2387c5f3e5033d6447a490322a5ea8c674 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 17 Aug 2026 23:51:51 +0100 Subject: [PATCH] feat(postit): wire Circle + BlogAcl clients in the DI container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit App.axaml.cs is the composition root for PostIt. It now also builds and registers: - CircleApiClient (singleton) — backed by the same YavscApiClient and the same blogs base URL as BlogApiClient - BlogAclApiClient (singleton) — same shape - IYavscApiClient -> YavscApiClient mapping (singleton). The concrete class is still resolvable as YavscApiClient; the new registration makes the same instance available as IYavscApiClient so future consumers (and unit tests) can take the interface without coupling to the concrete type. The 3 high-level clients are singletons: they hold no mutable state of their own, just a reference to YavscApiClient and a base URL. Reusing the same instance across requests is what the HttpClient inside YavscApiClient was already designed for. --- src/PostIt/PostIt/App.axaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PostIt/PostIt/App.axaml.cs b/src/PostIt/PostIt/App.axaml.cs index 4a250ebe..033dbd09 100644 --- a/src/PostIt/PostIt/App.axaml.cs +++ b/src/PostIt/PostIt/App.axaml.cs @@ -57,6 +57,8 @@ public partial class App : Application var api = new YavscApiClient(settings, tokenStore); var client = new BlogApiClient(api, settings.BlogsApiUrl); + var circleClient = new CircleApiClient(api, settings.BlogsApiUrl); + var blogAclClient = new BlogAclApiClient(api, settings.BlogsApiUrl); var services = new ServiceCollection(); @@ -79,8 +81,11 @@ public partial class App : Application // ViewModels services.AddSingleton(settings); - services.AddSingleton(api); + services.AddSingleton(api); + services.AddSingleton(api); services.AddSingleton(client); + services.AddSingleton(circleClient); + services.AddSingleton(blogAclClient); services.AddTransient(); services.AddTransient(); services.AddTransient();