Skip to content

Commit

Permalink
Allow to be null for Clients so pagination is not triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Jun 6, 2018
1 parent e5ba87d commit 577332e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/API/Management/Clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Clients extends GenericResource
*
* @param null|string|array $fields - Fields to include or exclude from the result.
* @param null|boolean $include_fields - True to include $fields, false to exclude $fields.
* @param integer $page - Page number to get, zero-based.
* @param null|integer $page - Page number to get, zero-based.
* @param null|integer $per_page - Number of results to get, null to return the default number.
* @param array $add_params - Additional API parameters, over-written by function params.
*
Expand All @@ -30,7 +30,7 @@ class Clients extends GenericResource
*
* @link https://auth0.com/docs/api/management/v2#!/Clients/get_clients
*/
public function getAll($fields = null, $include_fields = null, $page = 0, $per_page = null, $add_params = [])
public function getAll($fields = null, $include_fields = null, $page = null, $per_page = null, $add_params = [])
{
// Set additional parameters first so they are over-written by function parameters.
$params = is_array( $add_params ) ? $add_params : [];
Expand All @@ -44,9 +44,11 @@ public function getAll($fields = null, $include_fields = null, $page = 0, $per_p
}

// Pagination.
$params['page'] = abs(intval($page));
if (null !== $per_page) {
$params['per_page'] = $per_page;
if (null !== $page) {
$params['page'] = abs(intval($page));
if (null !== $per_page) {
$params['per_page'] = $per_page;
}
}

return $this->apiClient->method('get')
Expand Down

0 comments on commit 577332e

Please sign in to comment.