Skip to content

Commit 6af707b

Browse files
committed
Rename WebhookCallDispatchedEvent to DispatchingWebhookCallEvent
1 parent b3c7665 commit 6af707b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ WebhookCall::create()
116116
->dispatch();
117117
```
118118

119-
This will send a post request to `https://other-app.com/webhooks`. The body of the request will be JSON encoded version of the array passed to `payload`. The request will have a header called `Signature` that will contain a signature the receiving app can use [to verify](https://github.com/spatie/laravel-webhook-server#how-signing-requests-works) the payload hasn't been tampered with. Dispatching a webhook call will also fire a `WebhookCallDispatchedEvent`.
119+
This will send a post request to `https://other-app.com/webhooks`. The body of the request will be JSON encoded version of the array passed to `payload`. The request will have a header called `Signature` that will contain a signature the receiving app can use [to verify](https://github.com/spatie/laravel-webhook-server#how-signing-requests-works) the payload hasn't been tampered with. Dispatching a webhook call will also fire a `DispatchingWebhookCallEvent`.
120120

121121
If the receiving app doesn't respond with a response code starting with `2`, the package will retry calling the webhook after 10 seconds. If that second attempt fails, the package will attempt to call the webhook a final time after 100 seconds. Should that attempt fail, the `FinalWebhookCallFailedEvent` will be raised.
122122

@@ -384,9 +384,9 @@ WebhookCall::create()
384384
### Events
385385

386386
The package fires these events:
387-
- `WebhookCallDispatchedEvent`: the webhook call has been initially dispatched to the queue.
387+
- `DispatchingWebhookCallEvent`: right before the webhook call will be dispatched to the queue.
388388
- `WebhookCallSucceededEvent`: the remote app responded with a `2xx` response code.
389-
- `WebhookCallFailedEvent`: the remote app responded with a non `2xx` response code, or it did not respond at all
389+
- `WebhookCallFailedEvent`: the remote app responded with a non `2xx` response code, or it did not respond at all.
390390
- `FinalWebhookCallFailedEvent`: the final attempt to call the webhook failed.
391391

392392
All these events have these properties:
@@ -399,7 +399,7 @@ All these events have these properties:
399399
- `tags`: the array of [tags](#adding-tags) used
400400
- `uuid`: a unique string to identify this call. This uuid will be the same for all attempts of a webhook call.
401401

402-
Except for the `WebhookCallDispatchedEvent`, all events have these additional properties:
402+
Except for the `DispatchingWebhookCallEvent`, all events have these additional properties:
403403

404404
- `attempt`: the attempt number
405405
- `response`: the response returned by the remote app. Can be an instance of `\GuzzleHttp\Psr7\Response` or `null`.

src/Events/WebhookCallDispatchedEvent.php renamed to src/Events/DispatchingWebhookCallEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Spatie\WebhookServer\Events;
44

5-
class WebhookCallDispatchedEvent
5+
class DispatchingWebhookCallEvent
66
{
77
public function __construct(
88
public string $httpVerb,

src/WebhookCall.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Foundation\Bus\PendingDispatch;
66
use Illuminate\Support\Str;
77
use Spatie\WebhookServer\BackoffStrategy\BackoffStrategy;
8-
use Spatie\WebhookServer\Events\WebhookCallDispatchedEvent;
8+
use Spatie\WebhookServer\Events\DispatchingWebhookCallEvent;
99
use Spatie\WebhookServer\Exceptions\CouldNotCallWebhook;
1010
use Spatie\WebhookServer\Exceptions\InvalidBackoffStrategy;
1111
use Spatie\WebhookServer\Exceptions\InvalidSigner;
@@ -230,7 +230,7 @@ public function dispatch(): PendingDispatch
230230
{
231231
$this->prepareForDispatch();
232232

233-
event(new WebhookCallDispatchedEvent(
233+
event(new DispatchingWebhookCallEvent(
234234
$this->callWebhookJob->httpVerb,
235235
$this->callWebhookJob->webhookUrl,
236236
$this->callWebhookJob->payload,

tests/WebhookTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Illuminate\Support\Facades\Event;
44
use Illuminate\Support\Facades\Queue;
5-
use Spatie\WebhookServer\Events\WebhookCallDispatchedEvent;
5+
use Spatie\WebhookServer\Events\DispatchingWebhookCallEvent;
66
use function PHPUnit\Framework\assertTrue;
77
use Spatie\WebhookServer\CallWebhookJob;
88
use Spatie\WebhookServer\Exceptions\CouldNotCallWebhook;
@@ -158,12 +158,12 @@
158158
Queue::assertPushed(CallWebhookJob::class);
159159
});
160160

161-
it('will fire an event when a webhook is initially dispatched', function () {
161+
it('will fire an event right before the webhook is initially dispatched', function () {
162162
Event::fake();
163163

164164
$url = 'https://localhost';
165165

166166
WebhookCall::create()->url($url)->useSecret('123')->dispatchIf(true);
167167

168-
Event::assertDispatched(WebhookCallDispatchedEvent::class, 1);
168+
Event::assertDispatched(DispatchingWebhookCallEvent::class, 1);
169169
});

0 commit comments

Comments
 (0)