From 9e8e3a37bb1f16e75e95f74be76fa4adb72cbd7d Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Thu, 10 Feb 2022 11:02:00 +0100 Subject: [PATCH] Add basic workflow endpoint with hello world message [MAILPOET-4135] --- mailpoet/lib/Automation/API/API.php | 2 ++ .../Automation/API/Endpoints/WorkflowsEndpoint.php | 13 +++++++++++++ mailpoet/lib/DI/ContainerConfigurator.php | 1 + 3 files changed, 16 insertions(+) create mode 100644 mailpoet/lib/Automation/API/Endpoints/WorkflowsEndpoint.php diff --git a/mailpoet/lib/Automation/API/API.php b/mailpoet/lib/Automation/API/API.php index fe798d7eca..efbc4bc4af 100644 --- a/mailpoet/lib/Automation/API/API.php +++ b/mailpoet/lib/Automation/API/API.php @@ -2,6 +2,7 @@ namespace MailPoet\Automation\API; +use MailPoet\Automation\API\Endpoints\WorkflowsEndpoint; use MailPoet\Automation\Exceptions\Exception; use MailPoet\Automation\WordPress; use ReflectionClass; @@ -20,6 +21,7 @@ class API { /** @var array> */ private $routes = [ + 'workflows' => WorkflowsEndpoint::class, ]; public function __construct( diff --git a/mailpoet/lib/Automation/API/Endpoints/WorkflowsEndpoint.php b/mailpoet/lib/Automation/API/Endpoints/WorkflowsEndpoint.php new file mode 100644 index 0000000000..961c6ec548 --- /dev/null +++ b/mailpoet/lib/Automation/API/Endpoints/WorkflowsEndpoint.php @@ -0,0 +1,13 @@ + 'Hello world.']); + } +} diff --git a/mailpoet/lib/DI/ContainerConfigurator.php b/mailpoet/lib/DI/ContainerConfigurator.php index 0f715ab187..0f3c0c81ed 100644 --- a/mailpoet/lib/DI/ContainerConfigurator.php +++ b/mailpoet/lib/DI/ContainerConfigurator.php @@ -105,6 +105,7 @@ class ContainerConfigurator implements IContainerConfigurator { $container->autowire(\MailPoet\Automation\API\EndpointFactory::class) ->setPublic(true) ->setArgument('$container', new Reference(ContainerWrapper::class)); + $container->autowire(\MailPoet\Automation\API\Endpoints\WorkflowsEndpoint::class)->setPublic(true); $container->autowire(\MailPoet\Automation\Automation::class)->setPublic(true); $container->autowire(\MailPoet\Automation\WordPress::class)->setPublic(true); // Config