forked from yanatan16/golang-soundcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracks.go
More file actions
44 lines (35 loc) · 1.08 KB
/
tracks.go
File metadata and controls
44 lines (35 loc) · 1.08 KB
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
package soundcloud
import (
"net/url"
)
type TrackApi struct {
trackEndpoint
}
func (api *Api) Tracks(params url.Values) ([]*Track, error) {
ret := make([]*Track, 0)
err := api.get("/tracks", params, &ret)
return ret, err
}
func (api *Api) Track(id uint64) *TrackApi {
return &TrackApi{*api.newTrackEndpoint("tracks", id)}
}
func (t *TrackApi) Comments(params url.Values) ([]*Comment, error) {
ret := make([]*Comment, 0)
err := t.api.get(t.base+"/comments", params, &ret)
return ret, err
}
func (t *TrackApi) Comment(id uint64) *commentEndpoint {
return t.api.newCommentEndpoint(t.base, "comments", id)
}
func (t *TrackApi) Favorites(params url.Values) ([]*User, error) {
ret := make([]*User, 0)
err := t.api.get(t.base+"/favorites", params, &ret)
return ret, err
}
func (t *TrackApi) Favorite(id uint64) *userEndpoint {
return t.api.newUserEndpoint(t.base, "favorites", id)
}
// No idea how these endpoints works
// func (t *TrackApi) SharedToUsers() (*usersEndpoint) {
// func (t *TrackApi) SharedToEmails() (*emailsEndpoint) {
// func (t *TrackApi) SecretToken() (*tokenEndpoint)