get method
BundledPages
get(
- String searchQuery, {
- Iterable<
SearchType> types = SearchType.values, - Market? market,
Get Spotify Catalog information about albums, artists, playlists, tracks, shows or episodes that match a keyword string.
types
: Valid types are: album , artist, playlist, track, show and episode.
Search results include hits from all the specified item types.
market
: An ISO 3166-1 alpha-2 country code or the string 'from_token'.
If a country code is specified, only artists, albums, and tracks with
content that is playable in that market is returned.
Implementation
BundledPages get(
String searchQuery, {
Iterable<SearchType> types = SearchType.values,
Market? market,
}) {
var type = types.map((type) => type._key).join(',');
var query = _buildQuery({
'q': searchQuery,
'type': type,
'market': market?.name,
});
return _getBundledPages('$_path?$query', {
'playlists': (json) => PlaylistSimple.fromJson(json),
'albums': (json) => AlbumSimple.fromJson(json),
'artists': (json) => Artist.fromJson(json),
'tracks': (json) => Track.fromJson(json),
'shows': (json) => Show.fromJson(json),
'episodes': (json) => Episode.fromJson(json)
});
}