Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Notifier SentMessage#36611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,7 @@
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
Expand DownExpand Up@@ -50,7 +51,7 @@ public function supports(MessageInterface $message): bool
return $message instanceof ChatMessage;
}

protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof ChatMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
Expand DownExpand Up@@ -84,5 +85,12 @@ protected function doSend(MessageInterface $message): void
if ($jsonContents && isset($jsonContents['results']['error'])) {
throw new TransportException(sprintf('Unable to post the Firebase message: %s.', $jsonContents['error']), $response);
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['results'][0]['message_id']);

return $message;
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Firebase\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@
use Symfony\Component\Notifier\Exception\LogicException;
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
Expand DownExpand Up@@ -51,7 +52,7 @@ public function supports(MessageInterface $message): bool
return $message instanceof SmsMessage && $this->phone === $message->getPhone();
}

protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$this->supports($message)) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given) and configured with your phone number.', __CLASS__, SmsMessage::class, \get_class($message)));
Expand All@@ -75,5 +76,7 @@ protected function doSend(MessageInterface $message): void

throw new TransportException(sprintf('Unable to send the SMS: error %d: ', $response->getStatusCode()).($errors[$response->getStatusCode()] ?? ''), $response);
}

return new SentMessage($message, (string) $this);
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.1",
"symfony/notifier": "^5.1"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\FreeMobile\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,7 @@
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
Expand DownExpand Up@@ -50,7 +51,7 @@ public function supports(MessageInterface $message): bool
/**
* @see https://api.mattermost.com
*/
protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof ChatMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
Expand All@@ -74,5 +75,12 @@ protected function doSend(MessageInterface $message): void

throw new TransportException(sprintf('Unable to post the Mattermost message: %s (%s).', $result['message'], $result['id']), $response);
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['id']);

return $message;
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Mattermost\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@
use Symfony\Component\Notifier\Exception\LogicException;
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
Expand DownExpand Up@@ -51,7 +52,7 @@ public function supports(MessageInterface $message): bool
return $message instanceof SmsMessage;
}

protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof SmsMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
Expand All@@ -73,5 +74,12 @@ protected function doSend(MessageInterface $message): void
throw new TransportException('Unable to send the SMS: '.$msg['error-text'].sprintf(' (code %s).', $msg['status']), $response);
}
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['messages'][0]['message-id']);

return $message;
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Nexmo\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@
use Symfony\Component\Notifier\Exception\LogicException;
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
Expand DownExpand Up@@ -53,7 +54,7 @@ public function supports(MessageInterface $message): bool
return $message instanceof SmsMessage;
}

protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof SmsMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
Expand DownExpand Up@@ -90,6 +91,13 @@ protected function doSend(MessageInterface $message): void

throw new TransportException(sprintf('Unable to send the SMS: %s.', $error['message']), $response);
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['ids'][0]);

return $message;
}

/**
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\OvhCloud\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,7 @@
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
Expand DownExpand Up@@ -55,7 +56,7 @@ public function supports(MessageInterface $message): bool
/**
* @see https://rocket.chat/docs/administrator-guides/integrations/
*/
protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof ChatMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
Expand DownExpand Up@@ -86,5 +87,12 @@ protected function doSend(MessageInterface $message): void
if (!$result['success']) {
throw new TransportException(sprintf('Unable to post the RocketChat message: %s.', $result['error']), $response);
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['message']['_id']);

return $message;
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\RocketChat\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@
use Symfony\Component\Notifier\Exception\LogicException;
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
Expand DownExpand Up@@ -51,7 +52,7 @@ public function supports(MessageInterface $message): bool
return $message instanceof SmsMessage;
}

protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof SmsMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
Expand All@@ -72,5 +73,12 @@ protected function doSend(MessageInterface $message): void

throw new TransportException(sprintf('Unable to send the SMS: %s (%s).', $error['text'], $error['code']), $response);
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['id']);

return $message;
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@
"php": ">=7.2.5",
"ext-json": "*",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Sinch\\": "" },
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,7 @@
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
Expand DownExpand Up@@ -58,7 +59,7 @@ public function supports(MessageInterface $message): bool
return $message instanceof ChatMessage && (null === $message->getOptions() || $message->getOptions() instanceof SlackOptions);
}

protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof ChatMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
Expand DownExpand Up@@ -86,5 +87,7 @@ protected function doSend(MessageInterface $message): void
if ('ok' !== $result) {
throw new TransportException('Unable to post the Slack message: '.$result, $response);
}

return new SentMessage($message, (string) $this);
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.1"
"symfony/notifier": "^5.2"
},
"require-dev": {
"symfony/event-dispatcher": "^4.3|^5.0"
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,7 @@
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
Expand DownExpand Up@@ -60,7 +61,7 @@ public function supports(MessageInterface $message): bool
/**
* @see https://core.telegram.org/bots/api
*/
protected function doSend(MessageInterface $message):void
protected function doSend(MessageInterface $message):SentMessage
{
if (!$message instanceof ChatMessage) {
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
Expand All@@ -82,5 +83,12 @@ protected function doSend(MessageInterface $message): void

throw new TransportException('Unable to post the Telegram message: '.$result['description'].sprintf(' (code %s).', $result['error_code']), $response);
}

$success = $response->toArray(false);

$message = new SentMessage($message, (string) $this);
$message->setMessageId($success['result']['message_id']);

return $message;
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp