You are here

public function ApiClient::method in Auth0 Single Sign On 8.2

Create a new RequestBuilder. Similar to the above but does not use a magic method.

Parameters

string $method - HTTP method to use (GET, POST, PATCH, etc).:

boolean $set_content_type - Automatically set a content-type header.:

Return value

RequestBuilder

File

vendor/auth0/auth0-php/src/API/Helpers/ApiClient.php, line 99

Class

ApiClient

Namespace

Auth0\SDK\API\Helpers

Code

public function method($method, $set_content_type = true) {
  $method = strtolower($method);
  $builder = new RequestBuilder([
    'domain' => $this->domain,
    'basePath' => $this->basePath,
    'method' => $method,
    'guzzleOptions' => $this->guzzleOptions,
    'returnType' => $this->returnType,
  ]);
  $builder
    ->withHeaders($this->headers);
  if ($set_content_type && in_array($method, [
    'patch',
    'post',
    'put',
    'delete',
  ])) {
    $builder
      ->withHeader(new ContentType('application/json'));
  }
  return $builder;
}