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

18
lib/API/API.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace MailPoet\API;
if(!defined('ABSPATH')) exit;
class API {
static function JSON() {
return new \MailPoet\API\JSON\API();
}
static function MP($version) {
$api_class = sprintf('%s\MP\%s\API', __NAMESPACE__, $version);
if(class_exists($api_class)) {
return new $api_class();
}
throw new \Exception(__('Invalid API version.', 'mailpoet'));
}
}