/
contentratings.go
50 lines (40 loc) · 1.18 KB
/
contentratings.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
package vimeo
// ContentRatingsService handles communication with the content ratings related
// methods of the Vimeo API.
//
// Vimeo API docs: https://developer.vimeo.com/api/endpoints/contentratings
type ContentRatingsService service
type contentRatingList struct {
Data []*ContentRating `json:"data"`
pagination
}
// ContentRating represents a content rating.
type ContentRating struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
}
// ListContentRatingOptions specifies the optional parameters to the
// ContentRatingsService.List method.
type ListContentRatingOptions struct {
ListOptions
}
// List the content rating.
//
// Vimeo API docs: https://developer.vimeo.com/api/playground/contentratings
func (s *ContentRatingsService) List(opt *ListContentRatingOptions) ([]*ContentRating, *Response, error) {
u, err := addOptions("contentratings", opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
ratings := &contentRatingList{}
resp, err := s.client.Do(req, ratings)
if err != nil {
return nil, resp, err
}
resp.setPaging(ratings)
return ratings.Data, resp, err
}