Fix API endpoints: resource IDs in URL path, not query params
- artists/{artist_id}/tracks and /direct-albums: artistID in path, return ArtistTracks/ArtistAlbums with pager
- likes: /users/me/likes/{type}s/{add-multiple|remove}, IDs as body params
- queue: /queues/{queue_id}/... instead of /queue/...?queue_id=...
- radio: /rotor/station/{station_id}/info and /tracks
- concerts: /concerts/{concert_id}/info, /concerts/tab-config
- playlists: /users/{user_id}/playlists
- labels: /labels/{label_id}, /albums, /artists
- clips: /clips/will/like, /artists/{artist_id}/blocks/artist-clips
- feed: /landing3/* endpoints
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
1 parent
02a6dabcfb
commit
70c2a5cd01
12 files changed
+238
-168
No files matched your search
+17
-27
@@ -23,13 +23,10 @@ func (c *Client) GetRadioStations(ctx context.Context) ([]*models.RadioStation,
|
||||
}
|
||||
|
||||
// GetRadioStation gets a radio station by ID
|
||||
// GET /rotor/station/{stationID}/info
|
||||
func (c *Client) GetRadioStation(ctx context.Context, stationID string) (*models.RadioStation, error) {
|
||||
params := map[string]string{
|
||||
"station_id": stationID,
|
||||
}
|
||||
|
||||
var result models.RadioStation
|
||||
if err := c.request.Get(ctx, "/radio/station", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/rotor/station/%s/info", stationID), nil, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.SetClient(c)
|
||||
@@ -37,16 +34,15 @@ func (c *Client) GetRadioStation(ctx context.Context, stationID string) (*models
|
||||
}
|
||||
|
||||
// GetStationTracks gets tracks for a radio station
|
||||
// GET /rotor/station/{stationID}/tracks
|
||||
func (c *Client) GetStationTracks(ctx context.Context, stationID string, limit int) (*models.StationTracksResult, error) {
|
||||
params := map[string]string{
|
||||
"station_id": stationID,
|
||||
}
|
||||
params := map[string]string{}
|
||||
if limit > 0 {
|
||||
params["limit"] = fmt.Sprintf("%d", limit)
|
||||
}
|
||||
|
||||
var result models.StationTracksResult
|
||||
if err := c.request.Get(ctx, "/radio/station/tracks", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/rotor/station/%s/tracks", stationID), params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
@@ -68,13 +64,10 @@ func (c *Client) GetRotorStations(ctx context.Context) ([]*models.RotorStation,
|
||||
}
|
||||
|
||||
// GetRotorStation gets a rotor station by ID
|
||||
// GET /rotor/station/{stationID}/info
|
||||
func (c *Client) GetRotorStation(ctx context.Context, stationID string) (*models.RotorStation, error) {
|
||||
params := map[string]string{
|
||||
"station_id": stationID,
|
||||
}
|
||||
|
||||
var result models.RotorStation
|
||||
if err := c.request.Get(ctx, "/rotor/station", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/rotor/station/%s/info", stationID), nil, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.SetClient(c)
|
||||
@@ -82,29 +75,25 @@ func (c *Client) GetRotorStation(ctx context.Context, stationID string) (*models
|
||||
}
|
||||
|
||||
// GetRotorStationTracks gets tracks for a rotor station
|
||||
// GET /rotor/station/{stationID}/tracks
|
||||
func (c *Client) GetRotorStationTracks(ctx context.Context, stationID string, limit int) (*models.RotorStationTracksResult, error) {
|
||||
params := map[string]string{
|
||||
"station_id": stationID,
|
||||
}
|
||||
params := map[string]string{}
|
||||
if limit > 0 {
|
||||
params["limit"] = fmt.Sprintf("%d", limit)
|
||||
}
|
||||
|
||||
var result models.RotorStationTracksResult
|
||||
if err := c.request.Get(ctx, "/rotor/station/tracks", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/rotor/station/%s/tracks", stationID), params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
// StartRotorSession starts a rotor session
|
||||
// POST /rotor/station/{stationID}/session/start
|
||||
func (c *Client) StartRotorSession(ctx context.Context, stationID string) (*models.RotorSession, error) {
|
||||
params := map[string]string{
|
||||
"station_id": stationID,
|
||||
}
|
||||
|
||||
var result models.RotorSession
|
||||
if err := c.request.Post(ctx, "/rotor/session/start", params, &result); err != nil {
|
||||
if err := c.request.Post(ctx, fmt.Sprintf("/rotor/station/%s/session/start", stationID), nil, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.SetClient(c)
|
||||
@@ -112,6 +101,7 @@ func (c *Client) StartRotorSession(ctx context.Context, stationID string) (*mode
|
||||
}
|
||||
|
||||
// GetRotorSession gets rotor session info
|
||||
// GET /rotor/session?session_id={sessionID}
|
||||
func (c *Client) GetRotorSession(ctx context.Context, sessionID string) (*models.RotorSession, error) {
|
||||
params := map[string]string{
|
||||
"session_id": sessionID,
|
||||
@@ -126,13 +116,13 @@ func (c *Client) GetRotorSession(ctx context.Context, sessionID string) (*models
|
||||
}
|
||||
|
||||
// RotorSessionFeedback sends feedback for a rotor session track
|
||||
// POST /rotor/station/{stationID}/feedback
|
||||
func (c *Client) RotorSessionFeedback(ctx context.Context, sessionID, trackID, feedbackType string) error {
|
||||
params := map[string]string{
|
||||
"session_id": sessionID,
|
||||
"track_id": trackID,
|
||||
"feedback": feedbackType, // "like", "dislike", "skip"
|
||||
"track_id": trackID,
|
||||
"feedback": feedbackType, // "like", "dislike", "skip"
|
||||
}
|
||||
|
||||
var result map[string]any
|
||||
return c.request.Post(ctx, "/rotor/session/feedback", params, &result)
|
||||
return c.request.Post(ctx, fmt.Sprintf("/rotor/station/%s/feedback", sessionID), params, &result)
|
||||
}
|
||||
Reference in new issue
Block a user