Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow $page to be null for Clients so pagination is not triggered #259

Merged
merged 1 commit into from
Jun 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null to not request pagination

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lbalmaceda - That's only for legacy clients, correct? We don't want to force pagination but don't we also want to encourage folks to use it? Seems confusing to add that with or without a note about legacy clients.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshcanhelp you're right :)

* @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