Add DependencyInjection support for ReCClient

Introduced a `DependencyInjection` class in the `ReC.Client`
namespace to enable dependency injection for `ReCClient`.

Added an `AddRecClient` extension method for `IServiceCollection`
to register an `HttpClient` with a configurable `apiUri` as the
base address.

Included conditional `using System;` for .NET Framework
compatibility and added `Microsoft.Extensions.DependencyInjection`
to support DI services.
This commit is contained in:
Developer 02 2025-12-05 23:23:17 +01:00
parent 4ee79d6cd8
commit 8cad1df95d

View File

@ -0,0 +1,18 @@
using Microsoft.Extensions.DependencyInjection;
#if NETFRAMEWORK
using System;
#endif
namespace ReC.Client
{
public static class DependencyInjection
{
public static IHttpClientBuilder AddRecClient(this IServiceCollection services, string apiUri)
{
return services.AddHttpClient(ReCClient.ClientName, client =>
{
client.BaseAddress = new Uri(apiUri);
});
}
}
}