-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWebhook.php
More file actions
49 lines (41 loc) · 1.28 KB
/
Copy pathWebhook.php
File metadata and controls
49 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace WPGraphQL\Webhooks\Entity;
/**
* Class Webhook
*
* Represents a Webhook entity (Data Transfer Object).
*
* @package WPGraphQL\Webhooks
*/
class Webhook {
/** @var int Webhook post ID. */
public int $id;
/** @var string Webhook name (post title). */
public string $name;
/** @var string Event the webhook listens to. */
public string $event;
/** @var string Destination URL for the webhook. */
public string $url;
/** @var string HTTP method used for the webhook request. */
public string $method;
/** @var array HTTP headers to be sent with the webhook request. */
public array $headers;
/**
* Webhook constructor.
*
* @param int $id Webhook post ID.
* @param string $name Webhook name.
* @param string $event Event the webhook listens to.
* @param string $url Destination URL for the webhook.
* @param string $method HTTP method used for the webhook request. Defaults to 'POST'.
* @param array $headers HTTP headers to be sent with the request.
*/
public function __construct( int $id, string $name, string $event, string $url, string $method = 'POST', array $headers = [] ) {
$this->id = $id;
$this->name = $name;
$this->event = $event;
$this->url = $url;
$this->method = $method;
$this->headers = $headers;
}
}