1 | <?php |
||
10 | class Send extends AbstractApi |
||
11 | { |
||
12 | |||
13 | const SENDER_ACTION_TYPING_ON = 'typing_on'; |
||
14 | const SENDER_ACTION_TYPING_OFF = 'typing_off'; |
||
15 | const SENDER_ACTION_MARK_SEEN = 'mark_seen'; |
||
16 | |||
17 | const NOTIFICATION_TYPE_REGULAR = 'REGULAR'; |
||
18 | const NOTIFICATION_TYPE_SILENT_PUSH = 'SILENT_PUSH'; |
||
19 | const NOTIFICATION_TYPE_NO_PUSH = 'NO_PUSH'; |
||
20 | |||
21 | /** |
||
22 | * Send constructor. |
||
23 | * |
||
24 | * @param string $pageToken |
||
25 | */ |
||
26 | public function __construct(string $pageToken) |
||
30 | |||
31 | /** |
||
32 | * @param string $recipient |
||
33 | * @param $message |
||
34 | * @param string $notificationType |
||
35 | * @return \Kerox\Messenger\Response\SendResponse |
||
36 | */ |
||
37 | public function sendMessage(string $recipient, $message, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
||
47 | |||
48 | /** |
||
49 | * @param string $recipient |
||
50 | * @param string $action |
||
51 | * @param string $notificationType |
||
52 | * @return \Kerox\Messenger\Response\SendResponse |
||
53 | */ |
||
54 | public function sendAction(string $recipient, string $action, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
||
64 | |||
65 | /** |
||
66 | * @param $message |
||
67 | * @return \Kerox\Messenger\Model\Message |
||
68 | * @throws \InvalidArgumentException |
||
69 | */ |
||
70 | private function isValidMessage($message): Message |
||
82 | |||
83 | /** |
||
84 | * @param string $notificationType |
||
85 | */ |
||
86 | private function isValidNotificationType(string $notificationType) |
||
93 | |||
94 | /** |
||
95 | * @return array |
||
96 | */ |
||
97 | private function getAllowedNotificationType(): array |
||
105 | |||
106 | /** |
||
107 | * @param string $action |
||
108 | */ |
||
109 | private function isValidAction(string $action) |
||
116 | |||
117 | /** |
||
118 | * @return array |
||
119 | */ |
||
120 | private function getAllowedSenderAction(): array |
||
128 | } |
||
129 |