This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimes.go
287 lines (226 loc) · 8.53 KB
/
animes.go
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
package shikimori
import (
"context"
"strconv"
"time"
)
type RatesScoresStat struct {
Name int `json:"name"`
Value int `json:"value"`
}
type RatesStatusesStat struct {
Name string `json:"name"`
Value int `json:"value"`
}
type Anime struct {
ID int `json:"id"`
Name string `json:"name"`
Russian string `json:"russian"`
Image Image `json:"image"`
URL string `json:"url"`
Kind *string `json:"kind,omitempty"`
Score string `json:"score"`
Status string `json:"status"`
Episodes int `json:"episodes"`
EpisodesAired int `json:"episodes_aired"`
AiredOn *string `json:"aired_on,omitempty"`
ReleasedOn *string `json:"released_on,omitempty"`
}
type AnimeFull struct {
Anime
Rating string `json:"rating"`
English []string `json:"english"`
Japanese []string `json:"japanese"`
Synonyms []string `json:"synonyms"`
LicenseNameRu *string `json:"license_name_ru,omitempty"`
Duration int `json:"duration"`
Description *string `json:"description,omitempty"`
DescriptionHTML string `json:"description_html"`
DescriptionSource *string `json:"description_source,omitempty"`
Franchise *string `json:"franchise,omitempty"`
Favoured bool `json:"favoured"`
Anons bool `json:"anons"`
Ongoing bool `json:"ongoing"`
ThreadID *int `json:"thread_id,omitempty"`
TopicID *int `json:"topic_id,omitempty"`
MyanimelistID int `json:"myanimelist_id"`
RatesScoresStats []RatesScoresStat `json:"rates_scores_stats"`
RatesStatusesStats []RatesStatusesStat `json:"rates_statuses_stats"`
UpdatedAt time.Time `json:"updated_at"`
NextEpisodeAt *time.Time `json:"next_episode_at,omitempty"`
Fansubbers []string `json:"fansubbers"`
Fandubbers []string `json:"fandubbers"`
Licensors []string `json:"licensors"`
Genres []Genre `json:"genres"`
Studios []Studio `json:"studios"`
Videos []Video `json:"videos"`
Screenshots []Screenshot `json:"screenshots"`
UserRate *UserRate `json:"user_rate,omitempty"`
}
type CharacterAnime struct {
Anime
Roles []string `json:"roles"`
Role string `json:"role"`
}
type AnimeImage struct {
Original string `json:"original"`
Preview string `json:"preview"`
X96 string `json:"x96"`
X48 string `json:"x48"`
}
type AnimeOrder string
const (
AnimeOrderID AnimeOrder = "id"
AnimeOrderIDDesc AnimeOrder = "id_desc"
AnimeOrderRanked AnimeOrder = "ranked"
AnimeOrderKind AnimeOrder = "kind"
AnimeOrderPopularity AnimeOrder = "popularity"
AnimeOrderName AnimeOrder = "name"
AnimeOrderAiredOn AnimeOrder = "aired_on"
AnimeOrderEpisodes AnimeOrder = "episodes"
AnimeOrderStatus AnimeOrder = "status"
AnimeOrderRandom AnimeOrder = "random"
AnimeOrderCreatedAt AnimeOrder = "created_at"
AnimeOrderCreatedAtDesc AnimeOrder = "created_at_desc"
)
type AnimeDuration string
const (
// Less than 10 minutes.
AnimeDurationsS AnimeDuration = "S"
// Less than 30 minutes.
AnimeDurationsD AnimeDuration = "D"
// More than 30 minutes.
AnimeDurationsF AnimeDuration = "F"
)
type AnimeRating string
const (
// No rating.
AnimeRatingNone AnimeRating = "none"
// All ages.
AnimeRatingG AnimeRating = "g"
// Children.
AnimeRatingPG AnimeRating = "pg"
// Teens 13 or older.
AnimeRatingPG13 AnimeRating = "pg_13"
// Recommended (violence & profanity).
AnimeRatingR AnimeRating = "r"
// Mild Nudity (may also contain violence & profanity).
AnimeRatingRPlus AnimeRating = "r_plus"
// Hentai (extreme sexual content/nudity).
AnimeRatingRX AnimeRating = "rx"
)
type AnimeMyList string
const (
AnimeMyListPlanned AnimeMyList = "planned"
AnimeMyListWatching AnimeMyList = "watching"
AnimeMyListRewatching AnimeMyList = "rewatching"
AnimeMyListCompleted AnimeMyList = "completed"
AnimeMyListOnHold AnimeMyList = "on_hold"
AnimeMyListDropped AnimeMyList = "dropped"
)
type AnimesParams struct {
// Must be a number between 1 and 100000.
Page int `json:"page,omitempty"`
// 50 maximum. Must be a number.
Limit int `json:"limit,omitempty"`
// Must be one of: id, id_desc, ranked, kind, popularity, name,
// aired_on, episodes, status, random, ranked_random,
// ranked_shiki, created_at, created_at_desc.
Order AnimeOrder `json:"order,omitempty"`
// Must be one of: tv, movie, ova, ona, special, music, tv_13, tv_24, tv_48.
Kind AnimeKind `json:"kind,omitempty"`
// Must be one of: anons, ongoing, released.
Status AnimeStatus `json:"status,omitempty"`
// Examples: summer_2017, 2016, 2014_2016, 199x.
Season string `json:"season,omitempty"`
// Minimal anime score. Must be a number.
Score int `json:"score,omitempty"`
// Must be one of: S, D, F.
Duration AnimeDuration `json:"duration,omitempty"`
// Must be one of: none, g, pg, pg_13, r, r_plus, rx.
Rating AnimeRating `json:"rating,omitempty"`
// List of genre ids separated by comma.
Genre string `json:"genre,omitempty"`
// List of studio ids separated by comma.
Studio string `json:"studio,omitempty"`
// List of franchises separated by comma.
Franchise string `json:"franchise,omitempty"`
// Set to false to allow hentai, yaoi and yuri. Must be one of: true, false.
Censored bool `json:"censored,omitempty"`
// Status of manga in current user list.
// Must be one of: planned, watching, rewatching, completed, on_hold, dropped.
MyList AnimeMyList `json:"mylist,omitempty"`
// List of anime ids separated by comma.
IDs string `json:"ids,omitempty"`
// List of anime ids separated by comma.
ExcludeIDs string `json:"exclude_ids,omitempty"`
// Search phrase to filter animes by name. Must be a String.
Search string `json:"search,omitempty"`
}
func (s *API) Animes(ctx context.Context, params *AnimesParams) (resp []Anime, err error) {
err = s.get(ctx, &resp, "animes", params)
return
}
type AnimeParams struct{}
func (s *API) Anime(ctx context.Context, id int, params *AnimeParams) (resp AnimeFull, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id), params)
return
}
type AnimeRole struct {
Roles []string `json:"roles"`
RolesRussian []string `json:"roles_russian"`
Character *CharacterBase `json:"character"`
Person *PersonBase `json:"person"`
}
type AnimeRolesParams struct{}
func (s *API) AnimeRoles(
ctx context.Context, id int, params *AnimeRolesParams,
) (resp []AnimeRole, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/roles", params)
return
}
type AnimeSimilarParams struct{}
func (s *API) AnimeSimilar(ctx context.Context, id int, params *AnimeSimilarParams) (resp []Anime, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/similar", params)
return
}
type AnimeRelated struct {
Relation string `json:"relation"`
RelationRussian string `json:"relation_russian"`
Anime Anime `json:"anime"`
Manga interface{} `json:"manga"`
}
type AnimeRelatedParams struct{}
func (s *API) AnimeRelated(ctx context.Context, id int, params *AnimeRelatedParams) (resp []AnimeRelated, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/related", params)
return
}
type AnimeScreenshotsParams struct{}
func (s *API) AnimeScreenshots(
ctx context.Context, id int, params *AnimeScreenshotsParams,
) (resp []Screenshot, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/screenshots", params)
return
}
type AnimeFranchiseParams struct{}
func (s *API) AnimeFranchise(ctx context.Context, id int, params *AnimeFranchiseParams) (
resp Franchise,
err error,
) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/franchise", params)
return
}
type AnimeExternalLinksParams struct{}
func (s *API) AnimeExternalLinks(
ctx context.Context, id int, params *AnimeExternalLinksParams,
) (resp []ExternalLink, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/external_links", params)
return
}
type AnimeTopicsParams struct{}
func (s *API) AnimeTopics(
ctx context.Context, id int, params *AnimeTopicsParams,
) (resp []Topic, err error) {
err = s.get(ctx, &resp, "animes/"+strconv.Itoa(id)+"/topics", params)
return
}