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 | * @param \GuzzleHttp\Client $client |
||
26 | */ |
||
27 | public function __construct(string $pageToken, Client $client) |
||
31 | |||
32 | /** |
||
33 | * @param string $recipient |
||
34 | * @param $message |
||
35 | * @param string $notificationType |
||
36 | * @return \Kerox\Messenger\Response\SendResponse |
||
37 | */ |
||
38 | public function message(string $recipient, $message, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
||
48 | |||
49 | /** |
||
50 | * @param string $recipient |
||
51 | * @param string $action |
||
52 | * @param string $notificationType |
||
53 | * @return \Kerox\Messenger\Response\SendResponse |
||
54 | */ |
||
55 | public function action(string $recipient, string $action, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
||
65 | |||
66 | /** |
||
67 | * @param $message |
||
68 | * @return \Kerox\Messenger\Model\Message |
||
69 | * @throws \InvalidArgumentException |
||
70 | */ |
||
71 | private function isValidMessage($message): Message |
||
83 | |||
84 | /** |
||
85 | * @param string $notificationType |
||
86 | */ |
||
87 | private function isValidNotificationType(string $notificationType) |
||
94 | |||
95 | /** |
||
96 | * @return array |
||
97 | */ |
||
98 | private function getAllowedNotificationType(): array |
||
106 | |||
107 | /** |
||
108 | * @param string $action |
||
109 | */ |
||
110 | private function isValidAction(string $action) |
||
117 | |||
118 | /** |
||
119 | * @return array |
||
120 | */ |
||
121 | private function getAllowedSenderAction(): array |
||
129 | } |
||
130 |