Add basic workflow endpoint with hello world message

[MAILPOET-4135]
This commit is contained in:
Jan Jakes
2022-02-10 11:02:00 +01:00
committed by Veljko V
parent 51d6b541e5
commit 9e8e3a37bb
3 changed files with 16 additions and 0 deletions

View File

@@ -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<string, class-string<Endpoint>> */
private $routes = [
'workflows' => WorkflowsEndpoint::class,
];
public function __construct(

View File

@@ -0,0 +1,13 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\API\Endpoints;
use MailPoet\Automation\API\Endpoint;
use MailPoet\Automation\API\Request;
use MailPoet\Automation\API\Response;
class WorkflowsEndpoint extends Endpoint {
public function get(Request $request): Response {
return new Response(['message' => 'Hello world.']);
}
}

View File

@@ -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