internal/structs.go
110 lines · 2754 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 CoverImage struct {
70 Large string `json:"large"`
71 } `json:"coverImage"`
72}
73
74// Page represents the page in AniList response
75type Page struct {
76 Media []AniListAnime `json:"media"`
77}
78
79// ResponseData represents the full response structure
80type ResponseData struct {
81 Page Page `json:"Page"`
82}
83
84type Media struct {
85 Duration int `json:"duration"`
86 Episodes int `json:"episodes"`
87 ID int `json:"id"`
88 Title AnimeTitle `json:"title"`
89}
90
91type Entry struct {
92 Media Media `json:"media"`
93 Progress int `json:"progress"`
94 Score float64 `json:"score"`
95 Status string `json:"status"`
96 CoverImage string `json:"coverImage"`
97}
98
99type AnimeList struct {
100 Watching []Entry `json:"watching"`
101 Completed []Entry `json:"completed"`
102 Paused []Entry `json:"paused"`
103 Dropped []Entry `json:"dropped"`
104 Planning []Entry `json:"planning"`
105}
106
107type RofiSelectPreview struct {
108 Title string `json:"title"`
109 CoverImage string `json:"coverImage"`
110}