Abstract_REST_Endpoint::swaggerize_args( TECEvent_AutomatorZapierRESTV1Endpointsarray $args = array(), TECEvent_AutomatorZapierRESTV1Endpointsarray $defaults = array() )

Converts an array of arguments suitable for the WP REST API to the Swagger format.


Parameters

$args

(<span class="TECEvent_AutomatorZapierRESTV1EndpointsarrayTECEvent_AutomatorZapierRESTV1Endpointsarray<string|">TECEvent_AutomatorZapierRESTV1Endpointsmixed>) (Optional) An array of arguments to swaggerize.

Default value: array()

$defaults

(<span class="TECEvent_AutomatorZapierRESTV1EndpointsarrayTECEvent_AutomatorZapierRESTV1Endpointsarray<string|">TECEvent_AutomatorZapierRESTV1Endpointsmixed>) (Optional) A default array of arguments.

Default value: array()


Top ↑

Return

(TECEvent_AutomatorZapierRESTV1Endpointsarray<string|TECEvent_AutomatorZapierRESTV1Endpointsmixed>) The converted arguments.


Top ↑

Source

File: src/Event_Automator/Zapier/REST/V1/Endpoints/Abstract_REST_Endpoint.php

		$this->api                = $api;
		$this->documentation      = $documentation;
		$this->details            = $this->get_endpoint_details();
		$this->enabled            = empty( $this->details['enabled'] ) ? false : true;
		$this->missing_dependency = empty( $this->details['missing_dependency'] ) ? false : true;
	}

	/**
	 * Register the actual endpoint on WP Rest API.
	 *
	 * @since 1.0.0
	 */
	abstract public function register();

	/**
	 * Returns an array in the format used by Swagger 2.0.
	 *
	 * While the structure must conform to that used by v2.0 of Swagger the structure can be that of a full document
	 * or that of a document part.
	 * The intelligence lies in the "gatherer" of informations rather than in the single "providers" implementing this
	 * interface.
	 *
	 * @since 1.0.0
	 *
	 * @link http://swagger.io/
	 *
	 * @return array<string|mixed> An array description of a Swagger supported component.
	 */
	abstract public function get_documentation();

	/**
	 * Provides the content of the `args` array to register the endpoint support for GET requests.
	 *
	 * @since 1.0.0
	 *
	 * @return array<string|mixed> An array of read 'args'.
	 */
	abstract public function READ_args();

	/**
	 * Gets the Endpoint path for this route.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_endpoint_path() {
		return $this->path;
	}

	/**
	 * Sanitize a request argument based on details registered to the route.
	 *
	 * @since 1.0.0
	 *
	 * @param mixed $value Value of the 'filter' argument.
	 *
	 * @return string|array<string|string> A text field sanitized string or array.
	 */
	public function sanitize_callback( $value ) {
		if ( is_array( $value ) ) {
			return array_map( 'sanitize_text_field', $value );
		}

Top ↑

Changelog

Changelog
Version Description
1.0.0 Introduced.