\smtech\CanvasPestCanvasPageLink

An object to represent Canvas API pagination information.

As the whole point of CanvasPest is to abstract the actual API response out of the way, concealing the mundane details of the response pagination, this particular object is used only internally to create object-oriented access to the API response's link header.

Summary

Methods
Properties
Constants
__construct()
getName()
getEndpoint()
getParams()
getPageNumber()
getPerPage()
No public properties found
CURRENT
FIRST
LAST
NEXT
PREV
PARAM_PAGE_NUMBER
PARAM_PER_PAGE
No protected methods found
No protected properties found
N/A
No private methods found
$name
$endpoint
$params
N/A

Constants

CURRENT

CURRENT

Name of the current page link

FIRST

FIRST

Name of the first page link

LAST

LAST

Name of the last page link

NEXT

NEXT

Name of the next page link

PREV

PREV

Name of the previous page link

PARAM_PAGE_NUMBER

PARAM_PAGE_NUMBER

Name of the page number parameter in the page link

PARAM_PER_PAGE

PARAM_PER_PAGE

Name of the parameter describing the number of responses per page in the page link

Properties

$name

$name : string

Type

string — Name of the page link

$endpoint

$endpoint : string

Type

string — Path of the API endpoint being paginated

$params

$params : array

Type

array — Query parameters for the page link API call

Methods

__construct()

__construct(string  $pageUrl, string  $pageName) 

Construct a new Canvas page link object.

CanvasPageLinks can be constructed with two possible parameter lists:

Parameters

string $pageUrl

URL of the API endpoint to retrieve the page

string $pageName

Canonical name of the page relative to the current page.

Throws

\smtech\CanvasPest\CanvasPageLink_Exception

INVALID_CONSTRUCTOR If $pageUrl or $pageName is empty or a non-string

getName()

getName() : string

Canonical name of this page link

Returns

string

getEndpoint()

getEndpoint() : string

API endpoint being paginated

Returns

string

getParams()

getParams() : array

Query parameters to retrieve the linked page

Returns

array

getPageNumber()

getPageNumber() : integer

The (1-indexed) page number of this page

Returns

integer

getPerPage()

getPerPage() : integer

The number of responses per page generating this pagination

Returns

integer