| 1 |
<?php |
| 2 |
|
| 3 |
namespace BitCode\BitForm\API\Route; |
| 4 |
|
| 5 |
use BitCode\BitForm\API\Controller\EntryController; |
| 6 |
use WP_REST_Controller; |
| 7 |
use WP_REST_Server; |
| 8 |
|
| 9 |
class Routes extends WP_REST_Controller |
| 10 |
{ |
| 11 |
private $entryController; |
| 12 |
|
| 13 |
public function __construct() |
| 14 |
{ |
| 15 |
$this->namespace = 'bitform'; |
| 16 |
$this->rest_base = 'v1'; |
| 17 |
$this->entryController = new EntryController(); |
| 18 |
} |
| 19 |
|
| 20 |
public function register_routes() |
| 21 |
{ |
| 22 |
/* google sheet route */ |
| 23 |
register_rest_route( |
| 24 |
$this->namespace, |
| 25 |
$this->rest_base . '/google/', |
| 26 |
[ |
| 27 |
[ |
| 28 |
'methods' => WP_REST_Server::READABLE, |
| 29 |
'callback' => [$this->entryController, 'googleAuth'], |
| 30 |
'permission_callback' => '__return_true' |
| 31 |
] |
| 32 |
|
| 33 |
] |
| 34 |
); |
| 35 |
// oneDrive rest route |
| 36 |
register_rest_route( |
| 37 |
$this->namespace, |
| 38 |
$this->rest_base . '/oneDrive/', |
| 39 |
[ |
| 40 |
[ |
| 41 |
'methods' => WP_REST_Server::READABLE, |
| 42 |
'callback' => [$this->entryController, 'oneDriveAuth'], |
| 43 |
'permission_callback' => '__return_true' |
| 44 |
] |
| 45 |
|
| 46 |
] |
| 47 |
); |
| 48 |
|
| 49 |
// zoho |
| 50 |
register_rest_route( |
| 51 |
$this->namespace, |
| 52 |
$this->rest_base . '/zoho/', |
| 53 |
[ |
| 54 |
[ |
| 55 |
'methods' => WP_REST_Server::READABLE, |
| 56 |
'callback' => [$this->entryController, 'authRedirect'], |
| 57 |
'permission_callback' => '__return_true' |
| 58 |
] |
| 59 |
|
| 60 |
] |
| 61 |
); |
| 62 |
} |
| 63 |
} |
| 64 |
|