Interface IHttpClientFactoryService
- Namespace
 - FoundationaLLM.Common.Interfaces
 
- Assembly
 - FoundationaLLM.Common.dll
 
Service that provides a common interface for creating HttpClient instances from IHttpClientFactory. and ensures that all necessary headers are added to the request.
public interface IHttpClientFactoryService
  - Extension Methods
 
Methods
CreateClient(APIEndpointConfiguration, UnifiedUserIdentity?)
Creates a HttpClient instance based on the endpoint configuration.
Task<HttpClient> CreateClient(APIEndpointConfiguration endpointConfiguration, UnifiedUserIdentity? userIdentity)
  Parameters
endpointConfigurationAPIEndpointConfigurationThe APIEndpointConfiguration resource used to create the client.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity of the caller requesting the client.
Returns
- Task<HttpClient>
 An HttpClient instance.
CreateClient(string, string, UnifiedUserIdentity)
Creates a HttpClient instance based on the client name. The client name must be registered in the IHttpClientFactory configuration.
Task<HttpClient> CreateClient(string instanceId, string clientName, UnifiedUserIdentity userIdentity)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
clientNamestringThe name of the HTTP client to create. This name must be registered as an APIEndpointConfiguration resource in the FoundationaLLM.Configuration resource provider.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity of the caller requesting the client.
Returns
- Task<HttpClient>
 An HttpClient instance.
CreateClientForStatus(string, string, UnifiedUserIdentity)
Creates a HttpClient instance based on the client name and sets the base address to the status endpoint. The client name must be registered in the IHttpClientFactory configuration.
Task<HttpClient> CreateClientForStatus(string instanceId, string clientName, UnifiedUserIdentity userIdentity)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
clientNamestringThe name of the HTTP client to create. This name must be registered as an APIEndpointConfiguration resource in the FoundationaLLM.Configuration resource provider.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity of the caller requesting the client.
Returns
- Task<HttpClient>
 An HttpClient instance.
Exceptions
- Exception
 When if the service base address is null or the status endpoint is null or empty.
CreateClient<T>(string, string, UnifiedUserIdentity, Func<Dictionary<string, object>, T>, Dictionary<string, object>?)
Creates a T client instance based on the client name and a client builder delegate.
Task<T> CreateClient<T>(string instanceId, string clientName, UnifiedUserIdentity userIdentity, Func<Dictionary<string, object>, T> clientBuilder, Dictionary<string, object>? clientBuilderParameters = null)
  Parameters
instanceIdstringThe FoundationaLLM instance identifier.
clientNamestringThe name of the HTTP client to create. This name must be registered as an APIEndpointConfiguration resource in the FoundationaLLM.Configuration resource provider.
userIdentityUnifiedUserIdentityThe UnifiedUserIdentity of the caller requesting the client.
clientBuilderFunc<Dictionary<string, object>, T>A delegate that creates the
Tclient instance based on a dictionary of values. The keys available in the dictionary are defined in HttpClientFactoryServiceKeyNames.clientBuilderParametersDictionary<string, object>A dictionary of parameters to pass to the client builder delegate.
Returns
- Task<T>
 A
Tclient instance.
Type Parameters
TThe type of the client to create.