-
Notifications
You must be signed in to change notification settings - Fork 0
Pagination
Christian KASSE edited this page Apr 2, 2026
·
1 revision
All list endpoints in the SDK return paginated results using PageRequest and PageResponse.
Build a page request with the builder:
import com.essabu.common.model.PageRequest;
PageRequest page = PageRequest.builder()
.page(0) // Page number (0-based)
.size(25) // Items per page (default: 20, max: 100)
.sort("createdAt,desc") // Sort field and direction
.build();| Parameter | Type | Default | Description |
|---|---|---|---|
page |
int |
0 |
Zero-based page index |
size |
int |
20 |
Number of items per page (max 100) |
sort |
String |
null |
Sort expression: field,asc or field,desc
|
The response contains the data and pagination metadata:
import com.essabu.common.model.PageResponse;
PageResponse<Map> result = essabu.hr().employees().list(companyId, page);
// Access data
List<Map> items = result.getContent();
// Pagination metadata
int totalElements = result.getTotalElements();
int totalPages = result.getTotalPages();
int currentPage = result.getNumber();
int pageSize = result.getSize();
boolean isFirst = result.isFirst();
boolean isLast = result.isLast();
boolean hasNext = result.hasNext();
boolean hasPrevious = result.hasPrevious();| Field | Type | Description |
|---|---|---|
content |
List<T> |
Items on the current page |
totalElements |
int |
Total number of items across all pages |
totalPages |
int |
Total number of pages |
number |
int |
Current page number (0-based) |
size |
int |
Page size |
first |
boolean |
Whether this is the first page |
last |
boolean |
Whether this is the last page |
int page = 0;
PageResponse<Map> result;
do {
result = essabu.hr().employees().list(
companyId,
PageRequest.builder().page(page).size(50).build()
);
for (Map employee : result.getContent()) {
processEmployee(employee);
}
page++;
} while (result.hasNext());Sort by any field in ascending or descending order:
// Sort by last name ascending
PageRequest.builder().sort("lastName,asc").build();
// Sort by creation date descending
PageRequest.builder().sort("createdAt,desc").build();Some list endpoints accept additional filter parameters as part of the request:
// Endpoints that accept companyId as a parameter
essabu.hr().employees().list(companyId, pageRequest);
// Endpoints with query parameters
essabu.accounting().wallets().listTransactions(walletId, pageRequest);Getting Started
Core Concepts
Modules
- HR Module
- Accounting Module
- Identity Module
- Trade Module
- Payment Module
- EInvoice Module
- Project Module
- Asset Module
Resources