Pagination¶
Ticket and document list responses use a Laravel paginator under the top-level data key.
Read one page¶
use Newfoundcodes\Okatana\Request\TicketListOptions;
$response = $client->tickets()->list(
$projectId,
new TicketListOptions(perPage: 100, page: 1),
);
$page = $response->pagination();
foreach ($page->items as $ticket) {
// process ticket
}
The paginator exposes:
itemscurrentPagelastPageperPagetotalnextPageUrlpreviousPageUrlraw
Iterate all pages¶
$pageNumber = 1;
do {
$page = $client->tickets()->list(
$projectId,
new TicketListOptions(perPage: 200, page: $pageNumber),
)->pagination();
foreach ($page->items as $ticket) {
exportTicket($ticket);
}
++$pageNumber;
} while ($page->hasNextPage());
The page query parameter provides compatibility for the Laravel paginator and is absent from the OpenAPI file. Retain integration tests against your deployment for pagination behavior.
Document filters¶
use Newfoundcodes\Okatana\DocumentStatus;
use Newfoundcodes\Okatana\Request\DocumentListOptions;
$options = new DocumentListOptions(
projectId: $projectId,
status: DocumentStatus::Published,
query: 'runbook',
tags: ['production', 'runbook'],
perPage: 100,
page: 1,
);
Multiple document tag names are serialized as a comma-separated tags value.