tmdb - lists.go
1 package tmdb
2
3 import (
4 "net/url"
5 "strconv"
6 )
7
8 // ListDetails is the details of a list
9 type ListDetails struct {
10 CreatedBy string `json:"created_by"`
11 Description string `json:"description"`
12 FavoriteCount int64 `json:"favorite_count"`
13 ID string `json:"id"`
14 Items []MovieResult `json:"items"`
15 ItemCount int64 `json:"item_count"`
16 Language string `json:"iso_639_1"`
17 Name string `json:"name"`
18 PosterPath *string `json:"poster_path"`
19 }
20
21 // ListDetails retrieves the details of a list
22 func (t *TMDB) ListDetails(id string, params ...option) (*ListDetails, error) {
23 l := new(ListDetails)
24 if err := t.get(l, "/3/list/"+id, url.Values{}, params...); err != nil {
25 return nil, err
26 }
27 return l, nil
28 }
29
30 // ListItemPresent states whether a move exists within a list
31 type ListItemPresent struct {
32 ID string `json:"id"`
33 ItemPresent bool `json:"item_present"`
34 }
35
36 // ListItemPresent checks whether a list contains a movie
37 func (t *TMDB) ListItemPresent(listID string, movieID int64) (*ListItemPresent, error) {
38 l := new(ListItemPresent)
39 if err := t.get(l, "/3/list/"+listID+"/item_status", url.Values{"movie_id": []string{strconv.FormatInt(movieID, 10)}}); err != nil {
40 return nil, err
41 }
42 return l, nil
43 }