WC_REST_WCCOM_Site_Installer_Controller::register_routes()publicWC 7.7.0

Register the routes for plugin auto-installer.

Method of the class: WC_REST_WCCOM_Site_Installer_Controller{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_REST_WCCOM_Site_Installer_Controller = new WC_REST_WCCOM_Site_Installer_Controller();
$WC_REST_WCCOM_Site_Installer_Controller->register_routes();

Changelog

Since 7.7.0 Introduced.

WC_REST_WCCOM_Site_Installer_Controller::register_routes() code WC 9.4.2

public function register_routes() {

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base,
		array(
			array(
				'methods'             => WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'install' ),
				'permission_callback' => array( $this, 'check_permission' ),
				'args'                => array(
					'product-id'      => array(
						'required' => true,
						'type'     => 'integer',
					),
					'run-until-step'  => array(
						'required' => true,
						'type'     => 'string',
						'enum'     => WC_WCCOM_Site_Installation_Manager::STEPS,
					),
					'idempotency-key' => array(
						'required' => true,
						'type'     => 'string',
					),
				),
			),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/reset',
		array(
			array(
				'methods'             => WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'reset_install' ),
				'permission_callback' => array( $this, 'check_permission' ),
				'args'                => array(
					'product-id'      => array(
						'required' => true,
						'type'     => 'integer',
					),
					'idempotency-key' => array(
						'required' => true,
						'type'     => 'string',
					),
				),
			),
		)
	);
}