forked from ryanbradynd05/go-tmdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
credits.go
49 lines (46 loc) · 1.32 KB
/
credits.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
package tmdb
import (
"fmt"
)
// Credit struct
type Credit struct {
CreditType string `json:"credit_type"`
Department string
Job string
Media struct {
ID int
Name string
OriginalName string `json:"original_name"`
Character string
Episodes []struct {
AirDate string `json:"air_date"`
EpisodeNumber int `json:"episode_number"`
Name string
Overview string
SeasonNumber int `json:"season_number"`
StillPath string `json:"still_path"`
}
Seasons []struct {
AirDate string `json:"air_date"`
PosterPath string `json:"poster_path"`
SeasonNumber int `json:"season_number"`
}
}
MediaType string `json:"media_type"`
ID string
Person struct {
Name string
ID string
}
}
// GetCreditInfo gets the detailed information about a particular credit record
// https://developers.themoviedb.org/3/credits/get-credit-details
func (tmdb *TMDb) GetCreditInfo(id string, options map[string]string) (*Credit, error) {
var availableOptions = map[string]struct{}{
"language": {}}
var creditInfo Credit
optionsString := getOptionsString(options, availableOptions)
uri := fmt.Sprintf("%s/credit/%v?api_key=%s%s", baseURL, id, tmdb.apiKey, optionsString)
result, err := getTmdb(uri, &creditInfo)
return result.(*Credit), err
}