AuthenticatedApiClient.cs
1 namespace GUNRPG.ConsoleClient.Auth; 2 3 /// <summary> 4 /// Provides the shared <see cref="System.Net.Http.HttpClient"/> instance that has 5 /// <see cref="GUNRPG.ConsoleClient.Identity.AuthDelegatingHandler"/> attached. 6 /// 7 /// The handler injects Bearer tokens and transparently handles 401 responses 8 /// (silent refresh → device-code re-login), so all callers benefit from 9 /// authenticated API access without any per-call auth logic. 10 /// 11 /// Game code should use <see cref="Http"/> to make API calls rather than 12 /// constructing raw <see cref="System.Net.Http.HttpClient"/> instances. 13 /// </summary> 14 public sealed class AuthenticatedApiClient 15 { 16 /// <summary>The authenticated HTTP client. Use this to make game API calls.</summary> 17 public HttpClient Http { get; } 18 19 public AuthenticatedApiClient(HttpClient http) 20 { 21 Http = http; 22 } 23 }