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