refactor(IHttpClientOptions): removed
This commit is contained in:
parent
c65eefb954
commit
3b8b315fea
@ -1,13 +0,0 @@
|
|||||||
namespace DigitalData.Core.Abstractions.Client
|
|
||||||
{
|
|
||||||
public interface IHttpClientOptions
|
|
||||||
{
|
|
||||||
string Uri { get; init; }
|
|
||||||
|
|
||||||
string? Path { get; init; }
|
|
||||||
|
|
||||||
IEnumerable<KeyValuePair<string, object>>? Headers { get; init; }
|
|
||||||
|
|
||||||
IEnumerable<KeyValuePair<string, object?>>? QueryParams { get; init; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
namespace DigitalData.Core.Abstractions.Client
|
namespace DigitalData.Core.Abstractions.Client
|
||||||
{
|
{
|
||||||
public interface IHttpClientService<TClientOptions> : IBaseHttpClientService where TClientOptions : IHttpClientOptions
|
public interface IHttpClientService<TClientOptions> : IBaseHttpClientService
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@ namespace DigitalData.Core.Client
|
|||||||
{
|
{
|
||||||
public static class DIExtensions
|
public static class DIExtensions
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddHttpClientService(this IServiceCollection services, IConfigurationSection? section)
|
public static IServiceCollection AddHttpClientService(this IServiceCollection services, IConfigurationSection? section = null)
|
||||||
{
|
{
|
||||||
services.TryAddSingleton<HttpClient>();
|
services.TryAddSingleton<HttpClient>();
|
||||||
services.TryAddSingleton<CookieContainer>();
|
services.TryAddSingleton<CookieContainer>();
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
using DigitalData.Core.Abstractions.Client;
|
namespace DigitalData.Core.Client
|
||||||
|
|
||||||
namespace DigitalData.Core.Client
|
|
||||||
{
|
{
|
||||||
public class HttpClientOptions : IHttpClientOptions
|
public class HttpClientOptions
|
||||||
{
|
{
|
||||||
public required string Uri { get; init; }
|
public required string Uri { get; init; }
|
||||||
|
|
||||||
public string? Path { get; init; }
|
public string? Path { get; init; } = null;
|
||||||
|
|
||||||
public IEnumerable<KeyValuePair<string, object>>? Headers { get; init; }
|
public IEnumerable<KeyValuePair<string, object>>? Headers { get; init; } = null;
|
||||||
|
|
||||||
public IEnumerable<KeyValuePair<string, object?>>? QueryParams { get; init; }
|
public IEnumerable<KeyValuePair<string, object?>>? QueryParams { get; init; } = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ namespace DigitalData.Core.Client
|
|||||||
|
|
||||||
public static T Provide<T>() where T : notnull => _lazyProvider.Value.GetRequiredService<T>();
|
public static T Provide<T>() where T : notnull => _lazyProvider.Value.GetRequiredService<T>();
|
||||||
|
|
||||||
public static IHttpClientService<TOptions> ProvideHttpClientService<TOptions>() where TOptions : IHttpClientOptions
|
public static IHttpClientService<TOptions> ProvideHttpClientService<TOptions>()
|
||||||
=> _lazyProvider.Value.GetRequiredService<IHttpClientService<TOptions>>();
|
=> _lazyProvider.Value.GetRequiredService<IHttpClientService<TOptions>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user