Endpoints should overwrite
This commit is contained in:
parent
60a5a8a0ff
commit
6cbe095fc6
|
@ -58,7 +58,8 @@ abstract class AbstractTermsContoller extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -98,7 +99,8 @@ abstract class AbstractTermsContoller extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -112,7 +114,8 @@ abstract class AbstractTermsContoller extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ class Coupons extends AbstractPostsController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -107,7 +108,8 @@ class Coupons extends AbstractPostsController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -121,7 +123,8 @@ class Coupons extends AbstractPostsController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ class CustomerDownloads extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class Customers extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -110,7 +111,8 @@ class Customers extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -124,7 +126,8 @@ class Customers extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ class Data extends AbstractController {
|
|||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ class Leaderboards extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -55,7 +56,8 @@ class Leaderboards extends AbstractController {
|
|||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_allowed_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ class NetworkOrders extends Orders {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,67 +34,75 @@ class OrderNotes extends AbstractController {
|
|||
* Register the routes for order notes.
|
||||
*/
|
||||
public function register_routes() {
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base, array(
|
||||
'args' => array(
|
||||
'order_id' => array(
|
||||
'description' => __( 'The order ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base,
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_items' ),
|
||||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array( $this, 'create_item' ),
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => array_merge( $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ), array(
|
||||
'note' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Order note content.', 'woocommerce' ),
|
||||
'required' => true,
|
||||
'args' => array(
|
||||
'order_id' => array(
|
||||
'description' => __( 'The order ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
) ),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_items' ),
|
||||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array( $this, 'create_item' ),
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => array_merge( $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ), array(
|
||||
'note' => array(
|
||||
'type' => 'string',
|
||||
'description' => __( 'Order note content.', 'woocommerce' ),
|
||||
'required' => true,
|
||||
),
|
||||
) ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
) );
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
'order_id' => array(
|
||||
'description' => __( 'The order ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array( $this, 'delete_item' ),
|
||||
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'force' => array(
|
||||
'default' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
'order_id' => array(
|
||||
'description' => __( 'The order ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array( $this, 'delete_item' ),
|
||||
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'force' => array(
|
||||
'default' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
) );
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -71,7 +71,8 @@ class OrderRefunds extends Orders {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -109,7 +110,8 @@ class OrderRefunds extends Orders {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class Orders extends AbstractObjectsController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -105,7 +106,8 @@ class Orders extends AbstractObjectsController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -119,7 +121,8 @@ class Orders extends AbstractObjectsController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ class PaymentGateways extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
|
@ -65,7 +66,8 @@ class PaymentGateways extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@ class ProductAttributeTerms extends AbstractTermsContoller {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -103,7 +104,8 @@ class ProductAttributeTerms extends AbstractTermsContoller {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -123,7 +125,8 @@ class ProductAttributeTerms extends AbstractTermsContoller {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ class ProductAttributes extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -100,7 +101,8 @@ class ProductAttributes extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -114,7 +116,8 @@ class ProductAttributes extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@ class ProductReviews extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -108,7 +109,8 @@ class ProductReviews extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -122,7 +124,8 @@ class ProductReviews extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class ProductVariations extends Products {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
|
@ -112,7 +113,8 @@ class ProductVariations extends Products {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base . '/batch',
|
||||
|
@ -130,7 +132,8 @@ class ProductVariations extends Products {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class Products extends AbstractObjectsController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -109,7 +110,8 @@ class Products extends AbstractObjectsController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -123,7 +125,8 @@ class Products extends AbstractObjectsController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ class Reports extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ class Settings extends AbstractController {
|
|||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
|
@ -51,7 +52,8 @@ class Settings extends AbstractController {
|
|||
'permission_callback' => array( $this, 'update_items_permissions_check' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ class SettingsOptions extends AbstractController {
|
|||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -65,7 +66,8 @@ class SettingsOptions extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -94,7 +96,8 @@ class SettingsOptions extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ class ShippingMethods extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
|
@ -59,7 +60,8 @@ class ShippingMethods extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ class ShippingZoneLocations extends AbstractShippingZonesController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -92,7 +93,8 @@ class ShippingZoneMethods extends AbstractShippingZonesController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ class ShippingZones extends AbstractShippingZonesController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -82,7 +83,8 @@ class ShippingZones extends AbstractShippingZonesController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ class SystemStatus extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ class SystemStatusTools extends AbstractController {
|
|||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -63,7 +64,8 @@ class SystemStatusTools extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ class TaxClasses extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -70,7 +71,8 @@ class TaxClasses extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ class Taxes extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -84,7 +85,8 @@ class Taxes extends AbstractController {
|
|||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route(
|
||||
|
@ -98,7 +100,8 @@ class Taxes extends AbstractController {
|
|||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
)
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,78 +34,90 @@ class Webhooks extends AbstractController {
|
|||
* Register the routes for webhooks.
|
||||
*/
|
||||
public function register_routes() {
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base, array(
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base,
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_items' ),
|
||||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
'args' => $this->get_collection_params(),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_items' ),
|
||||
'permission_callback' => array( $this, 'get_items_permissions_check' ),
|
||||
'args' => $this->get_collection_params(),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array( $this, 'create_item' ),
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => array_merge( $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ), array(
|
||||
'topic' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => __( 'Webhook topic.', 'woocommerce' ),
|
||||
),
|
||||
'delivery_url' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => __( 'Webhook delivery URL.', 'woocommerce' ),
|
||||
),
|
||||
) ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array( $this, 'create_item' ),
|
||||
'permission_callback' => array( $this, 'create_item_permissions_check' ),
|
||||
'args' => array_merge( $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ), array(
|
||||
'topic' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => __( 'Webhook topic.', 'woocommerce' ),
|
||||
),
|
||||
'delivery_url' => array(
|
||||
'required' => true,
|
||||
'type' => 'string',
|
||||
'description' => __( 'Webhook delivery URL.', 'woocommerce' ),
|
||||
),
|
||||
) ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
) );
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array(
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'update_item' ),
|
||||
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array( $this, 'delete_item' ),
|
||||
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'force' => array(
|
||||
'default' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array( $this, 'get_item' ),
|
||||
'permission_callback' => array( $this, 'get_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'context' => $this->get_context_param( array( 'default' => 'view' ) ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'update_item' ),
|
||||
'permission_callback' => array( $this, 'update_item_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array( $this, 'delete_item' ),
|
||||
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
|
||||
'args' => array(
|
||||
'force' => array(
|
||||
'default' => false,
|
||||
'type' => 'boolean',
|
||||
'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_item_schema' ),
|
||||
) );
|
||||
true
|
||||
);
|
||||
|
||||
register_rest_route( $this->namespace, '/' . $this->rest_base . '/batch', array(
|
||||
register_rest_route(
|
||||
$this->namespace, '/' . $this->rest_base . '/batch',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'batch_items' ),
|
||||
'permission_callback' => array( $this, 'batch_items_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array( $this, 'batch_items' ),
|
||||
'permission_callback' => array( $this, 'batch_items_permissions_check' ),
|
||||
'args' => $this->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
),
|
||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||
) );
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue