-
Notifications
You must be signed in to change notification settings - Fork 0
/
toplevellists.go
60 lines (50 loc) · 1.69 KB
/
toplevellists.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
package rottentomatoes
type ListsDirectoryResponse struct {
Links ListsDirectoryLinks `json:"links,omitempty"`
}
type ListsDirectoryLinks struct {
Movies string `json:"movies,omitempty"`
DVDs string `json:"dvds,omitempty"`
}
type MovieListsDirectoryResponse struct {
Links MovieListsDirectoryLinks `json:"links,omitempty"`
}
type MovieListsDirectoryLinks struct {
BoxOffice string `json:"box_office,omitempty"`
InTheaters string `json:"in_theaters,omitempty"`
Opening string `json:"opening,omitempty"`
Upcoming string `json:"upcoming,omitempty"`
}
type DVDListsDirectoryResponse struct {
Links DVDListsDirectoryLinks `json:"links,omitempty"`
}
type DVDListsDirectoryLinks struct {
TopRentals string `json:"top_rentals,omitempty"`
CurrentReleases string `json:"current_releases,omitempty"`
NewReleases string `json:"new_releases,omitempty"`
Upcoming string `json:"upcoming,omitempty"`
}
type TopLevelListsService struct {
client *Client
}
// Returns the top level lists available in the API.
func (t *TopLevelListsService) ListsDirectory() (*ListsDirectoryResponse, error) {
rel := "lists.json?"
resp := new(ListsDirectoryResponse)
_, err := t.client.get(rel, nil, resp)
return resp, err
}
// Returns the movie lists.
func (t *TopLevelListsService) MovieListsDirectory() (*MovieListsDirectoryResponse, error) {
rel := "lists/movies.json?"
resp := new(MovieListsDirectoryResponse)
_, err := t.client.get(rel, nil, resp)
return resp, err
}
// Returns the dvd lists.
func (t *TopLevelListsService) DVDListsDirectory() (*DVDListsDirectoryResponse, error) {
rel := "lists/dvds.json?"
resp := new(DVDListsDirectoryResponse)
_, err := t.client.get(rel, nil, resp)
return resp, err
}