Files
jsmr/JSMR.Infrastructure/Integrations/DLSite/Mapping/DLSiteReleasedWorksMapper.cs
Brian Bicknell d9e421178f
All checks were successful
ci / build-test (push) Successful in 2m21s
ci / publish-image (push) Successful in 2m19s
Added inital job entity and services. Added released works API integration.
2026-03-27 01:32:39 -04:00

34 lines
1.0 KiB
C#

using JSMR.Application.Integrations.DLSite.Models.ReleasedWorks;
using JSMR.Infrastructure.Integrations.DLSite.Models.NewWorks;
namespace JSMR.Infrastructure.Integrations.DLSite.Mapping;
public static class DLSiteReleasedWorksMapper
{
public static ReleasedWorksCollection Map(NewWorksApiResponse response)
{
ReleasedWorksCollection result = [];
if (response.Data.Products.Length == 0)
return result;
foreach (NewWorksApiProduct product in response.Data.Products)
{
result.Add(product.Id, Map(product));
}
return result;
}
private static ReleasedWork Map(NewWorksApiProduct product)
{
return new ReleasedWork
{
ProductId = product.Id,
Title = product.Name ?? string.Empty,
MaskedTitle = product.NameMasked ?? string.Empty,
Description = product.Description ?? string.Empty,
MaskedDescription = product.DescriptionMasked ?? string.Empty
};
}
}