34 lines
1.0 KiB
C#
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
|
|
};
|
|
}
|
|
} |