route( '/operations', array( 'methods' => \WP_REST_Server::READABLE, 'callback' => array( $this, 'list_operations' ), 'args' => array( 'include_internal' => array( 'type' => 'boolean', 'default' => false, ), ), ) ); } /** * Handles GET /operations. * * @param \WP_REST_Request $request Request. * @return \WP_REST_Response */ public function list_operations( \WP_REST_Request $request ) { return $this->respond( Plugin::instance()->operations()->descriptors( (bool) $request['include_internal'] ) ); } }