-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathme_history.go
34 lines (28 loc) · 847 Bytes
/
me_history.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
package applemusic
import (
"context"
)
// HistoryHeavyRotation represents a list of heavy rotation content.
type HistoryHeavyRotation struct {
Data []Resource `json:"data"`
Href string `json:"href,omitempty"`
Next string `json:"next,omitempty"`
}
// GetHistoryHeavyRotation fetches the resources in heavy rotation for the user.
func (s *MeService) GetHistoryHeavyRotation(ctx context.Context, opt *PageOptions) (*HistoryHeavyRotation, *Response, error) {
u := "v1/me/history/heavy-rotation"
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
}
heavyRotation := &HistoryHeavyRotation{}
resp, err := s.client.Do(ctx, req, heavyRotation)
if err != nil {
return nil, resp, err
}
return heavyRotation, resp, nil
}