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0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / rest-api / Server.php
woocommerce / includes / rest-api Last commit date
Controllers 4 years ago Utilities 5 years ago Package.php 5 years ago Server.php 4 years ago
Server.php
203 lines
1 <?php
2 /**
3 * Initialize this version of the REST API.
4 *
5 * @package WooCommerce\RestApi
6 */
7
8 namespace Automattic\WooCommerce\RestApi;
9
10 defined( 'ABSPATH' ) || exit;
11
12 use Automattic\WooCommerce\RestApi\Utilities\SingletonTrait;
13
14 /**
15 * Class responsible for loading the REST API and all REST API namespaces.
16 */
17 class Server {
18 use SingletonTrait;
19
20 /**
21 * REST API namespaces and endpoints.
22 *
23 * @var array
24 */
25 protected $controllers = array();
26
27 /**
28 * Hook into WordPress ready to init the REST API as needed.
29 */
30 public function init() {
31 add_action( 'rest_api_init', array( $this, 'register_rest_routes' ), 10 );
32 }
33
34 /**
35 * Register REST API routes.
36 */
37 public function register_rest_routes() {
38 foreach ( $this->get_rest_namespaces() as $namespace => $controllers ) {
39 foreach ( $controllers as $controller_name => $controller_class ) {
40 $this->controllers[ $namespace ][ $controller_name ] = new $controller_class();
41 $this->controllers[ $namespace ][ $controller_name ]->register_routes();
42 }
43 }
44 }
45
46 /**
47 * Get API namespaces - new namespaces should be registered here.
48 *
49 * @return array List of Namespaces and Main controller classes.
50 */
51 protected function get_rest_namespaces() {
52 return apply_filters(
53 'woocommerce_rest_api_get_rest_namespaces',
54 array(
55 'wc/v1' => $this->get_v1_controllers(),
56 'wc/v2' => $this->get_v2_controllers(),
57 'wc/v3' => $this->get_v3_controllers(),
58 'wc-telemetry' => $this->get_telemetry_controllers(),
59 )
60 );
61 }
62
63 /**
64 * List of controllers in the wc/v1 namespace.
65 *
66 * @return array
67 */
68 protected function get_v1_controllers() {
69 return array(
70 'coupons' => 'WC_REST_Coupons_V1_Controller',
71 'customer-downloads' => 'WC_REST_Customer_Downloads_V1_Controller',
72 'customers' => 'WC_REST_Customers_V1_Controller',
73 'order-notes' => 'WC_REST_Order_Notes_V1_Controller',
74 'order-refunds' => 'WC_REST_Order_Refunds_V1_Controller',
75 'orders' => 'WC_REST_Orders_V1_Controller',
76 'product-attribute-terms' => 'WC_REST_Product_Attribute_Terms_V1_Controller',
77 'product-attributes' => 'WC_REST_Product_Attributes_V1_Controller',
78 'product-categories' => 'WC_REST_Product_Categories_V1_Controller',
79 'product-reviews' => 'WC_REST_Product_Reviews_V1_Controller',
80 'product-shipping-classes' => 'WC_REST_Product_Shipping_Classes_V1_Controller',
81 'product-tags' => 'WC_REST_Product_Tags_V1_Controller',
82 'products' => 'WC_REST_Products_V1_Controller',
83 'reports-sales' => 'WC_REST_Report_Sales_V1_Controller',
84 'reports-top-sellers' => 'WC_REST_Report_Top_Sellers_V1_Controller',
85 'reports' => 'WC_REST_Reports_V1_Controller',
86 'tax-classes' => 'WC_REST_Tax_Classes_V1_Controller',
87 'taxes' => 'WC_REST_Taxes_V1_Controller',
88 'webhooks' => 'WC_REST_Webhooks_V1_Controller',
89 'webhook-deliveries' => 'WC_REST_Webhook_Deliveries_V1_Controller',
90 );
91 }
92
93 /**
94 * List of controllers in the wc/v2 namespace.
95 *
96 * @return array
97 */
98 protected function get_v2_controllers() {
99 return array(
100 'coupons' => 'WC_REST_Coupons_V2_Controller',
101 'customer-downloads' => 'WC_REST_Customer_Downloads_V2_Controller',
102 'customers' => 'WC_REST_Customers_V2_Controller',
103 'network-orders' => 'WC_REST_Network_Orders_V2_Controller',
104 'order-notes' => 'WC_REST_Order_Notes_V2_Controller',
105 'order-refunds' => 'WC_REST_Order_Refunds_V2_Controller',
106 'orders' => 'WC_REST_Orders_V2_Controller',
107 'product-attribute-terms' => 'WC_REST_Product_Attribute_Terms_V2_Controller',
108 'product-attributes' => 'WC_REST_Product_Attributes_V2_Controller',
109 'product-categories' => 'WC_REST_Product_Categories_V2_Controller',
110 'product-reviews' => 'WC_REST_Product_Reviews_V2_Controller',
111 'product-shipping-classes' => 'WC_REST_Product_Shipping_Classes_V2_Controller',
112 'product-tags' => 'WC_REST_Product_Tags_V2_Controller',
113 'products' => 'WC_REST_Products_V2_Controller',
114 'product-variations' => 'WC_REST_Product_Variations_V2_Controller',
115 'reports-sales' => 'WC_REST_Report_Sales_V2_Controller',
116 'reports-top-sellers' => 'WC_REST_Report_Top_Sellers_V2_Controller',
117 'reports' => 'WC_REST_Reports_V2_Controller',
118 'settings' => 'WC_REST_Settings_V2_Controller',
119 'settings-options' => 'WC_REST_Setting_Options_V2_Controller',
120 'shipping-zones' => 'WC_REST_Shipping_Zones_V2_Controller',
121 'shipping-zone-locations' => 'WC_REST_Shipping_Zone_Locations_V2_Controller',
122 'shipping-zone-methods' => 'WC_REST_Shipping_Zone_Methods_V2_Controller',
123 'tax-classes' => 'WC_REST_Tax_Classes_V2_Controller',
124 'taxes' => 'WC_REST_Taxes_V2_Controller',
125 'webhooks' => 'WC_REST_Webhooks_V2_Controller',
126 'webhook-deliveries' => 'WC_REST_Webhook_Deliveries_V2_Controller',
127 'system-status' => 'WC_REST_System_Status_V2_Controller',
128 'system-status-tools' => 'WC_REST_System_Status_Tools_V2_Controller',
129 'shipping-methods' => 'WC_REST_Shipping_Methods_V2_Controller',
130 'payment-gateways' => 'WC_REST_Payment_Gateways_V2_Controller',
131 );
132 }
133
134 /**
135 * List of controllers in the wc/v3 namespace.
136 *
137 * @return array
138 */
139 protected function get_v3_controllers() {
140 return array(
141 'coupons' => 'WC_REST_Coupons_Controller',
142 'customer-downloads' => 'WC_REST_Customer_Downloads_Controller',
143 'customers' => 'WC_REST_Customers_Controller',
144 'network-orders' => 'WC_REST_Network_Orders_Controller',
145 'order-notes' => 'WC_REST_Order_Notes_Controller',
146 'order-refunds' => 'WC_REST_Order_Refunds_Controller',
147 'orders' => 'WC_REST_Orders_Controller',
148 'product-attribute-terms' => 'WC_REST_Product_Attribute_Terms_Controller',
149 'product-attributes' => 'WC_REST_Product_Attributes_Controller',
150 'product-categories' => 'WC_REST_Product_Categories_Controller',
151 'product-reviews' => 'WC_REST_Product_Reviews_Controller',
152 'product-shipping-classes' => 'WC_REST_Product_Shipping_Classes_Controller',
153 'product-tags' => 'WC_REST_Product_Tags_Controller',
154 'products' => 'WC_REST_Products_Controller',
155 'product-variations' => 'WC_REST_Product_Variations_Controller',
156 'reports-sales' => 'WC_REST_Report_Sales_Controller',
157 'reports-top-sellers' => 'WC_REST_Report_Top_Sellers_Controller',
158 'reports-orders-totals' => 'WC_REST_Report_Orders_Totals_Controller',
159 'reports-products-totals' => 'WC_REST_Report_Products_Totals_Controller',
160 'reports-customers-totals' => 'WC_REST_Report_Customers_Totals_Controller',
161 'reports-coupons-totals' => 'WC_REST_Report_Coupons_Totals_Controller',
162 'reports-reviews-totals' => 'WC_REST_Report_Reviews_Totals_Controller',
163 'reports' => 'WC_REST_Reports_Controller',
164 'settings' => 'WC_REST_Settings_Controller',
165 'settings-options' => 'WC_REST_Setting_Options_Controller',
166 'shipping-zones' => 'WC_REST_Shipping_Zones_Controller',
167 'shipping-zone-locations' => 'WC_REST_Shipping_Zone_Locations_Controller',
168 'shipping-zone-methods' => 'WC_REST_Shipping_Zone_Methods_Controller',
169 'tax-classes' => 'WC_REST_Tax_Classes_Controller',
170 'taxes' => 'WC_REST_Taxes_Controller',
171 'webhooks' => 'WC_REST_Webhooks_Controller',
172 'system-status' => 'WC_REST_System_Status_Controller',
173 'system-status-tools' => 'WC_REST_System_Status_Tools_Controller',
174 'shipping-methods' => 'WC_REST_Shipping_Methods_Controller',
175 'payment-gateways' => 'WC_REST_Payment_Gateways_Controller',
176 'data' => 'WC_REST_Data_Controller',
177 'data-continents' => 'WC_REST_Data_Continents_Controller',
178 'data-countries' => 'WC_REST_Data_Countries_Controller',
179 'data-currencies' => 'WC_REST_Data_Currencies_Controller',
180 );
181 }
182
183 /**
184 * List of controllers in the telemetry namespace.
185 *
186 * @return array
187 */
188 protected function get_telemetry_controllers() {
189 return array(
190 'tracker' => 'WC_REST_Telemetry_Controller',
191 );
192 }
193
194 /**
195 * Return the path to the package.
196 *
197 * @return string
198 */
199 public static function get_path() {
200 return dirname( __DIR__ );
201 }
202 }
203