| 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 |
// public $entryController; |
| 11 |
|
| 12 |
public function __construct() { |
| 13 |
$this->namespace = 'bitform'; |
| 14 |
$this->rest_base = 'v1'; |
| 15 |
$this->entryController = new EntryController(); |
| 16 |
} |
| 17 |
|
| 18 |
public function register_routes() { |
| 19 |
/* google sheet route */ |
| 20 |
register_rest_route( |
| 21 |
$this->namespace, |
| 22 |
$this->rest_base . '/google/', |
| 23 |
[ |
| 24 |
[ |
| 25 |
'methods' => WP_REST_Server::READABLE, |
| 26 |
'callback' => [$this->entryController, 'googleAuth'], |
| 27 |
'permission_callback' => '__return_true' |
| 28 |
] |
| 29 |
|
| 30 |
] |
| 31 |
); |
| 32 |
// oneDrive rest route |
| 33 |
register_rest_route( |
| 34 |
$this->namespace, |
| 35 |
$this->rest_base . '/oneDrive/', |
| 36 |
[ |
| 37 |
[ |
| 38 |
'methods' => WP_REST_Server::READABLE, |
| 39 |
'callback' => [$this->entryController, 'oneDriveAuth'], |
| 40 |
'permission_callback' => '__return_true' |
| 41 |
] |
| 42 |
|
| 43 |
] |
| 44 |
); |
| 45 |
|
| 46 |
// zoho |
| 47 |
register_rest_route( |
| 48 |
$this->namespace, |
| 49 |
$this->rest_base . '/zoho/', |
| 50 |
[ |
| 51 |
[ |
| 52 |
'methods' => WP_REST_Server::READABLE, |
| 53 |
'callback' => [$this->entryController, 'authRedirect'], |
| 54 |
'permission_callback' => '__return_true' |
| 55 |
] |
| 56 |
|
| 57 |
] |
| 58 |
); |
| 59 |
} |
| 60 |
} |
| 61 |
|