-
Notifications
You must be signed in to change notification settings - Fork 35
/
tv_episode_groups.go
75 lines (71 loc) · 2.22 KB
/
tv_episode_groups.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
package tmdb
import (
"fmt"
jsoniter "github.com/json-iterator/go"
)
// TVEpisodeGroupsDetails type is a struct for details JSON response.
type TVEpisodeGroupsDetails struct {
Description string `json:"description"`
EpisodeCount int `json:"episode_count"`
GroupCount int `json:"group_count"`
Groups []struct {
ID string `json:"id"`
Name string `json:"name"`
Order int `json:"order"`
Episodes []struct {
AirDate string `json:"air_date"`
EpisodeNumber int `json:"episode_number"`
ID int64 `json:"id"`
Name string `json:"name"`
Overview string `json:"overview"`
ProductionCode jsoniter.RawMessage `json:"production_code"`
SeasonNumber int `json:"season_number"`
ShowID int64 `json:"show_id"`
StillPath string `json:"still_path"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Order int `json:"order"`
} `json:"episodes"`
Locked bool `json:"locked"`
} `json:"groups"`
ID string `json:"id"`
Name string `json:"name"`
Network struct {
ID int64 `json:"id"`
LogoPath string `json:"logo_path"`
Name string `json:"name"`
OriginCountry string `json:"origin_country"`
} `json:"network"`
Type int `json:"type"`
}
// GetTVEpisodeGroupsDetails the details of a TV episode group.
// Groups support 7 different types which are enumerated as the following:
//
// 1. Original air date
// 2. Absolute
// 3. DVD
// 4. Digital
// 5. Story arc
// 6. Production
// 7. TV
//
// https://developers.themoviedb.org/3/tv-episode-groups/get-tv-episode-group-details
func (c *Client) GetTVEpisodeGroupsDetails(
id string,
urlOptions map[string]string,
) (*TVEpisodeGroupsDetails, error) {
options := c.fmtOptions(urlOptions)
tmdbURL := fmt.Sprintf(
"%s%sepisode_group/%s?api_key=%s%s",
baseURL,
tvURL,
id,
c.apiKey,
options,
)
tvEpisodeGroupDetails := TVEpisodeGroupsDetails{}
if err := c.get(tmdbURL, &tvEpisodeGroupDetails); err != nil {
return nil, err
}
return &tvEpisodeGroupDetails, nil
}