From 8c986af0cb34f36e0af063b4099e6e937ce87bd0 Mon Sep 17 00:00:00 2001
From: Mathieu Ledru <mathieu.ledru-ext@pictime-groupe.com>
Date: Thu, 11 May 2023 13:33:02 +0200
Subject: [PATCH] :sparkles: Add webhook support

---
 src/Flow/WebhookFlow.php | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 src/Flow/WebhookFlow.php

diff --git a/src/Flow/WebhookFlow.php b/src/Flow/WebhookFlow.php
new file mode 100644
index 00000000..cd598182
--- /dev/null
+++ b/src/Flow/WebhookFlow.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Flow\Flow;
+
+use Closure;
+use Flow\DriverInterface;
+use Flow\IpStrategyInterface;
+
+class WebhookFlow extends FlowDecorator
+{
+    public function __construct(Closure $job, Closure $errorJob = null, ?IpStrategyInterface $ipStrategy = null, ?DriverInterface $driver = null)
+    {
+        $U = fn (Closure $f) => $f($f);
+        $Y = fn (Closure $f) => $U(fn (Closure $x) => $f(fn ($y) => $U($x)($y)));
+
+        parent::__construct(new Flow($Y($job), $errorJob, $ipStrategy, $driver));
+    }
+}