mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
ren IListService to IListRepository as it actually serves as a repo
This commit is contained in:
parent
6d5abc0ac4
commit
bc4149414b
7 changed files with 27 additions and 27 deletions
|
|
@ -0,0 +1,9 @@
|
|||
using System.Net.Http;
|
||||
|
||||
namespace FilterLists.Agent.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IListRepository
|
||||
{
|
||||
HttpClient HttpClient { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
using System.Net.Http;
|
||||
|
||||
namespace FilterLists.Agent.Core.Interfaces.Services
|
||||
{
|
||||
public interface IListService
|
||||
{
|
||||
HttpClient HttpClient { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -32,8 +32,8 @@ public static void RegisterAgentServices(this IServiceCollection services)
|
|||
services.AddMediatR(AppDomain.CurrentDomain.GetAssemblies());
|
||||
services.AddSingleton<IFilterListsApiClient, FilterListsApiClient>();
|
||||
services.AddGitHubClient();
|
||||
services.AddListService();
|
||||
services.AddUrlService();
|
||||
services.AddListRepository();
|
||||
services.AddArchiveRepository();
|
||||
services.AddTransient<IListInfoRepository, ListInfoRepository>();
|
||||
services.AddTransient<IUrlRepository, UrlRepository>();
|
||||
|
|
@ -86,9 +86,9 @@ private static void AddGitHubClient(this IServiceCollection services)
|
|||
});
|
||||
}
|
||||
|
||||
private static void AddListService(this IServiceCollection services)
|
||||
private static void AddUrlService(this IServiceCollection services)
|
||||
{
|
||||
services.AddHttpClient<IListService, ListService>()
|
||||
services.AddHttpClient<IUrlService, UrlService>()
|
||||
.ConfigureHttpMessageHandlerBuilder(b =>
|
||||
{
|
||||
b.PrimaryHandler = new HttpClientHandler {AllowAutoRedirect = false};
|
||||
|
|
@ -99,9 +99,9 @@ private static void AddListService(this IServiceCollection services)
|
|||
.WaitAndRetryAsync(5, i => i * TimeSpan.FromSeconds(3)));
|
||||
}
|
||||
|
||||
private static void AddUrlService(this IServiceCollection services)
|
||||
private static void AddListRepository(this IServiceCollection services)
|
||||
{
|
||||
services.AddHttpClient<IUrlService, UrlService>()
|
||||
services.AddHttpClient<IListRepository, ListRepository>()
|
||||
.ConfigureHttpMessageHandlerBuilder(b =>
|
||||
{
|
||||
b.PrimaryHandler = new HttpClientHandler {AllowAutoRedirect = false};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Agent.Core.Entities;
|
||||
using FilterLists.Agent.Core.Interfaces.Services;
|
||||
using FilterLists.Agent.Core.Interfaces.Repositories;
|
||||
using FilterLists.Agent.Extensions;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -30,9 +30,9 @@ public class Handler : AsyncRequestHandler<Command>
|
|||
private readonly HttpClient _httpClient;
|
||||
private readonly ILogger<Handler> _logger;
|
||||
|
||||
public Handler(IListService listService, ILogger<Handler> logger)
|
||||
public Handler(IListRepository listRepository, ILogger<Handler> logger)
|
||||
{
|
||||
_httpClient = listService.HttpClient;
|
||||
_httpClient = listRepository.HttpClient;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Agent.Core.Entities;
|
||||
using FilterLists.Agent.Core.Interfaces.Services;
|
||||
using FilterLists.Agent.Core.Interfaces.Repositories;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SharpCompress.Archives;
|
||||
|
|
@ -30,9 +30,9 @@ public class Handler : AsyncRequestHandler<Command>
|
|||
private readonly HttpClient _httpClient;
|
||||
private readonly ILogger<Handler> _logger;
|
||||
|
||||
public Handler(IListService listService, ILogger<Handler> logger)
|
||||
public Handler(IListRepository listRepository, ILogger<Handler> logger)
|
||||
{
|
||||
_httpClient = listService.HttpClient;
|
||||
_httpClient = listRepository.HttpClient;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Agent.Core.Entities;
|
||||
using FilterLists.Agent.Core.Interfaces.Services;
|
||||
using FilterLists.Agent.Core.Interfaces.Repositories;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SharpCompress.Common;
|
||||
|
|
@ -29,9 +29,9 @@ public class Handler : AsyncRequestHandler<Command>
|
|||
private readonly HttpClient _httpClient;
|
||||
private readonly ILogger<Handler> _logger;
|
||||
|
||||
public Handler(IListService listService, ILogger<Handler> logger)
|
||||
public Handler(IListRepository listRepository, ILogger<Handler> logger)
|
||||
{
|
||||
_httpClient = listService.HttpClient;
|
||||
_httpClient = listRepository.HttpClient;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using FilterLists.Agent.Core.Interfaces.Services;
|
||||
using FilterLists.Agent.Core.Interfaces.Repositories;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace FilterLists.Agent.Infrastructure.Services
|
||||
namespace FilterLists.Agent.Infrastructure.Repositories
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class ListService : IListService
|
||||
public class ListRepository : IListRepository
|
||||
{
|
||||
public ListService(HttpClient client)
|
||||
public ListRepository(HttpClient client)
|
||||
{
|
||||
client.Timeout = TimeSpan.FromSeconds(90);
|
||||
|
||||
Loading…
Reference in a new issue