internal/structs.go
101 lines · 2536 bytes
1package internal
2
3type AnimeTitle struct {
4 Romaji string `json:"title_romanji"`
5 English string `json:"title"`
6 Japanese string `json:"title_japanese"`
7}
8
9type Anime struct {
10 Title AnimeTitle `json:"title"`
11 Ep Episode `json:"ep"`
12 CoverImage string `json:"url"` // Assuming this field corresponds to the cover image URL
13 TotalEpisodes int `json:"total_episodes"` // If provided by the API
14 MalId int `json:"mal_id"`
15 AnilistId int `json:"anilist_id"` // Assuming you have an Anilist ID in your struct
16 Rewatching bool
17 AllanimeId string // Can be populated as necessary
18}
19
20type Skip struct {
21 Start int `json:"start"`
22 End int `json:"end"`
23}
24
25type SkipTimes struct {
26 Op Skip `json:"op"`
27 Ed Skip `json:"ed"`
28}
29
30type Episode struct {
31 Title AnimeTitle `json:"title"`
32 Number int `json:"number"`
33 SkipTimes SkipTimes `json:"skip_times"`
34 Player playingVideo `json:"player"`
35 Resume bool `json:"resume"`
36 Started bool `json:"started"`
37 Duration int `json:"duration"`
38 Links []string `json:"links"`
39 IsFiller bool `json:"filler"`
40 IsRecap bool `json:"recap"`
41 Aired string `json:"aired"`
42 Synopsis string `json:"synopsis"`
43 ContinueLast bool
44 IsCompleted bool
45}
46
47type playingVideo struct {
48 Url string
49 Speed float64 `json:"speed"`
50 PlaybackTime int `json:"playback_time"`
51 SocketPath string
52}
53
54type User struct {
55 Token string
56 Username string
57 Id int
58 AnimeList AnimeList
59}
60
61// AniListAnime is the struct for the API response
62type AniListAnime struct {
63 ID int `json:"id"`
64 Title struct {
65 Romaji string `json:"romaji"`
66 English string `json:"english"`
67 Native string `json:"native"`
68 } `json:"title"`
69}
70
71// Page represents the page in AniList response
72type Page struct {
73 Media []AniListAnime `json:"media"`
74}
75
76// ResponseData represents the full response structure
77type ResponseData struct {
78 Page Page `json:"Page"`
79}
80
81type Media struct {
82 Duration int `json:"duration"`
83 Episodes int `json:"episodes"`
84 ID int `json:"id"`
85 Title AnimeTitle `json:"title"`
86}
87
88type Entry struct {
89 Media Media `json:"media"`
90 Progress int `json:"progress"`
91 Score float64 `json:"score"`
92 Status string `json:"status"`
93}
94
95type AnimeList struct {
96 Watching []Entry `json:"watching"`
97 Completed []Entry `json:"completed"`
98 Paused []Entry `json:"paused"`
99 Dropped []Entry `json:"dropped"`
100 Planning []Entry `json:"planning"`
101}