PagingLinksResponse
in package
Represents pagination navigation links in Horizon API collection responses
Horizon returns collections (accounts, transactions, operations, etc.) in paginated format to manage large result sets efficiently. This response object contains the hypermedia links needed to navigate between pages of results.
Links provided:
- self: URL for the current page
- next: URL for the next page (may be null if on last page)
- prev: URL for the previous page (may be null if on first page)
These links include the proper cursor and limit parameters, allowing seamless navigation through result sets without manually constructing URLs. The SDK's PageResponse classes use these links internally when calling getNextPage() and getPreviousPage() methods.
Tags
Table of Contents
Methods
- fromJson() : PagingLinksResponse
- Creates a PagingLinksResponse from JSON data
- getNext() : LinkResponse|null
- Gets the link to the next page of results
- getPrev() : LinkResponse|null
- Gets the link to the previous page of results
- getSelf() : LinkResponse
- Gets the link to the current page
- loadFromJson() : void
- Populates the object from parsed JSON data
Methods
fromJson()
Creates a PagingLinksResponse from JSON data
public
static fromJson(array<string|int, mixed> $json) : PagingLinksResponse
Parameters
- $json : array<string|int, mixed>
-
Associative array of pagination links from API response
Return values
PagingLinksResponse —The populated pagination links object
getNext()
Gets the link to the next page of results
public
getNext() : LinkResponse|null
This link points to the next page in the collection. It will be null if the current page is the last page. The link includes the appropriate cursor value to fetch the next set of records.
Return values
LinkResponse|null —The next page link, or null if on last page
getPrev()
Gets the link to the previous page of results
public
getPrev() : LinkResponse|null
This link points to the previous page in the collection. It will be null if the current page is the first page. The link includes the appropriate cursor value to fetch the previous set of records.
Return values
LinkResponse|null —The previous page link, or null if on first page
getSelf()
Gets the link to the current page
public
getSelf() : LinkResponse
This link represents the URL that was used to fetch the current page of results, including all query parameters like cursor, order, and limit.
Return values
LinkResponse —The self link with href and optional templated flag
loadFromJson()
Populates the object from parsed JSON data
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>
-
Associative array of pagination links from API response