Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognised item type error when using fields on GetPlaylistItems #262

Open
thechubbypanda opened this issue Jun 16, 2024 · 4 comments
Open

Comments

@thechubbypanda
Copy link

I'm calling

spotify.Client.GetPlaylistItems(ctx, id, spotify.Fields("items(track(id))"))

and I get the error:

unrecognized item type: 

I'm assuming this is because it's expecting to decode the rest of the fields that don't exist.

I'd expect it to just give me back tracks with only the id populated.

@TimHi
Copy link

TimHi commented Jun 19, 2024

I'm confused what spotify.Fields("items(track(id))") is in your case, are you passing a valid spotify playlist ID?

@thechubbypanda
Copy link
Author

thechubbypanda commented Jun 19, 2024

Yeah, the playlistID is valid. The call works fine without the Fields parameter. See the code here.

I'm trying to use this endpoint as follows:
image

@TimHi
Copy link

TimHi commented Jun 20, 2024

I see, the unmarshaling of the JSON expects the item type, using the filter its missing in func (t *PlaylistItemTrack) UnmarshalJSON.

Also it doesnt work for filters like spotify.Fields("items(track(name))").

I guess when using a Field it can't be expected that the PlaylistItemTrack matches the received JSON.

@thechubbypanda
Copy link
Author

So is there something we can do about this or is it a lost cause?
Do other endpoints play nicely with the fields param?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants