Automattic\WooCommerce\Internal\PushNotifications\Controllers

PushNotificationStatusRestController::get_schema │ public │ WC 11.2.0

The schema for the status response.

installed_drivers is keyed by driver identifier, so its shape is described with additionalProperties rather than named properties.

Метод класса: PushNotificationStatusRestController{}

Хуков нет.

Возвращает

array<string, mixed>.

Использование

$PushNotificationStatusRestController = new PushNotificationStatusRestController();
$PushNotificationStatusRestController->get_schema(): array;

Список изменений

С версии 11.2.0 Введена.

Код PushNotificationStatusRestController::get_schema() WC 11.2.2

public function get_schema(): array {
	$driver_flags = array(
		'type'       => 'object',
		'properties' => array(
			'connected' => array(
				'description' => __( "Whether the driver's underlying connection is present. Null when the check could not be performed.", 'woocommerce' ),
				'type'        => array( 'boolean', 'null' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'enabled'   => array(
				'description' => __( 'Whether the driver itself is switched on. Null when the check could not be performed.', 'woocommerce' ),
				'type'        => array( 'boolean', 'null' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'available' => array(
				'description' => __( 'Whether the driver is definitively both connected and enabled. An undetermined flag makes the driver unavailable.', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
		),
	);

	return array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'push_notification_status',
		'type'       => 'object',
		'properties' => array(
			'installed_drivers' => array(
				'description'          => __( 'The installed notification drivers, keyed by driver identifier.', 'woocommerce' ),
				'type'                 => 'object',
				'context'              => array( 'view' ),
				'readonly'             => true,
				'additionalProperties' => $driver_flags,
			),
			'preferred_driver'  => array(
				'description' => __( 'The driver the site prefers, being the first available one in precedence order, or null when none are available. Not a statement about what is delivering notifications to a given app.', 'woocommerce' ),
				'type'        => array( 'string', 'null' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
		),
	);
}