diff --git a/src/FilterLists.Agent/Core/List/IListRepository.cs b/src/FilterLists.Agent/Core/Lists/IListRepository.cs similarity index 85% rename from src/FilterLists.Agent/Core/List/IListRepository.cs rename to src/FilterLists.Agent/Core/Lists/IListRepository.cs index 1ebf201cb..edd4631b8 100644 --- a/src/FilterLists.Agent/Core/List/IListRepository.cs +++ b/src/FilterLists.Agent/Core/Lists/IListRepository.cs @@ -3,7 +3,7 @@ using System.Threading; using System.Threading.Tasks; -namespace FilterLists.Agent.Core.List +namespace FilterLists.Agent.Core.Lists { public interface IListRepository { diff --git a/src/FilterLists.Agent/Core/List/IListUrlRepository.cs b/src/FilterLists.Agent/Core/Lists/IListUrlRepository.cs similarity index 85% rename from src/FilterLists.Agent/Core/List/IListUrlRepository.cs rename to src/FilterLists.Agent/Core/Lists/IListUrlRepository.cs index c5f49f0e3..5cdf82efd 100644 --- a/src/FilterLists.Agent/Core/List/IListUrlRepository.cs +++ b/src/FilterLists.Agent/Core/Lists/IListUrlRepository.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; -namespace FilterLists.Agent.Core.List +namespace FilterLists.Agent.Core.Lists { public interface IListUrlRepository { diff --git a/src/FilterLists.Agent/Core/List/ListUrl.cs b/src/FilterLists.Agent/Core/Lists/ListUrl.cs similarity index 85% rename from src/FilterLists.Agent/Core/List/ListUrl.cs rename to src/FilterLists.Agent/Core/Lists/ListUrl.cs index ddc84c959..5dab18bf4 100644 --- a/src/FilterLists.Agent/Core/List/ListUrl.cs +++ b/src/FilterLists.Agent/Core/Lists/ListUrl.cs @@ -1,7 +1,7 @@ using System; using JetBrains.Annotations; -namespace FilterLists.Agent.Core.List +namespace FilterLists.Agent.Core.Lists { [UsedImplicitly] public class ListUrl diff --git a/src/FilterLists.Agent/Core/IUrlRepository.cs b/src/FilterLists.Agent/Core/Urls/IUrlRepository.cs similarity index 56% rename from src/FilterLists.Agent/Core/IUrlRepository.cs rename to src/FilterLists.Agent/Core/Urls/IUrlRepository.cs index 7d71a1431..c6a55908d 100644 --- a/src/FilterLists.Agent/Core/IUrlRepository.cs +++ b/src/FilterLists.Agent/Core/Urls/IUrlRepository.cs @@ -2,14 +2,11 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Features.Urls.Models.ValidationResults; -namespace FilterLists.Agent.Core +namespace FilterLists.Agent.Core.Urls { public interface IUrlRepository { Task> GetAllAsync(CancellationToken cancellationToken); - - Task ValidateAsync(Uri u, CancellationToken cancellationToken); } } \ No newline at end of file diff --git a/src/FilterLists.Agent/Core/Urls/IUrlValidator.cs b/src/FilterLists.Agent/Core/Urls/IUrlValidator.cs new file mode 100644 index 000000000..120534fb3 --- /dev/null +++ b/src/FilterLists.Agent/Core/Urls/IUrlValidator.cs @@ -0,0 +1,11 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace FilterLists.Agent.Core.Urls +{ + public interface IUrlValidator + { + Task ValidateAsync(Uri u, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/src/FilterLists.Agent/Features/Urls/Models/ValidationResults/UrlValidationResult.cs b/src/FilterLists.Agent/Core/Urls/UrlValidationResult.cs similarity index 93% rename from src/FilterLists.Agent/Features/Urls/Models/ValidationResults/UrlValidationResult.cs rename to src/FilterLists.Agent/Core/Urls/UrlValidationResult.cs index d75a2baa9..9e1a7edf2 100644 --- a/src/FilterLists.Agent/Features/Urls/Models/ValidationResults/UrlValidationResult.cs +++ b/src/FilterLists.Agent/Core/Urls/UrlValidationResult.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -namespace FilterLists.Agent.Features.Urls.Models.ValidationResults +namespace FilterLists.Agent.Core.Urls { public class UrlValidationResult { diff --git a/src/FilterLists.Agent/Extensions/UriExtensions.cs b/src/FilterLists.Agent/Extensions/UriExtensions.cs index a2a010855..ed75427b4 100644 --- a/src/FilterLists.Agent/Extensions/UriExtensions.cs +++ b/src/FilterLists.Agent/Extensions/UriExtensions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; namespace FilterLists.Agent.Extensions { diff --git a/src/FilterLists.Agent/Features/Lists/ArchiveLists.cs b/src/FilterLists.Agent/Features/Lists/ArchiveLists.cs index 7d35828ee..dcb4ce57a 100644 --- a/src/FilterLists.Agent/Features/Lists/ArchiveLists.cs +++ b/src/FilterLists.Agent/Features/Lists/ArchiveLists.cs @@ -1,6 +1,6 @@ using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using MediatR; namespace FilterLists.Agent.Features.Lists diff --git a/src/FilterLists.Agent/Features/Lists/DownloadLists.cs b/src/FilterLists.Agent/Features/Lists/DownloadLists.cs index f602ef773..48ae88ffc 100644 --- a/src/FilterLists.Agent/Features/Lists/DownloadLists.cs +++ b/src/FilterLists.Agent/Features/Lists/DownloadLists.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using FilterLists.Agent.Extensions; using MediatR; using Microsoft.Extensions.Logging; diff --git a/src/FilterLists.Agent/Features/Lists/DownloadRawText.cs b/src/FilterLists.Agent/Features/Lists/DownloadRawText.cs index b1114373d..6b4cb39e0 100644 --- a/src/FilterLists.Agent/Features/Lists/DownloadRawText.cs +++ b/src/FilterLists.Agent/Features/Lists/DownloadRawText.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using FilterLists.Agent.Extensions; using MediatR; diff --git a/src/FilterLists.Agent/Features/Lists/DownloadSevenZip.cs b/src/FilterLists.Agent/Features/Lists/DownloadSevenZip.cs index 9c8abb12d..4ebfc1a5a 100644 --- a/src/FilterLists.Agent/Features/Lists/DownloadSevenZip.cs +++ b/src/FilterLists.Agent/Features/Lists/DownloadSevenZip.cs @@ -1,7 +1,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using MediatR; using SharpCompress.Archives; using SharpCompress.Archives.SevenZip; diff --git a/src/FilterLists.Agent/Features/Lists/DownloadZip.cs b/src/FilterLists.Agent/Features/Lists/DownloadZip.cs index 60965cbf4..a2498d56c 100644 --- a/src/FilterLists.Agent/Features/Lists/DownloadZip.cs +++ b/src/FilterLists.Agent/Features/Lists/DownloadZip.cs @@ -1,7 +1,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using MediatR; using SharpCompress.Common; using SharpCompress.Readers; diff --git a/src/FilterLists.Agent/Features/Urls/Models/ValidationResults/DataFileUrlValidationResults.cs b/src/FilterLists.Agent/Features/Urls/Models/ValidationResults/DataFileUrlValidationResults.cs index 35e45d104..d65d9ff67 100644 --- a/src/FilterLists.Agent/Features/Urls/Models/ValidationResults/DataFileUrlValidationResults.cs +++ b/src/FilterLists.Agent/Features/Urls/Models/ValidationResults/DataFileUrlValidationResults.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using FilterLists.Agent.Core.Urls; namespace FilterLists.Agent.Features.Urls.Models.ValidationResults { diff --git a/src/FilterLists.Agent/Features/Urls/ValidateAllUrls.cs b/src/FilterLists.Agent/Features/Urls/ValidateAllUrls.cs index a4eb1bb62..90b628aa5 100644 --- a/src/FilterLists.Agent/Features/Urls/ValidateAllUrls.cs +++ b/src/FilterLists.Agent/Features/Urls/ValidateAllUrls.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core; +using FilterLists.Agent.Core.Urls; using FilterLists.Agent.Features.Urls.Models.DataFileUrls; using FilterLists.Agent.Features.Urls.Models.ValidationResults; using MediatR; diff --git a/src/FilterLists.Agent/Features/Urls/ValidateUrls.cs b/src/FilterLists.Agent/Features/Urls/ValidateUrls.cs index facb4216b..e4c010433 100644 --- a/src/FilterLists.Agent/Features/Urls/ValidateUrls.cs +++ b/src/FilterLists.Agent/Features/Urls/ValidateUrls.cs @@ -4,9 +4,8 @@ using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; -using FilterLists.Agent.Core; +using FilterLists.Agent.Core.Urls; using FilterLists.Agent.Extensions; -using FilterLists.Agent.Features.Urls.Models.ValidationResults; using MediatR; namespace FilterLists.Agent.Features.Urls @@ -26,11 +25,11 @@ public Command(IEnumerable urls) public class Handler : IRequestHandler> { private const int MaxDegreeOfParallelism = 5; - private readonly IUrlRepository _repo; + private readonly IUrlValidator _urlValidator; - public Handler(IUrlRepository urlRepository) + public Handler(IUrlValidator urlValidator) { - _repo = urlRepository; + _urlValidator = urlValidator; } public async Task> Handle(Command request, CancellationToken cancellationToken) @@ -55,7 +54,7 @@ public async Task> Handle(Command request, Cancellatio private TransformBlock BuildValidator(CancellationToken cancellationToken) { return new TransformBlock( - async u => await _repo.ValidateAsync(u, cancellationToken), + async u => await _urlValidator.ValidateAsync(u, cancellationToken), new ExecutionDataflowBlockOptions {MaxDegreeOfParallelism = MaxDegreeOfParallelism} ); } diff --git a/src/FilterLists.Agent/Infrastructure/DependencyInjection/ServiceCollectionExtensions.cs b/src/FilterLists.Agent/Infrastructure/DependencyInjection/ServiceCollectionExtensions.cs index 013dd5204..225e5b701 100644 --- a/src/FilterLists.Agent/Infrastructure/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/FilterLists.Agent/Infrastructure/DependencyInjection/ServiceCollectionExtensions.cs @@ -1,9 +1,6 @@ using System; -using System.Net; -using System.Net.Http; using CommandLine; using FilterLists.Agent.AppSettings; -using FilterLists.Agent.Core; using FilterLists.Agent.Infrastructure.Disk; using FilterLists.Agent.Infrastructure.FilterListsApi; using FilterLists.Agent.Infrastructure.GitHub; @@ -13,7 +10,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using Polly; using Serilog; namespace FilterLists.Agent.Infrastructure.DependencyInjection @@ -27,11 +23,10 @@ public static void ConfigureServices(this IServiceCollection services) services.AddLocalization(); services.AddTransient(); services.AddMediatR(AppDomain.CurrentDomain.GetAssemblies()); + services.AddDiskResources(); services.AddFilterListsApiResources(); services.AddGitHubResources(); - services.AddUrlRepository(); - services.AddListRepository(); - services.AddArchiveRepository(); + services.AddWebResources(); } private static void AddConfiguration(this IServiceCollection services) @@ -76,18 +71,5 @@ private static void AddLoggingCustom(this IServiceCollection services) .CreateLogger()); }); } - - private static void AddUrlRepository(this IServiceCollection services) - { - services.AddHttpClient() - .ConfigureHttpMessageHandlerBuilder(b => - { - b.PrimaryHandler = new HttpClientHandler {AllowAutoRedirect = false}; - b.Build(); - }) - .AddTransientHttpErrorPolicy(b => - b.OrResult(r => r.StatusCode == HttpStatusCode.TooManyRequests) - .WaitAndRetryAsync(5, i => i * TimeSpan.FromSeconds(3))); - } } } \ No newline at end of file diff --git a/src/FilterLists.Agent/Infrastructure/Disk/ServiceCollectionExtensions.cs b/src/FilterLists.Agent/Infrastructure/Disk/ServiceCollectionExtensions.cs index 77e49d2f5..76f88be74 100644 --- a/src/FilterLists.Agent/Infrastructure/Disk/ServiceCollectionExtensions.cs +++ b/src/FilterLists.Agent/Infrastructure/Disk/ServiceCollectionExtensions.cs @@ -7,7 +7,7 @@ namespace FilterLists.Agent.Infrastructure.Disk { public static class ServiceCollectionExtensions { - public static void AddArchiveRepository(this IServiceCollection services) + public static void AddDiskResources(this IServiceCollection services) { services.AddTransient(s => { diff --git a/src/FilterLists.Agent/Infrastructure/FilterListsApi/FilterListsApiClient.cs b/src/FilterLists.Agent/Infrastructure/FilterListsApi/FilterListsApiClient.cs index 1c1b41491..7642a8290 100644 --- a/src/FilterLists.Agent/Infrastructure/FilterListsApi/FilterListsApiClient.cs +++ b/src/FilterLists.Agent/Infrastructure/FilterListsApi/FilterListsApiClient.cs @@ -8,6 +8,11 @@ namespace FilterLists.Agent.Infrastructure.FilterListsApi { + public interface IFilterListsApiClient + { + Task ExecuteAsync(IRestRequest restRequest, CancellationToken cancellationToken); + } + public class FilterListsApiClient : IFilterListsApiClient { private readonly IStringLocalizer _localizer; diff --git a/src/FilterLists.Agent/Infrastructure/FilterListsApi/IFilterListsApiClient.cs b/src/FilterLists.Agent/Infrastructure/FilterListsApi/IFilterListsApiClient.cs deleted file mode 100644 index 6a6638c3c..000000000 --- a/src/FilterLists.Agent/Infrastructure/FilterListsApi/IFilterListsApiClient.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using RestSharp; - -namespace FilterLists.Agent.Infrastructure.FilterListsApi -{ - public interface IFilterListsApiClient - { - Task ExecuteAsync(IRestRequest restRequest, CancellationToken cancellationToken); - } -} \ No newline at end of file diff --git a/src/FilterLists.Agent/Infrastructure/FilterListsApi/ListUrlRepository.cs b/src/FilterLists.Agent/Infrastructure/FilterListsApi/ListUrlRepository.cs index f5dedece0..2e5e677e3 100644 --- a/src/FilterLists.Agent/Infrastructure/FilterListsApi/ListUrlRepository.cs +++ b/src/FilterLists.Agent/Infrastructure/FilterListsApi/ListUrlRepository.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using RestSharp; namespace FilterLists.Agent.Infrastructure.FilterListsApi diff --git a/src/FilterLists.Agent/Infrastructure/FilterListsApi/ServiceCollectionExtensions.cs b/src/FilterLists.Agent/Infrastructure/FilterListsApi/ServiceCollectionExtensions.cs index 8c516859c..c035c6a22 100644 --- a/src/FilterLists.Agent/Infrastructure/FilterListsApi/ServiceCollectionExtensions.cs +++ b/src/FilterLists.Agent/Infrastructure/FilterListsApi/ServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; +using FilterLists.Agent.Core.Urls; using Microsoft.Extensions.DependencyInjection; namespace FilterLists.Agent.Infrastructure.FilterListsApi @@ -9,6 +10,7 @@ public static void AddFilterListsApiResources(this IServiceCollection services) { services.AddSingleton(); services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs b/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs new file mode 100644 index 000000000..911d360b9 --- /dev/null +++ b/src/FilterLists.Agent/Infrastructure/FilterListsApi/UrlRepository.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using FilterLists.Agent.Core.Urls; +using FilterLists.Agent.Features.Urls.Models.DataFileUrls; +using JetBrains.Annotations; +using Microsoft.Extensions.Localization; +using RestSharp; + +namespace FilterLists.Agent.Infrastructure.FilterListsApi +{ + [UsedImplicitly] + public class UrlRepository : IUrlRepository + { + private static readonly Dictionary EntityUrlsEndpoints = new Dictionary + { + {nameof(LicenseUrls), "licenses"}, + {nameof(ListUrls), "lists"}, + {nameof(MaintainerUrls), "maintainers"}, + {nameof(SoftwareUrls), "software"}, + {nameof(SyntaxUrls), "syntaxes"} + }; + + private readonly IFilterListsApiClient _apiClient; + private readonly IStringLocalizer _localizer; + + public UrlRepository(IFilterListsApiClient apiClient, IStringLocalizer stringLocalizer) + { + _apiClient = apiClient; + _localizer = stringLocalizer; + } + + public async Task> GetAllAsync(CancellationToken cancellationToken) + { + if (!EntityUrlsEndpoints.ContainsKey(typeof(TModel).Name)) + throw new ArgumentException(_localizer["The type of TModel is not valid."]); + var request = new RestRequest($"{EntityUrlsEndpoints[typeof(TModel).Name]}/seed"); + var response = await _apiClient.ExecuteAsync>(request, cancellationToken); + return response.ToList().SelectMany(r => + r.GetType().GetProperties().Where(p => p.GetValue(r) != null).Select(p => (Uri)p.GetValue(r))); + } + } +} \ No newline at end of file diff --git a/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs b/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs index 96e52f9a9..05f7fd57d 100644 --- a/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs +++ b/src/FilterLists.Agent/Infrastructure/Web/ListRepository.cs @@ -5,7 +5,7 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.Core.List; +using FilterLists.Agent.Core.Lists; using JetBrains.Annotations; using Microsoft.Extensions.Logging; diff --git a/src/FilterLists.Agent/Infrastructure/Web/ServiceCollectionExtensions.cs b/src/FilterLists.Agent/Infrastructure/Web/ServiceCollectionExtensions.cs index 0ff30ff85..ee3afaaf5 100644 --- a/src/FilterLists.Agent/Infrastructure/Web/ServiceCollectionExtensions.cs +++ b/src/FilterLists.Agent/Infrastructure/Web/ServiceCollectionExtensions.cs @@ -1,6 +1,8 @@ using System; using System.Net; -using FilterLists.Agent.Core.List; +using System.Net.Http; +using FilterLists.Agent.Core.Lists; +using FilterLists.Agent.Core.Urls; using Microsoft.Extensions.DependencyInjection; using Polly; @@ -8,11 +10,20 @@ namespace FilterLists.Agent.Infrastructure.Web { public static class ServiceCollectionExtensions { - public static void AddListRepository(this IServiceCollection services) + public static void AddWebResources(this IServiceCollection services) { services.AddHttpClient().AddTransientHttpErrorPolicy(b => b.OrResult(r => r.StatusCode == HttpStatusCode.TooManyRequests) .WaitAndRetryAsync(5, i => i * TimeSpan.FromSeconds(3))); + services.AddHttpClient() + .ConfigureHttpMessageHandlerBuilder(b => + { + b.PrimaryHandler = new HttpClientHandler {AllowAutoRedirect = false}; + b.Build(); + }) + .AddTransientHttpErrorPolicy(b => + b.OrResult(r => r.StatusCode == HttpStatusCode.TooManyRequests) + .WaitAndRetryAsync(5, i => i * TimeSpan.FromSeconds(3))); } } } \ No newline at end of file diff --git a/src/FilterLists.Agent/Infrastructure/UrlRepository.cs b/src/FilterLists.Agent/Infrastructure/Web/UrlValidator.cs similarity index 65% rename from src/FilterLists.Agent/Infrastructure/UrlRepository.cs rename to src/FilterLists.Agent/Infrastructure/Web/UrlValidator.cs index 34e10763b..e239696f7 100644 --- a/src/FilterLists.Agent/Infrastructure/UrlRepository.cs +++ b/src/FilterLists.Agent/Infrastructure/Web/UrlValidator.cs @@ -1,68 +1,33 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using FilterLists.Agent.AppSettings; -using FilterLists.Agent.Core; +using FilterLists.Agent.Core.Urls; using FilterLists.Agent.Extensions; -using FilterLists.Agent.Features.Urls.Models.DataFileUrls; -using FilterLists.Agent.Features.Urls.Models.ValidationResults; +using FilterLists.Agent.Infrastructure.FilterListsApi; using JetBrains.Annotations; -using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using RestSharp; -namespace FilterLists.Agent.Infrastructure +namespace FilterLists.Agent.Infrastructure.Web { [UsedImplicitly] - public class UrlRepository : IUrlRepository + public class UrlValidator : IUrlValidator { - private static readonly Dictionary EntityUrlsEndpoints = new Dictionary - { - {nameof(LicenseUrls), "licenses"}, - {nameof(ListUrls), "lists"}, - {nameof(MaintainerUrls), "maintainers"}, - {nameof(SoftwareUrls), "software"}, - {nameof(SyntaxUrls), "syntaxes"} - }; - - private readonly IRestClient _apiClient; private readonly HttpClient _httpClient; - private readonly IStringLocalizer _localizer; private readonly ILogger _logger; - public UrlRepository(IOptions filterListsApiOptions, HttpClient httpClient, - IStringLocalizer stringLocalizer, ILogger logger) + public UrlValidator(HttpClient httpClient, ILogger logger) { - _apiClient = new RestClient(filterListsApiOptions.Value.BaseUrl) {UserAgent = "FilterLists.Agent"}; - httpClient.Timeout = TimeSpan.FromSeconds(90); var header = new ProductHeaderValue("FilterLists.Agent"); var userAgent = new ProductInfoHeaderValue(header); httpClient.DefaultRequestHeaders.UserAgent.Add(userAgent); _httpClient = httpClient; - _localizer = stringLocalizer; _logger = logger; } - public async Task> GetAllAsync(CancellationToken cancellationToken) - { - if (!EntityUrlsEndpoints.ContainsKey(typeof(TModel).Name)) - throw new ArgumentException(_localizer["The type of TModel is not valid."]); - var request = new RestRequest($"{EntityUrlsEndpoints[typeof(TModel).Name]}/seed"); - var response = await _apiClient.ExecuteTaskAsync>(request, cancellationToken); - if (response.ErrorException != null) - _logger.LogError(response.ErrorException, - _localizer["Error retrieving response from the FilterLists API."]); - return response.Data.SelectMany(r => - r.GetType().GetProperties().Where(p => p.GetValue(r) != null).Select(p => (Uri)p.GetValue(r))); - } - public async Task ValidateAsync(Uri u, CancellationToken cancellationToken) { var result = new UrlValidationResult(u);