-
Notifications
You must be signed in to change notification settings - Fork 57
/
changes.go
48 lines (42 loc) · 1.58 KB
/
changes.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
package tmdb
import (
"fmt"
)
// Changes struct
type Changes struct {
Results []struct {
ID int
Adult bool
}
}
var changeOptions = map[string]struct{}{
"page": {},
"start_date": {},
"end_date": {}}
// GetChangesMovie gets a list of movie ids that have been edited
// https://developers.themoviedb.org/3/changes/get-movie-change-list
func (tmdb *TMDb) GetChangesMovie(options map[string]string) (*Changes, error) {
var movieChanges Changes
optionsString := getOptionsString(options, changeOptions)
uri := fmt.Sprintf("%s/movie/changes?api_key=%s%s", baseURL, tmdb.apiKey, optionsString)
result, err := getTmdb(uri, &movieChanges)
return result.(*Changes), err
}
// GetChangesPerson gets a list of people ids that have been edited
// https://developers.themoviedb.org/3/changes/get-person-change-list
func (tmdb *TMDb) GetChangesPerson(options map[string]string) (*Changes, error) {
var personChanges Changes
optionsString := getOptionsString(options, changeOptions)
uri := fmt.Sprintf("%s/person/changes?api_key=%s%s", baseURL, tmdb.apiKey, optionsString)
result, err := getTmdb(uri, &personChanges)
return result.(*Changes), err
}
// GetChangesTv gets a list of tv show ids that have been edited
// https://developers.themoviedb.org/3/changes/get-tv-change-list
func (tmdb *TMDb) GetChangesTv(options map[string]string) (*Changes, error) {
var tvChanges Changes
optionsString := getOptionsString(options, changeOptions)
uri := fmt.Sprintf("%s/tv/changes?api_key=%s%s", baseURL, tmdb.apiKey, optionsString)
result, err := getTmdb(uri, &tvChanges)
return result.(*Changes), err
}