-
Notifications
You must be signed in to change notification settings - Fork 2
/
OLAuthorData.cs
60 lines (56 loc) · 1.76 KB
/
OLAuthorData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using OpenLibraryNET.Utility;
using CodeGeneration_Attributes;
namespace OpenLibraryNET.Data
{
/// <summary>
/// Holds data about an author.
/// </summary>
[CollectionValueEquality]
public sealed partial record OLAuthorData : OLContainer
{
/// <summary>
/// The ID of the author.
/// </summary>
[JsonIgnore]
public string ID => OpenLibraryUtility.ExtractIdFromKey(Key);
/// <summary>
/// The key of the author.
/// </summary>
[JsonProperty("key")]
public string Key { get; init; } = "";
/// <summary>
/// The name of the author.
/// </summary>
[JsonProperty("name")]
public string Name { get; init; } = "";
/// <summary>
/// The author's birth date.
/// </summary>
[JsonProperty("birth_date")]
public string BirthDate { get; init; } = "";
/// <summary>
/// The author's date of death.
/// </summary>
[JsonProperty("death_date")]
public string DeathDate { get; init; } = "";
/// <summary>
/// The author's biography.
/// </summary>
[JsonProperty("bio")]
[JsonConverter(typeof(OpenLibraryUtility.Serialization.BioConverter))]
public string Bio { get; init; } = "";
/// <summary>
/// The author's photo IDs.
/// </summary>
[JsonIgnore]
public IReadOnlyList<int> PhotosIDs
{
get => new ReadOnlyCollection<int>(_photosIDs);
init => _photosIDs = value.ToArray();
}
[JsonProperty("photos")]
private int[] _photosIDs { get; init; } = Array.Empty<int>();
}
}