merge options

This commit is contained in:
Developer 02 2025-08-14 18:20:08 +02:00
parent 2e59c090a8
commit ce33b50953
3 changed files with 6 additions and 9 deletions

View File

@ -3,4 +3,6 @@
public class ClientOptions
{
public int ApiVersion { get; set; } = 1;
public string? ApiKey { get; set; }
}

View File

@ -1,4 +1,5 @@
using Leanetec.EConnect.Client.Interface;
using Leanetec.EConnect.Client;
using Leanetec.EConnect.Client.Interface;
using Leanetec.EConnect.Domain.Entities;
using Microsoft.Extensions.Options;
using System.Net.Http.Json;
@ -7,13 +8,13 @@ namespace Leanetec.EConnect.Infrastructure;
public class EConnectClient<TError> : IEConnectClient<TError> where TError : class
{
private readonly EConnectClientOptions _options;
private readonly ClientOptions _options;
private readonly Lazy<HttpClient> LazyHttp;
private HttpClient Http => LazyHttp.Value;
public EConnectClient(IOptions<EConnectClientOptions> options, IHttpClientFactory httpFactory)
public EConnectClient(IOptions<ClientOptions> options, IHttpClientFactory httpFactory)
{
_options = options.Value;
LazyHttp = new Lazy<HttpClient>(httpFactory.CreateEConnectClient);

View File

@ -1,6 +0,0 @@
namespace Leanetec.EConnect.Infrastructure;
public class EConnectClientOptions
{
public string? ApiKey { get; set; }
}