parseLibraryAlbums function
- JsonMap response,
- RequestFuncType requestFunc,
- int? limit
Parses albums from library.
Implementation
Future<List> parseLibraryAlbums(
JsonMap response,
RequestFuncType requestFunc,
int? limit,
) async {
final results = getLibraryContents(response, GRID);
if (results == null) return [];
final albums = parseAlbums(results['items'] as List<JsonMap>);
if (results.containsKey('continuations')) {
List parseFunc(List<JsonMap> contents) => parseAlbums(contents);
final remainingLimit = limit == null ? null : limit - albums.length;
albums.addAll(
await getContinuations(
results,
'gridContinuation',
remainingLimit,
requestFunc,
parseFunc,
),
);
}
return albums;
}