Skip to content

Commit 2f24186

Browse files
alamiraultnicolas-grekas
authored andcommitted
[Notifier] Document Notifier options in README files
1 parent 5a2463c commit 2f24186

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

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

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

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());

0 commit comments

Comments
 (0)