10000 bug #50349 [Notifier] Document Notifier options in README files (alam… · symfony/symfony@746c06b · GitHub
[go: up one dir, main page]

Skip to content

Commit 746c06b

Browse files
bug #50349 [Notifier] Document Notifier options in README files (alamirault)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [Notifier] Document Notifier options in README files | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> This PR add missing `*Options` documentations in notifier bridges readme Documented bridges are: - AllMySMS symfony/symfony-docs#18315 - ContactEveryone symfony/symfony-docs#18310 - Essendex symfony/symfony-docs#18308 - GatewayApi symfony/symfony-docs#18313 - MessageBird symfony/symfony-docs#18311 - MessageMedia symfony/symfony-docs#18312 - Twilio - Termii Waiting your feedback 😄 I will create another PR for AmazonSnsOptions, BandwidthOptions, ClickSendOptions, MobytOptions, PlivoOptions, RingCentralOptions, SmsmodeOptions, TwilioOptions after this one Commits ------- 6153f04 [Notifier] Document Notifier options in README files
2 parents 34c8f0c + 6153f04 commit 746c06b

File tree

12 files changed

+217
-6
lines changed

12 files changed

+217
-6
lines changed

src/Symfony/Component/Notifier/Bridge/AllMySms/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,35 @@ where:
1515
- `APIKEY` is your AllMySms API key
1616
- `FROM` is your sender (optional, default: 36180)
1717

18+
Adding Options to a Message
19+
---------------------------
20+
21+
With a AllMySms Message, you can use the `AllMySmsOptions` class to add
22+
[message options](https://doc.allmysms.com/api/allmysms_api_https_v9.0_EN.pdf).
23+
24+
```php
25+
use Symfony\Component\Notifier\Message\SmsMessage;
26+
use Symfony\Component\Notifier\Bridge\AllMySms\AllMySmsOptions;
27+
28+
$sms = new SmsMessage('+1411111111', 'My message');
29+
30+
$options = (new AllMySmsOptions())
31+
->alerting(1)
32+
->campaignName('API')
33+
->cliMsgId('test_cli_msg_id')
34+
->date('2023-05-23 23:47:25')
35+
->simulate(1)
36+
->uniqueIdentifier('unique_identifier')
37+
->verbose(1)
38+
// ...
39+
;
40+
41+
// Add the custom options to the sms message and send the message
42+
$sms->options($options);
43+
44+
$texter->send($sms);
45+
```
46+
1847
Resources
1948
---------
2049

src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getRecipientId(): ?string
3333
/**
3434
* @return $this
3535
*/
36-
public function diffusionName(int $diffusionName): static
36+
public function diffusionName(string $diffusionName): static
3737
{
3838
$this->options['diffusion_name'] = $diffusionName;
3939

src/Symfony/Component/Notifier/Bridge/ContactEveryone/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,30 @@ This bridge uses the light version of Contact Everyone API.
1919

2020
See your account info at https://contact-everyone.orange-business.com/#/login
2121

22+
Adding Options to a Message
23+
---------------------------
24+
25+
With a Contact everyone Message, you can use the `ContactEveryoneOptions` class to add
26+
message options.
27+
28+
```php
29+
use Symfony\Component\Notifier\Message\SmsMessage;
30+
use Symfony\Component\Notifier\Bridge\ContactEveryone\ContactEveryoneOptions;
31+
32+
$sms = new SmsMessage('+1411111111', 'My message');
33+
34+
$options = (new ContactEveryoneOptions())
35+
->diffusionName('My label')
36+
->category('my-category')
37+
// ...
38+
;
39+
40+
// Add the custom options to the sms message and send the message
41+
$sms->options($options);
42+
43+
$texter->send($sms);
44+
```
45+
2246
Resources
2347
---------
2448

src/Symfony/Component/Notifier/Bridge/ContactEveryone/Tests/ContactEveryoneOptionsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public function testContactEveryoneOptions()
2020
{
2121
$contactEveryoneOptions = (new ContactEveryoneOptions())
2222
->category('test_category')
23-
->diffusionName(123);
23+
->diffusionName('test_diffusion_name');
2424

2525
self::assertSame([
2626
'category' => 'test_category',
27-
'diffusion_name' => 123,
27+
'diffusion_name' => 'test_diffusion_name',
2828
], $contactEveryoneOptions->toArray());
2929
}
3030
}

src/Symfony/Component/Notifier/Bridge/Esendex/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,28 @@ where:
1818

1919
See Esendex documentation at https://developers.esendex.com/api-reference#smsapis
2020

21+
Adding Options to a Message
22+
---------------------------
23+
24+
With an Esendex Message, you can use the `EsendexOptions` class to add message options.
25+
26+
```php
27+
use Symfony\Component\Notifier\Message\SmsMessage;
28+
use Symfony\Component\Notifier\Bridge\Esendex\EsendexOptions;
29+
30+
$sms = new SmsMessage('+1411111111', 'My message');
31+
32+
$options = (new EsendexOptions())
33+
->accountReference('account_reference')
34+
// ...
35+
;
36+
37+
// Add the custom options to the sms message and send the message
38+
$sms->options($options);
39+
40+
$texter->send($sms);
41+
```
42+
2143
Resources
2244
---------
2345

src/Symfony/Component/Notifier/Bridge/GatewayApi/GatewayApiOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getRecipientId(): ?string
3333
/**
3434
* @return $this
3535
*/
36-
public function class(int $class): static
36+
public function class(string $class): static
3737
{
3838
$this->options['class'] = $class;
3939

src/Symfony/Component/Notifier/Bridge/GatewayApi/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ where:
1616

1717
See your account info at https://gatewayapi.com
1818

19+
Adding Options to a Message
20+
---------------------------
21+
22+
With a GatewayApi Message, you can use the `GatewayApiOptions` class to add
23+
[message options](https://gatewayapi.com/docs/apis/rest/).
24+
25+
```php
26+
use Symfony\Component\Notifier\Message\SmsMessage;
27+
use Symfony\Component\Notifier\Bridge\GatewayApi\GatewayApiOptions;
28+
29+
$sms = new SmsMessage('+1411111111', 'My message');
30+
31+
$options = (new GatewayApiOptions())
32+
->class('standard')
33+
->callbackUrl('https://my-callback-url')
34+
->userRef('user_ref')
35+
// ...
36+
;
37+
38+
// Add the custom options to the sms message and send the message
39+
$sms->options($options);
40+
41+
$texter->send($sms);
42+
```
43+
1944
Resources
2045
---------
2146

src/Symfony/Component/Notifier/Bridge/GatewayApi/Tests/GatewayApiOptionsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ class GatewayApiOptionsTest extends TestCase
1919
public function testGatewayApiOptions()
2020
{
2121
$gatewayApiOptions = (new GatewayApiOptions())
22-
->class(123)
22+
->class('test_class')
2323
->callbackUrl('test_callback_url')
2424
->userRef('test_user_ref');
2525

2626
self::assertSame([
27-
'class' => 123,
27+
'class' => 'test_class',
2828
'callback_url' => 'test_callback_url',
2929
'userref' => 'test_user_ref',
3030
], $gatewayApiOptions->toArray());

src/Symfony/Component/Notifier/Bridge/MessageBird/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,40 @@ where:
1414
- `TOKEN` is your MessageBird token
1515
- `FROM` is your sender
1616

17+
Adding Options to a Message
18+
---------------------------
19+
20+
With a MessageBird Message, you can use the `MessageBirdOptions` class to add
21+
[message options](https://developers.messagebird.com/api/sms-messaging/#send-outbound-sms).
22+
23+
```php
24+
use Symfony\Component\Notifier\Message\SmsMessage;
25+
use Symfony\Component\Notifier\Bridge\MessageBird\MessageBirdOptions;
26+
27+
$sms = new SmsMessage('+1411111111', 'My message');
28+
29+
$options = (new MessageBirdOptions())
30+
->type('test_type')
31+
->scheduledDatetime('test_scheduled_datetime')
32+
->createdDatetime('test_created_datetime')
33+
->dataCoding('test_data_coding')
34+
->gateway(999)
35+
->groupIds(['test_group_ids'])
36+
->mClass(888)
37+
->reference('test_reference')
38+
->reportUrl('test_report_url')
39+
->shortenUrls(true)
40+
->typeDetails('test_type_details')
41+
->validity(777)
42+
// ...
43+
;
44+
45+
// Add the custom options to the sms message and send the message
46+
$sms->options($options);
47+
48+
$texter->send($sms);
49+
```
50+
1751
Resources
1852
---------
1953

src/Symfony/Component/Notifier/Bridge/MessageMedia/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,36 @@ where:
1616
- `FROM` is your registered sender ID (optional). Accepted values: 3-15 letters, could be alpha tag, shortcode or international phone number.
1717
When phone number starts with a `+` sign, it needs to be url encoded in the DSN
1818

19+
Adding Options to a Message
20+
---------------------------
21+
22+
With a MessageMedia Message, you can use the `MessageMediaOptions` class to add
23+
[message options](https://messagemedia.github.io/documentation/#tag/Messages/operation/SendMessages).
24+
25+
```php
26+
use Symfony\Component\Notifier\Message\SmsMessage;
27+
use Symfony\Component\Notifier\Bridge\MessageMedia\MessageMediaOptions;
28+
29+
$sms = new SmsMessage('+1411111111', 'My message');
30+
31+
$options = (new MessageMediaOptions())
32+
->media(['media'])
33+
->callbackUrl('callback_url')
34+
->format('format')
35+
->deliveryReport(true)
36+
->expiry(999)
37+
->metadata(['metadata'])
38+
->scheduled('scheduled')
39+
->subject('subject');
40+
// ...
41+
;
42+
43+
// Add the custom options to the sms message and send the message
44+
$sms->options($options);
45+
46+
$texter->send($sms);
47+
```
48+
1949
Resources
2050
---------
2151

src/Symfony/Component/Notifier/Bridge/Termii/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ where:
1616
- `FROM` is your sender
1717
- `CHANNEL` is your channel (generic, dnd, whatsapp)
1818

19+
Adding Options to a Message
20+
---------------------------
21+
22+
With a Termii Message, you can use the `TermiiOptions` class to add
23+
[message options](https://developer.termii.com/messaging#send-message).
24+
25+
```php
26+
use Symfony\Component\Notifier\Message\SmsMessage;
27+
use Symfony\Component\Notifier\Bridge\Termii\TermiiOptions;
28+
29+
$sms = new SmsMessage('+1411111111', 'My message');
30+
31+
$options = (new TermiiOptions())
32+
->type('test_type')
33+
->channel('test_channel')
34+
->media('test_media_url', 'test_media_caption')
35+
// ...
36+
;
37+
38+
// Add the custom options to the sms message and send the message
39+
$sms->options($options);
40+
41+
$texter->send($sms);
42+
```
43+
1944
Resources
2045
---------
2146

src/Symfony/Component/Notifier/Bridge/Twilio/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,28 @@ where:
1515
- `TOKEN` is your Twilio token
1616
- `FROM` is your sender
1717

18+
Adding Options to a Message
19+
---------------------------
20+
21+
With a Twilio Message, you can use the `TwilioOptions` class to add message options.
22+
23+
```php
24+
use Symfony\Component\Notifier\Message\SmsMessage;
25+
use Symfony\Component\Notifier\Bridge\Twilio\TwilioOptions;
26+
27+
$sms = new SmsMessage('+1411111111', 'My message');
28+
29+
$options = (new TwilioOptions())
30+
->webhookUrl('test_webhook_url')
31+
// ...
32+
;
33+
34+
// Add the custom options to the sms message and send the message
35+
$sms->options($options);
36+
37+
$texter->send($sms);
38+
```
39+
1840
Resources
1941
---------
2042

0 commit comments

Comments
 (0)
0