-
Notifications
You must be signed in to change notification settings - Fork 1
/
playlist.go
53 lines (46 loc) · 1.6 KB
/
playlist.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
package deezer
import "fmt"
type PlaylistService service
type Playlist struct {
ID int `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Public bool `json:"public,omitempty"`
Link string `json:"link,omitempty"`
Picture string `json:"picture,omitempty"`
PictureSmall string `json:"picture_small,omitempty"`
PictureMedium string `json:"picture_medium,omitempty"`
PictureBig string `json:"picture_big,omitempty"`
PictureXL string `json:"picture_xl,omitempty"`
Checksum string `json:"checksum,omitempty"`
Tracklist string `json:"tracklist,omitempty"`
CreationDate string `json:"creation_date,omitempty"`
User *User `json:"user,omitempty"`
Type string `json:"type,omitempty"`
}
func (s *PlaylistService) Get(ID string) (*Playlist, error) {
var err error
playlist := new(Playlist)
s.client.base.Path("playlist/").Get(ID).Receive(playlist, err)
return playlist, err
}
func (s *PlaylistService) GetComments(ID string) (*Comments, error) {
var err error
comments := new(Comments)
path := fmt.Sprintf("playlist/%s/comments", ID)
s.client.base.Get(path).Receive(comments, err)
return comments, err
}
func (s *PlaylistService) GetFans(ID string) (*Fans, error) {
var err error
fans := new(Fans)
path := fmt.Sprintf("playlist/%s/fans", ID)
s.client.base.Get(path).Receive(fans, err)
return fans, err
}
func (s *PlaylistService) GetTracks(ID string) (*Tracks, error) {
var err error
tracks := new(Tracks)
path := fmt.Sprintf("playlist/%s/tracks", ID)
s.client.base.Get(path).Receive(tracks, err)
return tracks, err
}