PaginateBuilder
in package
implements
BuilderInterface
Builder for making paginated list queries.
Tags
Table of Contents
Interfaces
Constants
- MAX_PER_PAGE = 100
- MIN_PAGE = 1
Properties
Methods
- __construct() : void
- Builder for making paginated list queries.
- build() : string
- Builds the query string parameters from the Builder.
- page() : self
- Set the page you wish to fetch in a list call. Can be chained.
- perPage() : self
- Set the number of results you wish to fetch in a page of a list call. Can be chained.
Constants
MAX_PER_PAGE
private
mixed
MAX_PER_PAGE
= 100
MIN_PAGE
private
mixed
MIN_PAGE
= 1
Properties
$page
public
int
$page
$perPage
public
int
$perPage
Methods
__construct()
Builder for making paginated list queries.
public
__construct(int $page, int $perPage) : void
Has two attributes, page
and perPage
. When a PaginateBuilder
object is passed
to a list()
call, the call will fetch only the perPage
number of results and will
fetch the results offset by page
.
Parameters
- $page : int
-
The page of results to return in the API call
- $perPage : int
-
The number of results to return in each API call
build()
Builds the query string parameters from the Builder.
public
build([string $resourceName = null ]) : string
Parameters
- $resourceName : string = null
-
The type of resource to generate the query string for. Eg. AccountingResource, ProjectsResource
Return values
string —The built query string
page()
Set the page you wish to fetch in a list call. Can be chained.
public
page(int $page) : self
Parameters
- $page : int
-
The page of results to return in the API call
Return values
self —The PaginateBuilder instance
perPage()
Set the number of results you wish to fetch in a page of a list call. Can be chained.
public
perPage(int $perPage) : self
The page size is capped at 100.
Parameters
- $perPage : int
-
The number of results to return in each API call
Return values
self —The PaginateBuilder instance