| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Data Controller |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace Extendify\Shared\Controllers; |
| 8 |
|
| 9 |
use Extendify\Constants; |
| 10 |
use Extendify\Shared\Services\HttpClient; |
| 11 |
use Extendify\PartnerData; |
| 12 |
|
| 13 |
defined('ABSPATH') || die('No direct access.'); |
| 14 |
|
| 15 |
/** |
| 16 |
* The controller for handling general data |
| 17 |
*/ |
| 18 |
|
| 19 |
class DataController |
| 20 |
{ |
| 21 |
/** |
| 22 |
* Get Partner Plugins information. |
| 23 |
* |
| 24 |
* @return \WP_REST_Response |
| 25 |
*/ |
| 26 |
public static function getPartnerPlugins() |
| 27 |
{ |
| 28 |
$response = HttpClient::get( |
| 29 |
Constants::DASHBOARD_HOST . '/api/onboarding/partner-plugins', |
| 30 |
['params' => ['partner' => PartnerData::$id]] |
| 31 |
); |
| 32 |
|
| 33 |
return new \WP_REST_Response($response['response'], $response['code']); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Just here to check for 200 (vs server rate limiting) |
| 38 |
* |
| 39 |
* @return \WP_REST_Response |
| 40 |
*/ |
| 41 |
public static function ping() |
| 42 |
{ |
| 43 |
return new \WP_REST_Response(true, 200); |
| 44 |
} |
| 45 |
} |
| 46 |
|