diff --git a/src/FilterLists.Agent/Infrastructure/Repositories/EntityUrlsRepository.cs b/src/FilterLists.Agent/Infrastructure/Repositories/EntityUrlsRepository.cs index c6c491ff4..c6e1565bc 100644 --- a/src/FilterLists.Agent/Infrastructure/Repositories/EntityUrlsRepository.cs +++ b/src/FilterLists.Agent/Infrastructure/Repositories/EntityUrlsRepository.cs @@ -16,26 +16,30 @@ public EntityUrlsRepository(IFilterListsApiClient apiClient) _apiClient = apiClient; } - public async Task> GetAllAsync() - where TEntityUrls : IEntityUrls, new() + public async Task> GetAllAsync() where TEntityUrls : IEntityUrls, new() { - string entityEndpoint; - switch (typeof(TEntityUrls).Name) - { - case nameof(SyntaxUrls): - entityEndpoint = typeof(TEntityUrls).Name.Replace("Urls", "es").ToLowerInvariant(); - break; - case nameof(SoftwareUrls): - entityEndpoint = typeof(TEntityUrls).Name.Replace("Urls", "").ToLowerInvariant(); - break; - default: - entityEndpoint = typeof(TEntityUrls).Name.Replace("Urls", "s").ToLowerInvariant(); - break; - } - - var endpoint = $"{entityEndpoint}/seed"; + var endpoint = BuildEndpoint(); var request = new RestRequest(endpoint); return await _apiClient.ExecuteAsync>(request); } + + private static string BuildEndpoint() where TEntityUrls : IEntityUrls, new() + { + string endpointSuffix; + switch (typeof(TEntityUrls).Name) + { + case nameof(SyntaxUrls): + endpointSuffix = "es"; + break; + case nameof(SoftwareUrls): + endpointSuffix = ""; + break; + default: + endpointSuffix = "s"; + break; + } + + return $"{typeof(TEntityUrls).Name.Replace("Urls", endpointSuffix).ToLowerInvariant()}/seed"; + } } } \ No newline at end of file