Controller
2 months ago
Endpoints
2 months ago
Entities
2 months ago
Analytics.php
7 months ago
index.php
3 years ago
Analytics.php
34 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Automation\Integrations\MailPoet\Analytics; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\API\REST\API; |
| 9 | use MailPoet\Automation\Engine\Hooks; |
| 10 | use MailPoet\Automation\Engine\WordPress; |
| 11 | use MailPoet\Automation\Integrations\MailPoet\Analytics\Endpoints\AutomationFlowEndpoint; |
| 12 | use MailPoet\Automation\Integrations\MailPoet\Analytics\Endpoints\OverviewEndpoint; |
| 13 | use MailPoet\Automation\Integrations\MailPoet\Analytics\Endpoints\UpdateRunStatusEndpoint; |
| 14 | |
| 15 | class Analytics { |
| 16 | |
| 17 | /** @var WordPress */ |
| 18 | private $wordPress; |
| 19 | |
| 20 | public function __construct( |
| 21 | WordPress $wordPress |
| 22 | ) { |
| 23 | $this->wordPress = $wordPress; |
| 24 | } |
| 25 | |
| 26 | public function register(): void { |
| 27 | $this->wordPress->addAction(Hooks::API_INITIALIZE, function (API $api) { |
| 28 | $api->registerGetRoute('automation/analytics/automation_flow', AutomationFlowEndpoint::class); |
| 29 | $api->registerGetRoute('automation/analytics/overview', OverviewEndpoint::class); |
| 30 | $api->registerPutRoute('automation/analytics/runs/(?P<id>\d+)/status', UpdateRunStatusEndpoint::class); |
| 31 | }); |
| 32 | } |
| 33 | } |
| 34 |