Automattic\WooCommerce\Internal\Fulfillments

OrderFulfillmentsRestController::get_read_schema_for_fulfillmentprivateWC 1.0

Get the base schema for the fulfillment with a read context.

Method of the class: OrderFulfillmentsRestController{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_read_schema_for_fulfillment();

OrderFulfillmentsRestController::get_read_schema_for_fulfillment() code WC 10.3.3

private function get_read_schema_for_fulfillment() {
	return array(
		'id'           => array(
			'description' => __( 'Unique identifier for the fulfillment.', 'woocommerce' ),
			'type'        => 'integer',
			'context'     => array( 'view', 'edit' ),
			'readonly'    => true,
		),
		'entity_type'  => array(
			'description' => __( 'The type of entity for which the fulfillment is created.', 'woocommerce' ),
			'type'        => 'string',
			'required'    => true,
			'context'     => array( 'view', 'edit' ),
		),
		'entity_id'    => array(
			'description' => __( 'Unique identifier for the entity.', 'woocommerce' ),
			'type'        => 'string',
			'required'    => true,
			'context'     => array( 'view', 'edit' ),
		),
		'status'       => array(
			'description' => __( 'The status of the fulfillment.', 'woocommerce' ),
			'type'        => 'string',
			'default'     => 'unfulfilled',
			'required'    => true,
			'context'     => array( 'view', 'edit' ),
		),
		'is_fulfilled' => array(
			'description' => __( 'Whether the fulfillment is fulfilled.', 'woocommerce' ),
			'type'        => 'boolean',
			'default'     => false,
			'required'    => true,
			'context'     => array( 'view', 'edit' ),
		),
		'date_updated' => array(
			'description' => __( 'The date the fulfillment was last updated.', 'woocommerce' ),
			'type'        => 'string',
			'context'     => array( 'view', 'edit' ),
			'readonly'    => true,
			'required'    => true,
		),
		'date_deleted' => array(
			'description' => __( 'The date the fulfillment was deleted.', 'woocommerce' ),
			'anyOf'       => array(
				array(
					'type' => 'string',
				),
				array(
					'type' => 'null',
				),
			),
			'default'     => null,
			'context'     => array( 'view', 'edit' ),
			'readonly'    => true,
			'required'    => true,
		),
		'meta_data'    => array(
			'description' => __( 'Meta data for the fulfillment.', 'woocommerce' ),
			'type'        => 'array',
			'required'    => true,
			'items'       => $this->get_schema_for_meta_data(),
		),
	);
}