getUserPlaylists method

Future<List> getUserPlaylists(
  1. String channelId,
  2. String params
)

Retrieve a list of playlists for a given user.

Call this function again with the returned params to get the full list.

  • channelId channelId of the user.
  • params params obtained by getUser.

Returns List of user playlists in the format of getLibraryPlaylists. // TODO getLibraryPlaylists is currently missing

Implementation

Future<List> getUserPlaylists(String channelId, String params) async {
  const endpoint = 'browse';
  final body = {'browseId': channelId, 'params': params};
  final response = await sendRequest(endpoint, body);

  final results = nav(response, [
    ...SINGLE_COLUMN_TAB,
    ...SECTION_LIST_ITEM,
    ...GRID_ITEMS,
  ], nullIfAbsent: true);
  if (results == null) return [];

  return parseContentList(results as List<JsonMap>, parsePlaylist);
}