Implemented DLSiteClient.
This commit is contained in:
15
JSMR.Infrastructure/Integrations/Chobit/ChobitClient.cs
Normal file
15
JSMR.Infrastructure/Integrations/Chobit/ChobitClient.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace JSMR.Infrastructure.Integrations.Chobit.Models;
|
||||
|
||||
public class ChobitWorkResult : Dictionary<string, ChobitResult> { }
|
||||
@@ -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; } = [];
|
||||
}
|
||||
39
JSMR.Infrastructure/Integrations/Chobit/Models/ChobitWork.cs
Normal file
39
JSMR.Infrastructure/Integrations/Chobit/Models/ChobitWork.cs
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user