This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
forked from ryanbradynd05/go-tmdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchanges.go
48 lines (42 loc) · 1.59 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
// http://docs.themoviedb.apiary.io/#reference/changes/moviechanges/get
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
// http://docs.themoviedb.apiary.io/#reference/changes/personchanges/get
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
// http://docs.themoviedb.apiary.io/#reference/changes/tvchanges/get
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
}