Added inital job entity and services. Added released works API integration.
All checks were successful
ci / build-test (push) Successful in 2m21s
ci / publish-image (push) Successful in 2m19s

This commit is contained in:
2026-03-27 01:32:39 -04:00
parent 1c016ac62e
commit d9e421178f
36 changed files with 5596 additions and 43 deletions

View File

@@ -1,8 +1,11 @@
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Application.Integrations.Ports;
using JSMR.Application.Integrations.DLSite.Models.ReleasedWorks;
using JSMR.Application.Integrations.DLSite.Ports;
using JSMR.Infrastructure.Globalization;
using JSMR.Infrastructure.Http;
using JSMR.Infrastructure.Integrations.DLSite.Mapping;
using JSMR.Infrastructure.Integrations.DLSite.Models;
using JSMR.Infrastructure.Integrations.DLSite.Models.NewWorks;
using Microsoft.Extensions.Logging;
namespace JSMR.Infrastructure.Integrations.DLSite;
@@ -23,4 +26,23 @@ public class DLSiteClient(HttpClient http, ILogger<DLSiteClient> logger) : ApiCl
return DLSiteToDomainMapper.Map(productInfoCollection);
}
public async Task<ReleasedWorksCollection> GetReleasedWorksAsync(ReleasedWorksRequest request, CancellationToken cancellationToken = default)
{
string locale = LocaleMapper.ToDLSiteLocale(request.Locale);
string date = request.Date.ToString("yyyy-MM-dd");
string url = $"maniax/new/work/api?locale={locale}&date={date}&period={request.Period}";
NewWorksApiResponse response = await GetJsonAsync<NewWorksApiResponse>(url, cancellationToken: cancellationToken);
if (response.Meta.Code != 200)
{
throw new InvalidOperationException(
$"DLsite returned code {response.Meta.Code}. " +
$"ErrorType: {response.Meta.ErrorType}. " +
$"ErrorMessage: {response.Meta.ErrorMessage}");
}
return DLSiteReleasedWorksMapper.Map(response);
}
}