fix: force market as request option to search for shows
As put in this issue https://github.com/zmb3/spotify/issues/257 calling for client.Search with SearchTypeShow was always returning zero values for Shows data.
When doing same request I got same issue, so when looking into Spotify Developer Forums here and here it turned out to be a Spotify unfixed issue since, at least, 2020.
The solution to this as put by the community is to add market as query parameter as in:
curl --location 'https://api.spotify.com/v1/search?q=cyclast&type=show&market=co' \
--header 'Authorization: Bearer your-token'
This PR has:
- Enforces the use of market parameter when using
client.SearchwithSearchTypeShowsoclientwon't return zero values for correct search values. - Creates a unit test for
client.SearchwithSearchTypeShow. - Adds
CountryColombia.
after a quick local test session, I don't think market is the core issue here, when using curl or postman I can get the results without having to pass in the market parameter, something else is wrong, probably the way we're parsing the shows, will have a further look into it later
aplogies, I was wrong, found the issue - when using bearer token generated from developer.spotify.com, the returned json contains all the data we need, however, when we use the client id and secret to generate a bearer token on each request, using the token spotify returns does not return any shows unless market parameter is passed in. Issue is on spotify side, @zmb3 @strideynet not sure how you wanna proceed here
Followed @subash774 suggestion on new Error. As seen on Spotify forums it is on their side. Waiting for @zmb3 and @strideynet answer to see if they will proceed with this PR or not. Anyways I will be glad to help.
Thanks for raising this - I believe the market issue has been a "problem"/expected behaviour for a while. When using an access token, the native market of the user who the token is associated with is used. When only the Client ID/Secret is used, there is no default market to fall back on.
I'll take a look at this PR later today.