Quick registration of API clients
$ dotnet add package LSL.HttpClients.ServiceProviderAllows for easy registration of multiple clients for a single HttpClient.
Registering by assembly for every type that implements IClient:
using LSL.HttpClients.ServiceProvider;
...
serviceCollection.AddHttpClientForClientsFromAssembly(
typeof(HttpClientServiceCollectionExtensionsTests).Assembly,
t => t.IsAssignableTo(typeof(IClient)),
t => t);
Registering by type from an assembly of the type IClient:
using LSL.HttpClients.ServiceProvider;
...
serviceCollection.AddHttpClientForClientsFromAssemblyOf<IClient>(
t => t.IsAssignableTo(typeof(IClient)),
t => t);