BP_REST_Friends_Endpoint::get_item_schema()

Get the friends schema, conforming to JSON Schema.


Return Return

(array)


Source Source

File: bp-friends/classes/class-bp-rest-friends-endpoint.php

	public function get_item_schema() {
		if ( is_null( $this->schema ) ) {
			$this->schema = array(
				'$schema'    => 'http://json-schema.org/draft-04/schema#',
				'title'      => 'bp_friends',
				'type'       => 'object',
				'properties' => array(
					'id'           => array(
						'context'     => array( 'view', 'edit' ),
						'description' => __( 'Unique numeric identifier of the friendship.', 'buddypress' ),
						'type'        => 'integer',
					),
					'initiator_id' => array(
						'context'     => array( 'view', 'edit' ),
						'description' => __( 'The unique numeric identifier of the user who is requesting the Friendship.', 'buddypress' ),
						'type'        => 'integer',
					),
					'friend_id'    => array(
						'context'     => array( 'view', 'edit' ),
						'description' => __( 'The unique numeric identifier of the user who is invited to agree to the Friendship request.', 'buddypress' ),
						'type'        => 'integer',
					),
					'is_confirmed' => array(
						'context'     => array( 'view', 'edit' ),
						'description' => __( 'Whether the friendship been confirmed/accepted.', 'buddypress' ),
						'readonly'    => true,
						'type'        => 'boolean',
					),
					'date_created' => array(
						'context'     => array( 'view', 'edit' ),
						'description' => __( "The date the friendship was created, in the site's timezone.", 'buddypress' ),
						'readonly'    => true,
						'type'        => 'string',
						'format'      => 'date-time',
					),
				),
			);
		}

		/**
		 * Filters the friends schema.
		 *
		 * @since 6.0.0
		 *
		 * @param array $schema The endpoint schema.
		 */
		return apply_filters( 'bp_rest_friends_schema', $this->add_additional_fields_schema( $this->schema ) );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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