Files
Auto-GPT/lib/models/pagination.dart
hunteraraujo e3200d87ba Add Pagination Model for API Responses
Added a new Pagination class to model the pagination data that comes with API responses. This will help in handling paginated data more effectively and transparently.

The Pagination class includes fields for total items, total pages, current page, and page size. It also includes a factory constructor for creating an instance from a JSON object.
2023-09-02 14:58:49 -07:00

23 lines
505 B
Dart

class Pagination {
final int totalItems;
final int totalPages;
final int currentPage;
final int pageSize;
Pagination({
required this.totalItems,
required this.totalPages,
required this.currentPage,
required this.pageSize,
});
factory Pagination.fromJson(Map<String, dynamic> json) {
return Pagination(
totalItems: json['total_items'],
totalPages: json['total_pages'],
currentPage: json['current_page'],
pageSize: json['page_size'],
);
}
}