| 1 | <?php |
||
| 5 | class WebhookMessage |
||
| 6 | { |
||
| 7 | /** @var mixed */ |
||
| 8 | protected $data; |
||
| 9 | |||
| 10 | /** @var array|null */ |
||
| 11 | protected $headers; |
||
| 12 | |||
| 13 | /** @var string|null */ |
||
| 14 | protected $userAgent; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param mixed $data |
||
| 18 | * |
||
| 19 | * @return static |
||
| 20 | */ |
||
| 21 | public static function create($data = '') |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param mixed $data |
||
| 28 | */ |
||
| 29 | public function __construct($data = '') |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Set the Webhook data to be JSON encoded. |
||
| 36 | * |
||
| 37 | * @param mixed $data |
||
| 38 | * |
||
| 39 | * @return $this |
||
| 40 | */ |
||
| 41 | public function data($data) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Add a Webhook request custom header. |
||
| 50 | * |
||
| 51 | * @param string $name |
||
| 52 | * @param string $value |
||
| 53 | * |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | public function header($name, $value) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Set the Webhook request UserAgent. |
||
| 65 | * |
||
| 66 | * @param string $userAgent |
||
| 67 | * |
||
| 68 | * @return $this |
||
| 69 | */ |
||
| 70 | public function userAgent($userAgent) |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return array |
||
| 79 | */ |
||
| 80 | public function toArray() |
||
| 87 | } |
||
| 88 |