revert: IHttpClientOptions entfernen
This commit is contained in:
parent
52a7664e57
commit
f602a842be
13
DigitalData.Core.Abstractions/Client/IHttpClientOptions.cs
Normal file
13
DigitalData.Core.Abstractions/Client/IHttpClientOptions.cs
Normal file
@ -0,0 +1,13 @@
|
||||
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
|
||||
{
|
||||
public interface IHttpClientService<TClientOptions> : IBaseHttpClientService
|
||||
public interface IHttpClientService<TClientOptions> : IBaseHttpClientService where TClientOptions : IHttpClientOptions
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,15 @@
|
||||
namespace DigitalData.Core.Client
|
||||
using DigitalData.Core.Abstractions.Client;
|
||||
|
||||
namespace DigitalData.Core.Client
|
||||
{
|
||||
public class HttpClientOptions
|
||||
public class HttpClientOptions : IHttpClientOptions
|
||||
{
|
||||
public required string Uri { get; init; }
|
||||
|
||||
public string? Path { get; init; } = null;
|
||||
public string? Path { get; init; }
|
||||
|
||||
public IEnumerable<KeyValuePair<string, object>>? Headers { get; init; } = null;
|
||||
public IEnumerable<KeyValuePair<string, object>>? Headers { get; init; }
|
||||
|
||||
public IEnumerable<KeyValuePair<string, object?>>? QueryParams { get; init; } = null;
|
||||
public IEnumerable<KeyValuePair<string, object?>>? QueryParams { get; init; }
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace DigitalData.Core.Client
|
||||
|
||||
public static T Provide<T>() where T : notnull => _lazyProvider.Value.GetRequiredService<T>();
|
||||
|
||||
public static IHttpClientService<TOptions> ProvideHttpClientService<TOptions>()
|
||||
public static IHttpClientService<TOptions> ProvideHttpClientService<TOptions>() where TOptions : IHttpClientOptions
|
||||
=> _lazyProvider.Value.GetRequiredService<IHttpClientService<TOptions>>();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user