PaginationInput
Page of a list tool's result to return, shared by all paginated tools.
Declare it as an optional tool parameter, PaginationInput $pagination = new PaginationInput(), and return
a subclass of AbstractPaginatedResult. The JSON schema of the argument is generated from this class
and the argument is validated against its constraints.
A tool needing other bounds uses a subclass of this class instead:
- another default limit: redeclare the constructor with another default for
$limitand pass it on to the parent constructor, - another maximum limit: override getMaxLimit().
Descriptions are kept in the property docblocks, so subclasses inherit them.
Tags
Constants¶
DEFAULT_LIMIT ¶
|
|
|
MAX_LIMIT ¶
|
|
|
Properties¶
$limit
¶
Maximum number of items to return. Every page except the last one holds exactly this number of items.
|
|
|
Attributes
- #[Range]
- $min: 1
- $maxPropertyPath: 'maxLimit'
$offset
¶
Number of items to skip from the start of the full result. 0 returns the first page.
|
|
|
Attributes
- #[Range]
- $min: 0
Methods¶
__construct()
¶
|
|
|
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| $limit | int | PaginationInput::DEFAULT_LIMIT | - |
| $offset | int | 0 | - |
getMaxLimit()
¶
Upper bound of the limit.
|
|
|
It is also read without a constructed instance to build the JSON schema, so an override must not depend on the instance state (return a constant).
Return values
int