Skip to content

Commit f9febd9

Browse files
committed
Add support for notification reference
1 parent 182c5d8 commit f9febd9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/Notification.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class Notification
88
{
9+
protected ?string $reference = null;
10+
911
protected string $title;
1012

1113
protected string $body;
@@ -22,6 +24,13 @@ public static function new()
2224
return new static(new Client);
2325
}
2426

27+
public function reference(string $reference): self
28+
{
29+
$this->reference = $reference;
30+
31+
return $this;
32+
}
33+
2534
public function title(string $title): self
2635
{
2736
$this->title = $title;
@@ -43,12 +52,17 @@ public function message(string $body): self
4352
return $this;
4453
}
4554

46-
public function show(): void
55+
public function show(): self
4756
{
48-
$this->client->post('notification', [
57+
$response = $this->client->post('notification', [
58+
'reference' => $this->reference,
4959
'title' => $this->title,
5060
'body' => $this->body,
5161
'event' => $this->event,
5262
]);
63+
64+
$this->reference = $response->json('reference');
65+
66+
return $this;
5367
}
5468
}

0 commit comments

Comments
 (0)