diff --git a/HADotNet.Core/ClientFactory.cs b/HADotNet.Core/ClientFactory.cs
index 4625636..98c03fb 100644
--- a/HADotNet.Core/ClientFactory.cs
+++ b/HADotNet.Core/ClientFactory.cs
@@ -41,6 +41,30 @@ public static void Initialize(Uri instanceAddress, string apiKey)
IsInitialized = true;
}
+ ///
+ /// Initializes the client factory with the specified and which are forwarded to clients instantiated from this factory.
+ /// Allows specifying the to allow further configuring.
+ ///
+ ///
+ ///
+ ///
+ public static void Initialize(Uri instanceAddress, string apiKey, HttpClientHandler handler)
+ {
+ Client = new HttpClient(handler)
+ {
+ BaseAddress = instanceAddress,
+ DefaultRequestHeaders =
+ {
+ Authorization = new AuthenticationHeaderValue("Bearer", apiKey),
+ AcceptEncoding =
+ {
+ new StringWithQualityHeaderValue("identity")
+ }
+ }
+ };
+ IsInitialized = true;
+ }
+
///
/// Initializes the client factory with the specified and which are forwarded to clients instantiated from this factory.
///
@@ -48,6 +72,15 @@ public static void Initialize(Uri instanceAddress, string apiKey)
/// The Home Assistant long-lived access token.
public static void Initialize(string instanceAddress, string apiKey) => Initialize(new Uri(instanceAddress), apiKey);
+ ///
+ /// Initializes the client factory with the specified and which are forwarded to clients instantiated from this factory.
+ /// Allows specifying the to allow further configuring.
+ ///
+ ///
+ ///
+ ///
+ public static void Initialize(string instanceAddress, string apiKey, HttpClientHandler handler) => Initialize(new Uri(instanceAddress), apiKey, handler);
+
///
/// Resets the Client Factory to its initial state (not initialized).
///
@@ -72,5 +105,6 @@ public static void Reset()
/// Thrown if this is not initialized (call first).
/// A new instance of the specified type.
public static TClient GetClient() where TClient : BaseClient => (TClient)Activator.CreateInstance(typeof(TClient), Client);
+
}
}