getBookChapters method

Future<Response<Chapter>> getBookChapters({
  1. required String bookId,
  2. Pagination? pagination,
  3. ChapterSorting? sorting,
  4. List<Filter?>? idFilters,
  5. List<Filter?>? chapterNameFilters,
})

Returns Chapters of a particular Book based on the given pagination, sorting and filters.

Implementation

Future<Response<Chapter>> getBookChapters({
  required String bookId,
  Pagination? pagination,
  ChapterSorting? sorting,
  List<Filter?>? idFilters,
  List<Filter?>? chapterNameFilters,
}) async {
  return _getResponse<Chapter>(
    mapping: (c) => Chapter.fromJson(c),
    endpoint: 'book/${bookId}/chapter',
    pagination: pagination,
    sorting: sorting,
    filters: [
      ..._toAttributeFilters('_id', idFilters),
      ..._toAttributeFilters('chapterName', chapterNameFilters),
    ],
  );
}