You are here

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

Get all Rules, by page if desired. Required scope: "read:rules"

@link https://auth0.com/docs/api/management/v2#!/Rules/get_rules

Parameters

null|boolean $enabled Retrieves rules that match the value, otherwise all rules are retrieved.:

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

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.:

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/Rules.php, line 31

Class

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

Namespace

Auth0\SDK\API\Management

Code

public function getAll($enabled = null, $fields = null, $include_fields = null, $page = null, $per_page = null) {
  $params = [];

  // Only return enabled Rules.
  if ($enabled !== null) {
    $params['enabled'] = (bool) $enabled;
  }

  // Fields to include or exclude from results.
  if (!empty($fields)) {
    $params['fields'] = is_array($fields) ? implode(',', $fields) : $fields;
    if (null !== $include_fields) {
      $params['include_fields'] = $include_fields;
    }
  }

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