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\ClientInterface $client |
||
26 | */ |
||
27 | 9 | public function __construct(string $pageToken, ClientInterface $client) |
|
31 | |||
32 | /** |
||
33 | * @param string $recipient |
||
34 | * @param $message |
||
35 | * @param string $notificationType |
||
36 | * @return \Kerox\Messenger\Response\SendResponse |
||
37 | */ |
||
38 | 5 | public function message(string $recipient, $message, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
|
48 | |||
49 | /** |
||
50 | * @deprecated since 1.2.0 and will be remove in 1.3.0. Use the method `message()` instead |
||
51 | * @see message() |
||
52 | * @param string $recipient |
||
53 | * @param $message |
||
54 | * @param string $notificationType |
||
55 | * @return \Kerox\Messenger\Response\SendResponse |
||
56 | */ |
||
57 | public function sendMessage(string $recipient, $message, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
||
61 | |||
62 | /** |
||
63 | * @param string $recipient |
||
64 | * @param string $action |
||
65 | * @param string $notificationType |
||
66 | * @return \Kerox\Messenger\Response\SendResponse |
||
67 | */ |
||
68 | 2 | public function action(string $recipient, string $action, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
|
78 | |||
79 | /** |
||
80 | * @deprecated since 1.2.0 and will be removed in 1.3.0. Use the method `action()` instead |
||
81 | * @see action() |
||
82 | * @param string $recipient |
||
83 | * @param string $action |
||
84 | * @param string $notificationType |
||
85 | * @return \Kerox\Messenger\Response\SendResponse |
||
86 | */ |
||
87 | public function sendAction(string $recipient, string $action, string $notificationType = self::NOTIFICATION_TYPE_REGULAR): SendResponse |
||
91 | |||
92 | /** |
||
93 | * @param \Kerox\Messenger\Model\Message\Attachment $attachment |
||
94 | * @return \Kerox\Messenger\Response\SendResponse |
||
95 | */ |
||
96 | 1 | public function attachment(Attachment $attachment): SendResponse |
|
105 | |||
106 | /** |
||
107 | * @param $message |
||
108 | * @return \Kerox\Messenger\Model\Message |
||
109 | * @throws \InvalidArgumentException |
||
110 | */ |
||
111 | 6 | private function isValidMessage($message): Message |
|
123 | |||
124 | /** |
||
125 | * @param string $notificationType |
||
126 | */ |
||
127 | 5 | private function isValidNotificationType(string $notificationType) |
|
134 | |||
135 | /** |
||
136 | * @return array |
||
137 | */ |
||
138 | 5 | private function getAllowedNotificationType(): array |
|
146 | |||
147 | /** |
||
148 | * @param string $action |
||
149 | */ |
||
150 | 2 | private function isValidAction(string $action) |
|
157 | |||
158 | /** |
||
159 | * @return array |
||
160 | */ |
||
161 | 2 | private function getAllowedSenderAction(): array |
|
169 | } |
||
170 |