using System.Text.Json.Serialization;
namespace MaBibli.Api.Services.Isbn;
/// Réponse de https://openlibrary.org/books/OL…M.json (édition).
public record OpenLibraryEdition
{
[JsonPropertyName("key")]
public string? Key { get; init; }
[JsonPropertyName("title")]
public string? Title { get; init; }
[JsonPropertyName("subtitle")]
public string? Subtitle { get; init; }
///
/// Références d'auteurs, pas des noms : { "key": "/authors/OL31901A" }.
/// Il faut un second appel pour obtenir le nom — c'est le bug de BookLogr à ne pas reproduire.
/// Ce champ est parfois totalement absent (cas mesuré : Introduction to Algorithms).
///
[JsonPropertyName("authors")]
public List? Authors { get; init; }
/// Œuvre rattachée, utilisée en repli quand l'édition ne porte aucun auteur.
[JsonPropertyName("works")]
public List? Works { get; init; }
[JsonPropertyName("publishers")]
public List? Publishers { get; init; }
[JsonPropertyName("publish_date")]
public string? PublishDate { get; init; }
[JsonPropertyName("languages")]
public List? Languages { get; init; }
/// Mention de responsabilité brute, dernier repli si aucun auteur n'est résolvable.
[JsonPropertyName("by_statement")]
public string? ByStatement { get; init; }
}
/// Réponse de https://openlibrary.org/works/OL…W.json.
public record OpenLibraryWork
{
[JsonPropertyName("authors")]
public List? Authors { get; init; }
}
public record OpenLibraryWorkAuthor
{
[JsonPropertyName("author")]
public OpenLibraryCle? Author { get; init; }
}
/// Réponse de https://openlibrary.org/authors/OL…A.json.
public record OpenLibraryAuthor
{
[JsonPropertyName("name")]
public string? Name { get; init; }
[JsonPropertyName("personal_name")]
public string? PersonalName { get; init; }
}
/// Référence OpenLibrary : { "key": "/authors/OL31901A" }.
public record OpenLibraryCle
{
[JsonPropertyName("key")]
public string? Key { get; init; }
}