-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathApiModel.cs
105 lines (88 loc) · 2.43 KB
/
ApiModel.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Anime.Providers.KitsuIO.ApiClient
{
public class ApiListResponse
{
public List<Series> Data { get; set; }
public ResponseMeta Meta { get; set; }
}
public class ApiResponse
{
public Series Data { get; set; }
public List<Included> Included { get; set; }
}
public class Series
{
public long Id { get; set; }
public Attributes Attributes { get; set; }
}
public class Attributes
{
public string Synopsis { get; set; }
public Titles Titles { get; set; }
public string AverageRating { get; set; }
public DateTimeOffset? StartDate { get; set; }
public PosterImage PosterImage { get; set; }
// Episode specific
public int? Number { get; set; }
public int? SeasonNumber { get; set; }
public DateTime? AirDate { get; set; }
public int? Length { get; set; }
}
public class PosterImage
{
public Uri Medium { get; set; }
public Uri Original { get; set; }
}
public class Titles
{
[JsonPropertyName("en")] public string En { get; set; }
[JsonPropertyName("en_jp")] public string EnJp { get; set; }
[JsonPropertyName("ja_jp")] public string JaJp { get; set; }
[JsonPropertyName("en_us")] public string EnUs { get; set; }
public string GetTitle =>
!string.IsNullOrWhiteSpace(En) ? En :
!string.IsNullOrWhiteSpace(EnUs) ? EnUs :
!string.IsNullOrWhiteSpace(EnJp) ? EnJp :
JaJp;
public bool Equal(string title)
{
return
(En?.Equals(title) ?? false) ||
(EnUs?.Equals(title) ?? false) ||
(EnJp?.Equals(title) ?? false) ||
(JaJp?.Equals(title) ?? false);
}
}
public class ResponseMeta
{
public long? Count { get; set; }
}
public class Included
{
public IncludedAttributes Attributes { get; set; }
}
public class IncludedAttributes
{
public string Name { get; set; }
}
public enum ShowTypeEnum
{
Movie,
Ova,
Ona,
Tv,
Music,
Special
}
public enum Status
{
Current,
Finished,
Tba,
Unreleased,
Upcoming
}
}