File "WorkflowsDeleteEndpoint.php"

Full Path: /home/warrior1/public_html/languages/wp-content-20241001222009/plugins/mailpoet/lib/Automation/Engine/Endpoints/Workflows/WorkflowsDeleteEndpoint.php
File size: 914 bytes
MIME-type: text/x-php
Charset: utf-8

<?php declare(strict_types = 1);

namespace MailPoet\Automation\Engine\Endpoints\Workflows;

if (!defined('ABSPATH')) exit;


use MailPoet\API\REST\Request;
use MailPoet\API\REST\Response;
use MailPoet\Automation\Engine\API\Endpoint;
use MailPoet\Automation\Engine\Builder\DeleteWorkflowController;
use MailPoet\Validator\Builder;

class WorkflowsDeleteEndpoint extends Endpoint {
  /** @var DeleteWorkflowController */
  private $deleteController;

  public function __construct(
    DeleteWorkflowController $deleteController
  ) {
    $this->deleteController = $deleteController;
  }

  public function handle(Request $request): Response {
    $workflowId = intval($request->getParam('id'));
    $this->deleteController->deleteWorkflow($workflowId);
    return new Response(null);
  }

  public static function getRequestSchema(): array {
    return [
      'id' => Builder::integer()->required(),
    ];
  }
}