| 1 |
<?php |
| 2 |
/** |
| 3 |
* Handles requests to the /wc/shiprocket/v1/. |
| 4 |
* |
| 5 |
* @author Shiprocket |
| 6 |
* |
| 7 |
* @category API |
| 8 |
* @package Shiprocket |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; // Exit if accessed directly. |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Shipment Tracking Main Class. |
| 17 |
*/ |
| 18 |
if ( ! class_exists( 'Shiprocket_Woocommerce_Api' ) ) { |
| 19 |
/** |
| 20 |
* Holds Shiprocket API Methods. |
| 21 |
*/ |
| 22 |
class Shiprocket_Woocommerce_Api { |
| 23 |
|
| 24 |
/** |
| 25 |
* Constructor of Shiprocket_Woocommerce_Api class. |
| 26 |
*/ |
| 27 |
public function __construct() { |
| 28 |
add_action( 'rest_api_init', array( $this, 'user_list_api' ), 100 ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Initialize rest api for tracking. |
| 33 |
*/ |
| 34 |
public function user_list_api() { |
| 35 |
if ( ! class_exists( 'Shiprocket_User_List_API' ) ) { |
| 36 |
require_once 'class-shiprocket-user-list-api.php'; |
| 37 |
} |
| 38 |
$obj = new Shiprocket_User_List_API(); |
| 39 |
$obj->register_routes(); |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
|