-
Notifications
You must be signed in to change notification settings - Fork 19
/
me_library_music_videos.go
57 lines (47 loc) · 1.97 KB
/
me_library_music_videos.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
package applemusic
import "context"
// LibraryMusicVideoAttributes represents the attributes of library music video object.
type LibraryMusicVideoAttributes struct {
AlbumName string `json:"albumName"`
ArtistName string `json:"artistName"`
Artwork Artwork `json:"artwork"`
ContentRating string `json:"contentRating,omitempty"`
DurationInMillis int64 `json:"durationInMillis,omitempty"`
Name string `json:"name"`
PlayParams PlayParameters `json:"playParams,omitempty"`
TrackNumber int `json:"trackNumber,omitempty"`
}
// LibraryMusicVideo represents a Resource object that represents a library music video.
type LibraryMusicVideo struct {
Id string `json:"id"`
Type string `json:"type"`
Href string `json:"href,omitempty"`
Attributes LibraryMusicVideoAttributes `json:"attributes,omitempty"`
}
// LibraryMusicVideos represents a list of library music video.
type LibraryMusicVideos struct {
Data []LibraryMusicVideo `json:"data"`
Href string `json:"href,omitempty"`
Next string `json:"next,omitempty"`
}
func (s *MeService) getLibraryMusicVideos(ctx context.Context, u string, opt interface{}) (*LibraryMusicVideos, *Response, error) {
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
libraryMusicVideos := &LibraryMusicVideos{}
resp, err := s.client.Do(ctx, req, libraryMusicVideos)
if err != nil {
return nil, resp, err
}
return libraryMusicVideos, resp, nil
}
// GetAllLibraryMusicVideos fetches all the library music videos in alphabetical order.
func (s *MeService) GetAllLibraryMusicVideos(ctx context.Context, opt *PageOptions) (*LibraryMusicVideos, *Response, error) {
u := "v1/me/library/music-videos"
return s.getLibraryMusicVideos(ctx, u, opt)
}