forked from scakemyer/quasar
-
Notifications
You must be signed in to change notification settings - Fork 44
/
types.go
498 lines (444 loc) · 13.3 KB
/
types.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
package trakt
import "time"
// Object ...
type Object struct {
Title string `json:"title"`
Year int `json:"year"`
IDs *IDs `json:"ids"`
UpdatedAt time.Time `json:"updated_at"`
}
// MovieSearchResults ...
type MovieSearchResults []struct {
Type string `json:"type"`
Score interface{} `json:"score"`
Movie *Movie `json:"movie"`
}
// ShowSearchResults ...
type ShowSearchResults []struct {
Type string `json:"type"`
Score interface{} `json:"score"`
Show *Show `json:"show"`
}
// EpisodeSearchResults ...
type EpisodeSearchResults []struct {
Type string `json:"type"`
Score interface{} `json:"score"`
Episode *Episode
Show *Show
}
// Movie ...
type Movie struct {
Object
Certification string `json:"certification"`
Genres []string `json:"genres"`
Language string `json:"language"`
Overview string `json:"overview"`
Rating float32 `json:"rating"`
Released string `json:"released"`
Runtime int `json:"runtime"`
TagLine string `json:"tagline"`
Trailer string `json:"trailer"`
Translations []string `json:"available_translations"`
URL string `json:"homepage"`
Votes int `json:"votes"`
}
// Show ...
type Show struct {
Object
AiredEpisodes int `json:"aired_episodes"`
Airs *Airs `json:"airs"`
Certification string `json:"certification"`
Country string `json:"country"`
FirstAired string `json:"first_aired"`
Genres []string `json:"genres"`
Language string `json:"language"`
Network string `json:"network"`
Overview string `json:"overview"`
Rating float32 `json:"rating"`
Runtime int `json:"runtime"`
TagLine string `json:"tagline"`
Status string `json:"status"`
Trailer string `json:"trailer"`
Translations []string `json:"available_translations"`
URL string `json:"homepage"`
Votes int `json:"votes"`
}
// Season ...
type Season struct {
// Show *Show `json:"-"`
AiredEpisodes int `json:"aired_episodes"`
EpisodeCount int `json:"episode_count"`
FirstAired string `json:"first_aired"`
Network string `json:"network"`
Number int `json:"number"`
Overview string `json:"overview"`
Rating float32 `json:"rating"`
Votes int `json:"votes"`
Episodes []*Episode `json:"episodes"`
IDs *IDs `json:"ids"`
}
// Episode ...
type Episode struct {
// Show *Show `json:"-"`
// Season *ShowSeason `json:"-"`
Absolute int `json:"number_abs"`
FirstAired string `json:"first_aired"`
Number int `json:"number"`
Overview string `json:"overview"`
Season int `json:"season"`
Title string `json:"title"`
Translations []string `json:"available_translations"`
Runtime int `json:"runtime"`
Rating float32 `json:"rating"`
Votes int `json:"votes"`
IDs *IDs `json:"ids"`
}
// Airs ...
type Airs struct {
Day string `json:"day"`
Time string `json:"time"`
Timezone string `json:"timezone"`
}
// Movies ...
type Movies struct {
Watchers int `json:"watchers"`
Movie *Movie `json:"movie"`
}
// Shows ...
type Shows struct {
Watchers int `json:"watchers"`
Show *Show `json:"show"`
}
// Watchlist ...
type Watchlist struct {
Movies []*Movie `json:"movies"`
Shows []*Show `json:"shows"`
Episodes []*Episode `json:"episodes"`
}
// WatchlistMovie ...
type WatchlistMovie struct {
ListedAt time.Time `json:"listed_at"`
Type string `json:"type"`
Movie *Movie `json:"movie"`
}
// WatchlistShow ...
type WatchlistShow struct {
ListedAt time.Time `json:"listed_at"`
Type string `json:"type"`
Show *Show `json:"show"`
}
// WatchlistSeason ...
type WatchlistSeason struct {
ListedAt time.Time `json:"listed_at"`
Type string `json:"type"`
Season *Object `json:"season"`
Show *Object `json:"show"`
}
// WatchlistEpisode ...
type WatchlistEpisode struct {
ListedAt time.Time `json:"listed_at"`
Type string `json:"type"`
Episode *Episode `json:"episode"`
Show *Object `json:"show"`
}
// CollectionMovie ...
type CollectionMovie struct {
CollectedAt time.Time `json:"collected_at"`
Movie *Movie `json:"movie"`
}
// CollectionShow ...
type CollectionShow struct {
CollectedAt time.Time `json:"last_collected_at"`
Show *Show `json:"show"`
Seasons []*CollectedSeason `json:"seasons"`
}
// CollectedSeason ...
type CollectedSeason struct {
Number int `json:"number"`
Episodes []*CollectedEpisode `json:"episodes"`
}
// CollectedEpisode ...
type CollectedEpisode struct {
CollectedAt time.Time `json:"collected_at"`
Number int `json:"number"`
}
// HiddenShow ...
type HiddenShow struct {
HiddenAt time.Time `json:"hidden_at"`
Type string `json:"type"`
Show *Show `json:"show"`
}
// Sizes ...
type Sizes struct {
Full string `json:"full"`
Medium string `json:"medium"`
Thumbnail string `json:"thumb"`
}
// IDs ...
type IDs struct {
Trakt int `json:"trakt"`
IMDB string `json:"imdb"`
TMDB int `json:"tmdb"`
TVDB int `json:"tvdb"`
TVRage int `json:"tvrage"`
Slug string `json:"slug"`
}
// Code ...
type Code struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURL string `json:"verification_url"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
// Token ...
type Token struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
}
// TokenRefresh ...
type TokenRefresh struct {
RefreshToken string `json:"refresh_token"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
RedirectURI string `json:"redirect_uri"`
GrantType string `json:"grant_type"`
}
// ListContainer ...
type ListContainer struct {
LikeCount int `json:"like_count"`
CommentCount int `json:"comment_count"`
LikedAt time.Time `json:"liked_at"`
Type string `json:"type"`
List *List `json:"list"`
}
// List ...
type List struct {
Name string `json:"name"`
Description string `json:"description"`
Privacy string `json:"privacy"`
Type string `json:"type"`
DisplayNumbers bool `json:"display_numbers"`
AllowComments bool `json:"allow_comments"`
SortBy string `json:"sort_by"`
SortHow string `json:"sort_how"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ItemCount int `json:"item_count"`
CommentCount int `json:"comment_count"`
Likes int `json:"likes"`
IDs *IDs `json:"IDs"`
User *User `json:"User"`
}
// ListItem ...
type ListItem struct {
Rank int `json:"rank"`
ListedAt time.Time `json:"listed_at"`
Type string `json:"type"`
Movie *Movie `json:"movie"`
Show *Show `json:"show"`
// Season *Season `json:"season"`
// Episode *Episode `json:"episode"`
}
// CalendarShow ...
type CalendarShow struct {
FirstAired string `json:"first_aired"`
Episode *Episode `json:"episode"`
Show *Show `json:"show"`
}
// CalendarMovie ...
type CalendarMovie struct {
Released string `json:"released"`
Movie *Movie `json:"movie"`
}
// User ...
type User struct {
Username string `json:"username"`
Private bool `json:"private"`
Name string `json:"name"`
Vip bool `json:"vip"`
VipEp bool `json:"vip_ep"`
Ids struct {
Slug string `json:"slug"`
} `json:"ids"`
}
// UserSettings ...
type UserSettings struct {
User User `json:"user"`
Account struct{} `json:"account"`
}
// PausedMovie represents paused movie
type PausedMovie struct {
Progress float64 `json:"progress"`
PausedAt time.Time `json:"paused_at"`
ID int `json:"id"`
Type string `json:"type"`
Movie *Movie `json:"movie"`
}
// PausedEpisode represents paused episode with show information
type PausedEpisode struct {
Progress float64 `json:"progress"`
PausedAt time.Time `json:"paused_at"`
ID int `json:"id"`
Type string `json:"type"`
Episode *Episode `json:"episode"`
Show *Show `json:"show"`
}
// WatchedItem represents possible watched add/delete item
type WatchedItem struct {
MediaType string
KodiID int
KodiKey uint64
Movie int
Show int
Season int
Episode int
Watched bool
WatchedAt time.Time
}
// WatchedMovie ...
type WatchedMovie struct {
Plays int `json:"plays"`
LastWatchedAt time.Time `json:"last_watched_at"`
Movie *Movie `json:"movie"`
}
// WatchedShow ...
type WatchedShow struct {
Plays int `json:"plays"`
Watched bool
LastWatchedAt time.Time `json:"last_watched_at"`
Show *Show `json:"show"`
Seasons []*WatchedSeason `json:"seasons"`
}
// WatchedSeason ...
type WatchedSeason struct {
Plays int `json:"plays"`
Number int `json:"number"`
Episodes []*WatchedEpisode `json:"episodes"`
}
// WatchedEpisode ...
type WatchedEpisode struct {
Number int `json:"number"`
Plays int `json:"plays"`
LastWatchedAt time.Time `json:"last_watched_at"`
}
// WatchedProgressShow ...
type WatchedProgressShow struct {
Aired int `json:"aired"`
Completed int `json:"completed"`
LastWatchedAt time.Time `json:"last_watched_at"`
Seasons []*Season `json:"seasons"`
HiddenSeasons []*Season `json:"hidden_seasons"`
NextEpisode *Episode `json:"next_episode"`
LastEpisode *Episode `json:"last_episode"`
}
// ProgressShow ...
type ProgressShow struct {
Episode *Episode `json:"episode"`
Show *Show `json:"show"`
}
// Pagination ...
type Pagination struct {
ItemCount int `json:"x_pagination_item_count"`
Limit int `json:"x_pagination_limit"`
Page int `json:"x_pagination_page"`
PageCount int `json:"x_pagination_page_count"`
}
// UserActivities is a structure, returned by sync/last_activities
type UserActivities struct {
All time.Time `json:"all"`
Movies struct {
WatchedAt time.Time `json:"watched_at"`
CollectedAt time.Time `json:"collected_at"`
RatedAt time.Time `json:"rated_at"`
WatchlistedAt time.Time `json:"watchlisted_at"`
FavoritedAt time.Time `json:"favorited_at"`
CommentedAt time.Time `json:"commented_at"`
PausedAt time.Time `json:"paused_at"`
HiddenAt time.Time `json:"hidden_at"`
} `json:"movies"`
Episodes struct {
WatchedAt time.Time `json:"watched_at"`
CollectedAt time.Time `json:"collected_at"`
RatedAt time.Time `json:"rated_at"`
WatchlistedAt time.Time `json:"watchlisted_at"`
CommentedAt time.Time `json:"commented_at"`
PausedAt time.Time `json:"paused_at"`
} `json:"episodes"`
Shows struct {
RatedAt time.Time `json:"rated_at"`
WatchlistedAt time.Time `json:"watchlisted_at"`
FavoritedAt time.Time `json:"favorited_at"`
CommentedAt time.Time `json:"commented_at"`
HiddenAt time.Time `json:"hidden_at"`
} `json:"shows"`
Seasons struct {
RatedAt time.Time `json:"rated_at"`
WatchlistedAt time.Time `json:"watchlisted_at"`
CommentedAt time.Time `json:"commented_at"`
HiddenAt time.Time `json:"hidden_at"`
} `json:"seasons"`
Comments struct {
LikedAt time.Time `json:"liked_at"`
BlockedAt time.Time `json:"blocked_at"`
} `json:"comments"`
Lists struct {
LikedAt time.Time `json:"liked_at"`
UpdatedAt time.Time `json:"updated_at"`
CommentedAt time.Time `json:"commented_at"`
} `json:"lists"`
Watchlist struct {
UpdatedAt time.Time `json:"updated_at"`
} `json:"watchlist"`
Favorites struct {
UpdatedAt time.Time `json:"updated_at"`
} `json:"favorites"`
Account struct {
SettingsAt time.Time `json:"settings_at"`
FollowedAt time.Time `json:"followed_at"`
FollowingAt time.Time `json:"following_at"`
PendingAt time.Time `json:"pending_at"`
RequestedAt time.Time `json:"requested_at"`
} `json:"account"`
SavedFilters struct {
UpdatedAt time.Time `json:"updated_at"`
} `json:"saved_filters"`
Notes struct {
UpdatedAt time.Time `json:"updated_at"`
} `json:"notes"`
}
// ListItemsPayload describes items to add/remove from userlists
type ListItemsPayload struct {
Movies []*Movie `json:"movies,omitempty"`
Shows []*Show `json:"shows,omitempty"`
}
// HistoryResponseStats refrects stats for each action type
type HistoryResponseStats struct {
Movies int `json:"movies"`
Episodes int `json:"episodes"`
}
// HistoryResponse reflects response from History remove
type HistoryResponse struct {
Added HistoryResponseStats `json:"added"`
Deleted HistoryResponseStats `json:"deleted"`
NotFound struct {
Movies []struct {
IDs *IDs `json:"IDs"`
} `json:"movies"`
Shows []struct {
IDs *IDs `json:"IDs"`
} `json:"shows"`
Seasons []struct {
IDs *IDs `json:"IDs"`
} `json:"seasons"`
Episodes []struct {
IDs *IDs `json:"IDs"`
} `json:"episodes"`
Ids []int `json:"ids"`
} `json:"not_found"`
}
type WatchedMoviesType []*WatchedMovie
type WatchedShowsType []*WatchedShow