PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / trunk
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO vtrunk
1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 1.3.44 All 176 releases
disco / rest / Api.php

Api.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO trunk, at rest/Api.php

87 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Api.php
4 *
5 * @package Disco/Rest
6 * @license https://opensource.org/licenses/gpl-license.php GNU Public License
7 * @category API
8 */
9
10 namespace Disco\Rest;
11
12 /**
13 * Class Api
14 *
15 * This class is responsible for initializing and registering all the REST API routes for the Disco plugin.
16 */
17 class Api {
18
19 /**
20 * The namespace for the REST API routes.
21 */
22 public const NAMESPACE_NAME = 'disco';
23
24 /**
25 * The version of the REST API.
26 */
27 public const VERSION = 'v1';
28
29 /**
30 * The name of the route for dropdown related requests.
31 */
32 public const DROPDOWN_ROUTE_NAME = 'dropdown';
33
34 /**
35 * The name of the route for search related requests.
36 */
37 public const SEARCH_ROUTE_NAME = 'search';
38
39 /**
40 * The name of the route for campaign related requests.
41 */
42 public const CAMPAIGN_ROUTE_NAME = 'campaigns';
43
44 /**
45 * The name of the route for settings related requests.
46 */
47 public const SETTINGS_ROUTE_NAME = 'settings';
48
49 /**
50 * Constructor for the Api class.
51 *
52 * Adds the 'rest_api_init' action hook which calls the 'register_rest_api' method when the REST API is initialized.
53 */
54 public function __construct() {
55 add_action( 'rest_api_init', array( $this, 'register_rest_api' ) );
56 }
57
58 /**
59 * Method to register all the REST API routes for the Disco plugin.
60 *
61 * This method creates instances of the CampaignApi, SearchApi, DropDownApi, and SettingsApi classes, and calls
62 * their respective 'register_routes' methods.
63 *
64 * @return void
65 */
66 public function register_rest_api() {
67 $campaign = new CampaignApi;
68 $campaign->register_routes();
69
70 $search = new SearchApi;
71 $search->register_routes();
72
73 $dropdown = new DropDownApi;
74 $dropdown->register_routes();
75
76 $settings = new SettingsApi;
77 $settings->register_routes();
78
79 $image_upload = new ImageUploadApi;
80 $image_upload->register_routes();
81
82 $analytics = new AnalyticsApi;
83 $analytics->register_routes();
84 }
85
86 }
87