WC_REST_Webhook_Deliveries_V1_Controller::get_item_schema()publicWC 1.0

Get the Webhook's schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Webhook_Deliveries_V1_Controller::get_item_schema() WC 9.3.3

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'webhook_delivery',
		'type'       => 'object',
		'properties' => array(
			'id' => array(
				'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'duration' => array(
				'description' => __( 'The delivery duration, in seconds.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'summary' => array(
				'description' => __( 'A friendly summary of the response including the HTTP response code, message, and body.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'request_url' => array(
				'description' => __( 'The URL where the webhook was delivered.', 'woocommerce' ),
				'type'        => 'string',
				'format'      => 'uri',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'request_headers' => array(
				'description' => __( 'Request headers.', 'woocommerce' ),
				'type'        => 'array',
				'context'     => array( 'view' ),
				'readonly'    => true,
				'items'       => array(
					'type'    => 'string',
				),
			),
			'request_body' => array(
				'description' => __( 'Request body.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'response_code' => array(
				'description' => __( 'The HTTP response code from the receiving server.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'response_message' => array(
				'description' => __( 'The HTTP response message from the receiving server.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'response_headers' => array(
				'description' => __( 'Array of the response headers from the receiving server.', 'woocommerce' ),
				'type'        => 'array',
				'context'     => array( 'view' ),
				'readonly'    => true,
				'items'       => array(
					'type'    => 'string',
				),
			),
			'response_body' => array(
				'description' => __( 'The response body from the receiving server.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'date_created' => array(
				'description' => __( "The date the webhook delivery was logged, in the site's timezone.", 'woocommerce' ),
				'type'        => 'date-time',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);

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