Implemented DLSiteClient.

This commit is contained in:
2025-09-08 17:08:47 -04:00
parent 429252e61f
commit f250276a99
39 changed files with 1584 additions and 173 deletions

View File

@@ -0,0 +1,15 @@
using JSMR.Application.Integrations.Chobit.Models;
using JSMR.Application.Integrations.Ports;
using JSMR.Infrastructure.Http;
using Microsoft.Extensions.Logging;
namespace JSMR.Infrastructure.Integrations.Chobit;
public class ChobitClient(HttpClient http, ILogger logger) : ApiClient(http, logger), IChobitClient
{
public Task<ChobitWorkResult> GetSampleInfoAsync(string[] productIds, CancellationToken cancellationToken = default)
{
var url = $"api/v2/dlsite/embed?workno_list=${string.Join(",", productIds)}";
return GetJsonAsync<ChobitWorkResult>(url, ct: cancellationToken);
}
}

View File

@@ -0,0 +1,3 @@
namespace JSMR.Infrastructure.Integrations.Chobit.Models;
public class ChobitWorkResult : Dictionary<string, ChobitResult> { }

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
namespace JSMR.Infrastructure.Integrations.Chobit.Models;
public record ChobitResult
{
[JsonPropertyName("count")]
public int Count { get; set; }
[JsonPropertyName("works")]
public ChobitWork[] Works { get; set; } = [];
}

View File

@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
namespace JSMR.Infrastructure.Integrations.Chobit.Models;
public record ChobitWork
{
[JsonPropertyName("work_id")]
public string? WorkId { get; set; }
[JsonPropertyName("dlsite_work_id")]
public string? DLSiteWorkId { get; set; }
[JsonPropertyName("work_name")]
public string? WorkName { get; set; }
[JsonPropertyName("work_name_kana")]
public string? WorkNameKana { get; set; }
[JsonPropertyName("url")]
public string? Url { get; set; }
[JsonPropertyName("embed_url")]
public string? EmbedURL { get; set; }
[JsonPropertyName("thumb")]
public string? Thumb { get; set; }
[JsonPropertyName("mini_thumb")]
public string? MiniThumb { get; set; }
[JsonPropertyName("file_type")]
public string? FileType { get; set; }
[JsonPropertyName("embed_width")]
public decimal EmbedWidth { get; set; }
[JsonPropertyName("embed_height")]
public decimal EmbedHeight { get; set; }
}