1 | <?php |
||
5 | class WebhookMessage |
||
6 | { |
||
7 | /** |
||
8 | * The GET parameters of the request. |
||
9 | * |
||
10 | * @var array|string|null |
||
11 | */ |
||
12 | protected $query; |
||
13 | |||
14 | /** |
||
15 | * The POST data of the Webhook request. |
||
16 | * |
||
17 | * @var mixed |
||
18 | */ |
||
19 | protected $data; |
||
20 | |||
21 | /** |
||
22 | * The headers to send with the request. |
||
23 | * |
||
24 | * @var array|null |
||
25 | */ |
||
26 | protected $headers; |
||
27 | |||
28 | /** |
||
29 | * The user agent header. |
||
30 | * |
||
31 | * @var string|null |
||
32 | */ |
||
33 | protected $userAgent; |
||
34 | |||
35 | /** |
||
36 | * The Guzzle verify option. |
||
37 | * |
||
38 | * @var bool|string |
||
39 | */ |
||
40 | protected $verify = false; |
||
41 | |||
42 | /** |
||
43 | * @param mixed $data |
||
44 | * |
||
45 | * @return static |
||
46 | */ |
||
47 | 1 | public static function create($data = '') |
|
51 | |||
52 | /** |
||
53 | * @param mixed $data |
||
54 | */ |
||
55 | 11 | public function __construct($data = '') |
|
59 | |||
60 | /** |
||
61 | * Set the Webhook parameters to be URL encoded. |
||
62 | * |
||
63 | * @param mixed $query |
||
64 | * |
||
65 | * @return $this |
||
66 | */ |
||
67 | 2 | public function query($query) |
|
73 | |||
74 | /** |
||
75 | * Set the Webhook data to be JSON encoded. |
||
76 | * |
||
77 | * @param mixed $data |
||
78 | * |
||
79 | * @return $this |
||
80 | */ |
||
81 | 1 | public function data($data) |
|
87 | |||
88 | /** |
||
89 | * Add a Webhook request custom header. |
||
90 | * |
||
91 | * @param string $name |
||
92 | * @param string $value |
||
93 | * |
||
94 | * @return $this |
||
95 | */ |
||
96 | 5 | public function header($name, $value) |
|
102 | |||
103 | /** |
||
104 | * Set the Webhook request UserAgent. |
||
105 | * |
||
106 | * @param string $userAgent |
||
107 | * |
||
108 | * @return $this |
||
109 | */ |
||
110 | 5 | public function userAgent($userAgent) |
|
116 | |||
117 | /** |
||
118 | * Indicate that the request should be verified. |
||
119 | * |
||
120 | * @return $this |
||
121 | */ |
||
122 | 1 | public function verify($value = true) |
|
128 | |||
129 | /** |
||
130 | * @return array |
||
131 | */ |
||
132 | 11 | public function toArray() |
|
141 | } |
||
142 |