1 | <?php |
||
8 | class Message implements \JsonSerializable |
||
9 | { |
||
10 | |||
11 | use ValidatorTrait; |
||
12 | |||
13 | const TYPE_TEXT = 'text'; |
||
14 | const TYPE_ATTACHMENT = 'attachment'; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $type = self::TYPE_TEXT; |
||
20 | |||
21 | /** |
||
22 | * @var \Kerox\Messenger\Model\Message\Attachment|string |
||
23 | */ |
||
24 | protected $message; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $quickReplies = []; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $metadata; |
||
35 | |||
36 | /** |
||
37 | * Message constructor. |
||
38 | * |
||
39 | * @param \Kerox\Messenger\Model\Message\Attachment|string $message |
||
40 | */ |
||
41 | public function __construct($message) |
||
51 | |||
52 | /** |
||
53 | * @param mixed $quickReplies |
||
54 | * @return \Kerox\Messenger\Model\Message |
||
55 | * @throws \Exception |
||
56 | */ |
||
57 | public function setQuickReplies(array $quickReplies): Message |
||
64 | |||
65 | /** |
||
66 | * @param \Kerox\Messenger\Model\Message\QuickReply $quickReply |
||
67 | * @return \Kerox\Messenger\Model\Message |
||
68 | */ |
||
69 | public function addQuickReply(QuickReply $quickReply): Message |
||
75 | |||
76 | /** |
||
77 | * @param mixed $metadata |
||
78 | * @return Message |
||
79 | */ |
||
80 | public function setMetadata(string $metadata): Message |
||
87 | |||
88 | /** |
||
89 | * @return array |
||
90 | */ |
||
91 | public function jsonSerialize(): array |
||
101 | } |
||
102 |