BP_REST_Friends_Endpoint::get_item_schema()

Get the friends schema, conforming to JSON Schema.

Description

Return

(array)

Source

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

	public function get_item_schema() {
		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'bp_friends',
			'type'       => 'object',
			'properties' => array(
				'id'           => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'A unique numeric ID for the friendship.', 'buddyboss' ),
					'type'        => 'integer',
				),
				'initiator_id' => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'User ID of the friendship initiator.', 'buddyboss' ),
					'type'        => 'integer',
				),
				'friend_id'    => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'User ID of the `friend` - the one invited to the friendship.', 'buddyboss' ),
					'type'        => 'integer',
				),
				'is_confirmed' => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Whether the friendship been confirmed/accepted.', 'buddyboss' ),
					'readonly'    => true,
					'type'        => 'boolean',
				),
				'date_created' => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( "The date the friendship was created, in the site's timezone.", 'buddyboss' ),
					'readonly'    => true,
					'type'        => 'string',
					'format'      => 'date-time',
				),
			),
		);

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

Changelog

Changelog
Version Description
0.1.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.