@@ 26-36 (lines=11) @@ | ||
23 | * |
|
24 | * @throws \Exception |
|
25 | */ |
|
26 | public function message($recipient, $message, array $options = []): SendResponse |
|
27 | { |
|
28 | $this->isValidRecipient($recipient); |
|
29 | $this->isValidOptions($options, $message); |
|
30 | $message = $this->isValidMessage($message); |
|
31 | ||
32 | $request = new SendRequest($this->pageToken, $message, $recipient, $options); |
|
33 | $response = $this->client->post('me/messages', $request->build()); |
|
34 | ||
35 | return new SendResponse($response); |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * @param string|array $recipient |
|
@@ 43-53 (lines=11) @@ | ||
40 | * |
|
41 | * @throws \Kerox\Messenger\Exception\MessengerException |
|
42 | */ |
|
43 | public function action($recipient, string $action, array $options = []): SendResponse |
|
44 | { |
|
45 | $this->isValidRecipient($recipient); |
|
46 | $this->isValidSenderAction($action); |
|
47 | $this->isValidOptions($options); |
|
48 | ||
49 | $request = new SendRequest($this->pageToken, $action, $recipient, $options, SendRequest::REQUEST_TYPE_ACTION); |
|
50 | $response = $this->client->post('me/messages', $request->build()); |
|
51 | ||
52 | return new SendResponse($response); |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * @throws \Exception |