You are here

public function Clients::getAll in Auth0 Single Sign On 8.2

Get all Clients by page. Required scopes:

  • "read:clients" - For any call to this endpoint.
  • "read:client_keys" - To retrieve "client_secret" and "encryption_key" attributes.

@link https://auth0.com/docs/api/management/v2#!/Clients/get_clients

Parameters

null|string|array $fields Fields to include or exclude from the result::

  • Including only the fields required can speed up API calls significantly.
  • Arrays will be converted to comma-separated strings.

null|boolean $include_fields True to include $fields, false to exclude $fields.:

null|integer $page Page number to get, zero-based.:

null|integer $per_page Number of results to get, null to return the default number.:

array $add_params Additional API parameters, over-written by function params.:

Return value

mixed

Throws

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/src/API/Management/Clients.php, line 33

Class

Clients
Class Clients. Handles requests to the Clients endpoint of the v2 Management API.

Namespace

Auth0\SDK\API\Management

Code

public function getAll($fields = null, $include_fields = null, $page = null, $per_page = null, array $add_params = []) {

  // Set additional parameters first so they are over-written by function parameters.
  $params = is_array($add_params) ? $add_params : [];

  // Results fields.
  if (!empty($fields)) {
    $params['fields'] = is_array($fields) ? implode(',', $fields) : $fields;
    if (null !== $include_fields) {
      $params['include_fields'] = $include_fields;
    }
  }

  // Pagination.
  if (null !== $page) {
    $params['page'] = abs((int) $page);
    if (null !== $per_page) {
      $params['per_page'] = $per_page;
    }
  }
  return $this->apiClient
    ->method('get')
    ->addPath('clients')
    ->withDictParams($params)
    ->call();
}