WC_REST_Customer_Downloads_V1_Controller::get_item_schema()publicWC 1.0

Get the Customer Download's schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

$WC_REST_Customer_Downloads_V1_Controller = new WC_REST_Customer_Downloads_V1_Controller();
$WC_REST_Customer_Downloads_V1_Controller->get_item_schema();

Код WC_REST_Customer_Downloads_V1_Controller::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'customer_download',
		'type'       => 'object',
		'properties' => array(
			'download_url' => array(
				'description' => __( 'Download file URL.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'download_id' => array(
				'description' => __( 'Download ID (MD5).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'product_id' => array(
				'description' => __( 'Downloadable product ID.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'download_name' => array(
				'description' => __( 'Downloadable file name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'order_id' => array(
				'description' => __( 'Order ID.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'order_key' => array(
				'description' => __( 'Order key.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'downloads_remaining' => array(
				'description' => __( 'Number of downloads remaining.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'access_expires' => array(
				'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'file' => array(
				'description' => __( 'File details.', 'woocommerce' ),
				'type'        => 'object',
				'context'     => array( 'view' ),
				'readonly'    => true,
				'properties' => array(
					'name' => array(
						'description' => __( 'File name.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view' ),
						'readonly'    => true,
					),
					'file' => array(
						'description' => __( 'File URL.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => array( 'view' ),
						'readonly'    => true,
					),
				),
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}