LLMS_REST_Webhooks_Controller::get_item_schema()

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


Return Return

(array)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-webhooks-controller.php

	protected function get_item_schema_base() {

		return array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'webhook',
			'type'       => 'object',
			'properties' => array(
				'id'           => array(
					'description' => __( 'Webhook ID.', 'lifterlms' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'name'         => array(
					'description' => __( 'Friendly, human-readable name or description.', 'lifterlms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
					'arg_options' => array(
						'sanitize_callback' => 'sanitize_text_field',
					),
				),
				'status'       => array(
					'description' => __( 'The status of the webhook.', 'lifterlms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
					'enum'        => array_keys( LLMS_REST_API()->webhooks()->get_statuses() ),
					'default'     => 'disabled',
				),
				'topic'        => array(
					'description' => __( 'The webhook topic', 'lifterlms' ),
					'type'        => 'string',
					'required'    => true,
					'context'     => array( 'view', 'edit' ),
					'arg_options' => array(
						'validate_callback' => array( LLMS_REST_API()->webhooks(), 'is_topic_valid' ),
					),
				),
				'delivery_url' => array(
					'description' => __( 'The webhook payload delivery URL.', 'lifterlms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
					'required'    => true,
				),
				'secret'       => array(
					'description' => __( 'An optional secret key used to generate the delivery signature.', 'lifterlms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
				),
				'created'      => array(
					'description' => __( 'Creation date. Format: Y-m-d H:i:s', 'lifterlms' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'updated'      => array(
					'description' => __( 'Date last modified. Format: Y-m-d H:i:s', 'lifterlms' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'resource'     => array(
					'description' => __( 'The parsed resource from the `topic`.', 'lifterlms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'event'        => array(
					'description' => __( 'The parsed event from the `topic`.', 'lifterlms' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'hooks'        => array(
					'description' => __( 'List of WordPress action hook associated with the webhook.', 'lifterlms' ),
					'type'        => 'array',
					'items'       => array(
						'type' => 'string',
					),
					'context'     => array( 'view', 'edit' ),
				),
			),
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.