BP_REST_Topics_Actions_Endpoint::register_routes()
Register the component routes.
Description
Source
File: bp-forums/classes/class-bp-rest-topics-actions-endpoint.php
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base . '/merge/(?P<id>[\d]+)', array( 'args' => array( 'id' => array( 'description' => __( 'A unique numeric ID for the topic.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ), 'destination_id' => array( 'description' => __( 'A unique numeric ID for the destination topic.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ), 'subscribers' => array( 'description' => __( 'Whether to migrate subscriptions or not.', 'buddyboss' ), 'type' => 'boolean', 'default' => true, ), 'favorites' => array( 'description' => __( 'Whether to migrate favorites or not.', 'buddyboss' ), 'type' => 'boolean', 'default' => true, ), 'tags' => array( 'description' => __( 'Whether to migrate tags or not.', 'buddyboss' ), 'type' => 'boolean', 'default' => true, ), ), array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'merge_item' ), 'permission_callback' => array( $this, 'merge_item_permissions_check' ), ), 'schema' => array( $this, 'get_item_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/split/(?P<id>[\d]+)', array( 'args' => array( 'id' => array( 'description' => __( 'A unique numeric ID for the topic.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ), 'reply_id' => array( 'description' => __( 'A unique numeric ID for the topic\'s reply.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ), 'split_option' => array( 'description' => __( 'Choose a valid split option.', 'buddyboss' ), 'type' => 'string', 'required' => true, 'enum' => array( 'reply', 'existing' ), ), 'new_destination_title' => array( 'description' => __( 'New Topic title for the split with option reply.', 'buddyboss' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ), 'destination_id' => array( 'description' => __( 'A unique numeric ID for the destination topic.', 'buddyboss' ), 'type' => 'integer', ), 'subscribers' => array( 'description' => __( 'Whether to migrate subscriptions or not.', 'buddyboss' ), 'type' => 'boolean', 'default' => true, ), 'favorites' => array( 'description' => __( 'Whether to migrate favorites or not.', 'buddyboss' ), 'type' => 'boolean', 'default' => true, ), 'tags' => array( 'description' => __( 'Whether to migrate tags or not.', 'buddyboss' ), 'type' => 'boolean', 'default' => true, ), ), array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'split_item' ), 'permission_callback' => array( $this, 'split_item_permissions_check' ), ), 'schema' => array( $this, 'get_item_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/action/(?P<id>[\d]+)', array( 'args' => array( 'id' => array( 'description' => __( 'A unique numeric ID for the topic.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ), 'action' => array( 'description' => __( 'Action name to perform on the topic', 'buddyboss' ), 'type' => 'string', 'required' => true, 'enum' => array( 'favorite', 'subscribe', 'close', 'sticky', 'super_sticky', 'spam', 'trash', ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ), 'value' => array( 'description' => __( 'Value for the action on topic.', 'buddyboss' ), 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ), ), array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'action_items' ), 'permission_callback' => array( $this, 'action_items_permissions_check' ), ), 'schema' => array( $this, 'get_item_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/dropdown/(?P<id>[\d]+)', array( 'args' => array( 'id' => array( 'description' => __( 'A unique numeric ID for the topic.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ), 'page' => array( 'required' => false, 'default' => 1, 'description' => __( 'Current page of the collection.', 'buddyboss' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ), 'per_page' => array( 'required' => false, 'default' => 10, 'description' => __( 'Maximum number of items to be returned in result set.', 'buddyboss' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'maximum' => 9999999, 'validate_callback' => 'rest_validate_request_arg', ), ), array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'dropdown_items' ), 'permission_callback' => array( $this, 'dropdown_items_permissions_check' ), ), 'schema' => array( $this, 'get_dropdown_item_schema' ), ) ); }
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.