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
@@ -23,13 +23,10 @@ func (c *Client) GetLabels(ctx context.Context) ([]*models.Label, error) {
|
||||
}
|
||||
|
||||
// GetLabel gets a label by ID
|
||||
// GET /labels/{labelID}
|
||||
func (c *Client) GetLabel(ctx context.Context, labelID string) (*models.Label, error) {
|
||||
params := map[string]string{
|
||||
"label_id": labelID,
|
||||
}
|
||||
|
||||
var result models.Label
|
||||
if err := c.request.Get(ctx, "/labels", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/labels/%s", labelID), nil, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.SetClient(c)
|
||||
@@ -37,10 +34,9 @@ func (c *Client) GetLabel(ctx context.Context, labelID string) (*models.Label, e
|
||||
}
|
||||
|
||||
// GetLabelAlbums gets albums for a label
|
||||
// GET /labels/{labelID}/albums
|
||||
func (c *Client) GetLabelAlbums(ctx context.Context, labelID string, page, pageSize int) (*models.LabelAlbums, error) {
|
||||
params := map[string]string{
|
||||
"label_id": labelID,
|
||||
}
|
||||
params := map[string]string{}
|
||||
if page > 0 {
|
||||
params["page"] = fmt.Sprintf("%d", page)
|
||||
}
|
||||
@@ -49,17 +45,16 @@ func (c *Client) GetLabelAlbums(ctx context.Context, labelID string, page, pageS
|
||||
}
|
||||
|
||||
var result models.LabelAlbums
|
||||
if err := c.request.Get(ctx, "/labels/albums", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/labels/%s/albums", labelID), params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
// GetLabelArtists gets artists for a label
|
||||
// GET /labels/{labelID}/artists
|
||||
func (c *Client) GetLabelArtists(ctx context.Context, labelID string, page, pageSize int) (*models.LabelArtists, error) {
|
||||
params := map[string]string{
|
||||
"label_id": labelID,
|
||||
}
|
||||
params := map[string]string{}
|
||||
if page > 0 {
|
||||
params["page"] = fmt.Sprintf("%d", page)
|
||||
}
|
||||
@@ -68,7 +63,7 @@ func (c *Client) GetLabelArtists(ctx context.Context, labelID string, page, page
|
||||
}
|
||||
|
||||
var result models.LabelArtists
|
||||
if err := c.request.Get(ctx, "/labels/artists", params, &result); err != nil {
|
||||
if err := c.request.Get(ctx, fmt.Sprintf("/labels/%s/artists", labelID), params, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
|
||||
Reference in new issue
Block a user