Adds one entry point for both JSON and MP APIs

Removes endpoints folder and moves versions to the root
JSON API folder
This commit is contained in:
Vlad
2017-05-10 18:20:32 -04:00
parent 3c7ac5488a
commit 8b13889c7a
30 changed files with 49 additions and 48 deletions

24
lib/API/JSON/v1/Setup.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace MailPoet\API\JSON\v1;
use MailPoet\API\JSON\Endpoint as APIEndpoint;
use MailPoet\Config\Activator;
use MailPoet\WP\Hooks;
if(!defined('ABSPATH')) exit;
class Setup extends APIEndpoint {
function reset() {
try {
$activator = new Activator();
$activator->deactivate();
$activator->activate();
Hooks::doAction('mailpoet_setup_reset');
return $this->successResponse();
} catch(\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
));
}
}
}