From 3b8b315feab14f200d6e0889160e8d770395814c Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 25 Nov 2024 10:42:22 +0100 Subject: [PATCH] refactor(IHttpClientOptions): removed --- .../Client/IHttpClientOptions.cs | 13 ------------- .../Client/IHttpClientService.cs | 2 +- DigitalData.Core.Client/DIExtensions.cs | 2 +- DigitalData.Core.Client/HttpClientOptions.cs | 12 +++++------- DigitalData.Core.Client/ServiceFactory.cs | 2 +- 5 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 DigitalData.Core.Abstractions/Client/IHttpClientOptions.cs diff --git a/DigitalData.Core.Abstractions/Client/IHttpClientOptions.cs b/DigitalData.Core.Abstractions/Client/IHttpClientOptions.cs deleted file mode 100644 index 5600249..0000000 --- a/DigitalData.Core.Abstractions/Client/IHttpClientOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace DigitalData.Core.Abstractions.Client -{ - public interface IHttpClientOptions - { - string Uri { get; init; } - - string? Path { get; init; } - - IEnumerable>? Headers { get; init; } - - IEnumerable>? QueryParams { get; init; } - } -} \ No newline at end of file diff --git a/DigitalData.Core.Abstractions/Client/IHttpClientService.cs b/DigitalData.Core.Abstractions/Client/IHttpClientService.cs index fc186ee..e94aaed 100644 --- a/DigitalData.Core.Abstractions/Client/IHttpClientService.cs +++ b/DigitalData.Core.Abstractions/Client/IHttpClientService.cs @@ -1,6 +1,6 @@ namespace DigitalData.Core.Abstractions.Client { - public interface IHttpClientService : IBaseHttpClientService where TClientOptions : IHttpClientOptions + public interface IHttpClientService : IBaseHttpClientService { } } \ No newline at end of file diff --git a/DigitalData.Core.Client/DIExtensions.cs b/DigitalData.Core.Client/DIExtensions.cs index 4ec3b4c..f67d2e4 100644 --- a/DigitalData.Core.Client/DIExtensions.cs +++ b/DigitalData.Core.Client/DIExtensions.cs @@ -8,7 +8,7 @@ namespace DigitalData.Core.Client { 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(); services.TryAddSingleton(); diff --git a/DigitalData.Core.Client/HttpClientOptions.cs b/DigitalData.Core.Client/HttpClientOptions.cs index da859e9..d3f07f7 100644 --- a/DigitalData.Core.Client/HttpClientOptions.cs +++ b/DigitalData.Core.Client/HttpClientOptions.cs @@ -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 string? Path { get; init; } + public string? Path { get; init; } = null; - public IEnumerable>? Headers { get; init; } + public IEnumerable>? Headers { get; init; } = null; - public IEnumerable>? QueryParams { get; init; } + public IEnumerable>? QueryParams { get; init; } = null; } } \ No newline at end of file diff --git a/DigitalData.Core.Client/ServiceFactory.cs b/DigitalData.Core.Client/ServiceFactory.cs index 7a114ec..3acefe5 100644 --- a/DigitalData.Core.Client/ServiceFactory.cs +++ b/DigitalData.Core.Client/ServiceFactory.cs @@ -19,7 +19,7 @@ namespace DigitalData.Core.Client public static T Provide() where T : notnull => _lazyProvider.Value.GetRequiredService(); - public static IHttpClientService ProvideHttpClientService() where TOptions : IHttpClientOptions + public static IHttpClientService ProvideHttpClientService() => _lazyProvider.Value.GetRequiredService>(); } } \ No newline at end of file