Automattic\WooCommerce\Admin\API

MarketingCampaigns::get_item_schema()publicWC 1.0

Retrieves the item's schema, conforming to JSON Schema.

Method of the class: MarketingCampaigns{}

No Hooks.

Return

Array. Item schema data.

Usage

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

MarketingCampaigns::get_item_schema() code WC 9.2.3

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'marketing_campaign',
		'type'       => 'object',
		'properties' => array(
			'id'         => array(
				'description' => __( 'The unique identifier for the marketing campaign.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'channel'    => array(
				'description' => __( 'The unique identifier for the marketing channel that this campaign belongs to.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'title'      => array(
				'description' => __( 'Title of the marketing campaign.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'manage_url' => array(
				'description' => __( 'URL to the campaign management page.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'cost'       => array(
				'description' => __( 'Cost of the marketing campaign.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
				'type'        => 'object',
				'properties'  => array(
					'value'    => array(
						'type'     => 'string',
						'context'  => array( 'view' ),
						'readonly' => true,
					),
					'currency' => array(
						'type'     => 'string',
						'context'  => array( 'view' ),
						'readonly' => true,
					),
				),
			),
			'sales'      => array(
				'description' => __( 'Sales of the marketing campaign.', 'woocommerce' ),
				'context'     => array( 'view' ),
				'readonly'    => true,
				'type'        => 'object',
				'properties'  => array(
					'value'    => array(
						'type'     => 'string',
						'context'  => array( 'view' ),
						'readonly' => true,
					),
					'currency' => array(
						'type'     => 'string',
						'context'  => array( 'view' ),
						'readonly' => true,
					),
				),
			),
		),
	);

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