-
Notifications
You must be signed in to change notification settings - Fork 3
/
MediaRelationsResponse.go
213 lines (207 loc) · 6.23 KB
/
MediaRelationsResponse.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
package kitsu
import (
"time"
)
// MediaRelationsResponse ...
type MediaRelationsResponse struct {
Data []*MediaRelation `json:"data"`
Included []struct {
ID string `json:"id"`
Type string `json:"type"`
Links struct {
Self string `json:"self"`
} `json:"links"`
Attributes struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Slug string `json:"slug"`
Synopsis string `json:"synopsis"`
CoverImageTopOffset int `json:"coverImageTopOffset"`
Titles struct {
EnJp string `json:"en_jp"`
JaJp string `json:"ja_jp"`
} `json:"titles"`
CanonicalTitle string `json:"canonicalTitle"`
AbbreviatedTitles []interface{} `json:"abbreviatedTitles"`
AverageRating string `json:"averageRating"`
RatingFrequencies struct {
Num2 string `json:"2"`
Num3 string `json:"3"`
Num4 string `json:"4"`
Num5 string `json:"5"`
Num6 string `json:"6"`
Num7 string `json:"7"`
Num8 string `json:"8"`
Num9 string `json:"9"`
Num10 string `json:"10"`
Num11 string `json:"11"`
Num12 string `json:"12"`
Num13 string `json:"13"`
Num14 string `json:"14"`
Num15 string `json:"15"`
Num16 string `json:"16"`
Num17 string `json:"17"`
Num18 string `json:"18"`
Num19 string `json:"19"`
Num20 string `json:"20"`
} `json:"ratingFrequencies"`
UserCount int `json:"userCount"`
FavoritesCount int `json:"favoritesCount"`
StartDate string `json:"startDate"`
EndDate string `json:"endDate"`
PopularityRank int `json:"popularityRank"`
RatingRank int `json:"ratingRank"`
AgeRating string `json:"ageRating"`
AgeRatingGuide string `json:"ageRatingGuide"`
Subtype string `json:"subtype"`
Status string `json:"status"`
Tba interface{} `json:"tba"`
PosterImage struct {
Tiny string `json:"tiny"`
Small string `json:"small"`
Medium string `json:"medium"`
Large string `json:"large"`
Original string `json:"original"`
Meta struct {
Dimensions struct {
Tiny struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"tiny"`
Small struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"small"`
Medium struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"medium"`
Large struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"large"`
} `json:"dimensions"`
} `json:"meta"`
} `json:"posterImage"`
CoverImage struct {
Tiny string `json:"tiny"`
Small string `json:"small"`
Large string `json:"large"`
Original string `json:"original"`
Meta struct {
Dimensions struct {
Tiny struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"tiny"`
Small struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"small"`
Large struct {
Width interface{} `json:"width"`
Height interface{} `json:"height"`
} `json:"large"`
} `json:"dimensions"`
} `json:"meta"`
} `json:"coverImage"`
EpisodeCount int `json:"episodeCount"`
EpisodeLength int `json:"episodeLength"`
YoutubeVideoID interface{} `json:"youtubeVideoId"`
ShowType string `json:"showType"`
Nsfw bool `json:"nsfw"`
} `json:"attributes"`
Relationships struct {
Genres struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"genres"`
Categories struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"categories"`
Castings struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"castings"`
Installments struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"installments"`
Mappings struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"mappings"`
Reviews struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"reviews"`
MediaRelationships struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"mediaRelationships"`
Episodes struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"episodes"`
StreamingLinks struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"streamingLinks"`
AnimeProductions struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"animeProductions"`
AnimeCharacters struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"animeCharacters"`
AnimeStaff struct {
Links struct {
Self string `json:"self"`
Related string `json:"related"`
} `json:"links"`
} `json:"animeStaff"`
} `json:"relationships"`
} `json:"included"`
Meta struct {
Count int `json:"count"`
} `json:"meta"`
Links struct {
First string `json:"first"`
Next string `json:"next"`
Last string `json:"last"`
} `json:"links"`
}
// GetMediaRelations expects the usual query parameter and returns an MediaRelationsResponse object.
func GetMediaRelations(query string) (*MediaRelationsResponse, error) {
response, requestError := Get(query)
if requestError != nil {
return nil, requestError
}
mediaRelations := new(MediaRelationsResponse)
decodeError := response.Unmarshal(mediaRelations)
return mediaRelations, decodeError
}