You are here

public function Webhook::__construct in Webhooks 8

Webhook constructor.

Parameters

array $payload: The payload that is being send with the webhook.

array $headers: The headers that are being send with the webhook.

string $event: The event that is acted upon.

string $content_type: The content type of the payload.

File

src/Webhook.php, line 77

Class

Webhook
Class Webhook .

Namespace

Drupal\webhooks

Code

public function __construct(array $payload = [], array $headers = [], $event = 'default', $content_type = 'application/json') {
  $this
    ->setPayload($payload);
  $this
    ->setHeaders($headers);
  $this
    ->setEvent($event);
  $this
    ->setContentType($content_type);
  $uuid = new Uuid();
  $this
    ->setUuid($uuid
    ->generate());

  // Default to success.
  $this
    ->setStatus(TRUE);
}