merge options
This commit is contained in:
parent
2e59c090a8
commit
ce33b50953
@ -3,4 +3,6 @@
|
|||||||
public class ClientOptions
|
public class ClientOptions
|
||||||
{
|
{
|
||||||
public int ApiVersion { get; set; } = 1;
|
public int ApiVersion { get; set; } = 1;
|
||||||
|
|
||||||
|
public string? ApiKey { get; set; }
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Leanetec.EConnect.Client.Interface;
|
using Leanetec.EConnect.Client;
|
||||||
|
using Leanetec.EConnect.Client.Interface;
|
||||||
using Leanetec.EConnect.Domain.Entities;
|
using Leanetec.EConnect.Domain.Entities;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
@ -7,13 +8,13 @@ namespace Leanetec.EConnect.Infrastructure;
|
|||||||
|
|
||||||
public class EConnectClient<TError> : IEConnectClient<TError> where TError : class
|
public class EConnectClient<TError> : IEConnectClient<TError> where TError : class
|
||||||
{
|
{
|
||||||
private readonly EConnectClientOptions _options;
|
private readonly ClientOptions _options;
|
||||||
|
|
||||||
private readonly Lazy<HttpClient> LazyHttp;
|
private readonly Lazy<HttpClient> LazyHttp;
|
||||||
|
|
||||||
private HttpClient Http => LazyHttp.Value;
|
private HttpClient Http => LazyHttp.Value;
|
||||||
|
|
||||||
public EConnectClient(IOptions<EConnectClientOptions> options, IHttpClientFactory httpFactory)
|
public EConnectClient(IOptions<ClientOptions> options, IHttpClientFactory httpFactory)
|
||||||
{
|
{
|
||||||
_options = options.Value;
|
_options = options.Value;
|
||||||
LazyHttp = new Lazy<HttpClient>(httpFactory.CreateEConnectClient);
|
LazyHttp = new Lazy<HttpClient>(httpFactory.CreateEConnectClient);
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
namespace Leanetec.EConnect.Infrastructure;
|
|
||||||
|
|
||||||
public class EConnectClientOptions
|
|
||||||
{
|
|
||||||
public string? ApiKey { get; set; }
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user