When search results exceed the maximum allowed size, they are returned in segments (pages). To retrieve the next segment, you must use the pagination tokens provided in the current response.
- Call
handle() to get the first page. - Retrieve the continuation token from the response using
$response->getContinuationToken(). - For the subsequent call, pass the values from the token into the
nextPartitionKey and nextRowKey parameters of the handle() method.
Note on filtering behavior:
- If
dateFrom or dateTo is omitted, the search is performed for that specific date. If both are provided, the search covers the range between them. receiverVatNumber and invType are always applied using an equality operator.invType must be provided as a numeric value corresponding to the types defined in the Appendix.
use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Http\RequestDocs;
try {
// 1. Fetch the first page
$request1 = new RequestDocs();
$response1 = $request1->handle("1234567890");
// 2. Get the continuation token
$continuationToken = $response1->getContinuationToken();
// 3. Fetch the second page using the tokens
$request2 = new RequestDocs();
$response2 = $request2->handle(
mark: "1234567890",
dateFrom: "01/01/2021",
dateTo: "31/12/2021",
receiverVatNumber: "123456789",
entityVatNumber: "123456789",
invType: InvoiceType::TYPE_1_1,
nextPartitionKey: $continuationToken->getNextPartitionKey(),
nextRowKey: $continuationToken->getNextRowKey(),
);
} catch (MyDataException $e) {
echo "Error: " . $e->getMessage();
}